mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-27 23:42:51 +02:00
CComponents: rework kill()
There was some problems with restore, hide, clean and save background of item parts,
seen in detailsline. kill() worked not really clean.
kill() works now as virtual member and uses paintBackgroundBoxRel().
In consequence of which:
-unnecessary members in subclasses removed.
-add some comments
Origin commit data
------------------
Branch: ni/coolstream
Commit: a4c3e08f77
Author: Thilo Graf <dbt@novatux.de>
Date: 2013-05-03 (Fri, 03 May 2013)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -71,29 +71,35 @@ class CComponents
|
||||
inline virtual void getSize(int* w, int* h){*w=width; *h=height;};
|
||||
inline virtual void getDimensions(int* xpos, int* ypos, int* w, int* h){*xpos=x; *ypos=y; *w=width; *h=height;};
|
||||
|
||||
/// set colors: Possible color values are defined in "gui/color.h" and "gui/customcolor.h"
|
||||
///set colors: Possible color values are defined in "gui/color.h" and "gui/customcolor.h"
|
||||
inline virtual void setColorFrame(fb_pixel_t color){col_frame = color;};
|
||||
inline virtual void setColorBody(fb_pixel_t color){col_body = color;};
|
||||
inline virtual void setColorShadow(fb_pixel_t color){col_shadow = color;};
|
||||
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;};
|
||||
/// get colors
|
||||
///get colors
|
||||
inline virtual fb_pixel_t getColorFrame(){return col_frame;};
|
||||
inline virtual fb_pixel_t getColorBody(){return col_body;};
|
||||
inline virtual fb_pixel_t getColorShadow(){return col_shadow;};
|
||||
|
||||
/// set corner types: Possible corner types are defined in CFrameBuffer (see: driver/framebuffer.h).
|
||||
///set corner types: Possible corner types are defined in CFrameBuffer (see: driver/framebuffer.h).
|
||||
inline virtual void setCornerType(const int& type){corner_type = type;};
|
||||
inline virtual void setCornerRadius(const int& radius){corner_rad = radius;};
|
||||
/// get corner types:
|
||||
///get corner types:
|
||||
inline virtual int getCornerType(){return corner_type;};
|
||||
inline virtual int getCornerRadius(){return corner_rad;};
|
||||
|
||||
inline virtual void setFrameThickness(const int& thickness){fr_thickness = thickness;};
|
||||
inline virtual void setShadowOnOff(bool has_shadow){shadow = has_shadow;};
|
||||
|
||||
///hide current screen and restore background
|
||||
virtual void hide();
|
||||
///erase current screen without restore of background, as similar to paintBackgroundBoxRel() from CFrameBuffer
|
||||
virtual void kill();
|
||||
///returns paint mode, true=item was painted
|
||||
virtual bool isPainted(){return is_painted;}
|
||||
///allows paint of elemetary item parts (shadow, frame and body), similar as background, set it usually to false, if item used in a form
|
||||
virtual void doPaintBg(bool do_paint){paint_bg = do_paint;};
|
||||
|
||||
};
|
||||
|
||||
class CComponentsItem : public CComponents
|
||||
@@ -127,7 +133,6 @@ class CComponentsItem : public CComponents
|
||||
|
||||
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES) = 0;
|
||||
virtual void hide(bool no_restore = false);
|
||||
virtual void kill();
|
||||
virtual int getItemType();
|
||||
virtual void syncSysColors();
|
||||
|
||||
@@ -343,7 +348,6 @@ class CComponentsDetailLine : public CComponents
|
||||
~CComponentsDetailLine();
|
||||
|
||||
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
||||
void kill();
|
||||
inline void setColors(fb_pixel_t color_line, fb_pixel_t color_shadow){col_body = color_line; col_shadow = color_shadow;};
|
||||
void syncSysColors();
|
||||
inline void setYPosDown(const int& y_pos_down){y_down = y_pos_down;};
|
||||
|
@@ -140,7 +140,7 @@ void CComponents::paintFbItems(bool do_save_bg)
|
||||
frameBuffer->paintBoxFrame(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].frame_thickness, v_fbdata[i].color, v_fbdata[i].r);
|
||||
else if (fbtype == CC_FBDATA_TYPE_BACKGROUND)
|
||||
frameBuffer->paintBackgroundBoxRel(x, y, v_fbdata[i].dx, v_fbdata[i].dy);
|
||||
else if( allowPaint(i) )
|
||||
else if( allowPaint(i) || fbtype == CC_FBDATA_TYPE_LINE)
|
||||
frameBuffer->paintBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].color, v_fbdata[i].r, corner_type);
|
||||
}
|
||||
}
|
||||
@@ -170,6 +170,16 @@ inline void CComponents::hide()
|
||||
is_painted = false;
|
||||
}
|
||||
|
||||
//erase rendered objects
|
||||
void CComponents::kill()
|
||||
{
|
||||
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);
|
||||
clear();
|
||||
firstPaint = true;
|
||||
is_painted = false;
|
||||
}
|
||||
|
||||
//clean old screen buffer
|
||||
inline void CComponents::clear()
|
||||
{
|
||||
|
@@ -16,7 +16,7 @@
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this program; if not, write to the
|
||||
@@ -113,7 +113,7 @@ void CComponentsDetailLine::paint(bool do_save_bg)
|
||||
{
|
||||
/* vertical item mark | */
|
||||
{CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_top, thickness, h_mark_top, col_body, 0, 0, NULL, NULL},
|
||||
{CC_FBDATA_TYPE_LINE, x+width-sw, y_mark_top+sw, sw, h_mark_top, col_shadow, 0, 0, NULL, NULL},
|
||||
{CC_FBDATA_TYPE_LINE, x+width-sw, y_mark_top+sw, sw, h_mark_top-sw, col_shadow, 0, 0, NULL, NULL},
|
||||
{CC_FBDATA_TYPE_LINE, x+width-thickness, y_mark_top+h_mark_top, thickness, sw, col_shadow, 0, 0, NULL, NULL},
|
||||
|
||||
/* horizontal item line - */
|
||||
@@ -130,7 +130,7 @@ void CComponentsDetailLine::paint(bool do_save_bg)
|
||||
|
||||
/* vertical info mark | */
|
||||
{CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_down, thickness, h_mark_down, col_body, 0, 0, NULL, NULL},
|
||||
{CC_FBDATA_TYPE_LINE, x+width-sw, y_mark_down+sw, sw, h_mark_down, col_shadow, 0, 0, NULL, NULL},
|
||||
{CC_FBDATA_TYPE_LINE, x+width-sw, y_mark_down+sw, sw, h_mark_down-sw, col_shadow, 0, 0, NULL, NULL},
|
||||
{CC_FBDATA_TYPE_LINE, x+width-thickness, y_mark_down+h_mark_down,thickness, sw, col_shadow, 0, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
@@ -140,24 +140,6 @@ void CComponentsDetailLine::paint(bool do_save_bg)
|
||||
paintFbItems(do_save_bg);
|
||||
}
|
||||
|
||||
//remove painted fb items from screen
|
||||
void CComponentsDetailLine::kill()
|
||||
{
|
||||
//save current colors
|
||||
fb_pixel_t c_tmp1, c_tmp2;
|
||||
c_tmp1 = col_body;
|
||||
c_tmp2 = col_shadow;
|
||||
|
||||
//set background color
|
||||
col_body = col_shadow = COL_BACKGROUND;
|
||||
|
||||
//paint with background and restore, set last used colors
|
||||
paint(CC_SAVE_SCREEN_NO);
|
||||
col_body = c_tmp1;
|
||||
col_shadow = c_tmp2;
|
||||
firstPaint = true;
|
||||
}
|
||||
|
||||
//synchronize colors for details line
|
||||
//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.
|
||||
|
@@ -129,28 +129,6 @@ void CComponentsItem::hide(bool no_restore)
|
||||
hideCCItem(no_restore);
|
||||
}
|
||||
|
||||
|
||||
//hide rendered objects
|
||||
void CComponentsItem::kill()
|
||||
{
|
||||
//save current colors
|
||||
fb_pixel_t c_tmp1, c_tmp2, c_tmp3;
|
||||
c_tmp1 = col_body;
|
||||
c_tmp2 = col_shadow;
|
||||
c_tmp3 = col_frame;
|
||||
|
||||
//set background color
|
||||
col_body = col_frame = col_shadow = COL_BACKGROUND;
|
||||
|
||||
//paint with background and restore last used colors
|
||||
paint(CC_SAVE_SCREEN_NO);
|
||||
col_body = c_tmp1;
|
||||
col_shadow = c_tmp2;
|
||||
col_frame = c_tmp3;
|
||||
firstPaint = true;
|
||||
is_painted = false;
|
||||
}
|
||||
|
||||
//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.
|
||||
|
Reference in New Issue
Block a user