From 6cfb45e280fa9653e860a8e112092740faa9842e Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Thu, 19 May 2022 22:03:20 +0300 Subject: Move event handlers to unnamed namespace --- src/displayapp/widgets/Counter.cpp | 24 +++++++++++++----------- src/displayapp/widgets/Counter.h | 2 -- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/displayapp/widgets/Counter.cpp b/src/displayapp/widgets/Counter.cpp index 2caee4f2..92af89f4 100644 --- a/src/displayapp/widgets/Counter.cpp +++ b/src/displayapp/widgets/Counter.cpp @@ -2,21 +2,23 @@ using namespace Pinetime::Applications::Widgets; -Counter::Counter(int min, int max) : min {min}, max {max} { -} +namespace { + void upBtnEventHandler(lv_obj_t* obj, lv_event_t event) { + auto* widget = static_cast(obj->user_data); + if (event == LV_EVENT_SHORT_CLICKED || event == LV_EVENT_LONG_PRESSED_REPEAT) { + widget->Increment(); + } + } -void Counter::upBtnEventHandler(lv_obj_t* obj, lv_event_t event) { - auto* widget = static_cast(obj->user_data); - if (event == LV_EVENT_SHORT_CLICKED || event == LV_EVENT_LONG_PRESSED_REPEAT) { - widget->Increment(); + void downBtnEventHandler(lv_obj_t* obj, lv_event_t event) { + auto* widget = static_cast(obj->user_data); + if (event == LV_EVENT_SHORT_CLICKED || event == LV_EVENT_LONG_PRESSED_REPEAT) { + widget->Decrement(); + } } } -void Counter::downBtnEventHandler(lv_obj_t* obj, lv_event_t event) { - auto* widget = static_cast(obj->user_data); - if (event == LV_EVENT_SHORT_CLICKED || event == LV_EVENT_LONG_PRESSED_REPEAT) { - widget->Decrement(); - } +Counter::Counter(int min, int max) : min {min}, max {max} { } void Counter::Increment() { diff --git a/src/displayapp/widgets/Counter.h b/src/displayapp/widgets/Counter.h index eee6e7b6..3df8b839 100644 --- a/src/displayapp/widgets/Counter.h +++ b/src/displayapp/widgets/Counter.h @@ -9,8 +9,6 @@ namespace Pinetime { 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); -- cgit v1.2.3