add base classes for screens and widgets
along with screen manager to allow place to manage multiple screens
This commit is contained in:
parent
5c6008c491
commit
40052d31b7
8 changed files with 72 additions and 0 deletions
16
Platformio/OmoteUI/core/ScreenManager.cpp
Normal file
16
Platformio/OmoteUI/core/ScreenManager.cpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#include "ScreenManager.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace UI::Screen;
|
||||||
|
|
||||||
|
Manager Manager::mManager = Manager();
|
||||||
|
|
||||||
|
Manager& Manager::getInstance(){
|
||||||
|
return mManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
Manager::Manager(){}
|
||||||
|
|
||||||
|
void Manager::pushScreen(std::unique_ptr<UI::Screen::Base> aPage){
|
||||||
|
pages.push(std::move(aPage));
|
||||||
|
}
|
20
Platformio/OmoteUI/core/ScreenManager.hpp
Normal file
20
Platformio/OmoteUI/core/ScreenManager.hpp
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#include "ScreenBase.hpp"
|
||||||
|
#include <stack>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace UI::Screen{
|
||||||
|
|
||||||
|
class Manager{
|
||||||
|
public:
|
||||||
|
static Manager& getInstance();
|
||||||
|
|
||||||
|
void pushScreen(std::unique_ptr<UI::Screen::Base> aPage);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Manager();
|
||||||
|
static Manager mManager;
|
||||||
|
|
||||||
|
std::stack<std::unique_ptr<UI::Screen::Base>> pages;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
3
Platformio/OmoteUI/core/interfaces/IHandleButtons.hpp
Normal file
3
Platformio/OmoteUI/core/interfaces/IHandleButtons.hpp
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
class IHandleButtons{
|
||||||
|
virtual void OnKeyTap() = 0;
|
||||||
|
};
|
0
Platformio/OmoteUI/core/screen/ScreenBase.cpp
Normal file
0
Platformio/OmoteUI/core/screen/ScreenBase.cpp
Normal file
12
Platformio/OmoteUI/core/screen/ScreenBase.hpp
Normal file
12
Platformio/OmoteUI/core/screen/ScreenBase.hpp
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#include "lvgl.h"
|
||||||
|
namespace UI::Screen{
|
||||||
|
|
||||||
|
class Base {
|
||||||
|
public:
|
||||||
|
Base();
|
||||||
|
|
||||||
|
private:
|
||||||
|
lv_obj_t *mScreen = lv_obj_create(NULL);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
0
Platformio/OmoteUI/core/widget/WidgetBase.cpp
Normal file
0
Platformio/OmoteUI/core/widget/WidgetBase.cpp
Normal file
18
Platformio/OmoteUI/core/widget/WidgetBase.hpp
Normal file
18
Platformio/OmoteUI/core/widget/WidgetBase.hpp
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#include "lvgl.h"
|
||||||
|
namespace UI::Widget{
|
||||||
|
|
||||||
|
class Base{
|
||||||
|
public:
|
||||||
|
Base(lv_obj_t* aLvglSelf):
|
||||||
|
mLvglSelf(aLvglSelf)
|
||||||
|
{
|
||||||
|
mLvglSelf.user_data = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
lv_obj_t* mLvglSelf;
|
||||||
|
|
||||||
|
uint16_t mId;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -40,6 +40,9 @@ build_flags =
|
||||||
; ------------- Includes ------------------------------------
|
; ------------- Includes ------------------------------------
|
||||||
-I OmoteUI
|
-I OmoteUI
|
||||||
-I OmoteUI/core
|
-I OmoteUI/core
|
||||||
|
-I OmoteUI/core/interfaces
|
||||||
|
-I OmoteUI/core/screen
|
||||||
|
-I OmoteUI/core/widget
|
||||||
-I OmoteUI/UIs
|
-I OmoteUI/UIs
|
||||||
-I OmoteUI/UIs/Basic
|
-I OmoteUI/UIs/Basic
|
||||||
-I HAL
|
-I HAL
|
||||||
|
|
Loading…
Add table
Reference in a new issue