mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
CComponents/CComponentsItem: add advanced version of kill()
kill() allows now paint with defined colors 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 like before (empty background). Items with parent bindings use the background color of its parent as default, but can also be ignored. This function can be useful before repaint of items and/or, if required, to have a clean background inside item containers.
This commit is contained in:
@@ -227,11 +227,15 @@ inline void CComponents::hide()
|
|||||||
is_painted = false;
|
is_painted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//erase rendered objects
|
//erase or paint over rendered objects
|
||||||
void CComponents::kill()
|
void CComponents::kill(const fb_pixel_t& bg_color)
|
||||||
{
|
{
|
||||||
for(size_t i =0; i< v_fbdata.size() ;i++)
|
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);
|
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();
|
clearFbData();
|
||||||
firstPaint = true;
|
firstPaint = true;
|
||||||
is_painted = false;
|
is_painted = false;
|
||||||
|
@@ -201,8 +201,11 @@ class CComponents
|
|||||||
|
|
||||||
///hide current screen and restore background
|
///hide current screen and restore background
|
||||||
virtual void hide();
|
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
|
///returns paint mode, true=item was painted
|
||||||
virtual bool isPainted(){return is_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
|
///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
|
///hides item, arg: no_restore see hideCCItem() above
|
||||||
virtual void hide(bool no_restore = false);
|
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
|
///get the current item type, see attribute cc_item_type above
|
||||||
virtual int getItemType();
|
virtual int getItemType();
|
||||||
///syncronizes item colors with current color settings if required, NOTE: overwrites internal values!
|
///syncronizes item colors with current color settings if required, NOTE: overwrites internal values!
|
||||||
|
@@ -133,6 +133,22 @@ void CComponentsItem::hide(bool no_restore)
|
|||||||
hideCCItem(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
|
//synchronize colors for forms
|
||||||
//This is usefull if the system colors are changed during runtime
|
//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.
|
//so you can ensure correct applied system colors in relevant objects with unchanged instances.
|
||||||
|
Reference in New Issue
Block a user