cc_frm_buttons: expand functionality of setButtonTextColor()

Color parameters for 'select' and 'disable' colors added.


Origin commit data
------------------
Commit: 88c8147707
Author: Thilo Graf <dbt@novatux.de>
Date: 2020-12-07 (Mon, 07 Dec 2020)
This commit is contained in:
2020-12-07 23:28:52 +01:00
committed by vanhofen
parent 3a40172fa6
commit 884c6181df
2 changed files with 18 additions and 6 deletions

View File

@@ -117,7 +117,7 @@ void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const
append_y_offset = 0;
corner_rad = RADIUS_SMALL;
cc_btn_text_col = cc_body_gradient_enable ? COL_BUTTON_TEXT_ENABLED : COL_MENUFOOT_TEXT;
cc_btn_text_col = cc_btn_text_std_col = cc_btn_text_sel_col = cc_body_gradient_enable ? COL_BUTTON_TEXT_ENABLED : COL_MENUFOOT_TEXT;
cc_btn_text_disable_col = cc_body_gradient_enable ? COL_BUTTON_TEXT_DISABLED : COL_MENUCONTENTINACTIVE_TEXT;
cc_btn_icon_obj = NULL;
cc_btn_text_obj = NULL;
@@ -224,7 +224,16 @@ void CComponentsButton::initCaption()
cc_btn_text_obj->getCTextBoxObject()->setTextBorderWidth(0,0);
//set color
cc_btn_text_obj->setTextColor(this->cc_item_enabled ? cc_btn_text_col : cc_btn_text_disable_col);
if (isEnabled())
{
if(isSelected())
cc_btn_text_col = cc_btn_text_sel_col;
else
cc_btn_text_col = cc_btn_text_std_col;
}
else
cc_btn_text_col = cc_btn_text_disable_col;
cc_btn_text_obj->setTextColor(cc_btn_text_col);
//corner of text item
cc_btn_text_obj->setCorner(corner_rad-w_frame, corner_type);

View File

@@ -78,9 +78,7 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen
int cc_btn_alias;
///property: text color
fb_pixel_t cc_btn_text_col;
///property: text color for disabled button
fb_pixel_t cc_btn_text_disable_col;
fb_pixel_t cc_btn_text_col, cc_btn_text_disable_col, cc_btn_text_std_col, cc_btn_text_sel_col;
///object: text font
Font* cc_btn_font;
///object: dynamic font object handler
@@ -135,7 +133,12 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen
virtual ~CComponentsButton(){};
///set text color
void setButtonTextColor(fb_pixel_t caption_color){cc_btn_text_col = caption_color;};
void setButtonTextColor(const fb_pixel_t &caption_color, const fb_pixel_t &sel_caption_color = COL_BUTTON_TEXT_ENABLED, const fb_pixel_t &dis_caption_color = COL_BUTTON_TEXT_DISABLED)
{
cc_btn_text_std_col = caption_color;
cc_btn_text_sel_col = sel_caption_color;
cc_btn_text_disable_col = dis_caption_color;
};
/**Member to modify background behavior of embeded caption object.
* @param[in] mode