This is eTBookmarkEnd.m in view mode; [Download] [Up]
/////////////////////////////////////////////////////////////////////////////// // FILENAME: eTBookmarkEnd.m // SUMMARY: Implementation of the "stupid" end-of-region tag // SUPERCLASS: Object // INTERFACE: None // PROTOCOLS: <Annotation> // AUTHOR: Rohit Khare // COPYRIGHT: (c) 1994 California Institure of Technology, eText Project /////////////////////////////////////////////////////////////////////////////// // IMPLEMENTATION COMMENTS // Does as close to nothing as possible. /////////////////////////////////////////////////////////////////////////////// // HISTORY // 05/08/94: Created. First actual implementation. /////////////////////////////////////////////////////////////////////////////// #import "eTBookmarkEnd.h" @implementation eTBookmarkEnd // id etBookmark; // long anchorID; - init {return [self init:nil ID:0];} - init:theBookmark ID:(long)theID { [super init]; etBookmark = theBookmark; anchorID = theID; theIcon = [NXImage findImageNamed:".bmEnd"]; highlighted = NO; return self; } - beginDidFree { etBookmark = nil; return self; } - free { if (etBookmark) etBookmark = [etBookmark endDidFree:self]; return self = [super free]; } - click:sender {if (etBookmark) [etBookmark click:sender]; return self;} - doubleClick:sender {if (etBookmark) [etBookmark doubleClick:sender]; return self;} ///////////////////////// - initFromPboard:thePboard inDoc:theDoc linked:(BOOL) linked { NXLogError("initFromPboard called for bmEnd; should not have happened"); return [self init]; } - calcCellSize:(NXSize *)theSize {[theIcon getSize:theSize]; return self;} - drawSelf:(const NXRect *)cellFrame inView:view // MARGINALIA HERE! { NXPoint point; PSgsave(); PSsetgray([view backgroundGray]); NXRectFill(cellFrame); point = cellFrame->origin; point.y += cellFrame->size.height; [theIcon composite:NX_SOVER toPoint:&point]; PSgrestore(); return self; } - highlight:(const NXRect *)cellFrame inView:view lit:(BOOL)flag { if (highlighted != flag) { highlighted = flag; /* toggle highlighting */ NXHighlightRect(cellFrame); } return self; } - (BOOL) trackMouse:(NXEvent *)theEvent inRect:(const NXRect *)rect ofView:view { // TO fix this, check out Concepts chapter 7, prog dynam. if (!etBookmark) { if (theEvent->data.mouse.click == 2) [self doubleClick:self]; else if (theEvent->data.mouse.click == 1) [self click:self]; } else { [etBookmark trackMouse:theEvent inRect:rect ofView:view]; } return YES; } - writeRichText:(NXStream *)stream forView:view { NXPrintf(stream, "%x ", anchorID); return self; } - readRichText:(NXStream *)stream forView:view { NXScanf(stream, "%x ", &anchorID); etBookmark = [[eTBookmarkBinder new] bookmarkForID:anchorID]; [etBookmark setEnd:self]; return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.