Exemple #1
0
void getgadgetbounds(struct Gadget *gad, struct GadgetInfo *gi, WORD *x, WORD *y, WORD *w, WORD *h)
{
    if (!(gad->Flags & GFLG_EXTENDED) ||
        !(EG(gad)->MoreFlags & GMORE_BOUNDS))
    {
    	return getgadgetcoords(gad, gi, x, y, w, h);
    }
	
    *x = EG(gad)->BoundsLeftEdge + ((gad->Flags & GFLG_RELRIGHT)  ? gi->gi_Domain.Width  - 1 : 0);
    *y = EG(gad)->BoundsTopEdge  + ((gad->Flags & GFLG_RELBOTTOM) ? gi->gi_Domain.Height - 1 : 0);
    *w = EG(gad)->BoundsWidth    + ((gad->Flags & GFLG_RELWIDTH)  ? gi->gi_Domain.Width  : 0);
    *h = EG(gad)->BoundsHeight   + ((gad->Flags & GFLG_RELHEIGHT) ? gi->gi_Domain.Height : 0);
}
Exemple #2
0
IPTR AslProp__GM_RENDER(Class *cl, struct Gadget *g, struct gpRender *msg)
{
    struct AslPropData *data;
    IPTR retval;

    data = INST_DATA(cl, g);

    if (msg->gpr_Redraw == GREDRAW_REDRAW)
    {
        struct TagItem im_tags[] =
        {
            {IA_Width	, 0	},
            {IA_Height	, 0	},
            {TAG_DONE		}
        };
        WORD x, y, w, h;

        getgadgetcoords(g, msg->gpr_GInfo, &x, &y, &w, &h);

        x -= BORDERPROPSPACINGX;
        y -= BORDERPROPSPACINGY;
        w += BORDERPROPSPACINGX * 2;
        h += BORDERPROPSPACINGY * 2;

        im_tags[0].ti_Data = w;
        im_tags[1].ti_Data = h;

        SetAttrsA(data->frame, im_tags);

        DrawImageState(msg->gpr_RPort,
                       (struct Image *)data->frame,
                       x,
                       y,
                       IDS_NORMAL,
                       msg->gpr_GInfo->gi_DrInfo);

#if AVOID_FLICKER
        {
            struct IBox ibox, fbox;

            fbox.Left = x;
            fbox.Top = y;
            fbox.Width = w;
            fbox.Height = h;

            ibox.Left   = x + BORDERPROPSPACINGX;
            ibox.Top    = y + BORDERPROPSPACINGY;
            ibox.Width  = w - BORDERPROPSPACINGX * 2;
            ibox.Height = h - BORDERPROPSPACINGY * 2;

            PaintInnerFrame(msg->gpr_RPort,
                            msg->gpr_GInfo->gi_DrInfo,
                            data->frame,
                            &fbox,
                            &ibox,
                            msg->gpr_GInfo->gi_DrInfo->dri_Pens[BACKGROUNDPEN],
                            AslBase);

        }
#endif

    } /* if (msg->gpr_Redraw == GREDRAW_REDRAW) */

    retval = DoSuperMethodA(cl, (Object *)g, (Msg)msg);

    return retval;
}