From 5cb4c1408db7f4882d1ff5284d26342e2f9162cc Mon Sep 17 00:00:00 2001 From: MatthewColvin Date: Sat, 16 Sep 2023 14:46:59 -0500 Subject: [PATCH] flushed out the Base screen and widget classes a bit more --- Platformio/OmoteUI/core/screen/ScreenBase.cpp | 11 +++++++++++ Platformio/OmoteUI/core/screen/ScreenBase.hpp | 8 ++++++++ Platformio/OmoteUI/core/widget/WidgetBase.cpp | 12 ++++++++++++ Platformio/OmoteUI/core/widget/WidgetBase.hpp | 10 +++++----- 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/Platformio/OmoteUI/core/screen/ScreenBase.cpp b/Platformio/OmoteUI/core/screen/ScreenBase.cpp index e69de29..820cada 100644 --- a/Platformio/OmoteUI/core/screen/ScreenBase.cpp +++ b/Platformio/OmoteUI/core/screen/ScreenBase.cpp @@ -0,0 +1,11 @@ +#include "ScreenBase.hpp" + +using namespace UI::Screen; + +Base::Base(){ + +} + +void Base::AddWidget(Widget::Base::Ptr aWidget){ + mWidgets.push_back(std::move(aWidget)); +} diff --git a/Platformio/OmoteUI/core/screen/ScreenBase.hpp b/Platformio/OmoteUI/core/screen/ScreenBase.hpp index 1f869cd..fc8a6d9 100644 --- a/Platformio/OmoteUI/core/screen/ScreenBase.hpp +++ b/Platformio/OmoteUI/core/screen/ScreenBase.hpp @@ -1,11 +1,19 @@ #include "lvgl.h" +#include "WidgetBase.hpp" + +#include namespace UI::Screen{ class Base { public: + typedef std::unique_ptr Ptr; + Base(); + void AddWidget(Widget::Base::Ptr aWidget); + private: + std::vector mWidgets; lv_obj_t *mScreen = lv_obj_create(NULL); }; diff --git a/Platformio/OmoteUI/core/widget/WidgetBase.cpp b/Platformio/OmoteUI/core/widget/WidgetBase.cpp index e69de29..c56d254 100644 --- a/Platformio/OmoteUI/core/widget/WidgetBase.cpp +++ b/Platformio/OmoteUI/core/widget/WidgetBase.cpp @@ -0,0 +1,12 @@ +#include "WidgetBase.hpp" + +namespace UI::Widget{ + +Base::Base(lv_obj_t* aLvglSelf): + mLvglSelf(aLvglSelf) +{ + mLvglSelf->user_data = this; +} + + +} \ No newline at end of file diff --git a/Platformio/OmoteUI/core/widget/WidgetBase.hpp b/Platformio/OmoteUI/core/widget/WidgetBase.hpp index 5fcafcf..4254e30 100644 --- a/Platformio/OmoteUI/core/widget/WidgetBase.hpp +++ b/Platformio/OmoteUI/core/widget/WidgetBase.hpp @@ -1,13 +1,13 @@ #include "lvgl.h" + +#include namespace UI::Widget{ class Base{ public: - Base(lv_obj_t* aLvglSelf): - mLvglSelf(aLvglSelf) - { - mLvglSelf.user_data = this; - } + typedef std::unique_ptr Ptr; + + Base(lv_obj_t* aLvglSelf); private: lv_obj_t* mLvglSelf;