some progress

ugfx_release_2.6
Joel Bodenmann 2014-01-05 04:02:03 +01:00
parent 9f5d14cf5d
commit a6b81192eb
2 changed files with 42 additions and 16 deletions

View File

@ -153,44 +153,52 @@ static const GColorSet *getDrawColors(GWidgetObject *gw) {
void gwinCheckboxDraw_CheckOnLeft(GWidgetObject *gw, void *param) {
#define gcw ((GCheckboxObject *)gw)
coord_t ld, df;
coord_t ld, df, abs_x, abs_y;
const GColorSet * pcol;
(void) param;
if (gw->g.vmt != (gwinVMT *)&checkboxVMT) return;
if (gw->g.vmt != (gwinVMT *)&checkboxVMT)
return;
gwinGetAbsoluteCoordinates((GHandle)gw, &abs_x, &abs_y);
pcol = getDrawColors(gw);
ld = gw->g.width < gw->g.height ? gw->g.width : gw->g.height;
gdispGFillArea(gw->g.display, gw->g.x+1, gw->g.y+1, ld, ld-2, gw->pstyle->background);
gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, ld, ld, pcol->edge);
gdispGFillArea(gw->g.display, abs_x+1, abs_y+1, ld, ld-2, gw->pstyle->background);
gdispGDrawBox(gw->g.display, abs_x, abs_y, ld, ld, pcol->edge);
df = ld < 4 ? 1 : 2;
if (gw->g.flags & GCHECKBOX_FLG_CHECKED)
gdispGFillArea(gw->g.display, gw->g.x+df, gw->g.y+df, ld-2*df, ld-2*df, pcol->fill);
gdispGFillArea(gw->g.display, abs_x+df, abs_y+df, ld-2*df, ld-2*df, pcol->fill);
gdispGFillStringBox(gw->g.display, gw->g.x+ld+1, gw->g.y, gw->g.width-ld-1, gw->g.height, gw->text, gw->g.font, pcol->text, gw->pstyle->background, justifyLeft);
gdispGFillStringBox(gw->g.display, abs_x+ld+1, abs_y, gw->g.width-ld-1, gw->g.height, gw->text, gw->g.font, pcol->text, gw->pstyle->background, justifyLeft);
#undef gcw
}
void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param) {
#define gcw ((GCheckboxObject *)gw)
coord_t ep, ld, df;
coord_t ep, ld, df, abs_x, abs_y;
const GColorSet * pcol;
(void) param;
if (gw->g.vmt != (gwinVMT *)&checkboxVMT) return;
if (gw->g.vmt != (gwinVMT *)&checkboxVMT)
return;
gwinGetAbsoluteCoordinates((GHandle)gw, &abs_x, &abs_y);
pcol = getDrawColors(gw);
ld = gw->g.width < gw->g.height ? gw->g.width : gw->g.height;
ep = gw->g.width-ld-1;
gdispGFillArea(gw->g.display, gw->g.x+ep-1, gw->g.y+1, ld, ld-2, gw->pstyle->background);
gdispGDrawBox(gw->g.display, gw->g.x+ep, gw->g.y, ld, ld, pcol->edge);
gdispGFillArea(gw->g.display, abs_x+ep-1, abs_y+1, ld, ld-2, gw->pstyle->background);
gdispGDrawBox(gw->g.display, abs_x+ep, abs_y, ld, ld, pcol->edge);
df = ld < 4 ? 1 : 2;
if (gw->g.flags & GCHECKBOX_FLG_CHECKED)
gdispGFillArea(gw->g.display, gw->g.x+ep+df, gw->g.y+df, ld-2*df, ld-2*df, pcol->fill);
gdispGFillArea(gw->g.display, abs_x+ep+df, abs_y+df, ld-2*df, ld-2*df, pcol->fill);
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, ep-1, gw->g.height, gw->text, gw->g.font, pcol->text, gw->pstyle->background, justifyRight);
gdispGFillStringBox(gw->g.display, abs_x, abs_y, ep-1, gw->g.height, gw->text, gw->g.font, pcol->text, gw->pstyle->background, justifyRight);
#undef gcw
}

View File

@ -299,7 +299,15 @@ void gwinResize(GHandle gh, coord_t width, coord_t height) {
}
void gwinRedraw(GHandle gh) {
_gwm_redraw(gh, GWIN_WMFLG_PRESERVE|GWIN_WMFLG_NOBGCLEAR);
_gwm_redraw(gh, GWIN_WMFLG_PRESERVE | GWIN_WMFLG_NOBGCLEAR);
#if GWIN_NEED_HIERARCHY
GHandle tmp;
if (gh->child) {
for (tmp = gh->child; tmp; tmp = tmp->sibling)
gwinRedraw(tmp);
}
#endif
}
#if GDISP_NEED_TEXT
@ -309,8 +317,7 @@ void gwinRedraw(GHandle gh) {
#endif
#if GWIN_NEED_HIERARCHY
void gwinAddChild(GHandle parent, GHandle child, bool_t last)
{
void gwinAddChild(GHandle parent, GHandle child, bool_t last) {
child->parent = parent;
child->sibling = NULL;
child->child = NULL;
@ -325,8 +332,19 @@ void gwinRedraw(GHandle gh) {
s->sibling = child;
} else {
child->sibling = parent->child;
parent->child = child;
parent->child = child;
}
#if GDISP_NEED_CLIP
gdispGSetClip(child->display, child->x, child->y, child->width, child->height);
#endif
gdispGFillArea(child->display, child->x, child->y, child->width, child->height, child->bgcolor);
#if GDISP_NEED_CLIP
gdispGUnsetClip(child->display);
#endif
gwinClear(parent);
gwinRedraw(parent);
}
GHandle gwinGetFirstChild(GHandle gh) {