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.
This commit is contained in:
2014-05-11 16:17:18 +02:00
parent f073c74a40
commit 18f13b0062
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++){
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);
@@ -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)
{
string txt = g_Locale->getText(locale);
string txt = locale != NONEXISTANT_LOCALE ? g_Locale->getText(locale) : "";
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);
}