static void MyDrawUserItem(DialogRef theDialog, DialogItemIndex itemNo) { DialogItemType itemType; Handle itemHandle; Rect itemBox; GetDialogItem(theDialog, itemNo, &itemType, &itemHandle, &itemBox); CGrafPtr savePort; GetPort(&savePort); SetPortDialogPort(theDialog); PenState penState; GetPenState(&penState); PenSize(3, 3); if (itemType & itemDisable) { Pattern gray; PenPat(GetQDGlobalsGray(&gray)); } FrameRect(&itemBox); Rect userRect = {gUserV-4, gUserH-4, gUserV+4, gUserH+4}; PaintRect(&userRect); SetPenState(&penState); SetPort(savePort); }
Pattern MyGetQDGlobalsGray(void) { Pattern pat; #if TARGET_API_MAC_CARBON GetQDGlobalsGray(&pat); #else pat = qd.gray; #endif return pat; }
static void drawbuttonbackground (Rect r) { /* 2.1b3 dmb: use 'ppat' for button background; easier to modify, less code to draw. */ #ifdef gray3Dlook eraserect (r); #else //Code change by Timothy Paustian Friday, June 16, 2000 2:47:25 PM //Changed to Opaque call for Carbon if ((**shellwindowinfo).flwindowactive) { if (colorenabled ()) #if TARGET_API_MAC_CARBON == 1 DrawThemeWindowHeader (&r, kThemeStateActive); #else fillcolorrect (r, backgroundpattern); #endif else #if TARGET_API_MAC_CARBON == 1 { Pattern pat; GetQDGlobalsGray(&pat); FillRect (&r, &pat); } #else fillrect (r, buttonbackground); #endif }
void ZoomRect(Boolean zoomLarger,Rect *smallRect, Rect *bigRect) { double firstStep,stepValue,trailer,zoomRatio; short i,step; Rect curRect; unsigned long ticks; Pattern grayPattern; //used in carbonization RgnHandle rgnHandle = NewRgn(); GrafPtr oldPort; Rect tempRect1; GetPort(&oldPort); SetPort(GetWindowPort(gWindow)); //PenPat(&qd.gray); PenPat(GetQDGlobalsGray(&grayPattern)); PenMode(patXor); firstStep=kZoomRatio; for (i=0; i<kNumSteps; i++) { firstStep *= kZoomRatio; } if (!zoomLarger) { zoomRatio = 1.0/kZoomRatio; firstStep = 1.0-firstStep; } else zoomRatio = kZoomRatio; trailer = firstStep; stepValue = firstStep; for (step=0; step<(kNumSteps+kRectsVisible); step++) { // draw new frame if (step<kNumSteps) { stepValue /= zoomRatio; CalcRect(&curRect,smallRect,bigRect,stepValue); FrameRect(&curRect); } // erase old frame if (step>=kRectsVisible) { trailer /= zoomRatio; CalcRect(&curRect,smallRect,bigRect,trailer); FrameRect(&curRect); } QDFlushPortBuffer(GetWindowPort(gWindow), GetPortVisibleRegion(GetWindowPort(gWindow), rgnHandle)); Delay(kDelayTicks,&ticks); } PenNormal(); DisposeRgn(rgnHandle); smallRect->top = bigRect->top = -1; EraseRect(GetPortBounds(GetWindowPort(gWindow), &tempRect1)); SetPort(oldPort); }