From bd03327cb46532eb000bf732adb1898c6835b47c Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 1 May 2014 22:07:42 +0200 Subject: [PATCH] CComponentsFooter: use chain object in global scope of class --- src/gui/components/cc_frm_footer.cpp | 9 +++++++-- src/gui/components/cc_frm_footer.h | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index f8538b0f5..dacb4574e 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -84,6 +84,7 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const btn_contour = false; ccf_btn_font = NULL; + chain = NULL; addContextButton(buttons); initCCItems(); @@ -114,8 +115,12 @@ void CComponentsFooter::setButtonLabels(const struct button_label_s * const cont //initialize container (chain object) as button label container: this contains all passed (as interleaved) button label items, with this container we can work inside //footer as primary container (in this context '=this') and the parent for the button label container (chain object), //button label container (chain object) itself is concurrent the parent object for button objects. - CComponentsFrmChain *chain = new CComponentsFrmChain(x_chain, CC_CENTERED, w_chain, height, 0, CC_DIR_X, this); - chain->doPaintBg(false); + if (chain == NULL){ + chain = new CComponentsFrmChain(x_chain, CC_CENTERED, w_chain, height, 0, CC_DIR_X, this); + chain->doPaintBg(false); + } + if (!chain->empty()) + chain->clear(); //calculate default static width of button labels inside button object container related to available width of chain object int w_btn_fix = chain->getWidth() / label_count; diff --git a/src/gui/components/cc_frm_footer.h b/src/gui/components/cc_frm_footer.h index d943a5bc7..fcb547616 100644 --- a/src/gui/components/cc_frm_footer.h +++ b/src/gui/components/cc_frm_footer.h @@ -63,8 +63,10 @@ class CComponentsFooter : public CComponentsHeader ///property: set font for label caption, see also setButtonFont() Font* ccf_btn_font; + ///container for button objects + CComponentsFrmChain *chain; + public: - CComponentsFooter(CComponentsForm *parent = NULL); CComponentsFooter( const int& x_pos, const int& y_pos, const int& w, const int& h = 0, const int& buttons = 0,