This is MailComposerInspector.m in view mode; [Download] [Up]
//----------------------------------------------------------------------------------------------------
//
// MailComposerInspector
//
// Inherits From: IBInspector
//
// Declared In: MailComposerInspector.h
//
// Disclaimer
//
// You may freely copy, distribute and reuse this software and its
// associated documentation. I disclaim any warranty of any kind,
// expressed or implied, as to its fitness for any particular use.
//
//----------------------------------------------------------------------------------------------------
#import "MailComposerInspector.h"
#import "MailComposer.h"
@implementation MailComposerInspector
- init
{
// Initialize and return an instance of this class. Call [self revert:] to sync with
// inspected object. Set self as delegate for Text and TextFields. This will
// notify us when inspector is dirty (has been changed).
char path[MAXPATHLEN+1];
id bundle;
[super init];
if ( ! (bundle = [NXBundle bundleForClass: [MailComposerInspector class]] ) ) return nil; if ( ! [bundle getPath: path forResource: "MailComposerInspector" ofType: "nib"] ) return nil;
[NXApp loadNibFile: path owner: self withNames: NO fromZone: [self zone]];
[to setTextDelegate: self];
[subject setTextDelegate: self];
[cc setTextDelegate: self];
[body setDelegate: self];
[self revert: nil];
return self;
}
- revert:sender
{
// Sync with inspected object. Must call [super revert: ].
[to setStringValue: [object to]];
[subject setStringValue: [object subject]];
[cc setStringValue: [object cc]];
[body setSel: 0 :[body textLength]];
[body replaceSel: [object body]];
[to selectText: nil];
return [super revert:sender];
}
- ok: sender
{
// Make changes to object . Notify IB changes have occurred.
// Must call [super ok: ].
STR bodyText = malloc ([body textLength] + 1);
[body getSubstring: bodyText start: 0 length: [body textLength]];
[object body: bodyText];
if (bodyText) free(bodyText);
[object to: (STR)[to stringValue]];
[object subject: (STR)[subject stringValue]];
[object cc: (STR)[cc stringValue]];
[[NXApp activeDocument] touch];
return [super ok: sender];
}
- (BOOL)wantsButtons
{
// Tell IB we do want 'Revert' and 'Ok' buttons...
return YES;
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.