From 4ee32b90c1a888c0a24be35edce32afcaaece197 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 9 Nov 2012 23:08:55 +0100 Subject: [PATCH] CComponents: add option paint_bg and apply in CComponentsHeader Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/75fbc082694b9a3373e59870b224a116698e784e Author: Thilo Graf Date: 2012-11-09 (Fri, 09 Nov 2012) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/components/cc.h | 11 ++++++----- src/gui/components/components.cpp | 12 ++++++++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 55fdf6233..665149228 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -118,8 +118,8 @@ class CComponents CFrameBuffer * frameBuffer; std::vector v_fbdata; fb_pixel_t col_body, col_shadow, col_frame; - bool firstPaint, shadow, is_painted; - + bool firstPaint, shadow, is_painted, paint_bg; + void initVarBasic(); void paintFbItems(bool do_save_bg = true); fb_pixel_t* getScreen(int ax, int ay, int dx, int dy); @@ -164,16 +164,17 @@ class CComponents inline virtual void setShadowOnOff(bool has_shadow){shadow = has_shadow;}; virtual void hide(); - virtual bool isPainted(){return is_painted;}; + virtual bool isPainted(){return is_painted;} + virtual void doPaintBg(bool do_paint){paint_bg = do_paint;}; }; class CComponentsItem : public CComponents { - protected: + protected: void hideCCItem(bool no_restore = false); void paintInit(bool do_save_bg); void initVarItem(); - + public: CComponentsItem(); diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index d44f0ea5f..126f3cc51 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -80,6 +80,7 @@ void CComponents::initVarBasic() firstPaint = true; is_painted = false; + paint_bg = true; frameBuffer = CFrameBuffer::getInstance(); v_fbdata.clear(); saved_screen.pixbuf = NULL; @@ -185,10 +186,16 @@ void CComponentsItem::initVarItem() initVarBasic(); } +// Paint container background in cc-items with shadow, background and frame. +// This member must be called first in all paint() members before paint other items into the container. +// If backround is not required, it's possible to override this with variable paint_bg=false, use doPaintBg(true/false) to set this! void CComponentsItem::paintInit(bool do_save_bg) { clear(); + if(!paint_bg) + return; + int sw = shadow ? shadow_w : 0; int th = fr_thickness; @@ -391,6 +398,7 @@ void CComponentsText::paintText(bool do_save_bg) void CComponentsText::paint(bool do_save_bg) { + paintText(do_save_bg); } @@ -1730,7 +1738,7 @@ void CComponentsHeader::paint(bool do_save_bg) cch_icon_obj->setWidth(48); cch_icon_obj->setHeight(height); cch_icon_obj->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); - cch_icon_obj->setColorBody(col_body); + cch_icon_obj->doPaintBg(false); //corner of icon item cch_icon_obj->setCornerRadius(corner_rad-fr_thickness); @@ -1747,7 +1755,7 @@ void CComponentsHeader::paint(bool do_save_bg) cch_text_obj = new CComponentsText(cch_text_x, cch_items_y, width-cch_icon_obj->getWidth()-fr_thickness, height-2*fr_thickness, cch_text.c_str()); cch_text_obj->setTextFont(cch_font); cch_text_obj->setTextColor(cch_col_text); - cch_text_obj->setColorBody(col_body); + cch_text_obj->doPaintBg(false); //corner of text item cch_text_obj->setCornerRadius(corner_rad-fr_thickness);