summaryrefslogtreecommitdiff
path: root/NxWidgets/libnxwidgets/src/clabel.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'NxWidgets/libnxwidgets/src/clabel.cxx')
-rw-r--r--NxWidgets/libnxwidgets/src/clabel.cxx23
1 files changed, 21 insertions, 2 deletions
diff --git a/NxWidgets/libnxwidgets/src/clabel.cxx b/NxWidgets/libnxwidgets/src/clabel.cxx
index 4c7ea3554..be4fe902d 100644
--- a/NxWidgets/libnxwidgets/src/clabel.cxx
+++ b/NxWidgets/libnxwidgets/src/clabel.cxx
@@ -303,8 +303,10 @@ void CLabel::drawContents(CGraphicsPort *port)
// Draw the background (excluding the border)
+#ifdef CONFIG_NXWIDGETS_FLICKERFREE
port->drawFilledRect(rect.getX(), rect.getY(),
rect.getWidth(), rect.getHeight(), backColor);
+#endif
// Get the X/Y position of the text within the Label
@@ -312,10 +314,27 @@ void CLabel::drawContents(CGraphicsPort *port)
pos.x = rect.getX() + m_align.x;
pos.y = rect.getY() + m_align.y;
- // Add the text using the selected color
+#ifdef CONFIG_NXWIDGETS_FLICKERFREE
+ CNxFont* font = getFont();
+ int height = font->getHeight();
+ int width = font->getStringWidth(m_text);
+
+ // Draw the background (excluding the border and the text area)
+
+ port->drawFilledRect(rect.getX(), rect.getY(),
+ pos.x - rect.getX(), rect.getHeight(), backColor); // Left
+ port->drawFilledRect(pos.x + width, rect.getY(),
+ rect.getX2() - (pos.x + width) + 1, rect.getHeight(), backColor); // Right
+ port->drawFilledRect(pos.x, rect.getY(),
+ width, pos.y - rect.getY(), backColor); // Top
+ port->drawFilledRect(pos.x, pos.y + height,
+ width, rect.getY2() - (pos.y + height) + 1, backColor); // Bottom
+#endif
+
+ // Add the text using the selected color and background color
port->drawText(&pos, &rect, getFont(), m_text, 0, m_text.getLength(),
- textColor);
+ textColor, backColor);
}
/**