CComponentsForm: add virtual members to manipulate ccitems

This commit is contained in:
2012-11-19 15:53:17 +01:00
parent b330d78ff2
commit 949867e4ac
2 changed files with 34 additions and 0 deletions

View File

@@ -442,6 +442,10 @@ class CComponentsForm : public CComponentsItem
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
void hide(bool no_restore = false); void hide(bool no_restore = false);
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 removeCCItem(const uint& cc_item_id);
virtual int getCCItemId(CComponentsItem* cc_Item);
virtual CComponentsItem* getCCItem(const uint& cc_item_id);
virtual void paintCCItems(); virtual void paintCCItems();
}; };

View File

@@ -1570,6 +1570,36 @@ void CComponentsForm::addCCItem(CComponentsItem* cc_Item)
v_cc_items.push_back(cc_Item); v_cc_items.push_back(cc_Item);
} }
void CComponentsForm::insertCCItem(const uint& cc_item_id, CComponentsItem* cc_Item)
{
v_cc_items.insert(v_cc_items.begin()+cc_item_id, cc_Item);
}
int CComponentsForm::getCCItemId(CComponentsItem* cc_Item)
{
for (size_t i= 0; i< v_cc_items.size(); i++)
if (v_cc_items[i] == cc_Item)
return i;
return -1;
}
CComponentsItem* CComponentsForm::getCCItem(const uint& cc_item_id)
{
if (v_cc_items[cc_item_id])
return v_cc_items[cc_item_id];
return NULL;
}
void CComponentsForm::removeCCItem(const uint& cc_item_id)
{
if (v_cc_items[cc_item_id]) {
delete v_cc_items[cc_item_id];
v_cc_items[cc_item_id] = NULL;
v_cc_items.erase(v_cc_items.begin()+cc_item_id);
}
}
void CComponentsForm::paint(bool do_save_bg) void CComponentsForm::paint(bool do_save_bg)
{ {
//paint body //paint body