static void Draw(void *obj) { AG_Slider *sl = obj; int x; if (GetPosition(sl, &x) == -1) { return; } switch (sl->type) { case AG_SLIDER_VERT: AG_DrawBox(sl, AG_RECT(0,0,WIDTH(sl),HEIGHT(sl)), -1, WCOLOR(sl,0)); AG_DrawBox(sl, AG_RECT(0, x, WIDTH(sl), sl->wControl), sl->ctlPressed ? -1 : 1, WCOLOR(sl,0)); break; case AG_SLIDER_HORIZ: AG_DrawBox(sl, AG_RECT(0,0,WIDTH(sl),HEIGHT(sl)), -1, WCOLOR(sl,0)); AG_DrawBox(sl, AG_RECT(x, 0, sl->wControl, HEIGHT(sl)), sl->ctlPressed ? -1 : 1, WCOLOR(sl,0)); break; } }
static void Draw(void *obj) { AG_Titlebar *tbar = obj; AG_DrawBox(tbar, AG_RECT(0, 0, WIDTH(tbar), HEIGHT(tbar)), tbar->pressed ? -1 : 1, AG_WindowIsFocused(tbar->win) ? WCOLOR(tbar,0) : WCOLOR_DIS(tbar,0)); WIDGET_SUPER_OPS(tbar)->draw(tbar); }
static void Draw(void *obj) { AG_Box *box = obj; AG_Widget *chld; if (box->flags & AG_BOX_FRAME) { AG_DrawBox(box, AG_RECT(0, 0, WIDTH(box), HEIGHT(box)), box->depth, WCOLOR(box,AG_COLOR)); } OBJECT_FOREACH_CHILD(chld, box, ag_widget) AG_WidgetDraw(chld); }
static void Draw(void *p) { AG_Button *bu = p; AG_Variable *binding; void *pState; int pressed; binding = AG_GetVariable(bu, "state", &pState); pressed = GetState(bu, binding, pState); AG_UnlockVariable(binding); if (AG_WidgetEnabled(bu)) { AG_DrawBox(bu, AG_RECT(0, 0, WIDTH(bu), HEIGHT(bu)), pressed ? -1 : 1, WCOLOR(bu,0)); } else { AG_DrawBoxDisabled(bu, AG_RECT(0, 0, WIDTH(bu), HEIGHT(bu)), pressed ? -1 : 1, WCOLOR_DEF(bu,0), WCOLOR_DIS(bu,0)); } if (bu->lbl != NULL) { AG_WidgetDraw(bu->lbl); } else if (bu->surface != -1) { int w = WSURFACE(bu,bu->surface)->w; int h = WSURFACE(bu,bu->surface)->h; int x = 0, y = 0; switch (bu->justify) { case AG_TEXT_LEFT: x = bu->lPad; break; case AG_TEXT_CENTER: x = WIDTH(bu)/2 - w/2; break; case AG_TEXT_RIGHT: x = WIDTH(bu) - w - bu->rPad; break; } switch (bu->valign) { case AG_TEXT_TOP: y = bu->tPad; break; case AG_TEXT_MIDDLE: y = HEIGHT(bu)/2 - h/2; break; case AG_TEXT_BOTTOM: y = HEIGHT(bu) - h - bu->bPad; break; } if (pressed) { x++; y++; } AG_WidgetBlitSurface(bu, bu->surface, x, y); } }