From 18f13b0062285c64cd313b40a6126334952de552 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 11 May 2014 16:17:18 +0200 Subject: [PATCH] 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. --- src/gui/components/cc_frm_footer.cpp | 23 +++++++++++++++++++++-- src/gui/components/cc_frm_footer.h | 14 ++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 70105c7bf..5bb824cea 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -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); +} diff --git a/src/gui/components/cc_frm_footer.h b/src/gui/components/cc_frm_footer.h index 18e75ae7b..748879470 100644 --- a/src/gui/components/cc_frm_footer.h +++ b/src/gui/components/cc_frm_footer.h @@ -98,6 +98,20 @@ class CComponentsFooter : public CComponentsHeader ///returns pointer to internal button container 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