diff options
| author | Riku Isokoski <riksu9000@gmail.com> | 2022-04-21 17:17:49 +0300 |
|---|---|---|
| committer | JF <JF002@users.noreply.github.com> | 2022-06-06 21:28:03 +0200 |
| commit | 12d4bc4139aa3427782999166915f9d3899a4ed8 (patch) | |
| tree | bbe9f1db8f2daca547ee609f106db0ce8315f296 /src/displayapp/widgets/Counter.h | |
| parent | 17079fb114ad6db59200b684f894e7723450616e (diff) | |
Add initial counter widget
Diffstat (limited to 'src/displayapp/widgets/Counter.h')
| -rw-r--r-- | src/displayapp/widgets/Counter.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/displayapp/widgets/Counter.h b/src/displayapp/widgets/Counter.h new file mode 100644 index 00000000..a25635e2 --- /dev/null +++ b/src/displayapp/widgets/Counter.h @@ -0,0 +1,39 @@ +#pragma once +#include <lvgl/lvgl.h> + +namespace Pinetime { + namespace Applications { + namespace Widgets { + class Counter { + public: + Counter(int min, int max); + + void Create(); + static void upBtnEventHandler(lv_obj_t* obj, lv_event_t event); + static void downBtnEventHandler(lv_obj_t* obj, lv_event_t event); + void Increment(); + void Decrement(); + void SetValue(int newValue); + + int GetValue() const { + return value; + } + + lv_obj_t* GetObject() const { + return counterContainer; + }; + + private: + void UpdateLabel(); + + lv_obj_t* counterContainer; + lv_obj_t* upBtn; + lv_obj_t* downBtn; + lv_obj_t* number; + int value = 0; + int min; + int max; + }; + } + } +} |
