Update to latest libopenui
This commit is contained in:
@@ -107,11 +107,6 @@ CurveEdit::CurveEdit(Window * parent, const rect_t & rect, uint8_t index) :
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
CurveEdit::~CurveEdit()
|
||||
{
|
||||
preview.detach();
|
||||
}
|
||||
|
||||
void CurveEdit::updatePreview()
|
||||
{
|
||||
preview.clearPoints();
|
||||
|
||||
@@ -48,7 +48,15 @@ class CurveEdit: public FormField
|
||||
public:
|
||||
CurveEdit(Window * parent, const rect_t & rect, uint8_t index);
|
||||
|
||||
~CurveEdit() override;
|
||||
void deleteLater(bool detach = true, bool trash = true) override
|
||||
{
|
||||
if (_deleted)
|
||||
return;
|
||||
|
||||
preview.deleteLater(true, false);
|
||||
|
||||
FormField::deleteLater(detach, trash);
|
||||
}
|
||||
|
||||
void updatePreview();
|
||||
|
||||
|
||||
@@ -29,10 +29,9 @@ FullScreenDialog::FullScreenDialog(uint8_t type, std::string title, std::string
|
||||
message(std::move(message)),
|
||||
action(std::move(action)),
|
||||
confirmHandler(confirmHandler)
|
||||
#if defined(HARDWARE_KEYS)
|
||||
, previousFocus(focusWindow)
|
||||
#endif
|
||||
{
|
||||
Layer::push(this);
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
new FabButton(this, LCD_W - 50, LCD_H - 50, ICON_NEXT,
|
||||
[=]() -> uint8_t {
|
||||
@@ -41,6 +40,7 @@ FullScreenDialog::FullScreenDialog(uint8_t type, std::string title, std::string
|
||||
return 0;
|
||||
});
|
||||
#endif
|
||||
|
||||
bringToTop();
|
||||
setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
@@ -115,17 +115,11 @@ void FullScreenDialog::checkEvents()
|
||||
|
||||
void FullScreenDialog::deleteLater(bool detach, bool trash)
|
||||
{
|
||||
#if defined(HARDWARE_KEYS)
|
||||
#warning "TODO remove previousFocus from here, and use layers"
|
||||
if (previousFocus) {
|
||||
previousFocus->setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (running) {
|
||||
running = false;
|
||||
}
|
||||
else {
|
||||
Layer::pop(this);
|
||||
Window::deleteLater(detach, trash);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,9 +78,6 @@ class FullScreenDialog : public FormGroup
|
||||
bool running = false;
|
||||
std::function<bool(void)> closeCondition;
|
||||
std::function<void(void)> confirmHandler;
|
||||
#if defined(HARDWARE_KEYS)
|
||||
Window * previousFocus = nullptr;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // _FULLSCREEN_DIALOG_H_
|
||||
|
||||
@@ -90,7 +90,8 @@ void deleteExpo(uint8_t idx)
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
class InputEditWindow: public Page {
|
||||
class InputEditWindow: public Page
|
||||
{
|
||||
public:
|
||||
InputEditWindow(int8_t input, uint8_t index):
|
||||
Page(ICON_MODEL_INPUTS),
|
||||
@@ -116,9 +117,14 @@ class InputEditWindow: public Page {
|
||||
buildHeader(&header);
|
||||
}
|
||||
|
||||
~InputEditWindow() override
|
||||
void deleteLater(bool detach = true, bool trash = true) override
|
||||
{
|
||||
preview.detach();
|
||||
if (_deleted)
|
||||
return;
|
||||
|
||||
preview.deleteLater(true, false);
|
||||
|
||||
Page::deleteLater(detach, trash);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -38,7 +38,7 @@ PageHeader::PageHeader(Page * parent, uint8_t icon):
|
||||
PageHeader::~PageHeader()
|
||||
{
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
back.detach();
|
||||
back.deleteLater(true, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -51,28 +51,22 @@ void PageHeader::paint(BitmapBuffer * dc)
|
||||
Page::Page(unsigned icon):
|
||||
Window(&mainWindow, {0, 0, LCD_W, LCD_H}, OPAQUE),
|
||||
header(this, icon),
|
||||
body(this, { 0, MENU_HEADER_HEIGHT, LCD_W, LCD_H - MENU_HEADER_HEIGHT }, FORM_FORWARD_FOCUS),
|
||||
previousFocus(focusWindow)
|
||||
body(this, { 0, MENU_HEADER_HEIGHT, LCD_W, LCD_H - MENU_HEADER_HEIGHT }, FORM_FORWARD_FOCUS)
|
||||
{
|
||||
Layer::push(this);
|
||||
clearFocus();
|
||||
}
|
||||
|
||||
Page::~Page()
|
||||
{
|
||||
header.detach();
|
||||
body.detach();
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
Keyboard::hide();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Page::deleteLater(bool detach, bool trash)
|
||||
{
|
||||
#warning "TODO remove previousFocus and use layers"
|
||||
if (previousFocus) {
|
||||
previousFocus->setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
Layer::pop(this);
|
||||
|
||||
header.deleteLater(true, false);
|
||||
body.deleteLater(true, false);
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
Keyboard::hide();
|
||||
#endif
|
||||
|
||||
Window::deleteLater(detach, trash);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
|
||||
class Page;
|
||||
|
||||
class PageHeader: public FormGroup {
|
||||
class PageHeader: public FormGroup
|
||||
{
|
||||
public:
|
||||
PageHeader(Page * parent, uint8_t icon);
|
||||
|
||||
@@ -45,11 +46,12 @@ class PageHeader: public FormGroup {
|
||||
#endif
|
||||
};
|
||||
|
||||
class Page: public Window {
|
||||
class Page: public Window
|
||||
{
|
||||
public:
|
||||
explicit Page(unsigned icon);
|
||||
|
||||
~Page() override;
|
||||
void deleteLater(bool detach = true, bool trash = true) override;
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string getName() const override
|
||||
@@ -78,14 +80,11 @@ class Page: public Window {
|
||||
}
|
||||
#endif
|
||||
|
||||
void deleteLater(bool detach = true, bool trash = true) override;
|
||||
|
||||
void paint(BitmapBuffer * dc) override;
|
||||
|
||||
protected:
|
||||
PageHeader header;
|
||||
FormWindow body;
|
||||
Window * previousFocus;
|
||||
};
|
||||
|
||||
#endif // _PAGE_H_
|
||||
|
||||
@@ -98,11 +98,16 @@ class FlashDialog: public FullScreenDialog
|
||||
{
|
||||
}
|
||||
|
||||
~FlashDialog() override
|
||||
void deleteLater(bool detach = true, bool trash = true) override
|
||||
{
|
||||
progress.detach();
|
||||
if (_deleted)
|
||||
return;
|
||||
|
||||
progress.deleteLater(true, false);
|
||||
|
||||
FullScreenDialog::deleteLater(detach, trash);
|
||||
}
|
||||
|
||||
|
||||
void flash(const char * filename)
|
||||
{
|
||||
device.flashFirmware(filename, [=](const char * title, const char * message, int count, int total) -> void {
|
||||
|
||||
@@ -42,14 +42,6 @@ TabsGroupHeader::TabsGroupHeader(TabsGroup * parent, uint8_t icon):
|
||||
{
|
||||
}
|
||||
|
||||
TabsGroupHeader::~TabsGroupHeader()
|
||||
{
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
back.detach();
|
||||
#endif
|
||||
carousel.detach();
|
||||
}
|
||||
|
||||
void TabsGroupHeader::paint(BitmapBuffer * dc)
|
||||
{
|
||||
OpenTxTheme::instance()->drawMenuBackground(dc, icon, title);
|
||||
@@ -90,16 +82,9 @@ TabsGroup::TabsGroup(uint8_t icon):
|
||||
|
||||
TabsGroup::~TabsGroup()
|
||||
{
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
Keyboard::hide();
|
||||
#endif
|
||||
|
||||
for (auto tab: tabs) {
|
||||
delete tab;
|
||||
}
|
||||
|
||||
header.detach();
|
||||
body.detach();
|
||||
}
|
||||
|
||||
void TabsGroup::addTab(PageTab * page)
|
||||
|
||||
@@ -115,7 +115,19 @@ class TabsGroupHeader: public FormGroup {
|
||||
public:
|
||||
TabsGroupHeader(TabsGroup * menu, uint8_t icon);
|
||||
|
||||
~TabsGroupHeader() override;
|
||||
void deleteLater(bool detach = true, bool trash = true) override
|
||||
{
|
||||
if (_deleted)
|
||||
return;
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
back.deleteLater(true, false);
|
||||
#endif
|
||||
|
||||
carousel.deleteLater(true, false);
|
||||
|
||||
FormField::deleteLater(detach, trash);
|
||||
}
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string getName() const override
|
||||
@@ -140,7 +152,8 @@ class TabsGroupHeader: public FormGroup {
|
||||
const char * title = nullptr;
|
||||
};
|
||||
|
||||
class TabsGroup: public Window {
|
||||
class TabsGroup: public Window
|
||||
{
|
||||
friend class TabsCarousel;
|
||||
|
||||
public:
|
||||
@@ -148,6 +161,21 @@ class TabsGroup: public Window {
|
||||
|
||||
~TabsGroup() override;
|
||||
|
||||
void deleteLater(bool detach = true, bool trash = true) override
|
||||
{
|
||||
if (_deleted)
|
||||
return;
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
Keyboard::hide();
|
||||
#endif
|
||||
|
||||
header.deleteLater(true, false);
|
||||
body.deleteLater(true, false);
|
||||
|
||||
Window::deleteLater(detach, trash);
|
||||
}
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string getName() const override
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user