CComponentsFooter: optimize select buttons, try to assign better contrast

Now it's possible to set parameters for frames and text.
Parameters are prdefined for better contrasts in select or default mode.

TODO: background modes have no effects at the moment. Here are other things need to be done.
This commit is contained in:
2016-10-23 17:08:51 +02:00
parent 969e2fe600
commit 55ac581523
2 changed files with 34 additions and 6 deletions

View File

@@ -345,13 +345,20 @@ void CComponentsFooter::enableButtonBg(bool enable)
} }
} }
void CComponentsFooter::setSelectedButton(size_t item_id) void CComponentsFooter::setSelectedButton(size_t item_id, const fb_pixel_t& fr_col, const fb_pixel_t& sel_fr_col, const fb_pixel_t& bg_col, const fb_pixel_t& sel_bg_col, const fb_pixel_t& text_col, const fb_pixel_t& sel_text_col)
{ {
if (chain){ if (chain){
fb_pixel_t sel_col = COL_MENUCONTENTSELECTED_PLUS_2; for (size_t i= 0; i< chain->size(); i++){
CComponentsButton *btn = static_cast<CComponentsButton*>(chain->getCCItem(i));
btn->setButtonTextColor(text_col);
}
fb_pixel_t sel_col = fr_col;
if (chain->size() > 1) if (chain->size() > 1)
sel_col = COL_MENUCONTENTSELECTED_PLUS_0; //TODO: make it configurable sel_col = sel_fr_col; //TODO: make it configurable
chain->setSelectedItem(item_id, sel_col, COL_MENUCONTENTSELECTED_PLUS_2, COL_MENUCONTENT_PLUS_0, COL_MENUCONTENT_PLUS_0, 1, 2); chain->setSelectedItem(item_id, sel_col, fr_col, sel_bg_col, bg_col, 1, 2);
if (chain->size() > 1)
getSelectedButtonObject()->setButtonTextColor(sel_text_col);
} }
} }

View File

@@ -137,8 +137,29 @@ class CComponentsFooter : public CComponentsHeader
///disables background of buttons ///disables background of buttons
void disableButtonBg(){enableButtonBg(false);} void disableButtonBg(){enableButtonBg(false);}
///select a definied button, parameter1 as size_t /**Select a definied button inside button chain object
void setSelectedButton(size_t item_id); * @param[in] item_id
* @li optional: exepts type size_t
* @param[in] fr_col
* @li optional: exepts type fb_pixel_t, as default frame color
* @param[in] sel_fr_col
* @li optional: exepts type fb_pixel_t, as selected frame color
* @param[in] bg_col
* @li optional: exepts type fb_pixel_t, as default background color
* @param[in] sel_bg_col
* @li optional: exepts type fb_pixel_t, as selected background color
* @param[in] text_col
* @li optional: exepts type fb_pixel_t, as default text color
* @param[in] sel_text_col
* @li optional: exepts type fb_pixel_t, as selected text color
*/
void setSelectedButton(size_t item_id,
const fb_pixel_t& fr_col = COL_MENUCONTENTSELECTED_PLUS_2,
const fb_pixel_t& sel_fr_col = COL_MENUCONTENTSELECTED_PLUS_0,
const fb_pixel_t& bg_col = COL_MENUFOOT_PLUS_0, /*TODO disabled at the moment, without effect*/
const fb_pixel_t& sel_bg_col = COL_MENUCONTENTSELECTED_PLUS_2, /*TODO disabled at the moment, without effect*/
const fb_pixel_t& text_col = COL_MENUCONTENTDARK_TEXT_PLUS_2,
const fb_pixel_t& sel_text_col = COL_MENUCONTENT_TEXT);
///returns id of select button, return value as int, -1 = nothing is selected ///returns id of select button, return value as int, -1 = nothing is selected
int getSelectedButton(); int getSelectedButton();
///returns selected button object, return value as pointer to object, NULL means nothing is selected ///returns selected button object, return value as pointer to object, NULL means nothing is selected