diff options
Diffstat (limited to 'src/displayapp/screens/Screen.h')
| -rw-r--r-- | src/displayapp/screens/Screen.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/displayapp/screens/Screen.h b/src/displayapp/screens/Screen.h index e72a2368..4cf134d2 100644 --- a/src/displayapp/screens/Screen.h +++ b/src/displayapp/screens/Screen.h @@ -7,13 +7,16 @@ namespace Pinetime { namespace Applications { class DisplayApp; + namespace Screens { template <class T> class DirtyValue { public: DirtyValue() = default; // Use NSDMI + explicit DirtyValue(T const& v) : value {v} { } // Use MIL and const-lvalue-ref + bool IsUpdated() { if (this->isUpdated) { this->isUpdated = false; @@ -21,10 +24,12 @@ namespace Pinetime { } return false; } + T const& Get() { this->isUpdated = false; return value; } // never expose a non-const lvalue-ref + DirtyValue& operator=(const T& other) { if (this->value != other) { this->value = other; @@ -46,6 +51,7 @@ namespace Pinetime { public: explicit Screen(DisplayApp* app) : app {app} { } + virtual ~Screen() = default; static void RefreshTaskCallback(lv_task_t* task); @@ -61,10 +67,11 @@ namespace Pinetime { /** @return false if the event hasn't been handled by the app, true if it has been handled */ // Returning true will cancel lvgl tap - virtual bool OnTouchEvent(TouchEvents event) { + virtual bool OnTouchEvent(TouchEvents /*event*/) { return false; } - virtual bool OnTouchEvent(uint16_t x, uint16_t y) { + + virtual bool OnTouchEvent(uint16_t /*x*/, uint16_t /*y*/) { return false; } |
