mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 15:32:59 +02:00
CMsgBox: add option to enable/disable button background
replaces var name btn_contour for better plausibility
This commit is contained in:
@@ -83,7 +83,7 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const
|
||||
corner_rad = RADIUS_LARGE;
|
||||
corner_type = CORNER_BOTTOM;
|
||||
|
||||
btn_contour = false /*g_settings.theme.Button_gradient*/; //TODO: not implemented at the moment
|
||||
ccf_enable_button_bg = false /*g_settings.theme.Button_gradient*/; //TODO: not implemented at the moment
|
||||
ccf_btn_font = NULL;
|
||||
chain = NULL;
|
||||
|
||||
@@ -141,13 +141,15 @@ void CComponentsFooter::setButtonLabels(const struct button_label_s * const cont
|
||||
continue;
|
||||
}
|
||||
|
||||
CComponentsButton *btn = new CComponentsButton(0, CC_CENTERED, w_btn_min, (btn_contour ? height-2*fr_thickness : height), txt, icon_name);
|
||||
CComponentsButton *btn = new CComponentsButton(0, CC_CENTERED, w_btn_min, (ccf_enable_button_bg ? height-2*fr_thickness : height), txt, icon_name);
|
||||
|
||||
btn->setButtonFont(ccf_btn_font);
|
||||
btn->doPaintBg(btn_contour);
|
||||
btn->doPaintBg(ccf_enable_button_bg);
|
||||
btn->setButtonDirectKey(content[i].directKey);
|
||||
btn->setButtonDirectKeyA(content[i].directKeyAlt);
|
||||
btn->setButtonResult(content[i].btn_result);
|
||||
btn->setButtonAlias(content[i].btn_alias);
|
||||
btn->enableShadow();
|
||||
|
||||
//set button frames to icon color, predefined for available color buttons
|
||||
if (btn_auto_frame_col){
|
||||
@@ -163,9 +165,6 @@ void CComponentsFooter::setButtonLabels(const struct button_label_s * const cont
|
||||
btn->setColorFrame(f_col);
|
||||
}
|
||||
|
||||
if (btn_contour)
|
||||
btn->setFrameThickness(3, 3);
|
||||
|
||||
chain->addCCItem(btn);
|
||||
|
||||
//set x position of next button object
|
||||
@@ -296,12 +295,12 @@ void CComponentsFooter::setButtonLabel( const char *button_icon,
|
||||
setButtonLabel(button_icon, txt, chain_width, label_width, msg, result_value, alias_value, directKeyAlt);
|
||||
}
|
||||
|
||||
void CComponentsFooter::showButtonContour(bool show)
|
||||
void CComponentsFooter::enableButtonBg(bool enable)
|
||||
{
|
||||
btn_contour = show;
|
||||
ccf_enable_button_bg = enable;
|
||||
if (chain) {
|
||||
for (size_t i= 0; i< chain->size(); i++)
|
||||
chain->getCCItem(i)->doPaintBg(btn_contour);
|
||||
chain->getCCItem(i)->doPaintBg(ccf_enable_button_bg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -70,8 +70,8 @@ class CComponentsFooter : public CComponentsHeader
|
||||
fb_pixel_t color_body,
|
||||
fb_pixel_t color_shadow );
|
||||
|
||||
///show button frame and background, default false
|
||||
bool btn_contour;
|
||||
///show button with background, default false
|
||||
bool ccf_enable_button_bg;
|
||||
///enable/disable button frame in icon color, predefined for red, green, yellow and blue, default disabled
|
||||
bool btn_auto_frame_col;
|
||||
|
||||
@@ -126,8 +126,10 @@ class CComponentsFooter : public CComponentsHeader
|
||||
const int& alias_value = -1,
|
||||
const neutrino_msg_t& directKeyAlt = CRCInput::RC_nokey);
|
||||
|
||||
///causes show/hide countour of button frame and background, parameter bool show, default= true
|
||||
void showButtonContour(bool show = true);
|
||||
///enables background of buttons, parameter bool show, default= true
|
||||
void enableButtonBg(bool enable = true);
|
||||
///disables background of buttons
|
||||
void disableButtonBg(){enableButtonBg(false);}
|
||||
|
||||
///select a definied button, parameter1 as size_t
|
||||
void setSelectedButton(size_t item_id);
|
||||
|
@@ -7,7 +7,7 @@
|
||||
Günther@tuxbox.berlios.org
|
||||
|
||||
Implementation of CComponent Window class.
|
||||
Copyright (C) 2014-2015 Thilo Graf 'dbt'
|
||||
Copyright (C) 2014-2016 Thilo Graf 'dbt'
|
||||
|
||||
License: GPL
|
||||
|
||||
@@ -87,6 +87,7 @@ void CMsgBox::init(const int& Height, const int& ShowButtons, const msg_result_t
|
||||
|
||||
//enable footer and add its height
|
||||
showFooter(true);
|
||||
btn_enable_bg = false;
|
||||
ccw_footer->doPaintBg(false);
|
||||
int h_current = height;
|
||||
h_current += ccw_footer->getHeight();
|
||||
@@ -174,8 +175,8 @@ void CMsgBox::initButtons()
|
||||
|
||||
ccw_footer->setButtonLabels(v_buttons, 0, 125);
|
||||
|
||||
//show buttons with frame and background
|
||||
ccw_footer->showButtonContour(true);
|
||||
//show buttons with background
|
||||
ccw_footer->enableButtonBg(btn_enable_bg);
|
||||
|
||||
//set position of meassage window and refresh window properties
|
||||
setCenterPos();
|
||||
|
@@ -112,6 +112,9 @@ class CMsgBox : public CHintBox
|
||||
///assigned button captions
|
||||
std::string BTN_TEXT(const int& showed_button);
|
||||
|
||||
///enables/disable button background
|
||||
bool btn_enable_bg;
|
||||
|
||||
void initButtons();
|
||||
public:
|
||||
/* Constructor */
|
||||
@@ -181,6 +184,11 @@ class CMsgBox : public CHintBox
|
||||
*/
|
||||
void setButtonText(const int& showed_button, const std::string& text);
|
||||
|
||||
///enables background of buttons, parameter bool show, default= true
|
||||
void enableButtonBg(bool enable = true);
|
||||
///disables background of buttons
|
||||
void disableButtonBg(){enableButtonBg(false);}
|
||||
|
||||
// bool setText(const std::string* newText);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user