CComponents: move variable cc_gradientData, paintGradient into base class

Variable now usable via g_settings in all subclasses. enable/disable.
TODO: gradient type handling
This commit is contained in:
2014-09-20 21:34:43 +02:00
committed by [CST] Focus
parent 8762d4b871
commit 64c84fb490
7 changed files with 21 additions and 15 deletions

View File

@@ -64,6 +64,8 @@ CComponents::CComponents() : COSDFader(g_settings.theme.menu_Content_alpha)
frameBuffer = CFrameBuffer::getInstance();
v_fbdata.clear();
saved_screen.pixbuf = NULL;
gradientBuf = NULL;
paintGradient = false;
}
CComponents::~CComponents()
@@ -200,7 +202,7 @@ void CComponents::paintFbItems(bool do_save_bg)
}
else {
if(cc_allow_paint) {
if ((v_fbdata[i].fbdata_type == CC_FBDATA_TYPE_BOX) && (v_fbdata[i].data != NULL)) {
if (paintGradient && (v_fbdata[i].fbdata_type == CC_FBDATA_TYPE_BOX) && (v_fbdata[i].data != NULL)) {
// color gradient
gradientData_t *gradientData = static_cast<gradientData_t*> (v_fbdata[i].data);
if (gradientData->boxBuf == NULL)
@@ -314,3 +316,9 @@ void CComponents::setFrameThickness(const int& thickness, const int& thickness_s
if (fr_thickness_sel != thickness_sel)
fr_thickness_sel = thickness_sel;
}
void CComponents::setPaintGradient(bool do_paint_gradient)
{
paintGradient = g_settings.gradiant ? do_paint_gradient : false;
}

View File

@@ -78,6 +78,13 @@ class CComponents : public CComponentsSignals, public COSDFader
///property: color of frame if component is selected, Note: fr_thickness_sel must be set
fb_pixel_t col_frame_sel;
///property: contains data for gradiant handling
gradientData_t cc_gradientData;
///gradiant pixel buffer
fb_pixel_t *gradientBuf;
///property: true component can paint gradient, see also setPaintGradient()
bool paintGradient;
///property: true=component has shadow
bool shadow;
///property: width of shadow
@@ -179,6 +186,8 @@ class CComponents : public CComponentsSignals, public COSDFader
///set all basic framebuffer element colors at once
///Note: Possible color values are defined in "gui/color.h" and "gui/customcolor.h"
inline virtual void setColorAll(fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow){col_frame = color_frame; col_body = color_body; col_shadow = color_shadow;};
///set color gradient on/off
virtual void setPaintGradient(bool do_paint_gradient);
///get frame color
inline virtual fb_pixel_t getColorFrame(){return col_frame;};
@@ -249,8 +258,6 @@ class CComponentsItem : public CComponents
///Is typically the type CComponentsForm or derived classes, default intialized with NULL
CComponentsForm *cc_parent;
gradientData_t cc_gradientData;
///hides item, arg: no_restore=true causes no restore of background, but clean up pixel buffer if required
void hideCCItem(bool no_restore = false);

View File

@@ -76,6 +76,7 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const
col_frame = color_frame;
col_body = color_body;
col_shadow = color_shadow;
paintGradient = false;
corner_rad = RADIUS_LARGE;
corner_type = CORNER_BOTTOM;

View File

@@ -115,9 +115,7 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const
cch_icon_w = 0;
cch_text_x = cch_offset;
cch_buttons_space = cch_offset;
gradientBuf = NULL;
paintGradient = false;
paintGradient = g_settings.gradiant;
addContextButton(buttons);
initCCItems();

View File

@@ -49,9 +49,6 @@ class CComponentsHeader : public CComponentsForm
fb_pixel_t color_body = COL_MENUHEAD_PLUS_0,
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
fb_pixel_t *gradientBuf;
bool paintGradient;
protected:
///object: icon object, see also setIcon()
CComponentsPicture * cch_icon_obj;
@@ -203,9 +200,6 @@ class CComponentsHeader : public CComponentsForm
///paint header
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
//set color gradient an/off
virtual void setPaintGradient(bool g) { paintGradient = g; };
};
//! Sub class of CComponentsHeader.

View File

@@ -200,7 +200,6 @@ void CComponentsWindow::initHeader()
ccw_head->setCaption(ccw_caption, ccw_align_mode);
ccw_head->setContextButton(ccw_buttons);
ccw_head->setCorner(corner_rad, CORNER_TOP);
ccw_head->setPaintGradient(g_settings.gradiant);
}
}

View File

@@ -1099,7 +1099,6 @@ void CMenuWidget::paint()
// paint head
CComponentsHeader header(x, y, width + sb_width, hheight, getName(), iconfile);
header.setPaintGradient(g_settings.gradiant);
header.setShadowOnOff(CC_SHADOW_ON);
header.setOffset(10);
header.paint(CC_SAVE_SCREEN_NO);