summaryrefslogtreecommitdiff
path: root/src/ui/include
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-03-07 10:59:03 +1100
committerjacqueline <me@jacqueline.id.au>2024-03-07 10:59:03 +1100
commitef72b25660912ff247997089abfb93e9f0b52809 (patch)
treed5d9711cb5a4192966d914094e9370c446f145fb /src/ui/include
parent53c4ea7805f1af6a4d2969fc8eabbc8ae26ac5ca (diff)
downloadtangara-fw-ef72b25660912ff247997089abfb93e9f0b52809.tar.gz
use prototype inheritance for lua screens, rather than functions
this gives us a way to give each screen nice little hooks, like 'onShown' and 'onHidden'. later we can use these hooks to disable bindings for screens that aren't in-use.
Diffstat (limited to 'src/ui/include')
-rw-r--r--src/ui/include/screen.hpp3
-rw-r--r--src/ui/include/screen_lua.hpp3
2 files changed, 6 insertions, 0 deletions
diff --git a/src/ui/include/screen.hpp b/src/ui/include/screen.hpp
index 60939660..4241c712 100644
--- a/src/ui/include/screen.hpp
+++ b/src/ui/include/screen.hpp
@@ -27,6 +27,9 @@ class Screen {
Screen();
virtual ~Screen();
+ virtual auto onShown() -> void {}
+ virtual auto onHidden() -> void {}
+
auto root() -> lv_obj_t* { return root_; }
auto content() -> lv_obj_t* { return content_; }
auto alert() -> lv_obj_t* { return alert_; }
diff --git a/src/ui/include/screen_lua.hpp b/src/ui/include/screen_lua.hpp
index ee9f6813..0ed3a508 100644
--- a/src/ui/include/screen_lua.hpp
+++ b/src/ui/include/screen_lua.hpp
@@ -18,6 +18,9 @@ class Lua : public Screen {
Lua();
~Lua();
+ auto onShown() -> void override;
+ auto onHidden() -> void override;
+
auto SetObjRef(lua_State*) -> void;
private: