1. basic changes to mirror libopnui window hierararchy to lvgl object hierarchy

2. basic scroll support
3. Basic layer support (still pretty broken), multiple screen support
4. Preliminary impelemntation of TextEdit using lvgl.
5. Preliminary implementation of StaticText using lvgl.
6. Preliminary implementation of TextButton using lvgl.
This commit is contained in:
kkoenig1@optonline.com
2022-06-11 15:13:11 +02:00
committed by Raphael Coeffic
parent e538138ade
commit 6b70baf63a
13 changed files with 302 additions and 129 deletions
+15
View File
@@ -20,6 +20,7 @@
#pragma once
#include "window.h"
extern lv_obj_t * canvas;
class Layer
{
@@ -36,10 +37,20 @@ class Layer
static void push(Window * window)
{
// if (window->getLvObj()->parent != nullptr) {
// TRACE("Layers must have lvgl parent to be null");
// return;
// }
if (!stack.empty()) {
Layer & parentLayer = stack.back();
parentLayer.focus = Window::getFocus();
}
// layers are screens in lvgl
lv_scr_load(window->getLvObj());
lv_obj_set_parent(canvas, window->getLvObj());
stack.emplace_back(Layer(window));
#if defined(DEBUG_WINDOWS)
@@ -55,6 +66,8 @@ class Layer
if (stack.back().main == window) {
stack.pop_back();
const auto & back = stack.back();
lv_obj_set_parent(canvas, back.main->getLvObj());
lv_scr_load(back.main->getLvObj()); // load the screen.
if (back.focus) {
back.focus->setFocus(SET_FOCUS_DEFAULT);
}
@@ -63,6 +76,8 @@ class Layer
// TODO it would be better to do it in reverse order
for (auto it = stack.begin(); it != stack.end(); it++) {
if (it->main == window) {
lv_obj_set_parent(canvas, it->main->getLvObj());
lv_scr_load(it->main->getLvObj());
stack.erase(it);
break;
}