menu: fix height
This commit is contained in:
committed by
Raphael Coeffic
parent
a0e97c001d
commit
aca4b074ab
+14
-1
@@ -222,6 +222,19 @@ MenuWindowContent::MenuWindowContent(Menu* parent) :
|
|||||||
lv_obj_set_style_bg_opa(lvobj, LV_OPA_100, LV_PART_MAIN);
|
lv_obj_set_style_bg_opa(lvobj, LV_OPA_100, LV_PART_MAIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
coord_t MenuWindowContent::getHeaderHeight() const
|
||||||
|
{
|
||||||
|
if (title) return lv_obj_get_height(title);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MenuWindowContent::deleteLater(bool detach, bool trash)
|
||||||
|
{
|
||||||
|
if (_deleted) return;
|
||||||
|
body.deleteLater(true, false);
|
||||||
|
ModalWindowContent::deleteLater(detach, trash);
|
||||||
|
}
|
||||||
|
|
||||||
Menu::Menu(Window * parent, bool multiple):
|
Menu::Menu(Window * parent, bool multiple):
|
||||||
ModalWindow(parent, true),
|
ModalWindow(parent, true),
|
||||||
content(createMenuWindow(this)),
|
content(createMenuWindow(this)),
|
||||||
@@ -235,7 +248,7 @@ void Menu::updatePosition()
|
|||||||
|
|
||||||
if (!toolbar) {
|
if (!toolbar) {
|
||||||
// there is no navigation bar at the left, we may center the window on screen
|
// there is no navigation bar at the left, we may center the window on screen
|
||||||
auto headerHeight = content->title.empty() ? 0 : POPUP_HEADER_HEIGHT;
|
auto headerHeight = content->getHeaderHeight();
|
||||||
auto bodyHeight = min<coord_t>(height, MENUS_MAX_HEIGHT);
|
auto bodyHeight = min<coord_t>(height, MENUS_MAX_HEIGHT);
|
||||||
content->setTop((LCD_H - headerHeight - bodyHeight) / 2);
|
content->setTop((LCD_H - headerHeight - bodyHeight) / 2);
|
||||||
content->setHeight(headerHeight + bodyHeight);
|
content->setHeight(headerHeight + bodyHeight);
|
||||||
|
|||||||
+2
-7
@@ -140,14 +140,9 @@ class MenuWindowContent: public ModalWindowContent
|
|||||||
public:
|
public:
|
||||||
explicit MenuWindowContent(Menu * parent);
|
explicit MenuWindowContent(Menu * parent);
|
||||||
|
|
||||||
void deleteLater(bool detach = true, bool trash = true) override
|
coord_t getHeaderHeight() const;
|
||||||
{
|
|
||||||
if (_deleted)
|
|
||||||
return;
|
|
||||||
|
|
||||||
body.deleteLater(true, false);
|
void deleteLater(bool detach = true, bool trash = true) override;
|
||||||
ModalWindowContent::deleteLater(detach, trash);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(DEBUG_WINDOWS)
|
#if defined(DEBUG_WINDOWS)
|
||||||
std::string getName() const override
|
std::string getName() const override
|
||||||
|
|||||||
Reference in New Issue
Block a user