/*=========================================================================
* 
* TBKinter.hpp :  Banks DLL Interface - definition
* 
*
* Version			1.0
* Creation date		10/06/99	
* Revision date		
*
* Shaitan
*=======================================================================*/

#ifndef __TBK_INT_HPP__
#define __TBK_INT_HPP__


#include "ACP_Base.h"
#include "ITF.h"

// if you want only one instance of your DLL
#define DLL_ONLY_ONE_INSTANCE


class TBK_BankObject;

/*===========================================================================
*		Description:	class TBK_BanksInterface
*		Creation date:	10/06/99
*		Author:			Shaitan
*---------------------------------------------------------------------------
*		Revision date:                                      Author:         
*=========================================================================*/

class TBK_BanksInterface : public CPA_ToolDLLBase
{

/*===========================================================================
	Class members
=========================================================================*/
private:

// KeyBoard
	CPA_KeyActionConfiguration	* m_pKeyboard;

// Frames
	CSplitFrame					* m_pLeftFrame;
	CSplitFrame					* m_pBottomFrame;

// Dialogs 
	CPA_DialogList				* m_pDialogList;

// icons for dialog list
	CImageList					  m_oIconList;

// tree root for dialog list
	CPA_SuperObject				* m_pTreeRoot;

// banks
	TBK_BankObject				* m_pCommonBank;
	TBK_BankObject				* m_pCurrentBank;
	long						  m_lBankIndex;

// selection
	CPA_SuperObject				* m_pSelectedSector;
	TBK_BankObject				* m_pSelectedBank;



/*===========================================================================
	Functions
=========================================================================*/
public:

    TBK_BanksInterface(void);
    ~TBK_BanksInterface(void);

	
	void m_fn_vSaveDialogsPreferences (void);

	void m_fn_vSetSectorColor (CPA_SuperObject *pEdObj, tdeLocalColor eColor);

	long m_fn_lAddANewBank	(void);

	TBK_BankObject * m_fn_pGetBankByIndex	(long lIndex);
	TBK_BankObject * m_fn_pGetBankBySector	(CPA_SuperObject *pSector);

	void m_fn_vNotifyBankHeader (void);

	static void TBK_fn_eCallBackSaveBankHeader (SCR_tdst_File_Description *p_stFile, char *szSectionName, void *p_vData, SCR_tde_Ntfy_Action eAction);

	static SCR_tde_Anl_ReturnValue TBK_fn_eCallBackLoadBank		(SCR_tdst_File_Description *p_stFile, char *szName, char *p_szParams[], SCR_tde_Anl_Action eAction);
	static SCR_tde_Anl_ReturnValue TBK_fn_eCallBackLoadCommon	(SCR_tdst_File_Description *p_stFile, char *szName, char *p_szParams[], SCR_tde_Anl_Action eAction);
	static SCR_tde_Anl_ReturnValue TBK_fn_eCallBackLoadHeader	(SCR_tdst_File_Description *p_stFile, char *szName, char *p_szParams[], SCR_tde_Anl_Action eAction);


//#################################################################################
// DLL FUNCTIONS OVERLOAD
//#################################################################################
public:

/*===========================================================================
	Inits
=========================================================================*/
 
    void fn_vJustAfterRegistered	(void);
	void fn_vConstruct				(void);

    void fn_vBeforeEngine			(void);
    void fn_vBeforeEditor			(void);

	void fn_vLevelChanges			(void);
	void fn_vLevelHasChanged		(void);
	

/*===========================================================================
	Dialog Bar & Menus
=========================================================================*/

	void fn_vDefineDlgBarBtnIcon (tde_DlgBarCategory wCategory, tds_DlgBarBtn *_pDlgBarBtn);

    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 bAsCurrentEditor);
	void _OnPopUpMenuCommand	(UINT m_IDCmdMsg);


/*===========================================================================
	Editor
=========================================================================*/
 
	tdePermission fn_eAcceptNewEditor	(CPA_EditorBase *pNewEditor)	 { return C_CloseBefore; }

	BOOL fn_bCanActivateEditor	(CPA_List<CPA_BaseObject> *pParams);

	void fn_vOnActivateEditor	(CPA_List<CPA_BaseObject> *pParam, BOOL bBackActivated=FALSE);
	void fn_vOnCloseEditor		(void);

    BOOL fn_bHasGainedFocus		(void);
    void fn_vHasLostFocus		(void);


/*===========================================================================
	Permissions
=========================================================================*/

	tdeTypeAnswer fn_bAcceptSelect	(CPA_SuperObject *pEdObj, ACP_tdxIndex xIndex, HIE_tdstPickInfo *pPicking, tdeStatus eStatus);

	BOOL fn_bAcceptModifDelete		(CPA_List<CPA_SuperObject> *pListObjects, tdeStatus eStatus);
	BOOL fn_bAcceptModifParent		(CPA_List<CPA_SuperObject> *pListObjects, tdeStatus eStatus);
	BOOL fn_bAcceptModifCopy		(CPA_List<CPA_SuperObject> *pListObjects, tdeStatus eStatus);
	BOOL fn_bAcceptModifTranslate	(CPA_List<CPA_SuperObject> *pListObjects, tdeStatus eStatus);
	BOOL fn_bAcceptModifRotate		(CPA_List<CPA_SuperObject> *pListObjects, tdeStatus eStatus);
	BOOL fn_bAcceptModifScale		(CPA_SuperObject *pEdObj, tdeStatus eStatus);
	BOOL fn_bAcceptModifInsert		(CPA_SuperObject *pEdObj, CPA_SuperObject *pParent, tdeStatus eStatus);


/*===========================================================================
	Modifs
=========================================================================*/

	void fn_vOnSelect		(CPA_SuperObject *pEdObj, tdeTypeModif eType, tdeStatus eStatus);
	void fn_vOnModifName	(CPA_SuperObject *pEdObj, CString csInitalName, CString csFinalName, tdeTypeModif eType, 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_vOnModifInsert	(CPA_SuperObject *pEdObj, CPA_SuperObject *pParent, tdstPosition *p_stPosition, tdeTypeModif eType, tdeStatus eStatus);

	void fn_vOnChangeRoot	(void);
	void fn_vOnChangeWorld	(void);
	void fn_vOnChangeDevice (void);


/*===========================================================================
	Messages
=========================================================================*/

    BOOL _OnKeyDown			(UINT nChar, UINT nRepCnt, UINT nFlags);
    BOOL _OnKeyUp			(UINT nChar, UINT nRepCnt, UINT nFlags);
    BOOL _OnLButtonDown		(UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *pPicking);
    BOOL _OnRButtonDown		(UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *pPicking);
    BOOL _OnLButtonDblClk	(UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *pPicking);

/*===========================================================================
	for Dialog List
=========================================================================*/

	void GetListsForDialog			(CPA_DialogList *pDialog);
	void fn_vInitDefaultParameters	(CPA_DialogList *pDialog);

	BOOL fn_bOnButtonTest			(CPA_DialogList *pDialog, CString csListName, tdeListDrawMode eDraw);
	void fn_vSetANewTest			(CPA_DialogList *pDialog, CString csCurrentType);

	int	GetIconForListItem			(CPA_DialogList *pDialog, CString csListName, CPA_BaseObject *pObject);
	int	GetIconForTreeItem			(CPA_DialogList *pDialog, CString csListName, CPA_BaseObject *pObject);

	CPA_BaseObject * GetTreeNodeNextChild	(CPA_DialogList *pDialog, CString csListName, CPA_BaseObject *pParent, CPA_BaseObject *pCurrentChild);
	CPA_BaseObject * GetDialogSelection		(CPA_DialogList *pDialog, CString csListName, tdeListDrawMode eDrawMode);

	BOOL fn_bCanDragItemInHierarchyTree		(CPA_DialogList *pDialog, CString csListName, CPA_BaseObject *pObjectToDrag);
	BOOL fn_bCanDropItemInHierarchyTree		(CPA_DialogList *pDialog, CString csListName, CPA_BaseObject *pObjectToDrop, CPA_BaseObject *pTarget);
	BOOL fn_bOnDragDropInHierarchyTree		(CPA_DialogList *pDialog, CString csListName, CPA_BaseObject *pObject, CPA_BaseObject *pTarget);

	BOOL fn_bOnKeyDownInDialog				(CPA_DialogList *pDialog, CString csListName, tdeListDrawMode eDraw, CPA_BaseObject *pSelectedObject, UINT nChar, UINT nRepCnt, UINT nFlags);

	BOOL fn_bOnSelChangeHierarchyTree		(CPA_DialogList *pDialog, CString csListName, CPA_BaseObject *pSelectedObject, CPA_BaseObject *pSelectedParent);
};


extern tdstDLLIdentity TBK_g_stBanksIdentity;


#endif // __TBK_INT_HPP__
