mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
- CComponentsText: add possibility to set a text border
This commit is contained in:
@@ -93,6 +93,7 @@ void CComponentsText::initVarText()
|
|||||||
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;
|
||||||
|
ct_text_border = 1;
|
||||||
ct_col_text = COL_MENUCONTENT;
|
ct_col_text = COL_MENUCONTENT;
|
||||||
ct_text_sent = false;
|
ct_text_sent = false;
|
||||||
ct_paint_textbg = false;
|
ct_paint_textbg = false;
|
||||||
@@ -129,7 +130,7 @@ void CComponentsText::initCCText()
|
|||||||
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(ct_box);
|
||||||
ct_textbox->setTextBorderWidth(0);
|
ct_textbox->setTextBorderWidth(ct_text_border);
|
||||||
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);
|
||||||
|
@@ -52,6 +52,8 @@ class CComponentsText : public CComponentsItem
|
|||||||
fb_pixel_t ct_col_text;
|
fb_pixel_t ct_col_text;
|
||||||
///property: text display modes, see textbox.h for possible modes
|
///property: text display modes, see textbox.h for possible modes
|
||||||
int ct_text_mode;
|
int ct_text_mode;
|
||||||
|
///property: text border width
|
||||||
|
int ct_text_border;
|
||||||
///property: current text string
|
///property: current text string
|
||||||
std::string ct_text;
|
std::string ct_text;
|
||||||
///status: cached text string, mainly required to compare with current text
|
///status: cached text string, mainly required to compare with current text
|
||||||
@@ -98,6 +100,8 @@ class CComponentsText : public CComponentsItem
|
|||||||
virtual inline void setTextColor(fb_pixel_t color_text){ ct_col_text = color_text;};
|
virtual inline void setTextColor(fb_pixel_t color_text){ ct_col_text = color_text;};
|
||||||
///set text alignment, also see textbox.h for possible alignment modes
|
///set text alignment, also see textbox.h for possible alignment modes
|
||||||
virtual inline void setTextMode(const int mode){ct_text_mode = mode;};
|
virtual inline void setTextMode(const int mode){ct_text_mode = mode;};
|
||||||
|
///set text border width
|
||||||
|
virtual inline void setTextBorderWidth(const int border){ct_text_border = border;};
|
||||||
|
|
||||||
///send option to CTextBox object to paint background box behind text or not
|
///send option to CTextBox object to paint background box behind text or not
|
||||||
virtual inline void doPaintTextBoxBg(bool do_paintbox_bg){ ct_paint_textbg = do_paintbox_bg;};
|
virtual inline void doPaintTextBoxBg(bool do_paintbox_bg){ ct_paint_textbg = do_paintbox_bg;};
|
||||||
|
@@ -353,8 +353,8 @@ void CTextBox::refreshTextLineArray(void)
|
|||||||
lineBreakWidth = std::max(m_nMaxWidth, m_cFrameTextRel.iWidth - 2*text_border_width);
|
lineBreakWidth = std::max(m_nMaxWidth, m_cFrameTextRel.iWidth - 2*text_border_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_nMaxTextWidth)
|
if(m_nMaxTextWidth)
|
||||||
lineBreakWidth = m_nMaxTextWidth;
|
lineBreakWidth = m_nMaxTextWidth - 2*text_border_width;
|
||||||
|
|
||||||
//TRACE("[CTextBox] line %d: lineBreakWidth %d\n", __LINE__, lineBreakWidth);
|
//TRACE("[CTextBox] line %d: lineBreakWidth %d\n", __LINE__, lineBreakWidth);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user