aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@unormal.org>2013-07-02 08:29:38 +0200
committerJoel Bodenmann <joel@unormal.org>2013-07-02 08:29:38 +0200
commitad57ab7967d0e0ee3cfce8746b0c4969cfe970fd (patch)
tree8002d0a8e8a8b3203d1f3161f6950c57ba4039dc /src
parent931c46526521c5fd36856b1fc1990136d5f7f255 (diff)
downloaduGFX-ad57ab7967d0e0ee3cfce8746b0c4969cfe970fd.tar.gz
uGFX-ad57ab7967d0e0ee3cfce8746b0c4969cfe970fd.tar.bz2
uGFX-ad57ab7967d0e0ee3cfce8746b0c4969cfe970fd.zip
wip
Diffstat (limited to 'src')
-rw-r--r--src/gwin/label.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/gwin/label.c b/src/gwin/label.c
index e31a3de6..8c892217 100644
--- a/src/gwin/label.c
+++ b/src/gwin/label.c
@@ -41,8 +41,25 @@ static void _afterClear(GWindowObject *gh) {
return;
}
+static const gwinVMT labelVMT = {
+ "Label", // The class name
+ sizeof(GLabelWidget), // The object size
+ _destroy, // The destroy routine
+ 0, // The redraw routine
+ _afterClear // The after-clear routine
+};
+
GHandle gwinLabelCreate(GLabelWidget *widget, GWindowInit *pInit) {
+ if (!(widget = (GLabelWidget *)_gwindowCreate(&widget->g, pInit, &labelVMT, 0)))
+ return 0;
+
+ widget->g.x = pInit->x;
+ widget->g.y = pInit->y;
+ widget->g.width = pInit->width;
+ widget->g.height = pInit->height;
+ gwinSetVisible((GHandle)widget, pInit->show);
+ return (GHandle)widget;
}
void gwinLabelSetColor(GHandle gh, color_t color) {
@@ -53,14 +70,24 @@ void gwinLabelSetBgColor(GHandle gh, color_t bgColor) {
widget(gh)->g.bgcolor = bgColor;
}
-void gwinLabelSetText(GHandle gh, char* text) {
+void gwinLabelSetFont(GHandle gh, font_t font) {
+ widget(gh)->g.font = font;
+}
+
+void gwinLabelSetText(GHandle gh, const char* text) {
widget(gh)->text = text;
gwinLabelDraw(gh);
}
void gwinLabelDraw(GHandle gh) {
-
+ gdispFillString( widget(gh)->g.x,
+ widget(gh)->g.y,
+ widget(gh)->text,
+ widget(gh)->g.font,
+ widget(gh)->g.color,
+ widget(gh)->g.bgcolor
+ );
}
#endif // GFX_USE_GWIN && GFX_NEED_LABEL