CComponentsHeader: Fix height calculation

This commit is contained in:
M. Liebmann
2013-12-11 15:13:21 +01:00
parent 78bdef9c0a
commit c2c5b931cd
2 changed files with 14 additions and 4 deletions

View File

@@ -127,6 +127,7 @@ class CComponentsHeader : public CComponentsForm
std::vector<std::string> v_cch_btn; std::vector<std::string> v_cch_btn;
int cch_size_mode; int cch_size_mode;
int cch_caption_align; int cch_caption_align;
bool userHeight;
void initIcon(); void initIcon();
void initCaption(); void initCaption();

View File

@@ -51,7 +51,10 @@ CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const in
x = x_pos; x = x_pos;
y = y_pos; y = y_pos;
width = w; width = w;
height = h > 0 ? h : height; if (h > 0) {
userHeight = true;
height = h;
}
shadow = has_shadow; shadow = has_shadow;
col_frame = color_frame; col_frame = color_frame;
col_body = color_body; col_body = color_body;
@@ -74,7 +77,10 @@ CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const in
x = x_pos; x = x_pos;
y = y_pos; y = y_pos;
width = w; width = w;
height = h > 0 ? h : height; if (h > 0) {
userHeight = true;
height = h;
}
shadow = has_shadow; shadow = has_shadow;
col_frame = color_frame; col_frame = color_frame;
col_body = color_body; col_body = color_body;
@@ -99,6 +105,7 @@ void CComponentsHeader::initVarHeader()
cch_size_mode = CC_HEADER_SIZE_LARGE; cch_size_mode = CC_HEADER_SIZE_LARGE;
cch_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; cch_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE];
height = cch_font->getHeight(); height = cch_font->getHeight();
userHeight = false;
//CComponentsHeader //CComponentsHeader
cch_icon_obj = NULL; cch_icon_obj = NULL;
@@ -360,8 +367,10 @@ void CComponentsHeader::initCaption()
void CComponentsHeader::initCCItems() void CComponentsHeader::initCCItems()
{ {
//set size //set size
cch_font = (cch_size_mode == CC_HEADER_SIZE_LARGE? g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE] : g_Font[SNeutrinoSettings::FONT_TYPE_MENU]); if (!userHeight) {
height = cch_font->getHeight(); cch_font = (cch_size_mode == CC_HEADER_SIZE_LARGE? g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE] : g_Font[SNeutrinoSettings::FONT_TYPE_MENU]);
height = cch_font->getHeight();
}
//init icon //init icon
initIcon(); initIcon();