From cf8b422899f198ae713b5a2a35e2ea737521b053 Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Sun, 2 Oct 2022 21:05:15 +0200 Subject: Checkbox list now receives a function pointer to call when the setting has changed. This allow to remove the dependency between CheckBoxList (UI component) with SettingController. --- src/displayapp/screens/CheckboxList.h | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'src/displayapp/screens/CheckboxList.h') diff --git a/src/displayapp/screens/CheckboxList.h b/src/displayapp/screens/CheckboxList.h index 5bdd143e..4d27a62b 100644 --- a/src/displayapp/screens/CheckboxList.h +++ b/src/displayapp/screens/CheckboxList.h @@ -1,12 +1,12 @@ #pragma once -#include +#include "displayapp/Apps.h" +#include "displayapp/screens/Screen.h" +#include #include +#include +#include #include -#include -#include "displayapp/screens/Screen.h" -#include "displayapp/Apps.h" -#include "components/settings/Settings.h" namespace Pinetime { namespace Applications { @@ -14,34 +14,27 @@ namespace Pinetime { class CheckboxList : public Screen { public: static constexpr size_t MaxItems = 4; - CheckboxList(const uint8_t screenID, const uint8_t numScreens, DisplayApp* app, - Controllers::Settings& settingsController, const char* optionsTitle, const char* optionsSymbol, - void (Controllers::Settings::*SetOptionIndex)(uint8_t), - uint8_t (Controllers::Settings::*GetOptionIndex)() const, + uint32_t originalValue, + std::functionOnValueChanged, std::array options); - ~CheckboxList() override; - void UpdateSelected(lv_obj_t* object, lv_event_t event); private: const uint8_t screenID; - Controllers::Settings& settingsController; - const char* optionsTitle; - const char* optionsSymbol; - void (Controllers::Settings::*SetOptionIndex)(uint8_t); - uint8_t (Controllers::Settings::*GetOptionIndex)() const; + std::functionOnValueChanged; std::array options; std::array cbOption; std::array pageIndicatorBasePoints; std::array pageIndicatorPoints; lv_obj_t* pageIndicatorBase; lv_obj_t* pageIndicator; + uint32_t newValue; }; } } -- cgit v1.2.3-70-g09d2