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

@@ -35,14 +35,6 @@
using namespace std;
//abstract sub class CComponentsItem from CComponents
CComponentsItem::CComponentsItem()
{
//CComponentsItem
initVarItem();
cc_item_type = CC_ITEMTYPE_BASE;
}
// y
// x+------f-r-a-m-e-------+
// | |
@@ -50,13 +42,21 @@ CComponentsItem::CComponentsItem()
// | |
// +--------width---------+
void CComponentsItem::initVarItem()
//abstract sub class CComponentsItem from CComponents
CComponentsItem::CComponentsItem(CComponentsForm* parent)
{
//CComponents
cc_item_type = CC_ITEMTYPE_BASE;
cc_item_index = CC_NO_INDEX;
cc_item_enabled = true;
cc_item_selected = false;
cc_parent = NULL;
initParent(parent);
}
void CComponentsItem::initParent(CComponentsForm* parent)
{
cc_parent = parent;
if (cc_parent)
cc_parent->addCCItem(this);
}
// Paint container background in cc-items with shadow, background and frame.