summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/CheckboxList.h
blob: 4d27a62b9dbe7588a3bf9acea2b36577567180d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once

#include "displayapp/Apps.h"
#include "displayapp/screens/Screen.h"
#include <array>
#include <cstdint>
#include <functional>
#include <lvgl/lvgl.h>
#include <memory>

namespace Pinetime {
  namespace Applications {
    namespace Screens {
      class CheckboxList : public Screen {
      public:
        static constexpr size_t MaxItems = 4;
        CheckboxList(const uint8_t screenID,
                     const uint8_t numScreens,
                     DisplayApp* app,
                     const char* optionsTitle,
                     const char* optionsSymbol,
                     uint32_t originalValue,
                     std::function<void(uint32_t)>OnValueChanged,
                     std::array<const char*, MaxItems> options);
        ~CheckboxList() override;
        void UpdateSelected(lv_obj_t* object, lv_event_t event);

      private:
        const uint8_t screenID;
        std::function<void(uint32_t)>OnValueChanged;
        std::array<const char*, MaxItems> options;
        std::array<lv_obj_t*, MaxItems> cbOption;
        std::array<lv_point_t, 2> pageIndicatorBasePoints;
        std::array<lv_point_t, 2> pageIndicatorPoints;
        lv_obj_t* pageIndicatorBase;
        lv_obj_t* pageIndicator;
        uint32_t newValue;
      };
    }
  }
}