summaryrefslogtreecommitdiff
path: root/NxWidgets/libnxwidgets/src/clabel.cxx
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-12-21 20:09:32 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-12-21 20:09:32 +0000
commit1b917134adffafb33057be34683b5f73807aeca8 (patch)
treea548cfe35af25a0d7b7b3a8a304784c334aecdb6 /NxWidgets/libnxwidgets/src/clabel.cxx
parent2e885817755dbb96fa4183a312ea181b28bb70b1 (diff)
downloadpx4-nuttx-1b917134adffafb33057be34683b5f73807aeca8.tar.gz
px4-nuttx-1b917134adffafb33057be34683b5f73807aeca8.tar.bz2
px4-nuttx-1b917134adffafb33057be34683b5f73807aeca8.zip
Patches from Petteri Aimonen (plus a few other things)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5448 42af7a65-404d-4744-a932-0658087f49c3
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);
}
/**