//
//	Copyright © 2005 Nemetschek North America 
//	All Rights Reserved.
//
// Created by Vladislav Stanev

#pragma once

namespace VWFC
{
	namespace PluginSupport
	{
		enum EMenuCallbackEvent {
			kMenuCallbackEventActiveDocChange	= 'DOCC',		// Send when a different document becomes the frontmost one
			kMenuCallbackEventDocClose			= 'DCLS',		// Send when a document closes.
			kMenuCallbackEventSelChange			= 'SELC',
			kMenuCallbackEventLockObjectChange	= 'Lock',		// Object(s) have had their Lock flag changed.
			kMenuCallbackEventMenuDone			= 'DONE',
			kMenuCallbackEventWPChange			= 'wpch',
			kMenuCallbackEventWPListChange		= 'wpxx',
			kMenuCallbackEventDimStdChange		= 'DIMS',
			kMenuCallbackEventLayerChange		= 'LAYR',
			kMenuCallbackEventClassChange		= 'CLAS',
			kMenuCallbackEventSubscripAddDel	= 'SbAD',		// Send when a subscription [reference] has been added or deleted
			kMenuCallbackEvent3DViewChange		= '3DVC',
			kMenuCallbackEventViewChange		= 'VIEW',
			kMenuCallbackEventTextChange		= 'TEXT',		// Send when text menus or att palette is changed on a VW text object
			kMenuCallbackEventWallStyleChange	= 'WaCh',		// Send when a Wall Style has been added, deleted, or edited
			kMenuCallbackEventWallAdd		 	= 'WAdd',		// Send when a wall or round wall has been added
			kMenuCallbackEventWallDelete	 	= 'WDel',		// Send when a wall or round wall has been deleted
			kMenuCallbackEventWallEdit		 	= 'WEdt'		// Send when a wall or round wall has been edited
		};

		// ---------------------------------------------------------------------------
		class VWPluginMenuApp
		{
		public:
								VWPluginMenuApp();
			virtual				~VWPluginMenuApp();

		public:
			virtual void		InitializeApp();
			virtual void		DeinitializeApp();

			virtual TXString	GetContextualHelpID() const;

			virtual void		DoInterface();
			virtual void		NotifyCallback(EMenuCallbackEvent event);

			virtual bool		GetItemEnabled();

			virtual long		GetUserData() const;
			virtual void		SetUserData(long userData);
			long				GetResult() const;
			void				SetResult(long result);
			void				SetMenuChunkInfo(MenuChunkInfo* pMenuChunkInfo);

			// The default event notificaiotn
			// if no virutal is present for an event, this function is called to allow the user to catch everything
			virtual long		OnDefaultEvent(long action, long message);

		public:
			void				RegisterForCallback(EMenuCallbackEvent event);
			void				UnRegisterForCallback(EMenuCallbackEvent event);

		protected:
			MenuChunkInfo*		fpMenuChunkInfo;
			long				fResult;
		};
	}
}

// ------------------------------------------------------------------------------
#define	INSTANTIATE_MENU_APP(T)	VWFC::PluginSupport::VWPluginMenuApp* CreateMenuInstance()  { void* pRawMem = malloc( sizeof(T) ); return (T*) new (pRawMem) T(); }
