CComponents: add new parameter 'parent'

Use strictly CComponentsForm as parent parameter in constructors.
Some parts have been cleaned up (Constructors, init methodes removed)

New parameter makes it possible already add current item in constructor.
So in mostly situations is it not necessary to use explicit addCCItem(),
but addCCItem()is still valid and necessary in certain situations.

Affected are all cc-classes and their derivates.
Some classes must or can be adapted later. The function is
not currently restricted, because usage of parent parameter is not explicit
defined in constructors, see CImageInfo, here yet are used addCCItem()
methodes.

Generally this parameter is located in the constructors before bool has_shadow,
but it is not sure whether it would be better to use this parameter as the first.
That remains to be clarified.
This commit is contained in:
2014-03-03 09:43:39 +01:00
parent 4a76ca953e
commit 23d7b62cf0
42 changed files with 382 additions and 346 deletions

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
Copyright (C) 2012-2014, Thilo Graf 'dbt'
Copyright (C) 2012, Michael Liebmann 'micha-bbg'
License: GPL
@@ -35,7 +35,10 @@
using namespace std;
//sub class CComponentsShapeSquare from CComponentsItem
CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
CComponentsShapeSquare::CComponentsShapeSquare( const int x_pos, const int y_pos, const int w, const int h,
CComponentsForm *parent,
bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{
//CComponentsItem
cc_item_type = CC_ITEMTYPE_SHAPE_SQUARE;
@@ -49,6 +52,7 @@ CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos,
col_frame = color_frame;
col_body = color_body;
col_shadow = color_shadow;
initParent(parent);
}
void CComponentsShapeSquare::paint(bool do_save_bg)
@@ -59,8 +63,10 @@ void CComponentsShapeSquare::paint(bool do_save_bg)
//-------------------------------------------------------------------------------------------------------
//sub class CComponentsShapeCircle from CComponentsItem
CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam,
CComponentsForm *parent,
bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{
//CComponents, CComponentsItem
cc_item_type = CC_ITEMTYPE_SHAPE_CIRCLE;
@@ -80,6 +86,7 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam,
//CComponentsItem
corner_rad = d/2;
initParent(parent);
}
// y