ftp.nice.ch/Attic/openStep/developer/resources/MiscKit.2.0.5.s.gnutar.gz#/MiscKit2/Temp/Adder/MiscControllerKit.subproj/MiscInspectorManager.m

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

/* MiscInspectorManager.m created by todd on Sun 05-May-1996 */

#import <AppKit/AppKit.h>
#import "MiscInspectorController.h"
#import "MiscInspectorNibManager.h"
#import "MiscInspectorManager.h"

// Class variables (static)
static Class _inspectorNibManagerClass = nil;


@implementation MiscInspectorManager

/*" 
	MiscInspectorManager doesn't do much (yet) except provide
   access to it's inspector controller. Later on it'll control
   the switch views in the inspector window, etc.
"*/


//-------------------------------------------------------------------
// Class initialization
//-------------------------------------------------------------------

+ (void) initialize
{
	if (self == [MiscInspectorManager class]) {
		[self setInspectorNibManagerClass:[MiscInspectorNibManager class]];
	}
}


//-------------------------------------------------------------------
// Our default inspector manager
//-------------------------------------------------------------------

+ (MiscInspectorManager*) defaultInspectorManager
/*"
	Returns the current inspector manager if one exists. If it doesn't
	it tries to use the inspector nib manager returned by 
	#inspectorNibManagerClass to load and create one. We return nil 
	if for some reason we couldn't find nor load the inspector
	manager.
"*/
{
	MiscInspectorManager* ourInspectorManager;
	
	// Try to find an existing one.
	ourInspectorManager = 
		[MiscWindowManager windowManagerOfClass:[self class]];

	// If it doesn't exist then load it by loading our inspector nib 
	// manager.		
	if (ourInspectorManager == nil) {
		MiscInspectorNibManager* inspectorNibManager;
		
		// We use initWithBundle: instead of just init because
		// the inspector manager may reside in a different bundle
		// than the nib manager.
		inspectorNibManager = [[[self inspectorNibManagerClass] alloc]
            initWithBundle:[NSBundle bundleForClass:[self class]]];

		// Should probably check whether the object created is
		// a subclass of MiscInspectorManager I suppose.
		ourInspectorManager = [inspectorNibManager inspectorManager];
	}
	
	return ourInspectorManager;
}
	
//-------------------------------------------------------------------
// Our inspector nib manager class
//-------------------------------------------------------------------

+ (Class) inspectorNibManagerClass
/*"
	Returns the info nib manager class that will be loaded to create
	a new instance of ourself. Our #defaultInfoWindowManager uses this
	method to allocate and initialize our info window manager if it
	doesn't already exist.
"*/
{
	return _inspectorNibManagerClass;
}


+ (void) setInspectorNibManagerClass:(Class)newInspectorNibManagerClass
{
	_inspectorNibManagerClass = newInspectorNibManagerClass;
}


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


- (id) init
/*"
	Sets us so we are not released when the inspector window is closed.
"*/
{
    BOOL error = ([super init] == nil);

    if (!error) {
        [self setReleasedWhenWindowClosed:NO];

        if (error) {
            [self autorelease];
        }
    }

    return error ? nil : self;
}


- (MiscInspectorController*) inspectorController
/*"
	Returns our inspector controller or nil if we don't have one (you should
	though).
"*/
{
    return (MiscInspectorController*)
        [self controllerOfClass:[MiscInspectorController class]];
}

@end

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