summaryrefslogtreecommitdiff
path: root/src/ui/include/screen.hpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-09-28 08:29:55 +1000
committerjacqueline <me@jacqueline.id.au>2023-09-28 08:29:55 +1000
commitf09ba5ffd53bf7d28e0dc516c00a8f69ca7efae9 (patch)
treeaffce5567186d8944686afd824bf4ee4f7ee4d2d /src/ui/include/screen.hpp
parentf168bfab7698f28492c7693263525945a26cbcc8 (diff)
downloadtangara-fw-f09ba5ffd53bf7d28e0dc516c00a8f69ca7efae9.tar.gz
Use bindey for databinding instead of hand rolling ui updates
Diffstat (limited to 'src/ui/include/screen.hpp')
-rw-r--r--src/ui/include/screen.hpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/ui/include/screen.hpp b/src/ui/include/screen.hpp
index 76251a72..ac7b19f8 100644
--- a/src/ui/include/screen.hpp
+++ b/src/ui/include/screen.hpp
@@ -8,11 +8,15 @@
#include <memory>
#include <optional>
+#include <vector>
+#include "bindey/binding.h"
#include "core/lv_group.h"
#include "core/lv_obj.h"
#include "core/lv_obj_tree.h"
+#include "event_binding.hpp"
#include "lvgl.h"
+#include "nod/nod.hpp"
#include "widget_top_bar.hpp"
namespace ui {
@@ -51,6 +55,16 @@ class Screen {
auto CreateTopBar(lv_obj_t* parent, const widgets::TopBar::Configuration&)
-> widgets::TopBar*;
+ std::pmr::vector<bindey::scoped_binding> data_bindings_;
+ std::pmr::vector<std::unique_ptr<EventBinding>> event_bindings_;
+
+ template <typename T>
+ auto lv_bind(lv_obj_t* obj, lv_event_code_t ev, T fn) -> void {
+ auto binding = std::make_unique<EventBinding>(obj, ev);
+ binding->signal().connect(fn);
+ event_bindings_.push_back(std::move(binding));
+ }
+
lv_obj_t* const root_;
lv_obj_t* content_;
lv_obj_t* modal_content_;