From edbbfbef8f0f7ab231d9b59cd1c95bc2c2810ff5 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 27 Aug 2012 22:32:10 +0200 Subject: [PATCH] CComponentsTitleBar: add blanc constructor --- src/gui/components/cc.h | 6 ++++- src/gui/components/components.cpp | 40 ++++++++++++++++++++++++++----- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 423f5ba6d..706c50b31 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -363,8 +363,12 @@ class CComponentsItemBox : public CComponentsContainer class CComponentsTitleBar : public CComponentsItemBox { + private: + void initVarTitleBar(); + public: - CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, + CComponentsTitleBar(); + CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, const char* text = NULL, fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0); void calculateElements(); diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 950b30366..d77d535bc 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1121,12 +1121,17 @@ void CComponentsItemBox::paintPic(CComponentsPicture* pic) //------------------------------------------------------------------------------------------------------- //sub class CComponentsTitleBar from CComponentsItemBox -CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, +CComponentsTitleBar::CComponentsTitleBar() +{ + //CComponentsTitleBar + initVarTitleBar(); +} + +CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, const char* text, fb_pixel_t color_text, fb_pixel_t color_body) { //CComponentsItemBox - initVarItemBox(); - onlyOneTextElement = true; + initVarTitleBar(); //CComponents x = x_pos; @@ -1134,12 +1139,35 @@ CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const height = h; width = w; col_body = color_body; - corner_type = CORNER_TOP; - corner_rad = RADIUS_LARGE; - + //CComponentsTitleBar font_text = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; col_text = color_text; + + if (text) { + addElement (CC_ALIGN_LEFT, CC_ITEMBOX_TEXT, text); + calculateElements(); + } +} + + +void CComponentsTitleBar::initVarTitleBar() +{ + //CComponentsItemBox + initVarItemBox(); + onlyOneTextElement = true; + + font_text = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; + col_text = COL_MENUHEAD; + + //CComponents + x = 0; + y = 0; + height = font_text->getHeight() + 2*hSpacer; + width = frameBuffer->getScreenWidth(true);; + col_body = COL_MENUHEAD_PLUS_0; + corner_type = CORNER_TOP; + corner_rad = RADIUS_LARGE; }