Example #1
0
static Int16 LoadIcon(Int16 start)
{
	FormPtr     frmP = FrmGetActiveForm();
	Int8	    i;
    Int16       num;
    Int16       iconButtonID = IconSelectIcon1Button;
    BitmapPtr   pbmp;
    MemHandle   h;
    Int16       x, y;
    RectangleType r;

    num = DmNumResources(IconDB);
    if (start > num) start = 0;
    
	for (i = 0; i < 9*8; i++) {
        UInt16 idx = FrmGetObjectIndex(frmP, iconButtonID + i);

        FrmGetObjectPosition(frmP, idx, &x, &y);
        FrmGetObjectBounds(frmP, idx, &r);

        r.topLeft.x = x;
        r.topLeft.y = y;

        WinEraseRectangle(&r, 0);

        if (i+start <num) {
            h = (MemPtr)GetIconByIndex(IconDB, i + start);
            pbmp = (h) ? MemHandleLock(h) : NULL;

            if (pbmp) {
                WinDrawBitmap(pbmp, x, y);
                                
                MemHandleUnlock(h);
                DmReleaseResource(h);
                ShowObject(frmP, iconButtonID + i);
            }
            else {
                HideObject(frmP, iconButtonID + i);
            }
        }
        else {
            HideObject(frmP, iconButtonID + i);
        }
	}
    return num;
}
Example #2
0
// Graphics icon setting
//
void DrawFormANIcon(Int16 iconNumber, Int16 id)
{
    FormPtr frmP = FrmGetActiveForm();
    Int16 x, y;
    RectangleType r;
    UInt16 idx = FrmGetObjectIndex(frmP, id);

    FrmGetObjectPosition(frmP, idx, &x, &y);
    FrmGetObjectBounds(frmP, idx, &r);
    
    r.topLeft.x = x;
    r.topLeft.y = y;

    WinEraseRectangle(&r, 0);

    if (iconNumber >= 0) DrawANIcon(iconNumber, x+1, y);
}
static void JavaFormResizeForm(FormType *frmP,RectangleType *fromBounds, RectangleType *toBounds) {
	Int16 heightDelta, widthDelta;
	UInt16 numObjects, i;
	heightDelta=(toBounds->extent.y-toBounds->topLeft.y)-(fromBounds->extent.y-fromBounds->topLeft.y);
	widthDelta=(toBounds->extent.x-toBounds->topLeft.x)-(fromBounds->extent.x-fromBounds->topLeft.x);
	numObjects=FrmGetNumberOfObjects(frmP);
	for(i=0; i<numObjects; i++) {
		Coord x,y;
		FrmGetObjectPosition(frmP,i,&x,&y);
		switch(FrmGetObjectType(frmP,i)) {
		case frmGraffitiStateObj:
			FrmSetObjectPosition(frmP,i,x+widthDelta,y+heightDelta);
			break;
		default:
			FrmSetObjectPosition(frmP,i,x+(widthDelta>>1),y+(heightDelta>>1));
			break;
		}
	}
}