From 9dcee01e694f573f894377dded99699e812c48b6 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 23 Oct 2016 17:08:51 +0200 Subject: [PATCH] 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. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/55ac5815230c2547970901e088a0213c6161c853 Author: Thilo Graf Date: 2016-10-23 (Sun, 23 Oct 2016) --- src/gui/components/cc_frm_footer.cpp | 15 +++++++++++---- src/gui/components/cc_frm_footer.h | 25 +++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 2d777a7b5..8256752cd 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -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){ - fb_pixel_t sel_col = COL_MENUCONTENTSELECTED_PLUS_2; + for (size_t i= 0; i< chain->size(); i++){ + CComponentsButton *btn = static_cast(chain->getCCItem(i)); + btn->setButtonTextColor(text_col); + } + fb_pixel_t sel_col = fr_col; if (chain->size() > 1) - sel_col = COL_MENUCONTENTSELECTED_PLUS_0; //TODO: make it configurable - chain->setSelectedItem(item_id, sel_col, COL_MENUCONTENTSELECTED_PLUS_2, COL_MENUCONTENT_PLUS_0, COL_MENUCONTENT_PLUS_0, 1, 2); + sel_col = sel_fr_col; //TODO: make it configurable + chain->setSelectedItem(item_id, sel_col, fr_col, sel_bg_col, bg_col, 1, 2); + + if (chain->size() > 1) + getSelectedButtonObject()->setButtonTextColor(sel_text_col); } } diff --git a/src/gui/components/cc_frm_footer.h b/src/gui/components/cc_frm_footer.h index 301a93362..7796aac39 100644 --- a/src/gui/components/cc_frm_footer.h +++ b/src/gui/components/cc_frm_footer.h @@ -137,8 +137,29 @@ class CComponentsFooter : public CComponentsHeader ///disables background of buttons void disableButtonBg(){enableButtonBg(false);} - ///select a definied button, parameter1 as size_t - void setSelectedButton(size_t item_id); + /**Select a definied button inside button chain object + * @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 int getSelectedButton(); ///returns selected button object, return value as pointer to object, NULL means nothing is selected