From dba17b359c7f1717834f47dc52ff4915a0798a93 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 21 Aug 2016 18:32:14 +0200 Subject: [PATCH] CComponentsFooter: add member enableButtonShadow() Possibility to pass button properties into button objects Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/363cf101d127c2b1d399e290e11e5630153733e6 Author: Thilo Graf Date: 2016-08-21 (Sun, 21 Aug 2016) --- src/gui/components/cc_frm_footer.cpp | 13 ++++++++++++- src/gui/components/cc_frm_footer.h | 9 ++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index b72afbc74..5c2f5878d 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -72,6 +72,7 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const height = max(h, cch_font->getHeight()); shadow = shadow_mode; + ccf_enable_button_shadow = false; col_frame = color_frame; col_body = color_body; col_shadow = color_shadow; @@ -141,7 +142,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label_s * const cont continue; } - CComponentsButton *btn = new CComponentsButton(0, CC_CENTERED, w_btn_min, (ccf_enable_button_bg ? height-2*fr_thickness : height)- 2*shadow_w, txt, icon_name, NULL, false, true, CC_SHADOW_ON); + CComponentsButton *btn = new CComponentsButton(0, CC_CENTERED, w_btn_min, (ccf_enable_button_bg ? height-2*fr_thickness : height)- 2*shadow_w, txt, icon_name, NULL, false, true, ccf_enable_button_shadow); btn->setButtonFont(ccf_btn_font); btn->doPaintBg(ccf_enable_button_bg); @@ -354,3 +355,13 @@ void CComponentsFooter::setButtonText(const uint& btn_id, const std::string& tex else dprintf(DEBUG_NORMAL, "[CComponentsForm] [%s - %d] Error: can't set button text, possible wrong btn_id=%u, item=%p...\n", __func__, __LINE__, btn_id, item); } + + +void CComponentsFooter::enableButtonShadow(int mode, const int& shadow_width, bool force_paint) +{ + ccf_enable_button_shadow = mode; + if (chain){ + for(size_t i=0; isize(); i++) + chain->enableShadow(mode, shadow_width, force_paint); + } +} diff --git a/src/gui/components/cc_frm_footer.h b/src/gui/components/cc_frm_footer.h index aa0f2a19c..863ca7cea 100644 --- a/src/gui/components/cc_frm_footer.h +++ b/src/gui/components/cc_frm_footer.h @@ -72,6 +72,8 @@ class CComponentsFooter : public CComponentsHeader ///show button with background, default false bool ccf_enable_button_bg; + ///enable button with shadow, default false + bool ccf_enable_button_shadow; ///enable/disable button frame in icon color, predefined for red, green, yellow and blue, default disabled bool btn_auto_frame_col; @@ -178,7 +180,12 @@ class CComponentsFooter : public CComponentsHeader CC_FOOTER_SIZE_SMALL = 1 }; ///set size of footer, possible values are CC_FOOTER_SIZE_LARGE, CC_FOOTER_SIZE_SMALL - virtual void setSizeMode(const int& size_mode){cch_size_mode = size_mode; initCCItems();}; + virtual void setSizeMode(const int& size_mode){cch_size_mode = size_mode; initCCItems();} + + ///enable and sets shadow properties for embedded buttons + void enableButtonShadow(int mode = CC_SHADOW_ON, const int& shadow_width = RADIUS_SMALL, bool force_paint = false); + ///disable shadow for embedded buttons + void disbaleButtonShadow(){enableButtonShadow(CC_SHADOW_OFF);} }; #endif