CMenueWidget: get header height directly from header object

Origin commit data
------------------
Commit: 6de4e58535
Author: Thilo Graf <dbt@novatux.de>
Date: 2019-03-31 (Sun, 31 Mar 2019)
This commit is contained in:
2019-03-31 18:28:26 +02:00
committed by vanhofen
parent f66cf59982
commit c7bba69cb4
2 changed files with 22 additions and 11 deletions

View File

@@ -1247,7 +1247,9 @@ void CMenuWidget::calcSize()
if (neededWidth > width - frameBuffer->scale2Res(48)) {
width = neededWidth + frameBuffer->scale2Res(48)+1;
}
hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
initHeader();
hheight = header->getHeight();
int heightCurrPage=0;
page_start.clear();
@@ -1354,9 +1356,12 @@ void CMenuWidget::paint()
if (CInfoClock::getInstance()->isRun())
CInfoClock::getInstance()->disableInfoClock();
calcSize();
CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8 /*, nameString.c_str()*/);
/* prepare footer:
* We must prepare footer, to get current footer dimensions,
* otherwise footer will paint on wrong position
@@ -1366,16 +1371,7 @@ void CMenuWidget::paint()
OnBeforePaint();
// paint head
if (header == NULL){
header = new CComponentsHeader(x, y, width + scrollbar_width, hheight, getName(), iconfile);
header->enableShadow(CC_SHADOW_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT | CC_SHADOW_CORNER_BOTTOM_RIGHT);
header->setOffset(OFFSET_INNER_MID);
}
header->setCaption(getName());
header->setColorAll(COL_FRAME_PLUS_0, COL_MENUHEAD_PLUS_0, COL_SHADOW_PLUS_0);
header->setCaptionColor(COL_MENUHEAD_TEXT);
header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0);
header->enableGradientBgCleanUp(savescreen);
initHeader();
header->paint(CC_SAVE_SCREEN_NO);
// paint body background
@@ -1391,6 +1387,20 @@ void CMenuWidget::paint()
footer->paint(CC_SAVE_SCREEN_NO);
}
void CMenuWidget::initHeader()
{
if (!header){
header = new CComponentsHeader(x, y, width + scrollbar_width, 0, getName(), iconfile);
header->enableShadow(CC_SHADOW_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT | CC_SHADOW_CORNER_BOTTOM_RIGHT);
header->setOffset(OFFSET_INNER_MID);
}
header->setCaption(getName());
header->setColorAll(COL_FRAME_PLUS_0, COL_MENUHEAD_PLUS_0, COL_SHADOW_PLUS_0);
header->setCaptionColor(COL_MENUHEAD_TEXT);
header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0);
header->enableGradientBgCleanUp(savescreen);
}
void CMenuWidget::setMenuPos(const int& menu_width)
{
int scr_x = frameBuffer->getScreenX();

View File

@@ -608,6 +608,7 @@ class CMenuWidget : public CMenuTarget, public CComponentsSignals
void saveScreen();
void restoreScreen();
void setMenuPos(const int& menu_width);
void initHeader();
public:
CMenuWidget();