CComponentsForm: add virtual members to replace cc-item

Origin commit data
------------------
Branch: ni/coolstream
Commit: b9dd3e21bf
Author: Thilo Graf <dbt@novatux.de>
Date: 2012-11-26 (Mon, 26 Nov 2012)


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

------------------
This commit was generated by Migit
This commit is contained in:
2012-11-26 10:15:24 +01:00
parent 6cbe6f8d0f
commit 5b3ea563b0
2 changed files with 23 additions and 0 deletions

View File

@@ -444,6 +444,8 @@ class CComponentsForm : public CComponentsItem
virtual void addCCItem(CComponentsItem* cc_Item); virtual void addCCItem(CComponentsItem* cc_Item);
virtual void insertCCItem(const uint& cc_item_id, CComponentsItem* cc_Item); virtual void insertCCItem(const uint& cc_item_id, CComponentsItem* cc_Item);
virtual void removeCCItem(const uint& cc_item_id); virtual void removeCCItem(const uint& cc_item_id);
virtual void replaceCCItem(const uint& cc_item_id, CComponentsItem* new_cc_Item);
virtual void replaceCCItem(CComponentsItem* old_cc_Item, CComponentsItem* new_cc_Item);
virtual int getCCItemId(CComponentsItem* cc_Item); virtual int getCCItemId(CComponentsItem* cc_Item);
virtual CComponentsItem* getCCItem(const uint& cc_item_id); virtual CComponentsItem* getCCItem(const uint& cc_item_id);
virtual void paintCCItems(); virtual void paintCCItems();

View File

@@ -1585,6 +1585,27 @@ CComponentsItem* CComponentsForm::getCCItem(const uint& cc_item_id)
return NULL; return NULL;
} }
void CComponentsForm::replaceCCItem(const uint& cc_item_id, CComponentsItem* new_cc_Item)
{
if (!v_cc_items.empty()){
if (v_cc_items[cc_item_id]){
delete v_cc_items[cc_item_id];
v_cc_items[cc_item_id] = NULL;
v_cc_items[cc_item_id] = new_cc_Item;
}
}
#ifdef DEBUG_CC
else
printf("CComponentsForm: %s replace cc_Item not possible, v_cc_items is empty\n", __FUNCTION__);
#endif
}
void CComponentsForm::replaceCCItem(CComponentsItem* old_cc_Item, CComponentsItem* new_cc_Item)
{
replaceCCItem(getCCItemId(old_cc_Item), new_cc_Item);
}
void CComponentsForm::insertCCItem(const uint& cc_item_id, CComponentsItem* cc_Item) void CComponentsForm::insertCCItem(const uint& cc_item_id, CComponentsItem* cc_Item)
{ {