mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
CComponentsHeader: fix font and height handling
Font was not changeable. setCaptionFont() was without effect.
This commit is contained in:
@@ -93,12 +93,10 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const
|
|||||||
|
|
||||||
//init header width
|
//init header width
|
||||||
width = width_old = w == 0 ? frameBuffer->getScreenWidth(true) : w;
|
width = width_old = w == 0 ? frameBuffer->getScreenWidth(true) : w;
|
||||||
|
height = height_old = h;
|
||||||
|
|
||||||
//init header default height
|
cch_font = NULL;
|
||||||
height = height_old = max(h, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight());
|
cch_size_mode = CC_HEADER_SIZE_LARGE;
|
||||||
|
|
||||||
cch_size_mode = CC_HEADER_SIZE_LARGE;
|
|
||||||
initCaptionFont(); //sets cch_font and calculate height if required;
|
|
||||||
|
|
||||||
shadow = shadow_mode;
|
shadow = shadow_mode;
|
||||||
col_frame = col_frame_old = color_frame;
|
col_frame = col_frame_old = color_frame;
|
||||||
@@ -160,15 +158,15 @@ void CComponentsHeader::setCaption(neutrino_locale_t caption_locale, const int&
|
|||||||
|
|
||||||
void CComponentsHeader::setCaptionFont(Font* font)
|
void CComponentsHeader::setCaptionFont(Font* font)
|
||||||
{
|
{
|
||||||
initCaptionFont(font); //cch_font = font
|
cch_font = font;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CComponentsHeader::initCaptionFont(Font* font)
|
void CComponentsHeader::initCaptionFont()
|
||||||
{
|
{
|
||||||
Font *l_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE];
|
Font *l_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE];
|
||||||
Font *s_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU];
|
Font *s_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU];
|
||||||
|
|
||||||
if (font == NULL){
|
if (cch_font == NULL){
|
||||||
cch_font = (cch_size_mode == CC_HEADER_SIZE_LARGE? l_font : s_font);
|
cch_font = (cch_size_mode == CC_HEADER_SIZE_LARGE? l_font : s_font);
|
||||||
|
|
||||||
//select matching height
|
//select matching height
|
||||||
@@ -177,10 +175,8 @@ void CComponentsHeader::initCaptionFont(Font* font)
|
|||||||
else
|
else
|
||||||
height = std::min(height, s_font->getHeight());
|
height = std::min(height, s_font->getHeight());
|
||||||
}
|
}
|
||||||
else{
|
else
|
||||||
cch_font = font;
|
|
||||||
height = std::max(height, cch_font->getHeight());
|
height = std::max(height, cch_font->getHeight());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CComponentsHeader::setIcon(const char* icon_name)
|
void CComponentsHeader::setIcon(const char* icon_name)
|
||||||
@@ -513,12 +509,12 @@ void CComponentsHeader::initCaption()
|
|||||||
|
|
||||||
void CComponentsHeader::initCCItems()
|
void CComponentsHeader::initCCItems()
|
||||||
{
|
{
|
||||||
//set basic properties
|
|
||||||
Init(x, y, width, height, col_frame, col_body, col_shadow);
|
|
||||||
|
|
||||||
//set size
|
//set size
|
||||||
initCaptionFont();
|
initCaptionFont();
|
||||||
|
|
||||||
|
//set basic properties
|
||||||
|
Init(x, y, width, height, col_frame, col_body, col_shadow);
|
||||||
|
|
||||||
//init icon
|
//init icon
|
||||||
initIcon();
|
initIcon();
|
||||||
|
|
||||||
|
@@ -99,7 +99,7 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen
|
|||||||
bool cch_cl_enable_run;
|
bool cch_cl_enable_run;
|
||||||
|
|
||||||
///init font object and recalculates height if required
|
///init font object and recalculates height if required
|
||||||
void initCaptionFont(Font* font = NULL);
|
void initCaptionFont();
|
||||||
///sub: init icon object
|
///sub: init icon object
|
||||||
void initIcon();
|
void initIcon();
|
||||||
///sub: init caption object
|
///sub: init caption object
|
||||||
@@ -136,13 +136,44 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen
|
|||||||
virtual void setCaption(neutrino_locale_t caption_locale, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK, const fb_pixel_t& text_color = COL_MENUHEAD_TEXT);
|
virtual void setCaption(neutrino_locale_t caption_locale, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK, const fb_pixel_t& text_color = COL_MENUHEAD_TEXT);
|
||||||
|
|
||||||
///set alignment of caption within header, possible paramters are CTextBox::CENTER, CTextBox::NO_AUTO_LINEBREAK
|
///set alignment of caption within header, possible paramters are CTextBox::CENTER, CTextBox::NO_AUTO_LINEBREAK
|
||||||
virtual void setCaptionAlignment(const int& align_mode){cch_caption_align = align_mode;};
|
virtual void setCaptionAlignment(const int& align_mode){cch_caption_align = align_mode;}
|
||||||
///set text font object for caption
|
|
||||||
|
/**Set text font for title.
|
||||||
|
* Internal default font is g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE] and
|
||||||
|
* default height of header object is calculated from this font type.
|
||||||
|
* Height can be changed with modes by setSizeMode(), setHeight() or constructor.
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @param[in] font exepts font object, type Font*
|
||||||
|
* @see getCaptionFont(), setSizeMode(),
|
||||||
|
* setCaptionColor(),
|
||||||
|
* setCaptionAlignment(),
|
||||||
|
* setCaption()
|
||||||
|
*/
|
||||||
virtual void setCaptionFont(Font* font);
|
virtual void setCaptionFont(Font* font);
|
||||||
///returns font object of title caption
|
///returns font object of title caption
|
||||||
virtual Font* getCaptionFont(){return cch_font;};
|
virtual Font* getCaptionFont(){return cch_font;}
|
||||||
///set text color for caption
|
///set text color for caption
|
||||||
virtual void setCaptionColor(fb_pixel_t text_color){cch_col_text = text_color;};
|
virtual void setCaptionColor(fb_pixel_t text_color){cch_col_text = text_color;}
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
CC_HEADER_SIZE_LARGE = 0,
|
||||||
|
CC_HEADER_SIZE_SMALL = 1
|
||||||
|
};
|
||||||
|
/**Set size mode of header.
|
||||||
|
* These modes are using fonts SNeutrinoSettings::FONT_TYPE_MENU_TITLE for large mode (default)
|
||||||
|
* and SNeutrinoSettings::FONT_TYPE_MENU for small mode to set required height.
|
||||||
|
* If other size wanted then use set setCaptionFont() and setHeight()
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @param[in] size_mode exepts type int (enums)
|
||||||
|
* possible modes are:
|
||||||
|
* CC_HEADER_SIZE_LARGE
|
||||||
|
* CC_HEADER_SIZE_SMALL
|
||||||
|
* @see setCaption(), setHeight()
|
||||||
|
*/
|
||||||
|
virtual void setSizeMode(const int& size_mode){cch_size_mode = size_mode; initCCItems();}
|
||||||
|
|
||||||
///set offset between items
|
///set offset between items
|
||||||
virtual void setOffset(const int offset){cch_offset = offset;};
|
virtual void setOffset(const int offset){cch_offset = offset;};
|
||||||
@@ -198,14 +229,6 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen
|
|||||||
///set offset between icons within context button object
|
///set offset between icons within context button object
|
||||||
virtual void setButtonsSpace(const int buttons_space){cch_buttons_space = buttons_space;}
|
virtual void setButtonsSpace(const int buttons_space){cch_buttons_space = buttons_space;}
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
CC_HEADER_SIZE_LARGE = 0,
|
|
||||||
CC_HEADER_SIZE_SMALL = 1
|
|
||||||
};
|
|
||||||
///set size of header, possible values are CC_HEADER_SIZE_LARGE, CC_HEADER_SIZE_SMALL
|
|
||||||
virtual void setSizeMode(const int& size_mode){cch_size_mode = size_mode; initCCItems();}
|
|
||||||
|
|
||||||
///init all items within header object
|
///init all items within header object
|
||||||
virtual void initCCItems();
|
virtual void initCCItems();
|
||||||
///returns the text object
|
///returns the text object
|
||||||
|
Reference in New Issue
Block a user