ftp.nice.ch/Attic/openStep/developer/resources/MiscKit.2.0.5.s.gnutar.gz#/MiscKit2/Temp/TabbedViews/MiscTabMatrixPalette1/MiscTabActionCell.subproj/MiscTabActionCellInspector.m

This is MiscTabActionCellInspector.m in view mode; [Download] [Up]

/*
**	MiscSwitchViewInspector.m 
**	Copyright (C) 1995  David Slotnick 
*/

// RCS identification information
static char *rcsID = "$Id: MiscSwitchViewInspector.m,v 1.1 1996/08/06 03:37:01 slotnick Exp $";
static void __AvoidCompilerWarning(void) {if(!rcsID)__AvoidCompilerWarning();}

// NeXTSTEP Headers
#import <InterfaceBuilder/InterfaceBuilder.h>

// System Headers

// Third Party Headers

// Other Headers
#import "MiscTabActionCell.h"

// Class Headers
#import "MiscTabActionCellInspector.h"

// Private Constants

// Private Macros

// Module variables (static variables)


@implementation MiscTabActionCellInspector

/*"
   The MiscSwitchViewInspector implements the InterfaceBuilder inspector for the MiscSwitchView class.  The methods in this class apply immediately to the inspected MiscSwitchView instance, so the inspector buttons (OK and Revert) aren't displayed.
"*/


//-------------------------------------------------------------------
// 	Accessor methods
//-------------------------------------------------------------------

- (void)setColorWell:(NSColorWell *)colorWell;
{
    [_colorWell autorelease];
    _colorWell = [colorWell retain];
}

- (NSColorWell *) colorWell;
{
    return _colorWell;
}


//-------------------------------------------------------------------
// 	Initialization / deallocation
//-------------------------------------------------------------------

- (id) init
/*"
   Extends the superclass method to load the the inspector nib file.
   Returns self if successful, nil otherwise.
"*/
{
  NSString* inspectorNibPath;
  id bundle;

  BOOL error = ([super init] == nil) ? YES : NO;

    if (!error) {
      bundle = [NSBundle bundleForClass:[MiscTabActionCell class]];
      inspectorNibPath = [bundle pathForResource:@"MiscTabActionCellInspector"
                                          ofType:@"nib"];
        // Load the inspector nib.
        if (![NSBundle loadNibFile:inspectorNibPath externalNameTable:
          [NSDictionary dictionaryWithObjectsAndKeys:self, @"NSOwner", nil]
          withZone:[self zone]]) {
            NSLog (@"MiscTabActionCellInspector:: Could not load "
                   @"MiscTabActionCellInspector.nib");
            error = YES;
        }

        // Free myself if the initialization fails.
        if (error) {
            [self autorelease];
        }
    }
		
	return error ? nil : self;
}

- (void) dealloc
/*"
   Standard deallocator.
"*/
{
    [_colorWell release];
    [super dealloc];
}




//-------------------------------------------------------------------
// 	IBInspector methods
//-------------------------------------------------------------------
- (void)ok:sender
{
    [[self object] setColor:[[self colorWell] color]];
    
    // Added to display editors after subview changes.  This seems
    // to have broken in OpenStep/Mach PR2 [dls 4/30/96].
        [[(id <IB>)[NSApplication sharedApplication] activeDocument]
            drawObject:[self object]];
    // End added [dls 4/30/96].

    [[[self object] controlView] setNeedsDisplay:YES];
    [[[self object] controlView] display];
    [super ok:sender];
}

- (void) revert:(id)sender
/*"
   Updates the inspector with the attributes of the currently inspected switch view.
"*/
{
    [[self colorWell] setTarget:NULL];
    [[self colorWell] setColor:[[self object] color]];
    [[self colorWell] setTarget:self];
    
    [[self colorWell] display];

// Added to display editors after subview changes.  This seems
// to have broken in OpenStep/Mach PR2 [dls 4/30/96].
    [[(id <IB>)[NSApplication sharedApplication] activeDocument]
        drawObject:[self object]];
// End added [dls 4/30/96].

    // Invoke superclass functionality.
    [super revert:sender];
}

- (BOOL) wantsButtons
/*"
   The inspector controls take effect immediately, so the OK and Revert buttons aren't needed.
"*/   
{
    return NO;
}

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.