ftp.nice.ch/pub/next/developer/resources/classes/misckit/MiscKit.1.10.0.s.gnutar.gz#/MiscKit/Examples/MiscClassDecoder/MiscClassDecoder.bproj/MiscClassDecoderSetup.m

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

//
// Time-stamp: <94/11/26 17:10:03 stephan>
//
//	MiscClassDecoderSetup.m -- load a MiscClassDecoder window into
//	any application.
//	
//		Written by Stephan Wacker <stephan@rodion.muc.de>
//		Copyright (c) 1994 by Stephan Wacker.
//		Version 1.0  All rights reserved.
//
//		This notice may not be removed from this source code.
//
//	This object is included in the MiscKit by permission from the author
//	and its use is governed by the MiscKit license, found in the file
//	"LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
//	for a list of all applicable permissions and restrictions.
//

#if 0 // Description
#

How can you create a window in another person's app?

1) Start the app from gdb and let it run.
2) When the app has initialized, stop it with Ctrl-C.
3) Issue these commands:
      print [[[[NXBundle alloc] initForDirectory: "/LocalDeveloper/Examples/MiscKit/MiscClassDecoder.app/MiscClassDecoder.bundle"] classNamed: "MiscClassDecoderSetup"] new]
      continue

That sould give you a MiscClassDecoder window. 

#
#endif // Description


#import "MiscClassDecoderSetup.h"

#define K_MyBundleName	"MiscClassDecoder"


@implementation MiscClassDecoderSetup


- init
// Create one instance of the interface.
{
    char	nibPath[MAXPATHLEN + 1];
    NXBundle	*bundle;
    
    if( ! (bundle = [NXBundle bundleForClass:[self class]]) )
    {
	NXRunAlertPanel( [[self class] name],
			 "Cannot find my bundle",
			 NULL, NULL, NULL );
	return nil;
    }
    
    // printf( "Bundle for directory %s loaded\n", [bundle directory] );
    
    if ( ! [bundle getPath: nibPath forResource: K_MyBundleName ofType: "nib"] )
    {
	NXRunAlertPanel( [[self class] name],
			 "Cannot find interface: " K_MyBundleName ".nib",
			 NULL, NULL, NULL );
	return nil;
    }
    
    if( ! [NXApp loadNibFile: nibPath owner: self] )
    {
	NXRunAlertPanel( [[self class] name],
			 "Cannot load interface: " K_MyBundleName ".nib",
			 NULL, NULL, NULL );
	return nil;
    }
    
    [window makeKeyAndOrderFront: self];
    // [window setFloatingPanel: YES];
    
    return self;
}


- window
{
    return window;
}


- decoder
{
    return decoder;
}


@end	// MiscClassDecoderSetup

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