summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/Screen.h
diff options
context:
space:
mode:
authorFinlay Davidson <finlay.davidson@coderclass.nl>2023-01-07 21:23:15 +0100
committerJF <JF002@users.noreply.github.com>2023-01-09 21:41:21 +0100
commit96165a8541b33baace920e26f062b2e282d644c6 (patch)
tree41a5c6ec1f9a9981fcf970b7b48095b54c142d64 /src/displayapp/screens/Screen.h
parent09db67e003ab593956b4d4474fd08e7548985030 (diff)
Format header files
In my PR updating clang-format, I forgot to also format the headers.
Diffstat (limited to 'src/displayapp/screens/Screen.h')
-rw-r--r--src/displayapp/screens/Screen.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/displayapp/screens/Screen.h b/src/displayapp/screens/Screen.h
index e72a2368..a2452da5 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);
@@ -64,6 +70,7 @@ namespace Pinetime {
virtual bool OnTouchEvent(TouchEvents event) {
return false;
}
+
virtual bool OnTouchEvent(uint16_t x, uint16_t y) {
return false;
}