home *** CD-ROM | disk | FTP | other *** search
- /* StringInspector.m
- * Written By: Thomas Burkholder
- *
- * You may freely copy, distribute, and reuse the code in this example.
- * NeXT disclaims any warranty of any kind, expressed or implied, as to its
- * fitness for any particular use.
- */
-
- #import "StringInspector.h"
-
- @implementation String (AttributesInspector)
-
- - (const char *)getInspectorClassName
- {
- return "StringInspector";
- }
-
- - (NXImage *)getIBImage
- {
- return [NXImage findImageNamed:"StringIcon"];
- }
-
- @end
-
- @implementation StringAgent (IBImageCategory)
-
- - (NXImage *)getIBImage
- {
- return [NXImage findImageNamed:"StringAgentIcon"];
- }
-
- @end
-
- @implementation StringInspector
-
- - init
- {
- char buf[MAXPATHLEN+1];
- NXBundle *bundle;
- [super init];
- bundle = [NXBundle bundleForClass:[String class]];
- [bundle getPath:buf forResource:"StringInspector" ofType:"nib"];
- [NXApp loadNibFile:buf owner:self withNames:NO fromZone:[self zone]];
- return self;
- }
-
- - ok:sender
- {
- id d;
-
- [object setStringValue:[valueField stringValue]];
- [self revertInspector:sender];
- // worry about possible editors...
- d = [[NXApp activeDocument] getEditor:NO for:object];
- if (d) [d resetObject:object];
- return [super ok:sender];
- }
-
- - revertInspector:sender
- {
- [valueField setStringValue:[object stringValue]];
- return self;
- }
-
- - revert:sender
- {
- [self revertInspector:sender];
- return [super revert:sender];
- }
-
- - (BOOL)wantsButtons
- {
- return NO;
- }
-
- @end
-