#ifndef __FRMGEST_HPP__
#define __FRMGEST_HPP__
 
#ifdef ACTIVE_EDITOR
 
#include <afxtempl.h>
#include "FRMBase.hpp"
 
#define FRM_C_MaxRow    3
#define FRM_C_MaxCol    3
 
/****************************************/
#ifndef CPA_EXPORT
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif
#endif
/****************************************/
 
class CPA_EXPORT FRMGest
{
public:
    FRMGest(void);
    ~FRMGest(void);
 
public:
    int         m_iCanRefresh;
 
public:
    FRMBase     *ma_p_oWinArray[FRM_C_MaxCol+2][FRM_C_MaxRow+2];
    FRMBase     *ma_p_oOccupyArray[FRM_C_MaxCol+2][FRM_C_MaxRow+2];
    int         ma_iOrder[FRM_C_MaxCol+2][FRM_C_MaxRow+2];
    FRMBase     *mp_oFirstWindow;  
    int         m_iBeginSize;
 
    CList<FRMBase*,FRMBase*>    m_lstFrames;    /* List of all frames*/
 
private:
    void        mfn_vRecomputeSizeOpposite(FRMBase *, FRMBase *, char);
    void        mfn_vRecomputeSizeSame(FRMBase *, FRMBase *, char);
    void        mfn_vComputeActivatePos(FRMBase *);
    void        mfn_vExpandFrame(int, int);
    void        mfn_vExpandAll(void);
    void        mfn_vSearchNextOrder(int, int *, int *);
    FRMBase     *fn_vSearchHorizWindow(FRMBase *, int);
    FRMBase     *fn_vSearchVertWindow(FRMBase *, int);
 
public:
    void        mfn_vAddOneFrame(FRMBase *);
    void        mfn_vActivateWindow(FRMBase *);
    void        mfn_vDisactivateWindow(FRMBase *);
    void        mfn_vAWindowHasMoved(FRMBase *, char);
    void        mfn_vRefreshWindows(BOOL);
    void        mfn_vSetRefresh(BOOL);
    void        mfn_vUpdateWidthHeight(FRMBase *);
    void        mfn_vUpdateLastPos(void);
};
 
extern CPA_EXPORT FRMGest g_oFrameGest;
 
/*------------------------------------------------------------------------*/
class CPA_EXPORT BaseFrame : public CFrameWnd
{
public:
	void	mfnv_UpdateTitle(char *);
	virtual BOOL PreTranslateMessage( MSG* pMsg );
	afx_msg void OnActivate(UINT, CWnd*,BOOL);
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	/*CPA2 Gabi Dumitrascu 98/07/13*/
	afx_msg void OnNcMouseMove (UINT nHitTest, CPoint point);
	afx_msg UINT OnNcHitTest (CPoint point);
	/*End CPA2 Gabi Dumitrascu 98/07/13*/
	DECLARE_MESSAGE_MAP()
};
extern CPA_EXPORT BaseFrame	g_oBaseFrame;
 
#endif /* ACTIVE_EDITOR*/
 
#endif /* __FRMGEST_HPP__*/
