@@ -19,34 +19,16 @@ CheckboxList::CheckboxList(const uint8_t screenID,
1919 uint32_t originalValue,
2020 std::function<void (uint32_t )> OnValueChanged,
2121 std::array<Item, MaxItems> options)
22- : Screen(app), screenID {screenID}, OnValueChanged {std::move (OnValueChanged)}, options {options}, value {originalValue} {
22+ : Screen(app),
23+ screenID {screenID},
24+ OnValueChanged {std::move (OnValueChanged)},
25+ options {options},
26+ value {originalValue},
27+ pageIndicator (screenID, numScreens) {
2328 // Set the background to Black
2429 lv_obj_set_style_local_bg_color (lv_scr_act (), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
2530
26- if (numScreens > 1 ) {
27- pageIndicatorBasePoints[0 ].x = LV_HOR_RES - 1 ;
28- pageIndicatorBasePoints[0 ].y = 0 ;
29- pageIndicatorBasePoints[1 ].x = LV_HOR_RES - 1 ;
30- pageIndicatorBasePoints[1 ].y = LV_VER_RES;
31-
32- pageIndicatorBase = lv_line_create (lv_scr_act (), nullptr );
33- lv_obj_set_style_local_line_width (pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3 );
34- lv_obj_set_style_local_line_color (pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex (0x111111 ));
35- lv_line_set_points (pageIndicatorBase, pageIndicatorBasePoints.data (), 2 );
36-
37- const uint16_t indicatorSize = LV_VER_RES / numScreens;
38- const uint16_t indicatorPos = indicatorSize * screenID;
39-
40- pageIndicatorPoints[0 ].x = LV_HOR_RES - 1 ;
41- pageIndicatorPoints[0 ].y = indicatorPos;
42- pageIndicatorPoints[1 ].x = LV_HOR_RES - 1 ;
43- pageIndicatorPoints[1 ].y = indicatorPos + indicatorSize;
44-
45- pageIndicator = lv_line_create (lv_scr_act (), nullptr );
46- lv_obj_set_style_local_line_width (pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3 );
47- lv_obj_set_style_local_line_color (pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
48- lv_line_set_points (pageIndicator, pageIndicatorPoints.data (), 2 );
49- }
31+ pageIndicator.Create ();
5032
5133 lv_obj_t * container1 = lv_cont_create (lv_scr_act (), nullptr );
5234
0 commit comments