mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
CComponentsTitleBar: add parameter for default icon
...also removed parameter for text ailgnment, because the most titelbars need only left alignment and if required more elements, we can use the addElement() methode.
This commit is contained in:
@@ -367,20 +367,22 @@ class CComponentsTitleBar : public CComponentsItemBox
|
||||
{
|
||||
private:
|
||||
const char* tb_c_text;
|
||||
std::string tb_s_text;
|
||||
std::string tb_s_text, tb_icon_name;
|
||||
neutrino_locale_t tb_locale_text;
|
||||
int tb_text_align;
|
||||
int tb_text_align, tb_icon_align;
|
||||
|
||||
bool initText();
|
||||
void initText();
|
||||
void initIcon();
|
||||
void initElements();
|
||||
void initVarTitleBar();
|
||||
|
||||
public:
|
||||
CComponentsTitleBar();
|
||||
CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, const char* c_text = NULL, const int text_alignment = CC_ALIGN_LEFT,
|
||||
CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, const char* c_text = NULL, const std::string& s_icon ="",
|
||||
fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0);
|
||||
CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, const std::string& s_text ="", const int text_alignment = CC_ALIGN_LEFT,
|
||||
CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, const std::string& s_text ="", const std::string& s_icon ="",
|
||||
fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0);
|
||||
CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t locale_text = NONEXISTANT_LOCALE, const int text_alignment = CC_ALIGN_LEFT,
|
||||
CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t locale_text = NONEXISTANT_LOCALE, const std::string& s_icon ="",
|
||||
fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0);
|
||||
|
||||
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
||||
|
@@ -1191,7 +1191,34 @@ CComponentsTitleBar::CComponentsTitleBar()
|
||||
initVarTitleBar();
|
||||
}
|
||||
|
||||
CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, const char* c_text, const int text_alignment,
|
||||
void CComponentsTitleBar::initVarTitleBar()
|
||||
{
|
||||
//CComponentsItemBox
|
||||
initVarItemBox();
|
||||
onlyOneTextElement = true;
|
||||
|
||||
font_text = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE];
|
||||
it_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;
|
||||
|
||||
//CComponentsTitleBar
|
||||
tb_text_align = CC_ALIGN_LEFT;
|
||||
tb_icon_align = CC_ALIGN_LEFT;
|
||||
tb_c_text = NULL;
|
||||
tb_s_text = "";
|
||||
tb_locale_text = NONEXISTANT_LOCALE;
|
||||
tb_icon_name = "";
|
||||
}
|
||||
|
||||
CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, const char* c_text, const std::string& s_icon,
|
||||
fb_pixel_t color_text, fb_pixel_t color_body)
|
||||
{
|
||||
//CComponentsItemBox
|
||||
@@ -1207,96 +1234,79 @@ CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const
|
||||
|
||||
//CComponentsTitleBar
|
||||
tb_c_text = c_text;
|
||||
tb_text_align = text_alignment;
|
||||
tb_icon_name = s_icon;
|
||||
|
||||
if (initText())
|
||||
calculateElements();
|
||||
initElements();
|
||||
}
|
||||
|
||||
CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, const string& s_text, const int text_alignment,
|
||||
CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, const string& s_text, const std::string& s_icon,
|
||||
fb_pixel_t color_text, fb_pixel_t color_body)
|
||||
{
|
||||
//CComponentsItemBox
|
||||
initVarTitleBar();
|
||||
it_col_text = color_text;
|
||||
|
||||
|
||||
//CComponents
|
||||
x = x_pos;
|
||||
y = y_pos;
|
||||
height = h;
|
||||
width = w;
|
||||
col_body = color_body;
|
||||
|
||||
|
||||
//CComponentsTitleBar
|
||||
tb_s_text = s_text;
|
||||
tb_text_align = text_alignment;
|
||||
|
||||
if (initText())
|
||||
calculateElements();
|
||||
tb_icon_name = s_icon;
|
||||
|
||||
initElements();
|
||||
}
|
||||
|
||||
CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t locale_text, const int text_alignment,
|
||||
CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t locale_text, const std::string& s_icon,
|
||||
fb_pixel_t color_text, fb_pixel_t color_body)
|
||||
{
|
||||
//CComponentsItemBox
|
||||
initVarTitleBar();
|
||||
it_col_text = color_text;
|
||||
|
||||
|
||||
//CComponents
|
||||
x = x_pos;
|
||||
y = y_pos;
|
||||
height = h;
|
||||
width = w;
|
||||
col_body = color_body;
|
||||
|
||||
|
||||
//CComponentsTitleBar
|
||||
tb_locale_text = locale_text;
|
||||
tb_s_text = g_Locale->getText(tb_locale_text);
|
||||
tb_text_align = text_alignment;
|
||||
|
||||
if (initText())
|
||||
calculateElements();
|
||||
tb_icon_name = s_icon;
|
||||
|
||||
initElements();
|
||||
}
|
||||
|
||||
bool CComponentsTitleBar::initText()
|
||||
///basic init methodes for constructors ***************************************
|
||||
void CComponentsTitleBar::initIcon()
|
||||
{
|
||||
if (!tb_icon_name.empty())
|
||||
addElement (tb_icon_align, CC_ITEMBOX_ICON, tb_icon_name);
|
||||
}
|
||||
|
||||
void CComponentsTitleBar::initText()
|
||||
{
|
||||
if (tb_c_text){
|
||||
addElement (tb_text_align, CC_ITEMBOX_TEXT, tb_c_text);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
else if (!tb_s_text.empty()){
|
||||
addElement (tb_text_align, CC_ITEMBOX_TEXT, tb_s_text);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void CComponentsTitleBar::initVarTitleBar()
|
||||
void CComponentsTitleBar::initElements()
|
||||
{
|
||||
//CComponentsItemBox
|
||||
initVarItemBox();
|
||||
onlyOneTextElement = true;
|
||||
|
||||
font_text = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE];
|
||||
it_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;
|
||||
|
||||
//CComponentsTitleBar
|
||||
tb_text_align = CC_ALIGN_LEFT;
|
||||
tb_c_text = NULL;
|
||||
tb_s_text = "";
|
||||
tb_locale_text = NONEXISTANT_LOCALE;
|
||||
initIcon();
|
||||
initText();
|
||||
}
|
||||
|
||||
///*****************************************************************************
|
||||
|
||||
void CComponentsTitleBar::paint(bool do_save_bg)
|
||||
{
|
||||
|
Reference in New Issue
Block a user