diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 3b61a8023..6e2fc8920 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -202,7 +202,7 @@ void CComponentsForm::clear() } -void CComponentsForm::addCCItem(CComponentsItem* cc_Item) +int CComponentsForm::addCCItem(CComponentsItem* cc_Item) { if (cc_Item){ dprintf(DEBUG_DEBUG, "[CComponentsForm] %s-%d try to add cc_Item [type %d] to form [current index=%d] \n", __func__, __LINE__, cc_Item->getItemType(), cc_item_index); @@ -218,16 +218,18 @@ void CComponentsForm::addCCItem(CComponentsItem* cc_Item) cc_Item->setFocus(true); dprintf(DEBUG_DEBUG, "\t%s-%d parent index = %d, assigned index ======> %d\n", __func__, __LINE__, cc_item_index, new_index); - + return getCCItemId(cc_Item); } else dprintf(DEBUG_NORMAL, "[CComponentsForm] %s-%d tried to add an empty or invalide cc_item !!!\n", __func__, __LINE__); + return -1; } -void CComponentsForm::addCCItem(const std::vector &cc_Items) +int CComponentsForm::addCCItem(const std::vector &cc_Items) { for (size_t i= 0; i< cc_Items.size(); i++) addCCItem(cc_Items[i]); + return size(); } int CComponentsForm::getCCItemId(CComponentsItem* cc_Item) diff --git a/src/gui/components/cc_frm.h b/src/gui/components/cc_frm.h index 52c3d5934..94c488350 100644 --- a/src/gui/components/cc_frm.h +++ b/src/gui/components/cc_frm.h @@ -78,8 +78,10 @@ class CComponentsForm : public CComponentsItem ///NOTE: Items always have parent bindings to "this" and use the parent background color as default! Set parameter 'ignore_parent=true' to ignore parent background color! virtual void killCCItems(const fb_pixel_t& bg_color, bool ignore_parent); - virtual void addCCItem(CComponentsItem* cc_Item); - virtual void addCCItem(const std::vector &cc_items); + ///add an item to form collection, returns id + virtual int addCCItem(CComponentsItem* cc_Item); + ///add items from a vector to form collection, returns size/count of items + virtual int addCCItem(const std::vector &cc_items); virtual void insertCCItem(const uint& cc_item_id, CComponentsItem* cc_Item); ///removes item object from container and deallocates instance