Fixes for some pop-ups and sliding main views
This commit is contained in:
committed by
Raphael Coeffic
parent
d1d503da08
commit
98e231c9d4
@@ -25,14 +25,10 @@
|
|||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
#include "libopenui.h"
|
#include "libopenui.h"
|
||||||
|
|
||||||
LvglWidgetFactory fullScreenDialogFactory = LvglWidgetFactory([] (lv_obj_t *parent) {
|
|
||||||
return lv_obj_create(nullptr);
|
|
||||||
});
|
|
||||||
|
|
||||||
FullScreenDialog::FullScreenDialog(
|
FullScreenDialog::FullScreenDialog(
|
||||||
uint8_t type, std::string title, std::string message, std::string action,
|
uint8_t type, std::string title, std::string message, std::string action,
|
||||||
const std::function<void(void)>& confirmHandler) :
|
const std::function<void(void)>& confirmHandler) :
|
||||||
FormGroup(MainWindow::instance(), {0, 0, LCD_W, LCD_H}, OPAQUE, &fullScreenDialogFactory),
|
FormGroup(MainWindow::instance(), {0, 0, LCD_W, LCD_H}, OPAQUE),
|
||||||
type(type),
|
type(type),
|
||||||
title(std::move(title)),
|
title(std::move(title)),
|
||||||
message(std::move(message)),
|
message(std::move(message)),
|
||||||
|
|||||||
@@ -45,9 +45,7 @@ void PageHeader::paint(BitmapBuffer * dc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LvglWidgetFactory pageFactory = LvglWidgetFactory([] (lv_obj_t * parent) {
|
static LvglWidgetFactory pageFactory = {lv_obj_create, nullptr};
|
||||||
return lv_obj_create(nullptr);
|
|
||||||
});
|
|
||||||
|
|
||||||
Page::Page(unsigned icon):
|
Page::Page(unsigned icon):
|
||||||
Window(MainWindow::instance(), {0, 0, LCD_W, LCD_H}, OPAQUE, 0, &pageFactory),
|
Window(MainWindow::instance(), {0, 0, LCD_W, LCD_H}, OPAQUE, 0, &pageFactory),
|
||||||
|
|||||||
@@ -29,11 +29,18 @@
|
|||||||
|
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
|
|
||||||
|
static void tile_event_cb(lv_event_t* e)
|
||||||
|
{
|
||||||
|
auto code = lv_event_get_code(e);
|
||||||
|
if (code == LV_EVENT_DRAW_MAIN) {
|
||||||
|
TRACE("DRAW_MAIN tile[%d]", lv_event_get_user_data(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ViewMain * ViewMain::_instance = nullptr;
|
ViewMain * ViewMain::_instance = nullptr;
|
||||||
|
|
||||||
ViewMain::ViewMain():
|
ViewMain::ViewMain():
|
||||||
Window(MainWindow::instance(), MainWindow::instance()->getRect(), NO_SCROLLBAR),
|
Window(MainWindow::instance(), MainWindow::instance()->getRect(), NO_SCROLLBAR)
|
||||||
topbar(dynamic_cast<TopbarImpl*>(TopbarFactory::create(this)))
|
|
||||||
{
|
{
|
||||||
setPageWidth(getParent()->width());
|
setPageWidth(getParent()->width());
|
||||||
focusWindow = this;
|
focusWindow = this;
|
||||||
@@ -46,13 +53,15 @@ ViewMain::ViewMain():
|
|||||||
tile_view = lv_tileview_create(lvobj);
|
tile_view = lv_tileview_create(lvobj);
|
||||||
lv_obj_set_pos(tile_view, rect.x, rect.y);
|
lv_obj_set_pos(tile_view, rect.x, rect.y);
|
||||||
lv_obj_set_size(tile_view, rect.w, rect.h);
|
lv_obj_set_size(tile_view, rect.w, rect.h);
|
||||||
|
lv_obj_set_style_bg_opa(tile_view, LV_OPA_TRANSP, LV_PART_MAIN);
|
||||||
lv_obj_set_scrollbar_mode(tile_view, LV_SCROLLBAR_MODE_OFF);
|
lv_obj_set_scrollbar_mode(tile_view, LV_SCROLLBAR_MODE_OFF);
|
||||||
lv_obj_clear_flag(lvobj, LV_OBJ_FLAG_SCROLL_ELASTIC);
|
lv_obj_clear_flag(tile_view, LV_OBJ_FLAG_SCROLL_ELASTIC);
|
||||||
|
|
||||||
|
lv_obj_add_flag(tile_view, LV_OBJ_FLAG_EVENT_BUBBLE);
|
||||||
lv_obj_set_user_data(tile_view, this);
|
lv_obj_set_user_data(tile_view, this);
|
||||||
|
|
||||||
lv_obj_set_style_bg_opa(tile_view, LV_OPA_TRANSP, LV_PART_MAIN);
|
// create last to be on top
|
||||||
|
topbar = dynamic_cast<TopbarImpl*>(TopbarFactory::create(this));
|
||||||
lv_obj_move_foreground(topbar->getLvObj());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewMain::~ViewMain()
|
ViewMain::~ViewMain()
|
||||||
@@ -62,13 +71,15 @@ ViewMain::~ViewMain()
|
|||||||
|
|
||||||
void ViewMain::addMainView(Window* view, uint32_t viewId)
|
void ViewMain::addMainView(Window* view, uint32_t viewId)
|
||||||
{
|
{
|
||||||
auto tile = lv_tileview_add_tile(tile_view, viewId, 0, LV_DIR_LEFT | LV_DIR_RIGHT);
|
|
||||||
lv_obj_set_user_data(tile, view);
|
|
||||||
|
|
||||||
view->setLeft(lv_obj_get_x(tile));
|
|
||||||
view->setTop(lv_obj_get_y(tile));
|
|
||||||
|
|
||||||
TRACE("addMainView(0x%p, %d)", view, viewId);
|
TRACE("addMainView(0x%p, %d)", view, viewId);
|
||||||
|
|
||||||
|
auto tile = lv_tileview_add_tile(tile_view, viewId, 0, LV_DIR_LEFT | LV_DIR_RIGHT);
|
||||||
|
|
||||||
|
lv_obj_set_parent(view->getLvObj(), tile);
|
||||||
|
lv_obj_add_event_cb(tile, tile_event_cb, LV_EVENT_ALL, (void*)(unsigned long)viewId);
|
||||||
|
|
||||||
|
setInnerWidth(pageWidth * getMainViewsCount());
|
||||||
|
view->setLeft(pageWidth * viewId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewMain::setTopbarVisible(float visible)
|
void ViewMain::setTopbarVisible(float visible)
|
||||||
|
|||||||
Vendored
+1
-1
Submodule radio/src/thirdparty/libopenui updated: ff581d75fc...2fb7c8f342
Reference in New Issue
Block a user