mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 00:41:17 +02:00
CComponentsItemBox: move paint of icons and pictures into it's own member
This commit is contained in:
@@ -341,6 +341,7 @@ class CComponentsItemBox : public CComponentsContainer
|
|||||||
void paintItemBox(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
void paintItemBox(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
||||||
void calculateElements();
|
void calculateElements();
|
||||||
bool addElement(int align, int type, const std::string& element="", size_t *index=NULL);
|
bool addElement(int align, int type, const std::string& element="", size_t *index=NULL);
|
||||||
|
void paintImage(size_t index, bool newElement);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CComponentsItemBox();
|
CComponentsItemBox();
|
||||||
|
@@ -980,33 +980,44 @@ void CComponentsItemBox::refreshElement(size_t index, const std::string& element
|
|||||||
calculateElements();
|
calculateElements();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CComponentsItemBox::paintElement(size_t index, bool newElement)
|
//paint image into item box
|
||||||
|
void CComponentsItemBox::paintImage(size_t index, bool newElement)
|
||||||
{
|
{
|
||||||
CComponentsPicture* pic = NULL;
|
CComponentsPicture* pic = NULL;
|
||||||
|
pic = static_cast<CComponentsPicture*>(v_element_data[index].handler1);
|
||||||
|
|
||||||
|
int pw = 0, ph = 0;
|
||||||
|
|
||||||
|
if ((newElement) || (pic == NULL)) {
|
||||||
|
if (pic != NULL) {
|
||||||
|
pic->hide();
|
||||||
|
delete pic;
|
||||||
|
pic = NULL;
|
||||||
|
}
|
||||||
|
if ((v_element_data[index].type) == CC_ITEMBOX_PICTURE)
|
||||||
|
pic = new CComponentsPicture( v_element_data[index].x, v_element_data[index].y, v_element_data[index].width,
|
||||||
|
v_element_data[index].height, v_element_data[index].element);
|
||||||
|
else
|
||||||
|
pic = new CComponentsPicture( v_element_data[index].x, v_element_data[index].y, v_element_data[index].element);
|
||||||
|
v_element_data[index].handler1 = (void*)pic;
|
||||||
|
}
|
||||||
|
|
||||||
|
pic->getPictureSize(&pw, &ph);
|
||||||
|
pic->setHeight(ph);
|
||||||
|
pic->setWidth(pw);
|
||||||
|
pic->setColorBody(col_body);
|
||||||
|
pic->paint();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CComponentsItemBox::paintElement(size_t index, bool newElement)
|
||||||
|
{
|
||||||
CBox* box = NULL;
|
CBox* box = NULL;
|
||||||
CTextBox* textbox = NULL;
|
CTextBox* textbox = NULL;
|
||||||
int pw = 0, ph = 0;
|
|
||||||
switch (v_element_data[index].type) {
|
switch (v_element_data[index].type) {
|
||||||
case CC_ITEMBOX_ICON:
|
case CC_ITEMBOX_ICON:
|
||||||
case CC_ITEMBOX_PICTURE:
|
case CC_ITEMBOX_PICTURE:
|
||||||
pic = static_cast<CComponentsPicture*>(v_element_data[index].handler1);
|
paintImage(index,newElement);
|
||||||
if ((newElement) || (pic == NULL)) {
|
|
||||||
if (pic != NULL) {
|
|
||||||
pic->hide();
|
|
||||||
delete pic;
|
|
||||||
}
|
|
||||||
if ((v_element_data[index].type) == CC_ITEMBOX_PICTURE)
|
|
||||||
pic = new CComponentsPicture( v_element_data[index].x, v_element_data[index].y, v_element_data[index].width,
|
|
||||||
v_element_data[index].height, v_element_data[index].element);
|
|
||||||
else
|
|
||||||
pic = new CComponentsPicture( v_element_data[index].x, v_element_data[index].y, v_element_data[index].element);
|
|
||||||
v_element_data[index].handler1 = (void*)pic;
|
|
||||||
}
|
|
||||||
pic->getPictureSize(&pw, &ph);
|
|
||||||
pic->setHeight(ph);
|
|
||||||
pic->setWidth(pw);
|
|
||||||
pic->setColorBody(col_body);
|
|
||||||
pic->paint();
|
|
||||||
break;
|
break;
|
||||||
case CC_ITEMBOX_TEXT:
|
case CC_ITEMBOX_TEXT:
|
||||||
box = static_cast<CBox*>(v_element_data[index].handler1);
|
box = static_cast<CBox*>(v_element_data[index].handler1);
|
||||||
|
Reference in New Issue
Block a user