diff options
author | Riku Isokoski <riksu9000@gmail.com> | 2022-05-19 22:03:20 +0300 |
---|---|---|
committer | JF <JF002@users.noreply.github.com> | 2022-06-06 21:28:03 +0200 |
commit | 6cfb45e280fa9653e860a8e112092740faa9842e (patch) | |
tree | e1805cc8b28b6a5bb44ba27feefeefb7b5c136a8 /src/displayapp/widgets/Counter.cpp | |
parent | c6026aa6177f63ce7965c27ea4f07a304f61106b (diff) |
Move event handlers to unnamed namespace
Diffstat (limited to 'src/displayapp/widgets/Counter.cpp')
-rw-r--r-- | src/displayapp/widgets/Counter.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
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<Counter*>(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<Counter*>(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<Counter*>(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<Counter*>(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() { |