mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 08:21:07 +02:00
CComponentsForm: add new member genIndex()
Origin commit data
------------------
Branch: ni/coolstream
Commit: a8721fa72a
Author: Thilo Graf <dbt@novatux.de>
Date: 2013-06-23 (Sun, 23 Jun 2013)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -267,7 +267,8 @@ class CComponentsItem : public CComponents
|
|||||||
|
|
||||||
///get current index of item, see also attribut cc_item_index
|
///get current index of item, see also attribut cc_item_index
|
||||||
virtual int getIndex(){return cc_item_index;};
|
virtual int getIndex(){return cc_item_index;};
|
||||||
///set index to item, see also attribut cc_item_index
|
///set an index to item, see also attribut cc_item_index.
|
||||||
|
///To generate an index, use genIndex()
|
||||||
virtual void setIndex(const int& index){cc_item_index = index;};
|
virtual void setIndex(const int& index){cc_item_index = index;};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -143,11 +143,7 @@ void CComponentsForm::addCCItem(CComponentsItem* cc_Item)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//assign item index
|
//assign item index
|
||||||
int count = v_cc_items.size();
|
int new_index = genIndex();
|
||||||
char buf[64];
|
|
||||||
snprintf(buf, sizeof(buf), "%d%d", cc_item_index, count);
|
|
||||||
buf[63] = '\0';
|
|
||||||
int new_index = atoi(buf);
|
|
||||||
cc_Item->setIndex(new_index);
|
cc_Item->setIndex(new_index);
|
||||||
#ifdef DEBUG_CC
|
#ifdef DEBUG_CC
|
||||||
printf(" %s-%d parent index = %d, assigned index ======> %d\n", __FUNCTION__, __LINE__, cc_item_index, new_index);
|
printf(" %s-%d parent index = %d, assigned index ======> %d\n", __FUNCTION__, __LINE__, cc_item_index, new_index);
|
||||||
@@ -177,6 +173,15 @@ bool CComponentsForm::isAdded(CComponentsItem* cc_item)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CComponentsForm::genIndex()
|
||||||
|
{
|
||||||
|
int count = v_cc_items.size();
|
||||||
|
char buf[64];
|
||||||
|
snprintf(buf, sizeof(buf), "%d%d", cc_item_index, count);
|
||||||
|
buf[63] = '\0';
|
||||||
|
int ret = atoi(buf);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
CComponentsItem* CComponentsForm::getCCItem(const uint& cc_item_id)
|
CComponentsItem* CComponentsForm::getCCItem(const uint& cc_item_id)
|
||||||
{
|
{
|
||||||
|
@@ -41,6 +41,8 @@ class CComponentsForm : public CComponentsItem
|
|||||||
std::vector<CComponentsItem*> v_cc_items;
|
std::vector<CComponentsItem*> v_cc_items;
|
||||||
void initVarForm();
|
void initVarForm();
|
||||||
void paintForm(bool do_save_bg);
|
void paintForm(bool do_save_bg);
|
||||||
|
///generates next possible index for an item, see also cc_item_index, getIndex(), setIndex()
|
||||||
|
int genIndex();
|
||||||
|
|
||||||
int append_h_offset;
|
int append_h_offset;
|
||||||
int append_v_offset;
|
int append_v_offset;
|
||||||
|
Reference in New Issue
Block a user