diff --git a/radio/src/thirdparty/libopenui/src/dialog.cpp b/radio/src/thirdparty/libopenui/src/dialog.cpp index 46b863579..3df9c439d 100644 --- a/radio/src/thirdparty/libopenui/src/dialog.cpp +++ b/radio/src/thirdparty/libopenui/src/dialog.cpp @@ -19,13 +19,14 @@ #include "dialog.h" #include "mainwindow.h" +#include "theme.h" Dialog::Dialog(std::string title, const rect_t & rect): ModalWindow(), - content(this, rect), - form(&content, {0, 0, rect.w, rect.h}, FORM_NO_BORDER) + content(createDialogWindow(this, rect)), + form(content, {0, POPUP_HEADER_HEIGHT, rect.w, coord_t(rect.h - POPUP_HEADER_HEIGHT)}, FORM_NO_BORDER) { bringToTop(); - content.setTitle(title); + content->setTitle(title); form.setFocus(); } diff --git a/radio/src/thirdparty/libopenui/src/dialog.h b/radio/src/thirdparty/libopenui/src/dialog.h index 7ab4f8a83..9426e9bb6 100644 --- a/radio/src/thirdparty/libopenui/src/dialog.h +++ b/radio/src/thirdparty/libopenui/src/dialog.h @@ -30,11 +30,17 @@ class Dialog: public ModalWindow { ~Dialog() override { form.detach(); - content.detach(); } +#if defined(DEBUG_WINDOWS) + std::string getName() override + { + return "Dialog"; + } +#endif + protected: - ModalWindowContent content; + ModalWindowContent * content; FormGroup form; }; diff --git a/radio/src/thirdparty/libopenui/src/menu.cpp b/radio/src/thirdparty/libopenui/src/menu.cpp index 84dc6412f..394fdd626 100644 --- a/radio/src/thirdparty/libopenui/src/menu.cpp +++ b/radio/src/thirdparty/libopenui/src/menu.cpp @@ -102,8 +102,8 @@ void MenuWindowContent::paint(BitmapBuffer * dc) // the title if (!title.empty()) { - dc->drawText(MENUS_WIDTH / 2, (MENUS_HEADER_HEIGHT - getFontHeight(MENU_HEADER_FONT)) / 2, title.c_str(), CENTERED | MENU_HEADER_FONT); - dc->drawSolidHorizontalLine(0, MENUS_HEADER_HEIGHT - 1, MENUS_WIDTH, MENU_LINE_COLOR); + dc->drawText(MENUS_WIDTH / 2, (POPUP_HEADER_HEIGHT - getFontHeight(MENU_HEADER_FONT)) / 2, title.c_str(), CENTERED | MENU_HEADER_FONT); + dc->drawSolidHorizontalLine(0, POPUP_HEADER_HEIGHT - 1, MENUS_WIDTH, MENU_LINE_COLOR); } } @@ -117,7 +117,7 @@ void Menu::updatePosition() { if (!toolbar) { // there is no navigation bar at the left, we may center the window on screen - auto headerHeight = content->title.empty() ? 0 : MENUS_HEADER_HEIGHT; + auto headerHeight = content->title.empty() ? 0 : POPUP_HEADER_HEIGHT; auto bodyHeight = limit(MENUS_MIN_HEIGHT, content->body.lines.size() * MENUS_LINE_HEIGHT - 1, MENUS_MAX_HEIGHT); content->setTop((LCD_H - headerHeight - bodyHeight) / 2 + MENUS_OFFSET_TOP); content->setHeight(headerHeight + bodyHeight); diff --git a/radio/src/thirdparty/libopenui/src/menu.h b/radio/src/thirdparty/libopenui/src/menu.h index b7cdac108..dc60199ca 100644 --- a/radio/src/thirdparty/libopenui/src/menu.h +++ b/radio/src/thirdparty/libopenui/src/menu.h @@ -181,4 +181,4 @@ class Menu: public ModalWindow { void updatePosition(); }; -#endif +#endif // _MENU_H_ diff --git a/radio/src/thirdparty/libopenui/src/modal_window.cpp b/radio/src/thirdparty/libopenui/src/modal_window.cpp index 09c54e210..a77c36a92 100644 --- a/radio/src/thirdparty/libopenui/src/modal_window.cpp +++ b/radio/src/thirdparty/libopenui/src/modal_window.cpp @@ -37,9 +37,9 @@ void ModalWindow::paint(BitmapBuffer * dc) void ModalWindowContent::paint(BitmapBuffer * dc) { - dc->drawSolidFilledRect(0, 0, width(), PAGE_LINE_HEIGHT, FOCUS_BGCOLOR); - dc->drawText(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, title.c_str(), FOCUS_COLOR); - dc->drawSolidFilledRect(0, PAGE_LINE_HEIGHT, width(), height() - PAGE_LINE_HEIGHT, DEFAULT_BGCOLOR); + dc->drawSolidFilledRect(0, 0, width(), POPUP_HEADER_HEIGHT, FOCUS_BGCOLOR); + dc->drawText(FIELD_PADDING_LEFT, (POPUP_HEADER_HEIGHT - getFontHeight(FONT(STD))) / 2, title.c_str(), FOCUS_COLOR); + dc->drawSolidFilledRect(0, POPUP_HEADER_HEIGHT, width(), height() - POPUP_HEADER_HEIGHT, DEFAULT_BGCOLOR); /* // the background @@ -47,7 +47,7 @@ void ModalWindowContent::paint(BitmapBuffer * dc) // the title if (!title.empty()) { - dc->drawText(MENUS_WIDTH / 2, (MENUS_HEADER_HEIGHT - getFontHeight(MENU_HEADER_FONT)) / 2, title.c_str(), CENTERED | MENU_HEADER_FONT); - dc->drawSolidHorizontalLine(0, MENUS_HEADER_HEIGHT - 1, MENUS_WIDTH, MENU_LINE_COLOR); + dc->drawText(MENUS_WIDTH / 2, (POPUP_HEADER_HEIGHT - getFontHeight(MENU_HEADER_FONT)) / 2, title.c_str(), CENTERED | MENU_HEADER_FONT); + dc->drawSolidHorizontalLine(0, POPUP_HEADER_HEIGHT - 1, MENUS_WIDTH, MENU_LINE_COLOR); }*/ } diff --git a/radio/src/thirdparty/libopenui/src/theme.h b/radio/src/thirdparty/libopenui/src/theme.h index 4dafc524c..c1834d4c7 100644 --- a/radio/src/thirdparty/libopenui/src/theme.h +++ b/radio/src/thirdparty/libopenui/src/theme.h @@ -25,6 +25,8 @@ class Menu; class MenuWindowContent; +class Dialog; +class ModalWindowContent; class ChoiceBase; enum IconState { @@ -53,5 +55,6 @@ class Theme { extern Theme * theme; MenuWindowContent * createMenuWindow(Menu * menu); +ModalWindowContent * createDialogWindow(Dialog * dialog, const rect_t & rect); #endif // _THEME_H_