This is MiscSwapKitPalette.m in view mode; [Download] [Up]
#import "MiscSwapKitPalette.h" @implementation MiscSwapKitPalette - finishInstantiate { id idBundle; char buf[MAXPATHLEN + 1]; // Put the image on the button that will represent the controller // on the palette, then associate it with the object that is the // real controller. [super finishInstantiate]; idBundle = [NXBundle bundleForClass:[self class]]; if ([idBundle getPath:buf forResource:"MiscSCC" ofType:"tiff"]) [swapImageView setImage:[ [NXImage alloc] initFromFile:buf] ]; [self associateObject:realSwapObject type:IBObjectPboardType with:swapImageView]; return self; } @end @implementation MiscSwapView (IBDisplaying) // Displays a bezel around the view and writes their class name // in the center to identify subclasses, since otherwise you cannot // even see where the view is (on the palette and after being dragged). - drawSelf:(const NXRect *)rects :(int)rectCount { if ([NXApp conformsTo: @protocol(IB)]) if ([NXApp isTestingInterface] == NO) { id font = [Font boldSystemFontOfSize: 12.0 matrix: NX_IDENTITYMATRIX]; float x; float gray = [self backgroundGray]; float grays[4] = {NX_BLACK, NX_DKGRAY, NX_LTGRAY, NX_WHITE}; int i = 0; char *className = (char *)[ [self class] name]; NXRect indent; while (i<4 && gray != grays[i]) i++; // fill background with same color as will be used at runtime PSsetgray (gray); NXRectFill (&bounds); // choose an offset gray for border and text PSsetgray (grays[(i+2)%3]); NX_X (&indent) = NX_X (&bounds) + 2.0; NX_Y (&indent) = NX_Y (&bounds) + 2.0; NX_WIDTH (&indent) = NX_WIDTH (&bounds) - 4.0; NX_HEIGHT (&indent) = NX_HEIGHT (&bounds) - 4.0; NXFrameRect (&indent); [font set]; if ([font getWidthOf: className] > indent.size.width) x = 10.0; else x = (indent.size.width - [font getWidthOf: className])/2; PSmoveto (x, (indent.size.height-[font pointSize])/2); PSshow (className); } else [self swapContentView: [self trigger] ]; return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.