void doUpdateWindow(EventRecord *eventStrucPtr) { IMAGE *img; WindowRef windowRef; Rect srcRect, destRect, fillRect; PixMapHandle srcPixmapHdl, destPixmapHdl; RGBColor grayColour = { 0xC000,0xC000,0xC000 }; SInt32 hScroll, vScroll; windowRef = (WindowRef) eventStrucPtr->message; img = (IMAGE*)GetWRefCon(windowRef); srcPixmapHdl = img->pixmapHdl; destPixmapHdl = GetPortPixMap(GetWindowPort(windowRef)); hScroll = GetControl32BitValue(img->scrollbarHorizRef); vScroll = GetControl32BitValue(img->scrollbarVertRef); if (srcPixmapHdl) { PixMap *pixmap = *srcPixmapHdl; PixPatHandle hdlPixPat = NewPixPat(); MakeRGBPat(hdlPixPat, &grayColour); GetWindowPortBounds(windowRef,&destRect); destRect.right -= kScrollBarWidth; destRect.bottom -= kScrollBarWidth; if (destRect.right > pixmap->bounds.right) { fillRect.top = destRect.top; fillRect.bottom = destRect.bottom; fillRect.left = pixmap->bounds.right; fillRect.right = destRect.right; FillCRect(&fillRect, hdlPixPat); destRect.right = pixmap->bounds.right; } if (destRect.bottom > pixmap->bounds.bottom) { fillRect.top = pixmap->bounds.bottom; fillRect.bottom = destRect.bottom; fillRect.left = destRect.left; fillRect.right = destRect.right; FillCRect(&fillRect, hdlPixPat); destRect.bottom = pixmap->bounds.bottom; } DisposePixPat(hdlPixPat); srcRect = destRect; srcRect.left += hScroll; srcRect.right += hScroll; srcRect.top += vScroll; srcRect.bottom += vScroll; CopyBits((BitMap*)*srcPixmapHdl, (BitMap*)*destPixmapHdl, &srcRect, &destRect, srcCopy, NULL); } DrawGrowIcon(windowRef); }
void XFillRectangles( Display* display, /* Display. */ Drawable d, /* Draw on this. */ GC gc, /* Use this GC. */ XRectangle *rectangles, /* Rectangle array. */ int n_rectangels) /* Number of rectangles. */ { MacDrawable *macWin = (MacDrawable *) d; CGrafPtr saveWorld; GDHandle saveDevice; GWorldPtr destPort; Rect theRect; int i; destPort = TkMacGetDrawablePort(d); display->request++; GetGWorld(&saveWorld, &saveDevice); SetGWorld(destPort, NULL); TkMacSetUpClippingRgn(d); TkMacSetUpGraphicsPort(gc); for (i=0; i<n_rectangels; i++) { theRect.left = (short) (macWin->xOff + rectangles[i].x); theRect.top = (short) (macWin->yOff + rectangles[i].y); theRect.right = (short) (theRect.left + rectangles[i].width); theRect.bottom = (short) (theRect.top + rectangles[i].height); FillCRect(&theRect, gPenPat); } SetGWorld(saveWorld, saveDevice); }
void InAdditionsContent(EventRecord* evt, WindowPtr wCurrPtr) { Point localPt; Rect r, currCellRect, checkbox; ControlPartCode part; int i; Cell currCell; UInt8 hiliteVal; PixPatHandle ppH; GrafPtr oldPort; GetPort(&oldPort); SetPort(wCurrPtr); localPt = evt->where; GlobalToLocal( &localPt); /* Mouse Up */ /* scroll */ SetRect(&r, gControls->aw->compListBox.right, gControls->aw->compListBox.top, gControls->aw->compListBox.right + kScrollBarWidth, gControls->aw->compListBox.bottom); if ((evt->what == mouseUp) && (PtInRect( localPt, &r))) { LClick(localPt, evt->modifiers, gControls->aw->compList); SetRect(&r, gControls->aw->compListBox.left, gControls->aw->compListBox.top, gControls->aw->compListBox.right + 1, gControls->aw->compListBox.bottom); FrameRect(&r); } /* or un/check components */ if ((evt->what == mouseUp) && (PtInRect( localPt, &gControls->aw->compListBox))) { LClick(localPt, evt->modifiers, gControls->aw->compList); AddUpdateRowHighlight(localPt); /* invert the checkbox rect */ for (i=0; i<numRows; i++) { SetPt(&currCell, 0, i); LRect(&currCellRect, currCell, gControls->aw->compList); if (PtInRect(localPt, &currCellRect)) { SetRect(&checkbox, currCellRect.left+4, currCellRect.top+2, currCellRect.left+16, currCellRect.top+14); INVERT_HIGHLIGHT(&checkbox); break; } } AddSetOptInfo(false); } /* Mouse Down */ if ((evt->what == mouseDown) && (PtInRect( localPt, &gControls->aw->compListBox))) { /* show depressed button state */ for (i=0; i<numRows; i++) { SetPt(&currCell, 0, i); LRect(&currCellRect, currCell, gControls->aw->compList); if (PtInRect(localPt, &currCellRect)) { SetRect(&checkbox, currCellRect.left+4, currCellRect.top+2, currCellRect.left+16, currCellRect.top+14); ppH = GetPixPat(rGrayPixPattern); FillCRect(&checkbox, ppH); FrameRect(&checkbox); if (gControls->cfg->comp[rowToComp[i]].selected) { /* draw check mark */ MoveTo(checkbox.left+1, checkbox.top+1); LineTo(checkbox.right-2, checkbox.bottom-2); MoveTo(checkbox.right-2, checkbox.top+1); LineTo(checkbox.left+1, checkbox.bottom-2); } /* create 3D depression */ MoveTo(checkbox.left+1, checkbox.top+1); LineTo(checkbox.left+1, checkbox.bottom-1); MoveTo(checkbox.left+1, checkbox.top+1); LineTo(checkbox.right-1, checkbox.top+1); ForeColor(whiteColor); MoveTo(checkbox.right-1, checkbox.top+1); LineTo(checkbox.right-1, checkbox.bottom-1); MoveTo(checkbox.left+1, checkbox.bottom-1); LineTo(checkbox.right-1, checkbox.bottom-1); ForeColor(blackColor); if (ppH) DisposePixPat(ppH); break; } } } HLock((Handle)gControls->backB); r = (**(gControls->backB)).contrlRect; HUnlock((Handle)gControls->backB); if (PtInRect( localPt, &r)) { /* reset all rows to be not highlighted */ for (i=1; i<numRows; i++) gControls->cfg->comp[rowToComp[i]].highlighted = false; part = TrackControl(gControls->backB, evt->where, NULL); if (part) { /* extra handling since we used DrawString for static text msg * and framed our own listbox etc. */ gControls->aw->compListBox.top = 0; EraseRect(&gControls->aw->compListBox); ClearDiskSpaceMsgs(); KillControls(gWPtr); ShowComponentsWin(); return; } } HLock((Handle)gControls->nextB); r = (**(gControls->nextB)).contrlRect; HUnlock((Handle)gControls->nextB); if (PtInRect( localPt, &r)) { /* reset all rows to be not highlighted */ for (i=0; i<numRows; i++) gControls->cfg->comp[rowToComp[i]].highlighted = false; part = TrackControl(gControls->nextB, evt->where, NULL); if (part) { if (!VerifyDiskSpace()) return; gControls->aw->compListBox.top = 0; EraseRect(&gControls->aw->compListBox); ClearDiskSpaceMsgs(); KillControls(gWPtr); ShowTerminalWin(); return; } } SetPort(oldPort); }
void _HYPlatformGraphicPane::_FillRect (_HYRect rectDesc) { Rect r= HYRect2Rect (rectDesc); FillCRect (&r,fillColor); }
/* アイコンプレビューのアップデート */ void DrawIPIconPreview(const IPIconRec *ipIcon) { PicHandle previewPict; Rect r; Pattern pat; Boolean drawLarge=false,drawSmall=false,drawThumbnail=false; Handle h; OSErr err; IconSuiteRef iconSuite=NULL; IconRef iconRef; Rect picRect; /* プレビューの大きさ */ GetWindowPortBounds(gPreviewWindow,&r); /* まず背景 */ switch (gListBackground) { case iBackWhite: EraseRect(&r); break; case iBackGray: GetIndPattern(&pat,0,4); FillRect(&r,&pat); break; case iBackBlack: PaintRect(&r); break; case iBackDesktop: #if !TARGET_API_MAC_CARBON { PixPatHandle ppat; UseResFile(0); // ppat=GetPixPat(16); ppat=LMGetDeskCPat(); if (ppat==nil) { LMGetDeskPattern(&pat); FillRect(&r,&pat); } else { FillCRect(&r,ppat); // DisposePixPat(ppat); } UseResFile(gApplRefNum); } #else EraseRect(&r); #endif break; default: EraseRect(&r); break; } if (ipIcon!=NULL) { err=GetDataFromIPIcon(&h,ipIcon,kL1Data); drawLarge=(h!=nil); err=GetDataFromIPIcon(&h,ipIcon,kS1Data); drawSmall=(h!=nil); err=GetDataFromIPIcon(&h,ipIcon,kT32Data); drawThumbnail=(h!=nil); } if (drawThumbnail) previewPict = GetPicture(142); else previewPict = GetPicture(141); QDGetPictureBounds(previewPict, &picRect); DrawPicture(previewPict,&picRect); if (ipIcon==NULL) return; if (!isThumbnailIconsAvailable || !drawThumbnail) { iconSuite = ipIcon->iconSuite; } else { IconFamilyHandle iconFamily; err=IPIconToIconFamily(ipIcon,&iconFamily); err=RegisterIconRefFromIconFamily(kIconPartyCreator,'TEMP',iconFamily,&iconRef); // DisposeHandle((Handle)iconFamily); } if (isThumbnailIconsAvailable && drawThumbnail) { err=PlotIconRef(&iconPreviewRect[12],kAlignNone,kTransformNone,kIconServicesNormalUsageFlag, iconRef); err=ReleaseIconRef(iconRef); } else { if (iconSuite != NULL) { PlotIconSuite(&iconPreviewRect[0],kAlignNone,kTransformNone,iconSuite); PlotIconSuite(&iconPreviewRect[1],kAlignNone,kTransformSelected,iconSuite); if (drawLarge) { PlotIconSuite(&iconPreviewRect[4],kAlignNone,kTransformOpen,iconSuite); PlotIconSuite(&iconPreviewRect[5],kAlignNone,kTransformSelectedOpen,iconSuite); PlotIconSuite(&iconPreviewRect[8],kAlignNone,kTransformOffline,iconSuite); PlotIconSuite(&iconPreviewRect[9],kAlignNone,kTransformSelectedOffline,iconSuite); } PlotIconSuite(&iconPreviewRect[2],kAlignNone,kTransformNone,iconSuite); PlotIconSuite(&iconPreviewRect[3],kAlignNone,kTransformSelected,iconSuite); if (drawSmall) { PlotIconSuite(&iconPreviewRect[6],kAlignNone,kTransformOpen,iconSuite); PlotIconSuite(&iconPreviewRect[7],kAlignNone,kTransformSelectedOpen,iconSuite); PlotIconSuite(&iconPreviewRect[10],kAlignNone,kTransformOffline,iconSuite); PlotIconSuite(&iconPreviewRect[11],kAlignNone,kTransformSelectedOffline,iconSuite); } } } }