2022-03-04 19:12:44 -05:00
|
|
|
#pragma once
|
|
|
|
|
2022-10-02 15:05:15 -04:00
|
|
|
#include "displayapp/Apps.h"
|
|
|
|
#include "displayapp/screens/Screen.h"
|
|
|
|
#include <array>
|
2022-03-04 19:12:44 -05:00
|
|
|
#include <cstdint>
|
2022-10-02 15:05:15 -04:00
|
|
|
#include <functional>
|
|
|
|
#include <lvgl/lvgl.h>
|
2022-03-04 19:12:44 -05:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
namespace Pinetime {
|
|
|
|
namespace Applications {
|
|
|
|
namespace Screens {
|
|
|
|
class CheckboxList : public Screen {
|
|
|
|
public:
|
2022-09-27 12:06:15 -04:00
|
|
|
static constexpr size_t MaxItems = 4;
|
2022-10-11 15:36:31 -04:00
|
|
|
struct Item {
|
|
|
|
const char* name;
|
|
|
|
bool enabled;
|
|
|
|
};
|
|
|
|
|
2022-03-04 19:12:44 -05:00
|
|
|
CheckboxList(const uint8_t screenID,
|
|
|
|
const uint8_t numScreens,
|
|
|
|
DisplayApp* app,
|
|
|
|
const char* optionsTitle,
|
|
|
|
const char* optionsSymbol,
|
2022-10-02 15:05:15 -04:00
|
|
|
uint32_t originalValue,
|
2022-10-11 15:11:23 -04:00
|
|
|
std::function<void(uint32_t)> OnValueChanged,
|
2022-10-11 15:36:31 -04:00
|
|
|
std::array<Item, MaxItems> options);
|
2022-03-04 19:12:44 -05:00
|
|
|
~CheckboxList() override;
|
|
|
|
void UpdateSelected(lv_obj_t* object, lv_event_t event);
|
|
|
|
|
|
|
|
private:
|
|
|
|
const uint8_t screenID;
|
2022-10-11 15:11:23 -04:00
|
|
|
std::function<void(uint32_t)> OnValueChanged;
|
2022-10-11 15:36:31 -04:00
|
|
|
std::array<Item, MaxItems> options;
|
2022-09-27 12:06:15 -04:00
|
|
|
std::array<lv_obj_t*, MaxItems> cbOption;
|
|
|
|
std::array<lv_point_t, 2> pageIndicatorBasePoints;
|
|
|
|
std::array<lv_point_t, 2> pageIndicatorPoints;
|
2022-03-04 19:12:44 -05:00
|
|
|
lv_obj_t* pageIndicatorBase;
|
|
|
|
lv_obj_t* pageIndicator;
|
2022-10-11 15:02:05 -04:00
|
|
|
uint32_t value;
|
2022-03-04 19:12:44 -05:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|