VOID AROSCycle__GM_RENDER(Class *cl, Object *o, struct gpRender *msg) { struct CycleData *data = INST_DATA(cl, o); /* Full redraw: clear and draw border */ DrawImageState(msg->gpr_RPort,IM(EG(o)->GadgetRender), EG(o)->LeftEdge, EG(o)->TopEdge, EG(o)->Flags&GFLG_SELECTED?IDS_SELECTED:IDS_NORMAL, msg->gpr_GInfo->gi_DrInfo); if (data->font) SetFont(msg->gpr_RPort, data->font); else SetFont(msg->gpr_RPort, msg->gpr_GInfo->gi_DrInfo->dri_Font); if (data->labels) renderlabel(EG(o), data->labels[data->active], msg->gpr_RPort, msg->gpr_GInfo); /* Draw disabled pattern */ if (G(o)->Flags & GFLG_DISABLED) drawdisabledpattern(msg->gpr_RPort, msg->gpr_GInfo->gi_DrInfo->dri_Pens[SHADOWPEN], G(o)->LeftEdge, G(o)->TopEdge, G(o)->Width, G(o)->Height); }
IPTR GTCheckBox__GM_RENDER(Class *cl, struct Gadget *g, struct gpRender *msg) { struct CheckBoxData *data; IPTR result = TRUE; data = INST_DATA(cl, g); /* Render image */ drawimage(cl, g, msg->gpr_RPort, g->Flags&GFLG_SELECTED, g->Flags&GFLG_DISABLED); /* Render gadget label */ if (msg->gpr_Redraw == GREDRAW_REDRAW) { result = renderlabel(GadToolsBase, g, msg->gpr_RPort, data->labelplace); } return result; }
IPTR GTSlider__GM_RENDER(Class *cl, struct Gadget *g, struct gpRender *msg) { struct SliderData *data = INST_DATA(cl, g); IPTR retval; if (msg->gpr_Redraw == GREDRAW_REDRAW) { DrawImageState(msg->gpr_RPort, (struct Image *)data->frame, g->LeftEdge - BORDERPROPSPACINGX, g->TopEdge - BORDERPROPSPACINGY, IDS_NORMAL, msg->gpr_GInfo->gi_DrInfo); } retval = DoSuperMethodA(cl, (Object *)g, (Msg)msg); renderlabel(GadToolsBase, g, msg->gpr_RPort, data->labelplace); ReturnInt("Slider::Render", IPTR, retval); }
IPTR GTText__GM_RENDER(Class *cl, struct Gadget *g, struct gpRender *msg) { UWORD *pens = msg->gpr_GInfo->gi_DrInfo->dri_Pens; UBYTE textbuf[256], *str; struct TextData *data = INST_DATA(cl, g); WORD left, left2, top, width, height, numchars, tlength; struct TextFont *oldfont; struct RastPort *rp = msg->gpr_RPort; EnterFunc(bug("Text::Render()\n")); left = g->LeftEdge; top = g->TopEdge; width = g->Width; height = g->Height; if (msg->gpr_Redraw == GREDRAW_REDRAW) { if (data->frame) { DrawImageState(msg->gpr_RPort, (struct Image *)data->frame, left, top, IDS_NORMAL, msg->gpr_GInfo->gi_DrInfo); } renderlabel(GadToolsBase, g, msg->gpr_RPort, data->labelplace); } if (data->toprint || (data->gadgetkind != TEXT_KIND)) { /* preserve font */ oldfont = rp->Font; SetFont(rp, data->font); str = textbuf; if (data->gadgetkind == TEXT_KIND) { strncpy(str, (char *)data->toprint, sizeof(textbuf)); textbuf[sizeof(textbuf) - 1] = '\0'; } else /* NUMERIC_KIND or label of SLIDER_KIND */ { RawDoFmt(data->format, &(data->toprint), (VOID_FUNC)AROS_ASMSYMNAME(puttostr), &str); } D(bug("Text formatted into: %s\n", textbuf)); numchars = strlen(textbuf); if (data->flags & TEXTF_BORDER) { left += VBORDER + 1; top += HBORDER + 1; width = g->Width - (VBORDER + 1) * 2; height = g->Height - (HBORDER + 1) * 2; } if (data->flags & TEXTF_CLIPPED) { struct TextExtent te; /* See how many chars fits into the display area */ numchars = TextFit(rp, textbuf, numchars, &te, NULL, 1, width, g->Height); } tlength = TextLength(rp, textbuf, numchars); left2 = left; switch (data->justification) { case GTJ_LEFT: break; case GTJ_RIGHT: left2 += (width - tlength); break; case GTJ_CENTER: left2 += ((width - tlength) / 2); break; } /* Render text */ D(bug("Rendering text of lenghth %d at (%d, %d)\n", numchars, left, top)); SetABPenDrMd(rp, pens[data->backpen], pens[data->backpen], JAM2); RectFill(rp, left, top, left + width - 1, top + height - 1); SetAPen(rp, pens[data->frontpen]); Move(rp, left2, top + ((height - data->font->tf_YSize) / 2) + data->font->tf_Baseline); Text(rp, textbuf, numchars); SetFont(rp, oldfont); } /* if (data->toprint || (data->gadgetkind != TEXT_KIND)) */ ReturnInt("Text::Render", IPTR, 0); }