mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
CTextBox: add new parameter to setText() force_repaint
Paint routine of text has changed, so it can be useful to affect the old behavior of text repaint beacause of text is painted only if text or some other properties have changed. Default value of force_repaint is true, so we have the same behavior like before changes.
This commit is contained in:
@@ -178,6 +178,7 @@ void CTextBox::initVar(void)
|
||||
|
||||
m_textBackgroundColor = m_old_textBackgroundColor = COL_MENUCONTENT_PLUS_0;
|
||||
m_textColor = COL_MENUCONTENT_TEXT;
|
||||
m_old_textColor = 0;
|
||||
m_nPaintBackground = true;
|
||||
m_nBgRadius = m_old_nBgRadius = 0;
|
||||
m_nBgRadiusType = m_old_nBgRadiusType = CORNER_ALL;
|
||||
@@ -517,6 +518,7 @@ bool CTextBox::hasChanged(int* x, int* y, int* dx, int* dy)
|
||||
|| m_old_dx != *dx
|
||||
|| m_old_dy != *dy
|
||||
|| m_old_textBackgroundColor != m_textBackgroundColor
|
||||
|| m_old_textColor != m_textColor
|
||||
|| m_old_nBgRadius != m_nBgRadius
|
||||
|| m_old_nBgRadiusType != m_nBgRadiusType
|
||||
|| m_old_nMode != m_nMode){
|
||||
@@ -531,6 +533,7 @@ void CTextBox::reInitToCompareVar(int* x, int* y, int* dx, int* dy)
|
||||
m_old_dx = *dx;
|
||||
m_old_dy = *dy;
|
||||
m_old_textBackgroundColor = m_textBackgroundColor;
|
||||
m_old_textColor = m_textColor;
|
||||
m_old_nBgRadius = m_nBgRadius;
|
||||
m_old_nBgRadiusType = m_nBgRadiusType;
|
||||
m_old_nMode = m_nMode;
|
||||
@@ -699,12 +702,14 @@ void CTextBox::refresh(void)
|
||||
}
|
||||
|
||||
|
||||
bool CTextBox::setText(const std::string* newText, int max_width)
|
||||
bool CTextBox::setText(const std::string* newText, int max_width, bool force_repaint)
|
||||
{
|
||||
//TRACE("[CTextBox]->SetText \r\n");
|
||||
bool result = false;
|
||||
m_nMaxTextWidth = max_width;
|
||||
|
||||
//reset text to force repaint the text, managed in hasChanged()
|
||||
if (force_repaint)
|
||||
m_old_cText = "";
|
||||
//printf("setText: _max_width %d max_width %d\n", _max_width, max_width);
|
||||
if (newText != NULL)
|
||||
{
|
||||
|
@@ -124,7 +124,7 @@ class CTextBox
|
||||
|
||||
int m_old_x, m_old_y, m_old_dx, m_old_dy, m_old_nBgRadius, m_old_nBgRadiusType, m_old_nMode;
|
||||
bool m_has_scrolled;
|
||||
fb_pixel_t m_old_textBackgroundColor;
|
||||
fb_pixel_t m_old_textBackgroundColor, m_old_textColor;
|
||||
|
||||
bool m_showTextFrame;
|
||||
|
||||
@@ -183,7 +183,7 @@ class CTextBox
|
||||
void scrollPageDown(const int pages);
|
||||
void scrollPageUp(const int pages);
|
||||
void enableBackgroundPaint(bool mode = true){m_nPaintBackground = mode;};
|
||||
bool setText(const std::string* newText, int max_width = 0);
|
||||
bool setText(const std::string* newText, int max_width = 0, bool force_repaint = true);
|
||||
void setTextColor(fb_pixel_t color_text){ m_textColor = color_text;};
|
||||
void setBackGroundRadius(const int radius, const int type = CORNER_ALL){m_nBgRadius = radius; m_nBgRadiusType = type;};
|
||||
void setTextBorderWidth(int Hborder, int Vborder);
|
||||
|
Reference in New Issue
Block a user