From df6557dd311fa9a5aee75c69a3d27ff17afe88af Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Tue, 7 Jun 2022 00:30:42 +0300 Subject: Extend Counter functionality Custom fonts, twelve hour mode and Value changed callback. --- src/displayapp/widgets/Counter.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/displayapp/widgets/Counter.h') 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; }; } } -- cgit v1.2.3-70-g09d2