summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/CheckboxList.cpp
diff options
context:
space:
mode:
authorJean-François Milants <jf@codingfield.com>2022-10-11 21:36:31 +0200
committerJean-François Milants <jf@codingfield.com>2022-10-11 21:36:31 +0200
commiteb0af22ecf66957b9341521990c49a6d1d5d70e3 (patch)
tree269d1925185cd8d10cd39eb86f23c1170e40548e /src/displayapp/screens/CheckboxList.cpp
parent8c7be1fbb1d172ffc5cf99ec2b013f11f35dc421 (diff)
Watch face settings : disable watch faces that are not available (external resources are not installed).
Diffstat (limited to 'src/displayapp/screens/CheckboxList.cpp')
-rw-r--r--src/displayapp/screens/CheckboxList.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/displayapp/screens/CheckboxList.cpp b/src/displayapp/screens/CheckboxList.cpp
index d97726dd..5889c69a 100644
--- a/src/displayapp/screens/CheckboxList.cpp
+++ b/src/displayapp/screens/CheckboxList.cpp
@@ -18,7 +18,7 @@ CheckboxList::CheckboxList(const uint8_t screenID,
const char* optionsSymbol,
uint32_t originalValue,
std::function<void(uint32_t)> OnValueChanged,
- std::array<const char*, MaxItems> options)
+ std::array<Item, MaxItems> options)
: Screen(app), screenID {screenID}, OnValueChanged {std::move(OnValueChanged)}, options {options}, value {originalValue} {
// Set the background to Black
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
@@ -72,9 +72,12 @@ CheckboxList::CheckboxList(const uint8_t screenID,
lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0);
for (unsigned int i = 0; i < options.size(); i++) {
- if (strcmp(options[i], "")) {
+ if (strcmp(options[i].name, "")) {
cbOption[i] = lv_checkbox_create(container1, nullptr);
- lv_checkbox_set_text(cbOption[i], options[i]);
+ lv_checkbox_set_text(cbOption[i], options[i].name);
+ if (!options[i].enabled) {
+ lv_checkbox_set_disabled(cbOption[i]);
+ }
cbOption[i]->user_data = this;
lv_obj_set_event_cb(cbOption[i], event_handler);
SetRadioButtonStyle(cbOption[i]);
@@ -94,13 +97,16 @@ CheckboxList::~CheckboxList() {
void CheckboxList::UpdateSelected(lv_obj_t* object, lv_event_t event) {
if (event == LV_EVENT_VALUE_CHANGED) {
for (unsigned int i = 0; i < options.size(); i++) {
- if (strcmp(options[i], "")) {
+ if (strcmp(options[i].name, "")) {
if (object == cbOption[i]) {
lv_checkbox_set_checked(cbOption[i], true);
value = MaxItems * screenID + i;
} else {
lv_checkbox_set_checked(cbOption[i], false);
}
+ if (!options[i].enabled) {
+ lv_checkbox_set_disabled(cbOption[i]);
+ }
}
}
}