/* @(#)Z 1.8 com/src/ui/StdDisp.cpp, odui, od96nt, odnt9712d 97/03/21 16:49:12 (97/01/24 15:47:06) */
//====START_GENERATED_PROLOG======================================
//
//
//   COMPONENT_NAME: odui
//
//   CLASSES: none
//
//   ORIGINS: 82,27
//
//
//   (C) COPYRIGHT International Business Machines Corp. 1995,1996
//   All Rights Reserved
//   Licensed Materials - Property of IBM
//   US Government Users Restricted Rights - Use, duplication or
//   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
//   	
//   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
//   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
//   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
//   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
//   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
//   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
//   OR PERFORMANCE OF THIS SOFTWARE.
//
//====END_GENERATED_PROLOG========================================
//

/*
	File:		StdDisp.cpp

	Contains:	xxx put contents here xxx

	Owned by:	xxx put writers here xxx

	Copyright:	© 1994 - 1995 by Apple Computer, Inc., all rights reserved.

	Change History (most recent first):

		 <6>	  8/3/95	RR		#1257260: Collapse B classes. Remove
									somInit methods. Don't call IsInitialized
									or SubclassResponsibility
		 <5>	 6/15/95	RR		#1254828/1255536 Added eventInfo to
									Dispatch()
		 <4>	 5/26/95	RR		#1251403: Multithreading naming support
		 <3>	 4/13/95	RR		# 1216618 Added ODVolatile
		 <2>	  4/7/95	RR		#1216618 Added SOM_TRY etc.
		 <1>	 6/24/94	RR		first checked in

	To Do:
*/


/*
 *  This file was generated by the SOM Compiler.
 *  Generated using: 
 *      SOM Emitter emitxtm.dll: somc/smmain.c
 */

#define ODStandardDispatchModule_Class_Source
#define VARIABLE_MACROS
#include <StdDisp.xih>

#ifdef _PLATFORM_MACINTOSH_
#ifndef _STDDISPM_
#include "StdDispM.h"
#endif
#endif // _PLATFORM_MACINTOSH_

#ifdef _PLATFORM_OS2_
#ifndef _STDDISPM_
#include "StdDispO.h"
#endif
#endif // _PLATFORM_OS2_

#ifndef _ODUTILS_
#include "ODUtils.h"
#endif

SOM_Scope void  SOMLINK ODStandardDispatchModuleInitStandardDispatchModule(ODStandardDispatchModule *somSelf, Environment *ev,
		ODSession* session)
{
    ODStandardDispatchModuleData *somThis = ODStandardDispatchModuleGetData(somSelf);
    ODStandardDispatchModuleMethodDebug("ODStandardDispatchModule","InitStandardDispatchModule");
    
	/* Moved from somInit. SOM itself sets fields to zero
	_fMacImplementation = kODNULL;
	_fOS2Implementation = kODNULL;
	*/
	
#ifdef _PLATFORM_MACINTOSH_
    MacDispatchModule* module = kODNULL; ODVolatile(module);
#endif // _PLATFORM_MACINTOSH_

#ifdef _PLATFORM_OS2_
    OS2DispatchModule* module = kODNULL; ODVolatile(module);
#endif // _PLATFORM_OS2_
    
    try {
	
	#ifdef _PLATFORM_MACINTOSH_
		module = new MacDispatchModule;
		module->InitMacDispatchModule(ev, session);
		_fMacImplementation = module;
	#endif // _PLATFORM_MACINTOSH_

	#ifdef _PLATFORM_OS2_
		somSelf->InitDispatchModule(ev,session);   // [107613]
		module = new OS2DispatchModule;
		module->InitOS2DispatchModule(ev, session);
		_fOS2Implementation = module;
	#endif // _PLATFORM_OS2_
	
    }
    catch(ODException _exception) {

#if defined(_PLATFORM_MACINTOSH_) || defined(_PLATFORM_OS2_)
		ODDeleteObject(module);
#endif // _PLATFORM_MACINTOSH_, _PLATFORM_OS2_
		
        ODSetSOMException(ev,_exception);
    }
}

SOM_Scope void  SOMLINK ODStandardDispatchModulesomUninit(ODStandardDispatchModule *somSelf)
{
    ODStandardDispatchModuleData *somThis = ODStandardDispatchModuleGetData(somSelf);
    ODStandardDispatchModuleMethodDebug("ODStandardDispatchModule","somUninit");

#ifdef _PLATFORM_MACINTOSH_
	delete _fMacImplementation;
#endif

#ifdef _PLATFORM_OS2_
	delete _fOS2Implementation;
#endif

    parent_somUninit(somSelf);
}

SOM_Scope ODBoolean  SOMLINK ODStandardDispatchModuleDispatch(ODStandardDispatchModule *somSelf, Environment *ev,
		ODEventData* event,
		ODEventInfo* eventInfo)
{
    ODStandardDispatchModuleData *somThis = ODStandardDispatchModuleGetData(somSelf);
    ODStandardDispatchModuleMethodDebug("ODStandardDispatchModule","Dispatch");
    
    ODBoolean handled = kODFalse;
    
	try {

	    #ifdef _PLATFORM_MACINTOSH_
		handled = _fMacImplementation->Dispatch(ev, event, eventInfo);
	    #endif
	    #ifdef _PLATFORM_OS2_
		handled = _fOS2Implementation->Dispatch(ev, event, eventInfo);
	    #endif
   	 
   	}
        catch(ODException _exception) {
            ODSetSOMException(ev,_exception);
        }
   	
   	return handled;
}
