
//
// Copyright 1994 (c) Todd Anthony Nathan.  All Rights Reserved.
//
// Wed Apr 27 21:29:45 GMT-0700 1994
//

#import <appkit/appkit.h>
#import "ExplodingMenus.h"	// This XModule header.
#import "ExplodingMenusConstants.h"
#import "ExplodingMenu.h"		// Stone Design's object
#import <appkit/nextstd.h>		// NXLogError
#import <mach/cthreads.h>

/*
 * Keep track of the mach header where we get loaded
 * so we can use it to load other stuff later (such as
 * nib files)
 * Note: only needed in XModules that load nib files, etc.
 */
 
static struct mach_header	*loadHeader = NULL;

@implementation ProgressPanel : XModule

- init
{
	[super init];

	return ( self );
}

- free
{
	// Do your stuff here...

	return ( [super free] );
}

+ (const char *)moduleName
{
	return ( "ProgressPanel" );
}

+ (const char **)xCmdsAndFcns
{
	static char *handlerList[] = {
		"showmenus",
		"hidemenus",
		"em_version",
		NULL
	};
	return ( handlerList );
}

- prepareToExecuteHandlers
{
	// [self loadInterfaceData];
	return ( self );
}

- executeHandler:(NXAtom)handlerName
{
	if (!strcmp(handlerName, "showmenus")) {
		return ( [self showMenus] );
	} else if (!strcmp(handlerName, "hidemenus")) {
		return ( [self hideMenus] );
	} else if (!strcmp(handlerName, "em_version")) {
		return ( [self em_version] );
	} else  return ( nil ); // handlerName not recognized!
}

+ finishLoading:(struct mach_header *)header
{
	loadHeader = header; // Save this for later use
	return ( self );
}

- loadInterfaceData
{
	//[NXApp loadNibSection:"MyXModule.nib" owner:self
	//    withNames:NO fromHeader:loadHeader] )
		
	return ( self );
}

// XModule specific code...
//
- showMenus
{
	[[ExplodingMenu sharedInstance] explodeMenus:YES];
	return ( [[self getEmptyContainer] setString: ""] );

}

- hideMenus
{
	[[ExplodingMenu sharedInstance] explodeMenus:NO];
	return ( [[self getEmptyContainer] setString: ""] );
}

- em_version
{
	id		version;

	version = [[ self getEmptyContainer ] setString:"r" ];
	[ version appendString:EM_RELEASE ];
	[ version appendString:" v" ];
	[ version appendString:EM_VERSION ];
	[ version appendString:"    " ];
	[ version appendString:EM_RELTIME ];
	[ version appendString:"\n" ];
	[ version appendString:EM_COPYRIGHT ];

	return ( version );
}

@end

