This is Rubberview.m in view mode; [Download] [Up]
/* Generated by Interface Builder */ /* Augmented by Slugg Jello, Mouthing Flowers 152 20th Ave. #1 Seattle, WA. 98112 slugg@mouthers.nwnexus.wa.com */ #import "Rubberview.h" #import "Rubberband.h" #import <c.h> #import <appkit/Application.h> #import <appkit/Window.h> #import <appkit/NXCursor.h> #import <appkit/NXImage.h> #import <dpsclient/wraps.h> #import <appkit/graphics.h> @implementation Rubberview - initRubberband /* geez, ought to be able to do this in initFrame, but at that point view doesn't yet know its bounds */ { if (myRubberband == nil) { myRubberband = [[Rubberband alloc] initWithView:self]; originalBounds = bounds; } if (myCursorImage == nil) myCursorImage = [[NXImage alloc] initFromSection :"brush21"]; if (myCursor == nil) myCursor = [[NXCursor alloc] initFromImage :myCursorImage]; return self; } -free { if (myRubberband) [myRubberband free]; if (myCursor) [myCursor free]; if (myCursorImage) [myCursorImage free]; return [super free]; } - setRubberBounds :sender { if (myRubberband == nil) [self initRubberband]; flags.gettingBounds = TRUE; [[self window] invalidateCursorRectsForView :self]; [myRubberband setBounds :&originalBounds]; [self display]; return self; } - setRubberAnchor :sender { if (myRubberband == nil) [self initRubberband]; whichAnchor = (whichAnchor == RB_CENTER ? RB_CORNER : RB_CENTER); [myRubberband setPivot :whichAnchor]; return sender; } - mouseDown:(NXEvent *)theEvent { if (myRubberband == nil) [self initRubberband]; [myRubberband doStretch :theEvent]; if (flags.gettingBounds) { [myRubberband setCurrentRectToBounds]; flags.gettingBounds = FALSE; [[self window] invalidateCursorRectsForView :self]; [self display]; } return self; } - drawSelf:(const NXRect *)rects :(int)rectCount { NXRect rect; PSsetgray(NX_LTGRAY); NXRectFill(&bounds); if (myRubberband) [myRubberband bounds :&rect]; else rect = bounds; NXDrawGroove(&rect,rects); return self; } - resetCursorRects { NXRect visible; if (flags.gettingBounds) { if ([self getVisibleRect:&visible]) [self addCursorRect:&visible cursor:myCursor]; } else [self addCursorRect:&visible cursor:nil]; return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.