diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index dee9a91d3..683cc6fdd 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -244,6 +244,8 @@ class CComponentsItem : public CComponents virtual void setParent(CComponentsItem *parent){cc_parent = parent;}; ///returns pointer to the form object in which this item is embedded. 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 virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES) = 0; diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index bb652a41e..1d2420a56 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -165,14 +165,6 @@ int CComponentsForm::getCCItemId(CComponentsItem* cc_Item) return -1; } -bool CComponentsForm::isAdded(CComponentsItem* cc_item) -{ - bool ret = false; - if (getCCItemId(cc_item) != -1) - ret = true; - return ret; -} - int CComponentsForm::genIndex() { int count = v_cc_items.size(); diff --git a/src/gui/components/cc_frm.h b/src/gui/components/cc_frm.h index ec8149156..181b4ec78 100644 --- a/src/gui/components/cc_frm.h +++ b/src/gui/components/cc_frm.h @@ -69,8 +69,6 @@ class CComponentsForm : public CComponentsItem virtual void clearCCItems(); virtual void cleanCCForm(); 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 diff --git a/src/gui/components/cc_frm_signalbars.cpp b/src/gui/components/cc_frm_signalbars.cpp index 195507478..ea7949519 100644 --- a/src/gui/components/cc_frm_signalbars.cpp +++ b/src/gui/components/cc_frm_signalbars.cpp @@ -133,7 +133,7 @@ void CSignalBar::initSBarScale() sb_scale->setColorBody(col_body); //add scale object to container - if(!isAdded(sb_scale)) + if(!sb_scale->isAdded()) addCCItem(sb_scale); } @@ -158,7 +158,7 @@ void CSignalBar::initSBarValue() sb_vlbl->setColorBody(col_body); //add value label object to container - if (!isAdded(sb_vlbl)) + if (!sb_vlbl->isAdded()) addCCItem(sb_vlbl); } @@ -184,7 +184,7 @@ void CSignalBar::initSBarName() sb_lbl->setColorBody(col_body); //add name label object to container - if (!isAdded(sb_lbl)) + if (!sb_lbl->isAdded()) addCCItem(sb_lbl); } diff --git a/src/gui/components/cc_frm_signalbars.h b/src/gui/components/cc_frm_signalbars.h index d275af396..0e8268b6c 100644 --- a/src/gui/components/cc_frm_signalbars.h +++ b/src/gui/components/cc_frm_signalbars.h @@ -206,12 +206,12 @@ void CSampleClass::showSNR() signalbox = new CSignalBox(10, 100, 500, 38, frontend); // signalbox->setCornerRadius(0); //optional // signalbox->setColorBody(COL_BLACK); //optional - signalbox->setColorBody(COL_MENUHEAD_PLUS_0); + signalbox->setColorBody(COL_MENUHEAD_PLUS_0);q signalbox->doPaintBg(false); //if you want to add the object to a CC-Container (e.g. CComponentsWindow()), remove this line: signalbox->paint(false); //and add this lines: -// if (!isAdded(signalbox)) +// if (!ignalbox->isAdded()) // addCCItem(signalbox); //Note: signal box objects deallocate together with the CC-Container! } diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index f26aadd25..69997d755 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -232,12 +232,12 @@ void CComponentsWindow::initCCWItems() initBody(); //add header, body and footer items only one time - if (!isAdded(ccw_head)) + if (!ccw_head->isAdded()) addCCItem(ccw_head); - if (!isAdded(ccw_body)) + if (!ccw_body->isAdded()) addCCItem(ccw_body); if (ccw_footer) - if (!isAdded(ccw_footer)) + if (!ccw_footer->isAdded()) addCCItem(ccw_footer); } diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index 7f9362bb1..7406544b6 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -151,3 +151,12 @@ int CComponentsItem::getItemType() #endif 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; +}