diff options
| author | Riku Isokoski <riksu9000@gmail.com> | 2022-06-07 00:30:42 +0300 |
|---|---|---|
| committer | Riku Isokoski <riksu9000@gmail.com> | 2022-07-21 22:23:15 +0300 |
| commit | df6557dd311fa9a5aee75c69a3d27ff17afe88af (patch) | |
| tree | 631f00a383251aeb2bab6f996272fac8647555b6 /src/displayapp/widgets/Counter.h | |
| parent | 0f4233003edd9874b98e06cd878fce1b82907e3f (diff) | |
Extend Counter functionality
Custom fonts, twelve hour mode and Value changed callback.
Diffstat (limited to 'src/displayapp/widgets/Counter.h')
| -rw-r--r-- | src/displayapp/widgets/Counter.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/displayapp/widgets/Counter.h b/src/displayapp/widgets/Counter.h index 3df8b839..13b336ca 100644 --- a/src/displayapp/widgets/Counter.h +++ b/src/displayapp/widgets/Counter.h @@ -6,14 +6,16 @@ namespace Pinetime { namespace Widgets { class Counter { public: - Counter(int min, int max); + Counter(int min, int max, lv_font_t& font); void Create(); - void Increment(); - void Decrement(); + void UpBtnPressed(); + void DownBtnPressed(); void SetValue(int newValue); void HideControls(); void ShowControls(); + void EnableTwelveHourMode(); + void SetValueChangedEventCallback(void* userData, void (*handler)(void* userData)); int GetValue() const { return value; @@ -25,6 +27,7 @@ namespace Pinetime { private: void UpdateLabel(); + void (*ValueChangedHandler)(void* userData) = nullptr; lv_obj_t* counterContainer; lv_obj_t* upBtn; @@ -36,6 +39,10 @@ namespace Pinetime { int value = 0; int min; int max; + bool twelveHourMode = false; + lv_font_t& font; + + void* userData = nullptr; }; } } |
