mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
CComponentsItemBox: Add flag 'isCalculated' for control calculateElements()
This commit is contained in:
@@ -342,6 +342,7 @@ class CComponentsItemBox : public CComponentsContainer
|
|||||||
size_t prevElementLeft;
|
size_t prevElementLeft;
|
||||||
size_t prevElementRight;
|
size_t prevElementRight;
|
||||||
std::vector<comp_element_data_t> v_element_data;
|
std::vector<comp_element_data_t> v_element_data;
|
||||||
|
bool isCalculated;
|
||||||
|
|
||||||
void clearElements();
|
void clearElements();
|
||||||
void initVarItemBox();
|
void initVarItemBox();
|
||||||
@@ -367,6 +368,7 @@ class CComponentsItemBox : public CComponentsContainer
|
|||||||
virtual void addIcon(const std::string& s_icon_name, const int align=CC_ALIGN_LEFT, size_t *index=NULL);
|
virtual void addIcon(const std::string& s_icon_name, const int align=CC_ALIGN_LEFT, size_t *index=NULL);
|
||||||
virtual void addPicture(const std::string& s_picture_path, const int align=CC_ALIGN_LEFT, size_t *index=NULL);
|
virtual void addPicture(const std::string& s_picture_path, const int align=CC_ALIGN_LEFT, size_t *index=NULL);
|
||||||
virtual void addClock(const int align=CC_ALIGN_RIGHT, size_t *index=NULL);
|
virtual void addClock(const int align=CC_ALIGN_RIGHT, size_t *index=NULL);
|
||||||
|
virtual int getHeight();
|
||||||
};
|
};
|
||||||
|
|
||||||
class CComponentsTitleBar : public CComponentsItemBox
|
class CComponentsTitleBar : public CComponentsItemBox
|
||||||
|
@@ -852,9 +852,17 @@ void CComponentsItemBox::initVarItemBox()
|
|||||||
prevElementLeft = 0;
|
prevElementLeft = 0;
|
||||||
prevElementRight = 0;
|
prevElementRight = 0;
|
||||||
onlyOneTextElement = false;
|
onlyOneTextElement = false;
|
||||||
|
isCalculated = false;
|
||||||
v_element_data.clear();
|
v_element_data.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CComponentsItemBox::getHeight()
|
||||||
|
{
|
||||||
|
if (!isCalculated)
|
||||||
|
calculateElements();
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
void CComponentsItemBox::clearElements()
|
void CComponentsItemBox::clearElements()
|
||||||
{
|
{
|
||||||
for(size_t i = 0; i < v_element_data.size(); i++) {
|
for(size_t i = 0; i < v_element_data.size(); i++) {
|
||||||
@@ -874,6 +882,7 @@ void CComponentsItemBox::clearElements()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
isCalculated = false;
|
||||||
v_element_data.clear();
|
v_element_data.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -911,6 +920,7 @@ bool CComponentsItemBox::addLogoOrText(int align, const std::string& logo, const
|
|||||||
v_element_data.push_back(data);
|
v_element_data.push_back(data);
|
||||||
if (index != NULL)
|
if (index != NULL)
|
||||||
*index = v_element_data.size()-1;
|
*index = v_element_data.size()-1;
|
||||||
|
isCalculated = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -974,6 +984,7 @@ bool CComponentsItemBox::addElement(int align, int type, const std::string& elem
|
|||||||
v_element_data.push_back(data);
|
v_element_data.push_back(data);
|
||||||
if (index != NULL)
|
if (index != NULL)
|
||||||
*index = v_element_data.size()-1;
|
*index = v_element_data.size()-1;
|
||||||
|
isCalculated = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1199,6 +1210,7 @@ void CComponentsItemBox::calculateElements()
|
|||||||
}
|
}
|
||||||
|
|
||||||
calPositionOfElements();
|
calPositionOfElements();
|
||||||
|
isCalculated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CComponentsItemBox::paintItemBox(bool do_save_bg)
|
void CComponentsItemBox::paintItemBox(bool do_save_bg)
|
||||||
|
Reference in New Issue
Block a user