mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-30 08:51:04 +02:00
CComponentsItemBox: move paint of text into its own method
Origin commit data
------------------
Branch: ni/coolstream
Commit: 2c6a317b40
Author: Thilo Graf <dbt@novatux.de>
Date: 2012-09-09 (Sun, 09 Sep 2012)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -342,6 +342,7 @@ class CComponentsItemBox : public CComponentsContainer
|
|||||||
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);
|
void paintImage(size_t index, bool newElement);
|
||||||
|
void paintText(size_t index, bool newElement);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CComponentsItemBox();
|
CComponentsItemBox();
|
||||||
|
@@ -1009,45 +1009,63 @@ void CComponentsItemBox::paintImage(size_t index, bool newElement)
|
|||||||
pic->paint();
|
pic->paint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//paint text into item box
|
||||||
|
void CComponentsItemBox::paintText(size_t index, bool newElement)
|
||||||
|
{
|
||||||
|
//prepare textbox dimension instances
|
||||||
|
CBox* box = NULL;
|
||||||
|
box = static_cast<CBox*>(v_element_data[index].handler1);
|
||||||
|
|
||||||
|
if ((newElement) || (box == NULL)) {
|
||||||
|
if (box != NULL) {
|
||||||
|
delete box;
|
||||||
|
box = NULL;
|
||||||
|
}
|
||||||
|
box = new CBox();
|
||||||
|
v_element_data[index].handler1 = (void*)box;
|
||||||
|
}
|
||||||
|
|
||||||
|
box->iX = v_element_data[index].x;
|
||||||
|
box->iY = v_element_data[index].y;
|
||||||
|
box->iWidth = v_element_data[index].width;
|
||||||
|
box->iHeight = v_element_data[index].height;
|
||||||
|
|
||||||
|
|
||||||
|
//prepare text
|
||||||
|
CTextBox* textbox = NULL;
|
||||||
|
textbox = static_cast<CTextBox*>(v_element_data[index].handler2);
|
||||||
|
|
||||||
|
if ((newElement) || (textbox == NULL)) {
|
||||||
|
if (textbox != NULL) {
|
||||||
|
textbox->hide();
|
||||||
|
delete textbox;
|
||||||
|
textbox = NULL;
|
||||||
|
}
|
||||||
|
textbox = new CTextBox(v_element_data[index].element.c_str(), font_text, CTextBox::AUTO_WIDTH|CTextBox::AUTO_HIGH, box, col_body);
|
||||||
|
v_element_data[index].handler2 = (void*)textbox;
|
||||||
|
}
|
||||||
|
|
||||||
|
textbox->setTextBorderWidth(0);
|
||||||
|
textbox->enableBackgroundPaint(false);
|
||||||
|
textbox->setTextFont(font_text);
|
||||||
|
textbox->movePosition(box->iX, box->iY);
|
||||||
|
textbox->setTextColor(it_col_text);
|
||||||
|
|
||||||
|
if (textbox->setText(&v_element_data[index].element))
|
||||||
|
textbox->paint();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//paint available elements at one task
|
||||||
void CComponentsItemBox::paintElement(size_t index, bool newElement)
|
void CComponentsItemBox::paintElement(size_t index, bool newElement)
|
||||||
{
|
{
|
||||||
CBox* box = NULL;
|
|
||||||
CTextBox* textbox = NULL;
|
|
||||||
|
|
||||||
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:
|
||||||
paintImage(index,newElement);
|
paintImage(index,newElement);
|
||||||
break;
|
break;
|
||||||
case CC_ITEMBOX_TEXT:
|
case CC_ITEMBOX_TEXT:
|
||||||
box = static_cast<CBox*>(v_element_data[index].handler1);
|
paintText(index,newElement);
|
||||||
if ((newElement) || (box == NULL)) {
|
|
||||||
if (box != NULL) {
|
|
||||||
delete box;
|
|
||||||
}
|
|
||||||
box = new CBox();
|
|
||||||
v_element_data[index].handler1 = (void*)box;
|
|
||||||
}
|
|
||||||
box->iX = v_element_data[index].x;
|
|
||||||
box->iY = v_element_data[index].y;
|
|
||||||
box->iWidth = v_element_data[index].width;
|
|
||||||
box->iHeight = v_element_data[index].height;
|
|
||||||
textbox = static_cast<CTextBox*>(v_element_data[index].handler2);
|
|
||||||
if ((newElement) || (textbox == NULL)) {
|
|
||||||
if (textbox != NULL) {
|
|
||||||
textbox->hide();
|
|
||||||
delete textbox;
|
|
||||||
}
|
|
||||||
textbox = new CTextBox(v_element_data[index].element.c_str(), font_text, CTextBox::AUTO_WIDTH|CTextBox::AUTO_HIGH, box, col_body);
|
|
||||||
v_element_data[index].handler2 = (void*)textbox;
|
|
||||||
}
|
|
||||||
textbox->setTextBorderWidth(0);
|
|
||||||
textbox->enableBackgroundPaint(false);
|
|
||||||
textbox->setTextFont(font_text);
|
|
||||||
textbox->movePosition(box->iX, box->iY);
|
|
||||||
textbox->setTextColor(it_col_text);
|
|
||||||
if (textbox->setText(&v_element_data[index].element))
|
|
||||||
textbox->paint();
|
|
||||||
break;
|
break;
|
||||||
case CC_ITEMBOX_CLOCK:
|
case CC_ITEMBOX_CLOCK:
|
||||||
font_text->RenderString(v_element_data[index].x, v_element_data[index].y, v_element_data[index].width,
|
font_text->RenderString(v_element_data[index].x, v_element_data[index].y, v_element_data[index].width,
|
||||||
|
Reference in New Issue
Block a user