cc_button_select: add member setSelectedButton() without text color args

Origin commit data
------------------
Commit: edb80246d9
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 884c6181df
commit c984ac5216
2 changed files with 46 additions and 10 deletions

View File

@@ -48,7 +48,7 @@ int CCButtonSelect::getSelectedButton()
return -1;
}
void CCButtonSelect::setSelectedButton( size_t item_id,
void CCButtonSelect::SetSelectedButton( size_t item_id,
const fb_pixel_t& sel_fr_col,
const fb_pixel_t& fr_col,
const fb_pixel_t& sel_bg_col,
@@ -64,7 +64,7 @@ void CCButtonSelect::setSelectedButton( size_t item_id,
CComponentsItem *item = btn_container->getCCItem(i);
if (item->getItemType() >= CC_ITEMTYPE_BUTTON && item->getItemType() <= CC_ITEMTYPE_BUTTON_BLUE){
btn = static_cast<CComponentsButton*>(item);
btn->setButtonTextColor(text_col);
btn->setButtonTextColor(text_col, sel_text_col);
}
}
if (!btn){
@@ -72,13 +72,23 @@ void CCButtonSelect::setSelectedButton( size_t item_id,
return;
}
setSelectedButton(item_id, sel_fr_col, fr_col, sel_bg_col, bg_col, frame_width, sel_frame_width);
getSelectedButtonObject()->setButtonTextColor(text_col, sel_text_col);
}
}
void CCButtonSelect::setSelectedButton( size_t item_id,
const fb_pixel_t& sel_fr_col,
const fb_pixel_t& fr_col,
const fb_pixel_t& sel_bg_col,
const fb_pixel_t& bg_col,
const int& frame_width,
const int& sel_frame_width)
{
fb_pixel_t sel_col = fr_col;
if (btn_container->size() > 1)
sel_col = sel_fr_col; //TODO: make it configurable
btn_container->setSelectedItem(item_id, sel_col, fr_col, sel_bg_col, bg_col, frame_width, sel_frame_width);
getSelectedButtonObject()->setButtonTextColor(sel_text_col);
}
}

View File

@@ -68,8 +68,8 @@ class CCButtonSelect
* @param[in] sel_frame_width
* @li optional: expects type int, default = 1
*/
void setSelectedButton(size_t item_id,
const fb_pixel_t& sel_fr_col = COL_FRAME_PLUS_0,
void SetSelectedButton(size_t item_id,
const fb_pixel_t& sel_fr_col = COL_MENUCONTENTSELECTED_PLUS_0,
const fb_pixel_t& fr_col = COL_FRAME_PLUS_0,
const fb_pixel_t& sel_bg_col = COL_MENUCONTENTSELECTED_PLUS_0,
const fb_pixel_t& bg_col = COL_MENUCONTENT_PLUS_0,
@@ -77,6 +77,32 @@ class CCButtonSelect
const fb_pixel_t& sel_text_col = COL_MENUCONTENTSELECTED_TEXT,
const int& frame_width = 1,
const int& sel_frame_width = 1);
/**Select a definied button inside button chain object. Its the same functionality like SetSelectedButton() but without args for text colors.
* @param[in] item_id
* @li expects type size_t
* @param[in] sel_fr_col
* @li optional: expects type fb_pixel_t, as selected frame color
* @param[in] fr_col
* @li optional: expects type fb_pixel_t, as default frame color
* @param[in] sel_bg_col
* @li optional: expects type fb_pixel_t, as selected background color
* @param[in] bg_col
* @li optional: expects type fb_pixel_t, as default background color
* @param[in] frame_width
* @li optional: expects type int, default = 1
* @param[in] sel_frame_width
* @li optional: expects type int, default = 1
*
* @see SetSelectedButton()
*/
void setSelectedButton(size_t item_id,
const fb_pixel_t& sel_fr_col = COL_MENUCONTENTSELECTED_PLUS_0,
const fb_pixel_t& fr_col = COL_FRAME_PLUS_0,
const fb_pixel_t& sel_bg_col = COL_MENUCONTENTSELECTED_PLUS_0,
const fb_pixel_t& bg_col = COL_MENUCONTENT_PLUS_0,
const int& frame_width = 1,
const int& sel_frame_width = 1);
};
#endif //__CC_BTN_SEL_H__