diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index d704dfb43..009ef49c9 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -227,11 +227,15 @@ inline void CComponents::hide() is_painted = false; } -//erase rendered objects -void CComponents::kill() +//erase or paint over rendered objects +void CComponents::kill(const fb_pixel_t& bg_color) { - for(size_t i =0; i< v_fbdata.size() ;i++) - frameBuffer->paintBackgroundBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy); + for(size_t i =0; i< v_fbdata.size() ;i++){ + if (bg_color) + frameBuffer->paintBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, bg_color, v_fbdata[i].r, corner_type); + else + frameBuffer->paintBackgroundBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy); + } clearFbData(); firstPaint = true; is_painted = false; diff --git a/src/gui/components/cc_base.h b/src/gui/components/cc_base.h index 57db14785..819a2e60b 100644 --- a/src/gui/components/cc_base.h +++ b/src/gui/components/cc_base.h @@ -201,8 +201,11 @@ class CComponents ///hide current screen and restore background virtual void hide(); - ///erase current screen without restore of background, it's similar to paintBackgroundBoxRel() from CFrameBuffer - virtual void kill(); + + ///erase or paint over rendered objects without restore of background, it's similar to paintBackgroundBoxRel() known + ///from CFrameBuffer but with possiblity to define color, default color is 0 (empty background) + virtual void kill(const fb_pixel_t& bg_color = 0); + ///returns paint mode, true=item was painted virtual bool isPainted(){return is_painted;} ///allows paint of elementary item parts (shadow, frame and body), similar as background, set it usually to false, if item used in a form @@ -262,6 +265,11 @@ class CComponentsItem : public CComponents ///hides item, arg: no_restore see hideCCItem() above virtual void hide(bool no_restore = false); + ///erase or paint over rendered objects without restore of background, it's similar to paintBackgroundBoxRel() known + ///from CFrameBuffer but with possiblity to define color, default color is 0 (empty background) + ///NOTE: Items with parent binding use the parent background color as default! Set parameter 'ignore_parent=true' to ignore parent background color! + virtual void kill(const fb_pixel_t& bg_color = 0, bool ignore_parent = false); + ///get the current item type, see attribute cc_item_type above virtual int getItemType(); ///syncronizes item colors with current color settings if required, NOTE: overwrites internal values! diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index a35b2e33c..5819ad774 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -133,6 +133,22 @@ void CComponentsItem::hide(bool no_restore) hideCCItem(no_restore); } +//erase or paint over rendered objects +void CComponentsItem::kill(const fb_pixel_t& bg_color, bool ignore_parent) +{ + if(bg_color || cc_parent == NULL){ + CComponents::kill(bg_color); + return; + } + + if (cc_parent){ + if(bg_color || ignore_parent) + CComponents::kill(bg_color); + else + CComponents::kill(cc_parent->getColorBody()); + } +} + //synchronize colors for forms //This is usefull if the system colors are changed during runtime //so you can ensure correct applied system colors in relevant objects with unchanged instances.