From 0c91c4b0dc617d72203f3789cc8b9a668ae48e3e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 11 May 2014 17:26:38 +0200 Subject: [PATCH] CComponentsFooter: ignore item, if no text and icon are defined Empty buttons with defined width are causing gaps...looks not nice! Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/9937c0fae8b8be1c5f2437480c7791944b63f66d Author: Thilo Graf Date: 2014-05-11 (Sun, 11 May 2014) ------------------ This commit was generated by Migit --- src/gui/components/cc_frm_footer.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 5bb824cea..5d2411fe1 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -128,11 +128,19 @@ void CComponentsFooter::setButtonLabels(const struct button_label_s * const cont //generate and add button objects passed from button label content with default width to chain object. for (size_t i= 0; i< label_count; i++){ - CComponentsButton *btn = new CComponentsButton(0, CC_CENTERED, w_btn_min, height-height/4, content[i].text, content[i].button); + string txt = content[i].text; + string btn_name = string(content[i].button); + + //ignore item, if no text and icon are defined; + if (txt.empty() && btn_name.empty()){ + dprintf(DEBUG_INFO, "[CComponentsFooter] [%s - %d] ignore item [%d], no icon and text defined!\n", __func__, __LINE__, i); + continue; + } + + CComponentsButton *btn = new CComponentsButton(0, CC_CENTERED, w_btn_min, height-height/4, txt, btn_name); btn->setButtonFont(ccf_btn_font); btn->doPaintBg(btn_contour); - string btn_name = string(content[i].button); if (btn_name == NEUTRINO_ICON_BUTTON_RED) btn->setColorFrame(COL_DARK_RED); if (btn_name == NEUTRINO_ICON_BUTTON_GREEN) @@ -220,8 +228,8 @@ void CComponentsFooter::paintButtons(const int& x_pos, { this->setDimensionsAll(x_pos, y_pos, w, h); this->setButtonFont(font); - this->setButtonLabels(content, label_count, 0, label_width); this->setContextButton(context_buttons); + this->setButtonLabels(content, label_count, 0, label_width); this->paint(do_save_bg); }