diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 87687b29e..6cac356f6 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -77,6 +77,7 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const col_body = color_body; col_shadow = color_shadow; col_body_gradient = false; + btn_auto_frame_col = false; corner_rad = RADIUS_LARGE; corner_type = CORNER_BOTTOM; @@ -146,14 +147,19 @@ void CComponentsFooter::setButtonLabels(const struct button_label_s * const cont btn->setButtonResult(content[i].btn_result); btn->setButtonAlias(content[i].btn_alias); - if (btn_name == NEUTRINO_ICON_BUTTON_RED) - btn->setColorFrame(COL_DARK_RED); - if (btn_name == NEUTRINO_ICON_BUTTON_GREEN) - btn->setColorFrame(COL_DARK_GREEN); - if (btn_name == NEUTRINO_ICON_BUTTON_YELLOW) - btn->setColorFrame(COL_OLIVE); - if (btn_name == NEUTRINO_ICON_BUTTON_BLUE) - btn->setColorFrame(COL_DARK_BLUE); + //set button frames to icon color, predefined for available color buttons + if (btn_auto_frame_col){ + fb_pixel_t f_col = btn->getColorFrame(); + if (btn_name == NEUTRINO_ICON_BUTTON_RED) + f_col = COL_DARK_RED; + if (btn_name == NEUTRINO_ICON_BUTTON_GREEN) + f_col = COL_DARK_GREEN; + if (btn_name == NEUTRINO_ICON_BUTTON_YELLOW) + f_col = COL_OLIVE; + if (btn_name == NEUTRINO_ICON_BUTTON_BLUE) + f_col = COL_DARK_BLUE; + btn->setColorFrame(f_col); + } chain->addCCItem(btn); diff --git a/src/gui/components/cc_frm_footer.h b/src/gui/components/cc_frm_footer.h index 2606a1cca..3f2b6cb5b 100644 --- a/src/gui/components/cc_frm_footer.h +++ b/src/gui/components/cc_frm_footer.h @@ -69,6 +69,8 @@ class CComponentsFooter : public CComponentsHeader ///show button frame and background, default false bool btn_contour; + ///enable/disable button frame in icon color, predefined for red, green, yellow and blue, default disabled + bool btn_auto_frame_col; ///property: set font for label caption, see also setButtonFont() Font* ccf_btn_font; @@ -95,6 +97,9 @@ class CComponentsFooter : public CComponentsHeader ///add button labels with string label type as content, parameter 1 as vector, chain_width as int, label width as int void setButtonLabels(const std::vectorv_content, const int& chain_width, const int& label_width); + ///enable/disable button frame in icon color, predefined for red, green, yellow and blue + inline void enableButtonFrameColor(bool enable = true){btn_auto_frame_col = enable;} + ///add button labels with old label type, count as size_t, chain_width as int, label width as int ///NOTE: for compatibility with older button handler find in gui/widget/buttons.h, if possible, don't use this void setButtonLabels(const struct button_label * const content, const size_t& label_count, const int& chain_width = 0, const int& label_width = 0);