some progress
This commit is contained in:
parent
9f5d14cf5d
commit
a6b81192eb
2 changed files with 42 additions and 16 deletions
|
@ -153,44 +153,52 @@ static const GColorSet *getDrawColors(GWidgetObject *gw) {
|
||||||
|
|
||||||
void gwinCheckboxDraw_CheckOnLeft(GWidgetObject *gw, void *param) {
|
void gwinCheckboxDraw_CheckOnLeft(GWidgetObject *gw, void *param) {
|
||||||
#define gcw ((GCheckboxObject *)gw)
|
#define gcw ((GCheckboxObject *)gw)
|
||||||
coord_t ld, df;
|
coord_t ld, df, abs_x, abs_y;
|
||||||
const GColorSet * pcol;
|
const GColorSet * pcol;
|
||||||
(void) param;
|
(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);
|
pcol = getDrawColors(gw);
|
||||||
|
|
||||||
ld = gw->g.width < gw->g.height ? gw->g.width : gw->g.height;
|
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);
|
gdispGFillArea(gw->g.display, abs_x+1, abs_y+1, ld, ld-2, gw->pstyle->background);
|
||||||
gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, ld, ld, pcol->edge);
|
gdispGDrawBox(gw->g.display, abs_x, abs_y, ld, ld, pcol->edge);
|
||||||
|
|
||||||
df = ld < 4 ? 1 : 2;
|
df = ld < 4 ? 1 : 2;
|
||||||
if (gw->g.flags & GCHECKBOX_FLG_CHECKED)
|
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
|
#undef gcw
|
||||||
}
|
}
|
||||||
|
|
||||||
void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param) {
|
void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param) {
|
||||||
#define gcw ((GCheckboxObject *)gw)
|
#define gcw ((GCheckboxObject *)gw)
|
||||||
coord_t ep, ld, df;
|
coord_t ep, ld, df, abs_x, abs_y;
|
||||||
const GColorSet * pcol;
|
const GColorSet * pcol;
|
||||||
(void) param;
|
(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);
|
pcol = getDrawColors(gw);
|
||||||
|
|
||||||
ld = gw->g.width < gw->g.height ? gw->g.width : gw->g.height;
|
ld = gw->g.width < gw->g.height ? gw->g.width : gw->g.height;
|
||||||
ep = gw->g.width-ld-1;
|
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);
|
gdispGFillArea(gw->g.display, abs_x+ep-1, abs_y+1, ld, ld-2, gw->pstyle->background);
|
||||||
gdispGDrawBox(gw->g.display, gw->g.x+ep, gw->g.y, ld, ld, pcol->edge);
|
gdispGDrawBox(gw->g.display, abs_x+ep, abs_y, ld, ld, pcol->edge);
|
||||||
|
|
||||||
df = ld < 4 ? 1 : 2;
|
df = ld < 4 ? 1 : 2;
|
||||||
if (gw->g.flags & GCHECKBOX_FLG_CHECKED)
|
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
|
#undef gcw
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -299,7 +299,15 @@ void gwinResize(GHandle gh, coord_t width, coord_t height) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void gwinRedraw(GHandle gh) {
|
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
|
#if GDISP_NEED_TEXT
|
||||||
|
@ -309,8 +317,7 @@ void gwinRedraw(GHandle gh) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GWIN_NEED_HIERARCHY
|
#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->parent = parent;
|
||||||
child->sibling = NULL;
|
child->sibling = NULL;
|
||||||
child->child = NULL;
|
child->child = NULL;
|
||||||
|
@ -325,8 +332,19 @@ void gwinRedraw(GHandle gh) {
|
||||||
s->sibling = child;
|
s->sibling = child;
|
||||||
} else {
|
} else {
|
||||||
child->sibling = parent->child;
|
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) {
|
GHandle gwinGetFirstChild(GHandle gh) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue