/*
 =======================================================================================
  Name        : PO_Inter.hpp
 
  Author      : vincent lhullier            Date :01/09/97
 
  Description : PO DLL interface class
 =======================================================================================
  Modification -> Author :                  Date :
  Description :
 =======================================================================================
 */
 
 
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
 
#ifndef __PO_INTER_HPP__
#define __PO_INTER_HPP__
 
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#define D_PhysiCol_Define
#include "MEC.h"
#include "GAM.h"
#undef D_PhysiCol_Define
#include "EditorPO.hpp"
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
class CPODlgVse;
class CPODlgList;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#define DLL_ONLY_ONE_INSTANCE
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
 
/*
 *=======================================================================================
	Constants
 *=======================================================================================
 */
/*
 * constant for Query Action
 */
#define OPD_ActionEncapsulateObject	1
#define OPD_ActionCreateEmptyPO		2
#define OPD_ActionSecondPass        3
 
/*ROMTEAM WorldEditor (Nicu 28/10/97) */
#define OPD_ActionCreateGeometricPO		4
class Shape3D;
/*ENDROMTEAM WorldEditor (Nicu) */
 
/*
 *=============================================================================
	Instanciated Physical Object DLL interface class
 *=============================================================================
 */
class POInterface: public CPA_ObjectDLLBase
{
  private:
    EditorPO		*m_p_oSelectedPO;
	CPA_BaseObject	*m_p_oSelectedActor;
 
	CPODlgVse		*m_p_oDlgVse;
	CPODlgList		*m_p_oDlgList;
    CSplitFrame		*m_p_oSplitterLeft;
 
/*ROMTEAM WorldEditor (Cristian Stegaru 01/98)*/
public:
	CStringList							m_lstNameOfCandidateEPO;
	CTypedPtrList <CPtrList, EditorPO*> m_lstOfCandidateEPO;
	CString								m_csEPOFile;
	BOOL								m_bEPOListOK;
/*ENDROMTEAM WorldEditor (Cristian Stegaru)*/
 
  public:
	/* ==> Constructor */
    POInterface();
 
	/* ==> communication between the different dialog boxes */
	void	fn_vDisplayPOInfo( EditorPO *_p_oPO );
 
	/* ==> ACP MEssages Functions overload */
    void    fn_vJustAfterRegistered   (void);
    void    fn_vConstruct             (void);
    void    fn_vBeforeEngine          (void);
    void    fn_vBeforeEditor          (void);
 
/*ROMTEAM WorldEditor (Cristian Stegaru 01/98)*/
	void    fn_vBeforeSaveAll         (void);
/*ENDROMTEAM WorldEditor (Cristian Stegaru)*/
 
	/* ==> for changes */
    void	fn_vOnChangeRoot          (void);
    void	fn_vOnChangeWorld         (void);
    void	fn_vOnChangeDevice        (void);
 
    /* ==> Editor Modifs */
	BOOL	fn_bAcceptModifCopy(CPA_List<CPA_SuperObject> *pListObjects, tdeStatus eStatus);
    void	fn_vOnModifDelete  (CPA_List<EDT_SaveParents> *pListObjects, tdeTypeModif eType, tdeStatus eStatus);
    void	fn_vOnModifParent  (CPA_List<EDT_SaveParents> *pListObjects, tdeTypeModif eType, tdeStatus eStatus);
    void	fn_vOnModifCopy    (CPA_List<EDT_SaveParents> *pListObjects, tdeTypeModif eType, tdeStatus eStatus);
    void	fn_vOnModifName    (CPA_SuperObject *pEdObj, CString csInitalName, CString csFinalName, tdeTypeModif eType, tdeStatus eStatus);
    void	fn_vOnSelect       (CPA_SuperObject *pEdObj, tdeTypeModif eType, tdeStatus eStatus);
 
/*===========================================================================
	Dialog Bar - Mircea Dunka 31 Aug. 1998
=========================================================================*/
	void fn_vDefineDlgBarBtnIcon (tde_DlgBarCategory wCategory, tds_DlgBarBtn *_pDlgBarBtn);
 
	/* ==> Menus */
    BOOL	fn_bDefineSubMenu            (EDT_SubMenu *_p_oEDTSubMenu);
    void	_OnSubMenuCommand            (EDT_SubMenu *_p_oEDTSubMenu,UINT uiMsgID);
 
    BOOL	fn_bDefinePopupMenu(EDT_PopUpMenu *pPopup, CPA_List<CPA_SuperObject> *pSelection, BOOL bIsAlone);
    void	_OnPopUpMenuCommand(UINT m_IDCmdMsg);
 
	/* ==> Current Editor */
    tdePermission fn_eAcceptNewEditor (CPA_EditorBase *pNewDLL)     { return C_CloseBefore; }
	/*tdePermission fn_eAcceptNewEditor (CPA_EditorBase *pNewDLL)     { return C_Allow; }*/
 
	BOOL	fn_bGetPOFromObject( CPA_BaseObject *_p_oObject );
	BOOL	fn_bGetPOFromListOrSelection( CPA_List<CPA_BaseObject> *_p_oListObjects );
 
    BOOL	fn_bCanActivateEditor        (CPA_List<CPA_BaseObject> *pParam);
    BOOL	fn_bCanCloseEditor           (void);
 
    void	fn_vOnActivateEditor         (CPA_List<CPA_BaseObject> *pParam, BOOL bBackActivated=FALSE);
    void	fn_vOnCloseEditor            (void);
 
 
	/* ==> General Purpose */
	long	OnQueryAction  (CPA_EditorBase * /*p_oSender*/, WPARAM, LPARAM);
 
	/* ==> Reachable Objects */
	BOOL	fn_bLoadBaseObject(CPA_BaseObject *p_oObject);
 
 
	/*====================================================================================*/
	/*========================= OBJECT DLL FUNCTIONS OVERLOAD ============================*/
	/*====================================================================================*/
 
	/* ==> hierarchy */
    CPA_SuperObject *   GetNewEditorInstance(HIE_tdxHandleToSuperObject hEngineInstance);
	void				fn_vBuildNewEditorInstance (CPA_SuperObject *pEditorInstance, HIE_tdxHandleToSuperObject hEngineInstance);
    BOOL                fn_bCanHandleThisType(long lEngineType);
 
	/* ==> models & instances */
    void				fn_vInitListByType(CPA_World *pWorld);
 
	/* ==> objects */
    CPA_BaseObject		*Duplicate(CPA_BaseObject *pObject, CPA_SuperObject *pNewSuperObject);
 
	/*====================================================================================*/
	/* Owner*/
	/*====================================================================================*/
    void fn_vNameChanged            (void);
	void fn_vComputeBoundingVolume	(CPA_BaseObject *pObj);
	ACP_tdxHandleOfObject fn_hGetBoundingVolume (CPA_BaseObject *_pObj);
 
  protected:
    void fn_vUnSelect               (void);
 
 
 
/*ROMTEAM WorldEditor (Cristian Stegaru 01/98)*/
public:
	  BOOL mfn_bIsACandidateEPO (const CString csName);
	  int mfn_iGetEPOIdx (CString csEPOName);
	  void mfn_vFillListOfCandidateEPO ();
	  PO_tdxHandleToPhysicalObject mfn_hGethPOFromGeomObj (Geometry3D *pG3D);
	  Shape3D* mfn_pGetGeomObjFromEPOName (CString csEPOName);
	  EditorPO * mfn_pGetEPOwithGeomObjAttached (PO_tdxHandleToPhysicalObject hPO, CPA_BaseObject *pOwner, char *szSection);
/*ENDROMTEAM WorldEditor (Cristian Stegaru)*/
};
 
#undef extern
extern tdstDLLIdentity g_stPOIdentity;
 
#endif /* __PO_INTER_HPP__*/
