CComponentsItem: move function isAdded() to CComponentsItem class

Origin commit data
------------------
Branch: ni/coolstream
Commit: 3438b23f68
Author: Thilo Graf <dbt@novatux.de>
Date: 2013-10-19 (Sat, 19 Oct 2013)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
2013-10-19 01:13:26 +02:00
parent 1f917c4661
commit 8288a4eb9a
7 changed files with 19 additions and 18 deletions

View File

@@ -244,6 +244,8 @@ class CComponentsItem : public CComponents
virtual void setParent(CComponentsItem *parent){cc_parent = parent;}; virtual void setParent(CComponentsItem *parent){cc_parent = parent;};
///returns pointer to the form object in which this item is embedded. ///returns pointer to the form object in which this item is embedded.
virtual CComponentsItem * getParent(){return cc_parent;}; virtual CComponentsItem * getParent(){return cc_parent;};
///property: returns true if item is added to a form
virtual bool isAdded(CComponentsItem *parent_frm = NULL);
///abstract: paint item, arg: do_save_bg see paintInit() above ///abstract: paint item, arg: do_save_bg see paintInit() above
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES) = 0; virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES) = 0;

View File

@@ -165,14 +165,6 @@ int CComponentsForm::getCCItemId(CComponentsItem* cc_Item)
return -1; return -1;
} }
bool CComponentsForm::isAdded(CComponentsItem* cc_item)
{
bool ret = false;
if (getCCItemId(cc_item) != -1)
ret = true;
return ret;
}
int CComponentsForm::genIndex() int CComponentsForm::genIndex()
{ {
int count = v_cc_items.size(); int count = v_cc_items.size();

View File

@@ -69,8 +69,6 @@ class CComponentsForm : public CComponentsItem
virtual void clearCCItems(); virtual void clearCCItems();
virtual void cleanCCForm(); virtual void cleanCCForm();
virtual void setAppendOffset(const int &h_offset, const int& v_offset){append_h_offset = h_offset; append_v_offset = v_offset;}; virtual void setAppendOffset(const int &h_offset, const int& v_offset){append_h_offset = h_offset; append_v_offset = v_offset;};
///property: returns true, if item already added to form
virtual bool isAdded(CComponentsItem *cc_item);
}; };
class CComponentsIconForm : public CComponentsForm class CComponentsIconForm : public CComponentsForm

View File

@@ -133,7 +133,7 @@ void CSignalBar::initSBarScale()
sb_scale->setColorBody(col_body); sb_scale->setColorBody(col_body);
//add scale object to container //add scale object to container
if(!isAdded(sb_scale)) if(!sb_scale->isAdded())
addCCItem(sb_scale); addCCItem(sb_scale);
} }
@@ -158,7 +158,7 @@ void CSignalBar::initSBarValue()
sb_vlbl->setColorBody(col_body); sb_vlbl->setColorBody(col_body);
//add value label object to container //add value label object to container
if (!isAdded(sb_vlbl)) if (!sb_vlbl->isAdded())
addCCItem(sb_vlbl); addCCItem(sb_vlbl);
} }
@@ -184,7 +184,7 @@ void CSignalBar::initSBarName()
sb_lbl->setColorBody(col_body); sb_lbl->setColorBody(col_body);
//add name label object to container //add name label object to container
if (!isAdded(sb_lbl)) if (!sb_lbl->isAdded())
addCCItem(sb_lbl); addCCItem(sb_lbl);
} }

View File

@@ -206,12 +206,12 @@ void CSampleClass::showSNR()
signalbox = new CSignalBox(10, 100, 500, 38, frontend); signalbox = new CSignalBox(10, 100, 500, 38, frontend);
// signalbox->setCornerRadius(0); //optional // signalbox->setCornerRadius(0); //optional
// signalbox->setColorBody(COL_BLACK); //optional // signalbox->setColorBody(COL_BLACK); //optional
signalbox->setColorBody(COL_MENUHEAD_PLUS_0); signalbox->setColorBody(COL_MENUHEAD_PLUS_0);q
signalbox->doPaintBg(false); signalbox->doPaintBg(false);
//if you want to add the object to a CC-Container (e.g. CComponentsWindow()), remove this line: //if you want to add the object to a CC-Container (e.g. CComponentsWindow()), remove this line:
signalbox->paint(false); signalbox->paint(false);
//and add this lines: //and add this lines:
// if (!isAdded(signalbox)) // if (!ignalbox->isAdded())
// addCCItem(signalbox); // addCCItem(signalbox);
//Note: signal box objects deallocate together with the CC-Container! //Note: signal box objects deallocate together with the CC-Container!
} }

View File

@@ -232,12 +232,12 @@ void CComponentsWindow::initCCWItems()
initBody(); initBody();
//add header, body and footer items only one time //add header, body and footer items only one time
if (!isAdded(ccw_head)) if (!ccw_head->isAdded())
addCCItem(ccw_head); addCCItem(ccw_head);
if (!isAdded(ccw_body)) if (!ccw_body->isAdded())
addCCItem(ccw_body); addCCItem(ccw_body);
if (ccw_footer) if (ccw_footer)
if (!isAdded(ccw_footer)) if (!ccw_footer->isAdded())
addCCItem(ccw_footer); addCCItem(ccw_footer);
} }

View File

@@ -151,3 +151,12 @@ int CComponentsItem::getItemType()
#endif #endif
return -1; return -1;
} }
//returns true if current item is added to a form
bool CComponentsItem::isAdded(CComponentsItem *parent_frm)
{
if (cc_parent)
return true;
return false;
}