CComponentsFooter: add member paintButtons()

This is a nearly methode similar with the older button handler find
in gui/widget/buttons.h, some parameters are different,
but require minimalized input.
This member sets some basic parameters and will paint
concurrently on execute, explicit call of paint() is not required.
This should simplify the implementation of the footer class.


Origin commit data
------------------
Branch: ni/coolstream
Commit: 18f13b0062
Author: Thilo Graf <dbt@novatux.de>
Date: 2014-05-11 (Sun, 11 May 2014)



------------------
This commit was generated by Migit
This commit is contained in:
2014-05-11 16:17:18 +02:00
parent e09b3e485b
commit 40c61134b3
2 changed files with 35 additions and 2 deletions

View File

@@ -169,7 +169,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label_l * const cont
for (size_t i= 0; i< label_count; i++){ for (size_t i= 0; i< label_count; i++){
buttons[i].button = content[i].button; buttons[i].button = content[i].button;
buttons[i].text = g_Locale->getText(content[i].locale); buttons[i].text = content[i].locale != NONEXISTANT_LOCALE ? g_Locale->getText(content[i].locale) : "";
} }
setButtonLabels(buttons, label_count, chain_width, label_width); setButtonLabels(buttons, label_count, chain_width, label_width);
@@ -192,7 +192,7 @@ void CComponentsFooter::setButtonLabel(const char *button_icon, const std::strin
void CComponentsFooter::setButtonLabel(const char *button_icon, const neutrino_locale_t& locale, const int& chain_width, const int& label_width) void CComponentsFooter::setButtonLabel(const char *button_icon, const neutrino_locale_t& locale, const int& chain_width, const int& label_width)
{ {
string txt = g_Locale->getText(locale); string txt = locale != NONEXISTANT_LOCALE ? g_Locale->getText(locale) : "";
setButtonLabel(button_icon, txt, chain_width, label_width); setButtonLabel(button_icon, txt, chain_width, label_width);
} }
@@ -206,3 +206,22 @@ void CComponentsFooter::showButtonContour(bool show)
} }
} }
void CComponentsFooter::paintButtons(const int& x_pos,
const int& y_pos,
const int& w,
const int& h,
const size_t& label_count,
const struct button_label * const content,
const int& label_width,
const int& context_buttons,
Font* font,
bool do_save_bg)
{
this->setDimensionsAll(x_pos, y_pos, w, h);
this->setButtonFont(font);
this->setButtonLabels(content, label_count, 0, label_width);
this->setContextButton(context_buttons);
this->paint(do_save_bg);
}

View File

@@ -98,6 +98,20 @@ class CComponentsFooter : public CComponentsHeader
///returns pointer to internal button container ///returns pointer to internal button container
CComponentsFrmChain* getButtonChainObject(){return chain;}; CComponentsFrmChain* getButtonChainObject(){return chain;};
///this is a nearly methode similar with the older button handler find in gui/widget/buttons.h, some parameters are different, but require minimalized input
///this member sets some basic parameters and will paint concurrently on execute, explicit call of paint() is not required
void paintButtons( const int& x_pos,
const int& y_pos,
const int& w,
const int& h,
const size_t& label_count,
const struct button_label * const content,
const int& label_width = 0,
const int& context_buttons = 0,
Font* font = NULL,
bool do_save_bg = CC_SAVE_SCREEN_NO
);
}; };
#endif #endif