aboutsummaryrefslogtreecommitdiffstats
path: root/src/gwin/label.c
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2013-10-24 18:36:11 +1000
committerinmarket <andrewh@inmarket.com.au>2013-10-24 18:36:11 +1000
commit7a7e223d152b42553f7e6ce0220dd5d736b89c56 (patch)
tree22968b7c8e779a66a2eba431545b5b292fe722cc /src/gwin/label.c
parenta28dce97d877160b10a3683fbf8ea578c8405417 (diff)
downloaduGFX-7a7e223d152b42553f7e6ce0220dd5d736b89c56.tar.gz
uGFX-7a7e223d152b42553f7e6ce0220dd5d736b89c56.tar.bz2
uGFX-7a7e223d152b42553f7e6ce0220dd5d736b89c56.zip
Add multiple display support to GWIN.
You can now create windows on multiple displays.
Diffstat (limited to 'src/gwin/label.c')
-rw-r--r--src/gwin/label.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/gwin/label.c b/src/gwin/label.c
index 65afff7e..5619761a 100644
--- a/src/gwin/label.c
+++ b/src/gwin/label.c
@@ -48,8 +48,8 @@ static void gwinLabelDefaultDraw(GWidgetObject *gw, void *param) {
coord_t w, h;
(void) param;
- w = (gw->g.flags & GLABEL_FLG_WAUTO) ? getwidth(gw->text, gw->g.font, gdispGetWidth() - gw->g.x) : gw->g.width;
- h = (gw->g.flags & GLABEL_FLG_HAUTO) ? getheight(gw->text, gw->g.font, gdispGetWidth() - gw->g.x) : gw->g.height;
+ w = (gw->g.flags & GLABEL_FLG_WAUTO) ? getwidth(gw->text, gw->g.font, gdispGGetWidth(gw->g.display) - gw->g.x) : gw->g.width;
+ h = (gw->g.flags & GLABEL_FLG_HAUTO) ? getheight(gw->text, gw->g.font, gdispGGetWidth(gw->g.display) - gw->g.x) : gw->g.height;
if (gw->g.width != w || gw->g.height != h) {
gwinResize(&gw->g, w, h);
@@ -58,13 +58,13 @@ static void gwinLabelDefaultDraw(GWidgetObject *gw, void *param) {
}
// render the text
- gdispFillStringBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->text, gw->g.font,
+ gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->text, gw->g.font,
(gw->g.flags & GWIN_FLG_ENABLED) ? gw->pstyle->enabled.text : gw->pstyle->disabled.text, gw->pstyle->background,
justifyLeft);
// render the border (if any)
if (gw->g.flags & GLABEL_FLG_BORDER)
- gdispDrawBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, (gw->g.flags & GWIN_FLG_ENABLED) ? gw->pstyle->enabled.edge : gw->pstyle->disabled.edge);
+ gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, (gw->g.flags & GWIN_FLG_ENABLED) ? gw->pstyle->enabled.edge : gw->pstyle->disabled.edge);
}
static const gwidgetVMT labelVMT = {
@@ -102,23 +102,23 @@ static const gwidgetVMT labelVMT = {
#endif
};
-GHandle gwinLabelCreate(GLabelObject *widget, GWidgetInit *pInit) {
+GHandle gwinGLabelCreate(GDisplay *g, GLabelObject *widget, GWidgetInit *pInit) {
uint16_t flags = 0;
// auto assign width
if (pInit->g.width <= 0) {
flags |= GLABEL_FLG_WAUTO;
- pInit->g.width = getwidth(pInit->text, gwinGetDefaultFont(), gdispGetWidth() - pInit->g.x);
+ pInit->g.width = getwidth(pInit->text, gwinGetDefaultFont(), gdispGGetWidth(g) - pInit->g.x);
}
// auto assign height
if (pInit->g.height <= 0) {
flags |= GLABEL_FLG_HAUTO;
- pInit->g.height = getheight(pInit->text, gwinGetDefaultFont(), gdispGetWidth() - pInit->g.x);
+ pInit->g.height = getheight(pInit->text, gwinGetDefaultFont(), gdispGGetWidth(g) - pInit->g.x);
}
- if (!(widget = (GLabelObject *)_gwidgetCreate(&widget->w, pInit, &labelVMT)))
+ if (!(widget = (GLabelObject *)_gwidgetCreate(g, &widget->w, pInit, &labelVMT)))
return 0;
// no borders by default