Files
InfiniTime/src/displayapp/screens/CheckboxList.h
Jean-François Milants f0e8bb26e9 Watch face selection with CMake
Move displayapp/Apps.h into a header only library (to make the integration easier in InfiniSim.
2023-12-23 21:29:13 +01:00

46 lines
1.2 KiB
C++

#pragma once
#include "displayapp/apps/Apps.h"
#include "displayapp/screens/Screen.h"
#include <array>
#include <cstdint>
#include <functional>
#include <lvgl/lvgl.h>
#include <memory>
#include "displayapp/widgets/PageIndicator.h"
namespace Pinetime {
namespace Applications {
namespace Screens {
class CheckboxList : public Screen {
public:
static constexpr size_t MaxItems = 4;
struct Item {
const char* name;
bool enabled;
};
CheckboxList(const uint8_t screenID,
const uint8_t numScreens,
const char* optionsTitle,
const char* optionsSymbol,
uint32_t originalValue,
std::function<void(uint32_t)> OnValueChanged,
std::array<Item, 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<Item, MaxItems> options;
std::array<lv_obj_t*, MaxItems> cbOption;
uint32_t value;
Widgets::PageIndicator pageIndicator;
};
}
}
}