cc_frm_footer: add members to enable button allignment on top of footer

This commit is contained in:
2019-10-27 16:24:47 +01:00
parent 52e8737d2d
commit 97fc294d54
2 changed files with 7 additions and 2 deletions

View File

@@ -87,6 +87,7 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const
ccf_enable_button_shadow = false ; ccf_enable_button_shadow = false ;
ccf_button_shadow_width = shadow ? OFFSET_SHADOW/2 : 0; ccf_button_shadow_width = shadow ? OFFSET_SHADOW/2 : 0;
ccf_button_shadow_force_paint = false; ccf_button_shadow_force_paint = false;
ccf_button_container_y = -1; //centered as default
col_frame = col_frame_old = color_frame; col_frame = col_frame_old = color_frame;
col_body = col_body_old = color_body; col_body = col_body_old = color_body;
col_shadow = col_shadow_old = color_shadow; col_shadow = col_shadow_old = color_shadow;
@@ -176,7 +177,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
int h_container = ccf_btn_font->getHeight() > height+dist ? height-dist : ccf_btn_font->getHeight()+dist; int h_container = ccf_btn_font->getHeight() > height+dist ? height-dist : ccf_btn_font->getHeight()+dist;
h_container -= cc_parent ? (cc_parent->getFrameThickness()/2 - shadow_w) : 0; // if footer is embedded then consider possible frame around parent object (e.g. window) h_container -= cc_parent ? (cc_parent->getFrameThickness()/2 - shadow_w) : 0; // if footer is embedded then consider possible frame around parent object (e.g. window)
int x_container = width/2 - w_container/2; //FIXME: only centered position, other items will be overpainted int x_container = width/2 - w_container/2; //FIXME: only centered position, other items will be overpainted
int y_container = height/2 - h_container/2; int y_container = ccf_button_container_y < 0 ? height/2 - h_container/2 : ccf_button_container_y;
if (cch_icon_obj) if (cch_icon_obj)
x_container = cch_offset+cch_icon_obj->getWidth()+cch_offset; x_container = cch_offset+cch_icon_obj->getWidth()+cch_offset;
@@ -200,7 +201,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
*/ */
int x_btn = 0; int x_btn = 0;
int h_btn = btn_container->getHeight()- 2*fr_thickness - ccf_button_shadow_width; int h_btn = btn_container->getHeight()- 2*fr_thickness - ccf_button_shadow_width;
int y_btn = btn_container->getHeight()/2 - h_btn/2; int y_btn = ccf_button_container_y < 0 ? btn_container->getHeight()/2 - h_btn/2 : ccf_button_container_y;
/* /*
* Init button label objects * Init button label objects

View File

@@ -64,6 +64,8 @@ class CComponentsFooter : public CComponentsHeader, public CCButtonSelect
bool ccf_button_shadow_force_paint; bool ccf_button_shadow_force_paint;
///enable/disable button frame in icon color, predefined for red, green, yellow and blue, default disabled ///enable/disable button frame in icon color, predefined for red, green, yellow and blue, default disabled
bool btn_auto_frame_col; bool btn_auto_frame_col;
///extra button container y pos, overwrites internal default y centered position if value > 0
int ccf_button_container_y;
///property: set font for label caption, see also setButtonFont() ///property: set font for label caption, see also setButtonFont()
Font* ccf_btn_font; Font* ccf_btn_font;
@@ -162,6 +164,8 @@ class CComponentsFooter : public CComponentsHeader, public CCButtonSelect
void disbaleButtonShadow(){enableButtonShadow(CC_SHADOW_OFF);} void disbaleButtonShadow(){enableButtonShadow(CC_SHADOW_OFF);}
///get button label object with defined item id ///get button label object with defined item id
CComponentsButton* getButtonLabel(const uint& item_id); CComponentsButton* getButtonLabel(const uint& item_id);
/// allows to allign buttons on the top of footer, default parameter is true
void ButtonsOnTop(const bool& enable = true) { ccf_button_container_y = enable ? 0 : -1;}
}; };