/****************************************************************************************

		BasicModule.h

		Copyright: (c) 2001 Eovia Corp. All rights reserved.

		Author:	Ray Dream
		Date:	9/23/98

		Revision History

		when		who					what & why
		==========	================	======================================================
		09/12/99	Pierre		Merged BecameFirstResponder and ResignedFirstResponder
		8/26/99		Yann		Changes related to undoable actions for creating/destroying sub modules (MMMM)
		08/11/99	Guillaume&Christy	Added inheritance to all the Basic* classes
		8/10/99		cph					remove IExtension (now part of IExDataExchanger)
		05/06/99	Arnaud				Added GetPreferredRoom
		3/23/99		Greg				Added DragDrop tool support
		1/18/99		Joshua				Added BuildMenuBar
		11/24/98	Joshua				Added SelfToolAction
		10/1/98		Eml					Added IMCUnknown* pUnkOuter to Clone
		10/01/98	EricG				added argument to DrawContent
		9/29/98		Emil				added DrawContent ( was added by EricG in I3DExModule.h)

*****************************************************************************************/

#ifndef __BasicModule__
#define __BasicModule__

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "BasicCOMImplementations.h"
#include "I3DExModule.h"
#include "IChangeManagement.h"
#include "IMFExResponder.h"

struct I3DExEditorPanePart;



/**********************************************************************\
*                                                                      *
*     TBasicModule                                                     *
*                                                                      *
\**********************************************************************/


/// \addtogroup BaseClass
/// \{

/// Derive your object from this class if you want to implement a module (modeler)
///
/// \see I3DExModule
///
class TBasicModule : public TBasicDataExchanger,
					 public IMFExResponder,
					 public I3DExModule,
					 public IChangeListener
{
	public:
		virtual MCCOMErr			MCCOMAPI QueryInterface					(const MCIID& riid, void** ppvObj);
		virtual uint32 				MCCOMAPI AddRef							()	{ return TBasicDataExchanger::AddRef(); }
		virtual uint32				MCCOMAPI Release();

		virtual	void				MCCOMAPI Clone							(IExDataExchanger** clonedObject,IMCUnknown* pUnkOuter);
		virtual boolean				MCCOMAPI IsEqual						(IExDataExchanger * otherDataExchanger);
		virtual MCCOMErr			MCCOMAPI GetParameter					(IDType keyword, void* parameter);
		virtual MCCOMErr			MCCOMAPI SetParameter					(IDType keyword, void* parameter);
		virtual void*				MCCOMAPI GetExtensionDataBuffer			();
		virtual MCCOMErr 			MCCOMAPI ExtensionDataChanged			();
		virtual MCCOMErr 			MCCOMAPI HandleEvent					(MessageID message, IMFResponder* source, void* data);
		virtual int16 				MCCOMAPI GetResID						();

		virtual MCCOMErr 			MCCOMAPI Initialize						(IMCUnknown* inElement);
		virtual MCCOMErr 			MCCOMAPI Destroy						();
		virtual MCCOMErr 			MCCOMAPI Hydrate						();
		virtual MCCOMErr 			MCCOMAPI Dehydrate						();
		virtual	MCCOMErr			MCCOMAPI Import							(IMCUnknown* inElement, void* inImportData);
		virtual MCCOMErr			MCCOMAPI BuildMenuBar					();//deprecated
		virtual MCCOMErr			MCCOMAPI BuildMenuBar					(IMCMenuBar* theBar);
		
		virtual MCCOMErr			MCCOMAPI GetPreferredRoom				(IDType& roomId);
		virtual boolean				MCCOMAPI WantsToBeInCurrentRoom			();
		virtual boolean				MCCOMAPI SubModuleClosedMainWindow		(I3DShModule* subModule);
		virtual	MCCOMErr			MCCOMAPI SubModuleAboutToBeDestroyed	(I3DShModule* subModule);
		virtual MCCOMErr			MCCOMAPI SubModuleAboutToBeHydrated		(I3DShModule* subModule);
		virtual boolean				MCCOMAPI HaveSubModuleActive			() { return false; }
		virtual MCCOMErr			MCCOMAPI AboutToCloseMainWindow			();
		virtual	boolean				MCCOMAPI SavesInNativeFormat			();
		//virtual	void				MCCOMAPI AddTools						(int32 toolbarIndex,IMFToolGroup*	inToolGroup)		{}
		virtual	MCCOMErr			MCCOMAPI GetDefaultPropertiesClient		(IPropertiesClient** outPropClient) { return MC_S_FALSE; }

		// IMFExResponder
		virtual	boolean				MCCOMAPI Receive						(int32 message, IMFResponder* source, void* data);
		virtual boolean				MCCOMAPI SelfMenuAction					(ActionNumber actionNumber);
		virtual void				MCCOMAPI SelfPrepareMenus				();
		virtual boolean				MCCOMAPI SelfKeyDown					(TMCPlatformEvent* event);
		virtual void				MCCOMAPI SelfKeyUp						(TMCPlatformEvent* event);
		virtual boolean				MCCOMAPI SelfToolAction					(int32 inOldTool, int32 inNewTool);
		virtual boolean 			MCCOMAPI GetToolDropCandidate			(IMFDropCandidate**	outDropCandidate, int32 inToolID,
																			 IMFToolbarPart* inToolbarPart);

		virtual boolean				MCCOMAPI GetIndirectToolAction			(IShMouseAction** outAction, ActionNumber& outActionNumber,
																			 IMFResponder** outContext, IMFPart** outPart, const TMCPoint& inWhere,
																			 int32 inToolID, IMFToolbarPart* inToolbarPart);
		virtual MCCOMErr			MCCOMAPI GetMainToolInfo(TModelerToolInfo& mainToolInfo) { return MC_E_NOTIMPL; }
		virtual boolean				MCCOMAPI IsToolBarActive(int32 toolBarIndex) { return true; }
	
		// IChangeListener
		virtual void 				MCCOMAPI DataChanged					(IChangeChannel* channel, IDType changeKind, IMCUnknown* changedData);
		virtual void				MCCOMAPI BecameFirstResponder			(boolean on);

		virtual	void				MCCOMAPI AddTools			(int32 toolbarIndex,IMFToolGroup*	inToolGroup);
		virtual void				MCCOMAPI DocumentAttached				() {}

protected:
		TMCCountedPtr<IChangeChannel>		fPreferencesChangeChannel;
};

/// \}


#endif