mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 07:51:19 +02:00
CComponentsText: try to use an inherited version of CBox class
It's a partial solution to use full functionality for size handling of CTextBox in CComponentsText.
This commit is contained in:
@@ -90,12 +90,16 @@ void CComponentsText::initVarText()
|
|||||||
|
|
||||||
//CComponentsText
|
//CComponentsText
|
||||||
ct_font = NULL;
|
ct_font = NULL;
|
||||||
ct_box = NULL;
|
|
||||||
ct_textbox = NULL;
|
ct_textbox = NULL;
|
||||||
ct_text = "";
|
ct_text = "";
|
||||||
ct_old_text = ct_text;
|
ct_old_text = ct_text;
|
||||||
ct_text_mode = CTextBox::AUTO_WIDTH;
|
ct_text_mode = CTextBox::AUTO_WIDTH;
|
||||||
|
|
||||||
|
pX = &x;
|
||||||
|
pY = &y;
|
||||||
|
pHeight = &height;
|
||||||
|
pWidth = &width;
|
||||||
|
|
||||||
/* we need a minimal borderwith of 1px because the edge-smoothing
|
/* we need a minimal borderwith of 1px because the edge-smoothing
|
||||||
(or fontrenderer?) otherwise will paint single pixels outside the
|
(or fontrenderer?) otherwise will paint single pixels outside the
|
||||||
defined area. e.g. 'j' is leaving such residues */
|
defined area. e.g. 'j' is leaving such residues */
|
||||||
@@ -125,12 +129,10 @@ void CComponentsText::initCCText()
|
|||||||
ty = cc_yr;
|
ty = cc_yr;
|
||||||
}
|
}
|
||||||
//init text box dimensions
|
//init text box dimensions
|
||||||
if (ct_box == NULL)
|
this->iX/*x*/ = tx+fr_thickness;
|
||||||
ct_box = new CBox();
|
this->iY/*y*/ = ty+fr_thickness;
|
||||||
ct_box->iX = tx+fr_thickness;
|
this->iWidth/*width*/ = width-2*fr_thickness;
|
||||||
ct_box->iY = ty+fr_thickness;
|
this->iHeight/*height*/ = height-2*fr_thickness;
|
||||||
ct_box->iWidth = width-2*fr_thickness;
|
|
||||||
ct_box->iHeight = height-2*fr_thickness;
|
|
||||||
|
|
||||||
//init textbox
|
//init textbox
|
||||||
if (ct_textbox == NULL)
|
if (ct_textbox == NULL)
|
||||||
@@ -139,30 +141,26 @@ void CComponentsText::initCCText()
|
|||||||
//set text box properties
|
//set text box properties
|
||||||
ct_textbox->setTextFont(ct_font);
|
ct_textbox->setTextFont(ct_font);
|
||||||
ct_textbox->setTextMode(ct_text_mode);
|
ct_textbox->setTextMode(ct_text_mode);
|
||||||
ct_textbox->setWindowPos(ct_box);
|
ct_textbox->setWindowPos(this);
|
||||||
ct_textbox->setTextBorderWidth(ct_text_Hborder, ct_text_Vborder);
|
ct_textbox->setTextBorderWidth(ct_text_Hborder, ct_text_Vborder);
|
||||||
ct_textbox->enableBackgroundPaint(ct_paint_textbg);
|
ct_textbox->enableBackgroundPaint(ct_paint_textbg);
|
||||||
ct_textbox->setBackGroundColor(col_body);
|
ct_textbox->setBackGroundColor(col_body);
|
||||||
ct_textbox->setBackGroundRadius(corner_rad-fr_thickness, corner_type);
|
ct_textbox->setBackGroundRadius(corner_rad-fr_thickness, corner_type);
|
||||||
ct_textbox->setTextColor(ct_col_text);
|
ct_textbox->setTextColor(ct_col_text);
|
||||||
ct_textbox->setWindowMaxDimensions(ct_box->iWidth, ct_box->iHeight);
|
ct_textbox->setWindowMaxDimensions(width, height);
|
||||||
ct_textbox->setWindowMinDimensions(ct_box->iWidth, ct_box->iHeight);
|
ct_textbox->setWindowMinDimensions(width, height);
|
||||||
|
|
||||||
//send text to CTextBox object, but paint text only if text has changed or force option is enabled
|
//send text to CTextBox object, but paint text only if text has changed or force option is enabled
|
||||||
if ((ct_old_text != ct_text) || ct_force_text_paint)
|
if ((ct_old_text != ct_text) || ct_force_text_paint)
|
||||||
ct_text_sent = ct_textbox->setText(&ct_text, ct_box->iWidth);
|
ct_text_sent = ct_textbox->setText(&ct_text, this->iWidth);
|
||||||
ct_old_text = ct_text;
|
ct_old_text = ct_text;
|
||||||
#ifdef DEBUG_CC
|
#ifdef DEBUG_CC
|
||||||
printf(" [CComponentsText] [%s - %d] init text: %s [x %d, y %d, w %d, h %d]\n", __FUNCTION__, __LINE__, ct_text.c_str(), ct_box->iX, ct_box->iY, ct_box->iWidth, ct_box->iHeight);
|
printf(" [CComponentsText] [%s - %d] init text: %s [x %d, y %d, w %d, h %d]\n", __FUNCTION__, __LINE__, ct_text.c_str(), this->iX, this->iY, this->iWidth, this->iHeight);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CComponentsText::clearCCText()
|
void CComponentsText::clearCCText()
|
||||||
{
|
{
|
||||||
if (ct_box)
|
|
||||||
delete ct_box;
|
|
||||||
ct_box = NULL;
|
|
||||||
|
|
||||||
if (ct_textbox)
|
if (ct_textbox)
|
||||||
delete ct_textbox;
|
delete ct_textbox;
|
||||||
ct_textbox = NULL;
|
ct_textbox = NULL;
|
||||||
|
@@ -38,13 +38,11 @@ Handling of text parts based up CTextBox attributes and methodes.
|
|||||||
CComponentsText provides a interface to the embedded CTextBox object.
|
CComponentsText provides a interface to the embedded CTextBox object.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CComponentsText : public CComponentsItem
|
class CComponentsText : public CComponentsItem, public CBox
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
///object: CTextBox object
|
///object: CTextBox object
|
||||||
CTextBox * ct_textbox;
|
CTextBox * ct_textbox;
|
||||||
///object: CBox object
|
|
||||||
CBox * ct_box;
|
|
||||||
///object: Fontrenderer object
|
///object: Fontrenderer object
|
||||||
Font * ct_font;
|
Font * ct_font;
|
||||||
|
|
||||||
|
@@ -68,7 +68,11 @@
|
|||||||
|
|
||||||
class CBox
|
class CBox
|
||||||
{
|
{
|
||||||
private:
|
protected:
|
||||||
|
int *pX;
|
||||||
|
int *pY;
|
||||||
|
int *pWidth;
|
||||||
|
int *pHeight;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/* Constructor */
|
/* Constructor */
|
||||||
|
Reference in New Issue
Block a user