1
0
Fork 0

Move event handlers to unnamed namespace

This commit is contained in:
Riku Isokoski 2022-05-19 22:03:20 +03:00 committed by JF
parent c6026aa617
commit 6cfb45e280
2 changed files with 16 additions and 16 deletions

View file

@ -2,22 +2,24 @@
using namespace Pinetime::Applications::Widgets;
Counter::Counter(int min, int max) : min {min}, max {max} {
}
void Counter::upBtnEventHandler(lv_obj_t* obj, lv_event_t event) {
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::downBtnEventHandler(lv_obj_t* obj, lv_event_t event) {
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();
}
}
}
Counter::Counter(int min, int max) : min {min}, max {max} {
}
void Counter::Increment() {
value++;

View file

@ -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);