flushed out the Base screen and widget classes a bit more
This commit is contained in:
parent
64a868a907
commit
5cb4c1408d
4 changed files with 36 additions and 5 deletions
|
@ -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));
|
||||||
|
}
|
|
@ -1,11 +1,19 @@
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
|
#include "WidgetBase.hpp"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
namespace UI::Screen{
|
namespace UI::Screen{
|
||||||
|
|
||||||
class Base {
|
class Base {
|
||||||
public:
|
public:
|
||||||
|
typedef std::unique_ptr<Base> Ptr;
|
||||||
|
|
||||||
Base();
|
Base();
|
||||||
|
|
||||||
|
void AddWidget(Widget::Base::Ptr aWidget);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::vector<Widget::Base::Ptr> mWidgets;
|
||||||
lv_obj_t *mScreen = lv_obj_create(NULL);
|
lv_obj_t *mScreen = lv_obj_create(NULL);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
#include "WidgetBase.hpp"
|
||||||
|
|
||||||
|
namespace UI::Widget{
|
||||||
|
|
||||||
|
Base::Base(lv_obj_t* aLvglSelf):
|
||||||
|
mLvglSelf(aLvglSelf)
|
||||||
|
{
|
||||||
|
mLvglSelf->user_data = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,13 +1,13 @@
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
namespace UI::Widget{
|
namespace UI::Widget{
|
||||||
|
|
||||||
class Base{
|
class Base{
|
||||||
public:
|
public:
|
||||||
Base(lv_obj_t* aLvglSelf):
|
typedef std::unique_ptr<Base> Ptr;
|
||||||
mLvglSelf(aLvglSelf)
|
|
||||||
{
|
Base(lv_obj_t* aLvglSelf);
|
||||||
mLvglSelf.user_data = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
lv_obj_t* mLvglSelf;
|
lv_obj_t* mLvglSelf;
|
||||||
|
|
Loading…
Add table
Reference in a new issue