CComponentsFooter: add member enableButtonShadow()

Possibility to pass button properties into button objects
This commit is contained in:
2016-08-21 18:32:14 +02:00
parent 779c51bd00
commit 363cf101d1
2 changed files with 20 additions and 2 deletions

View File

@@ -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; i<chain->size(); i++)
chain->enableShadow(mode, shadow_width, force_paint);
}
}

View File

@@ -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