/*=========================================================================*/
/* DEVDevic.hpp :	Device dealed by MultiDevice.*/
/* This is a part of the PCA project.*/
/**/
/* Version			1.0*/
/* Creation date	26/06/96*/
/* Revision date*/
/**/
/* (c) Ubi Studios 1996*/
/**/
/* DO NOT MODIFY THAT FILE. IF SOMETHING NEEDS TO BE CHANGE, PLEASE CONTACT*/
/* OLIVIER DIDELOT OR MARC VILLEMAIN.*/
/*=========================================================================*/
 
#ifndef __DEVDEVIC_HPP__
#define __DEVDEVIC_HPP__
 
/*#include "Tde.h"*/
#define HieFriend
#include "LST.h"
#undef HieFriend
 
class DEV_ViewPort;
class DEV_MultiDevice;
class DEV_MultiDevice2D;
class DEV_MultiDevice3D;
class FRMSplitter;
class FRMBaseMenu;
class CPA_DialogBar;
 
 
 
 
 
#ifdef ACTIVE_EDITOR
 
 
 
 
 
 
 
 
class CPA_SuperObject;
 
/****************************************/
#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
/****************************************/
 
 
/*
#define M_DGetParentMultiDevice()        ((DEV_MultiDevice *)   (GetWindowParent()))
#define M_DGetParentMultiDevice2D()      ((DEV_MultiDevice2D *) (GetWindowParent()))
#define M_DGetParentMultiDevice3D()      ((DEV_MultiDevice3D *) (GetWindowParent()))
*/
/* type of view in the device.*/
#define C_DEVICE2D 0
#define C_DEVICE3D 1
 
#define DEV_YCaption    8       /* Size of caption bar*/
 
class CPA_EXPORT DEV_Device : public CWnd
{
public:
	DEV_Device();
	virtual ~DEV_Device();
 
public:
	GLD_tdhDevice	m_hDisplayDevice;
 
private:
	CWnd			*m_p_oWndParent;
	DEV_ViewPort	*mpViewPort;            /* ViewPort in the client zone.*/
	int				mType;                  /* Type of Device.*/
	UINT			mViewType;              /* 2D or 3D.*/
	BOOL			mbFullScreen;
	BOOL			mbFreezed;
	char			mRed, mGreen, mBlue;    /* Background Color.*/
	CRect			m_stRectWhileFullscreen;
 
#ifdef ACTIVE_EDITOR
    CBitmap         m_oBmClose;             /* Bitmap to close frame*/
    CBitmap         m_oBmGameRefresh1;      
    CBitmap         m_oBmGameRefresh2;      
    CRect           m_oRestoreRect;         /* Restore position of window*/
    BOOL            m_bIsMaximize;          /* Is device maximized ?*/
	int		        mNumber;                /* number of Device.*/
    CRect           m_oSizingRect;          /* Current rectangle for resizing*/
    double          m_dfProp;               /* Proportionnal resizing*/
public:
    BOOL            mbGameRefresh;          /* Engine will refresh that device ?*/
 
#endif /* ACTIVE_EDITOR*/
 
public:
	int						GetNumber();
    GLI_tdxHandleToCamera	GetCamera();
	DEV_ViewPort *			GetViewPort()				{ return mpViewPort; };
    CWnd *					GetWindowParent()			{ return m_p_oWndParent; }
	DEV_MultiDevice *		GetParentMultiDevice()		{ return (DEV_MultiDevice *) m_p_oWndParent; }
	DEV_MultiDevice2D *		GetParentMultiDevice2D()	{ return (DEV_MultiDevice2D *) m_p_oWndParent; }
	DEV_MultiDevice3D *		GetParentMultiDevice3D()	{ return (DEV_MultiDevice3D *) m_p_oWndParent; }
	FRMSplitter	*			GetParentSplitter()			{ return (FRMSplitter *) GetParent()->GetParent(); }
	CPA_DialogBar *			GetParentDialogBar();
 
#ifdef ACTIVE_EDITOR
	FRMBaseMenu*			GetParentFrame();
#else
	CFrameWnd*				GetParentFrame();
#endif
 
#ifdef ACTIVE_EDITOR
	void	        SetNumber(int);
	void	        CreateDevice(void *,int,int,int,int, UINT);
    BOOL            IsMaximize();
#endif /* ACTIVE_EDITOR*/
 
	void					AfterCreate();
	BOOL	        IsFreezed()	                                                { return mbFreezed; };
	void	        Freeze()	                                                { mbFreezed = TRUE; ShowWindow(SW_HIDE); };
	void	        Unfreeze()	                                                { mbFreezed = FALSE; ShowWindow(SW_SHOW); };
	void	        SetBackgroundColor(COLORREF Color);
	void	        SetBackgroundColor(char Red, char Green, char Blue);
	void	        GetBackgroundColor(char *Red, char *Green, char *Blue);
	void	        CreateDeviceBackground(void *, UINT);
	BOOL            IsFullScreen()	                                            { return mbFullScreen; };
	BOOL	        SwapFullScreen(BOOL Show = TRUE);
	void            SetMainWindowForRender(BOOL Show = TRUE); //chbani 
 
#ifdef ACTIVE_EDITOR
	void	        DrawObject(GLI_tdxHandleToLight hLight, HIE_tdxHandleToSuperObject hObject);
	void	        DrawEditorObject(GLI_tdxHandleToLight hLight, CPA_SuperObject *pRoot);
    void            DrawDeviceTitle(void);
#endif /* ACTIVE_EDITOR*/
 
protected:
	/*{{AFX_MSG(DEV_Device)*/
	afx_msg void    OnDestroy();
	afx_msg void    OnSize(UINT nType, int cx, int cy);
	afx_msg int     OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message);
	afx_msg int     OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void    OnWindowPosChanging(WINDOWPOS FAR* lpwndpos);
	afx_msg void    OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
	afx_msg void    OnPaint();
    afx_msg BOOL    OnNcActivate(BOOL bActiv);
	afx_msg void    OnSysCommand(UINT nID, LPARAM lParam);
#ifdef ACTIVE_EDITOR
    afx_msg void    OnSizing(UINT, LPRECT);
    afx_msg void    OnNcLButtonDblClk(UINT, CPoint);
    afx_msg void    OnNcMouseMove(UINT nHitTest, CPoint point);
    afx_msg void    OnNcPaint(void);
    afx_msg void    OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp);
    afx_msg UINT    OnNcHitTest(CPoint point);
    afx_msg void    OnNcRButtonDown(UINT HitTest, CPoint point);
    afx_msg void    OnNcLButtonDown(UINT HitTest, CPoint point);
    afx_msg void    OnNcLButtonUp(UINT HitTest, CPoint point);
 
    /* Message from title context menu*/
    afx_msg void    OnCxtMenu1();
    afx_msg void    OnCxtMenu2();
    afx_msg void    OnCxtMenu3();
    afx_msg void    OnCxtMenu4();
    afx_msg void    OnCxtMenu5();
    afx_msg void    OnCxtMenu6();
    afx_msg void    OnCxtMenu7();
    afx_msg void    OnCxtMenu8();
    afx_msg void    OnCxtMenu9();
    afx_msg void    OnCxtMenu10();
    afx_msg void    OnCxtMenu11();
    afx_msg void    OnCxtMenu12();
#endif /* ACTIVE_EDITOR*/
	/*}}AFX_MSG*/
 
	DECLARE_MESSAGE_MAP()
};
 
/*///////////////////////////////////////////////////////////////////////////*/
 
 
 
 
 
 
 
 
 
 
 
 
 
#else
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/****************************************/
#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
/****************************************/
 
 
/* type of view in the device.*/
#define C_DEVICE2D 0
#define C_DEVICE3D 1
 
#define DEV_YCaption    8       /* Size of caption bar*/
 
class CPA_EXPORT DEV_Device : public CWnd
{
public:
	DEV_Device();
	virtual ~DEV_Device();
 
public:
	GLD_tdhDevice	m_hDisplayDevice;
 
private:
	CWnd			*m_p_oWndParent;
	DEV_ViewPort	*mpViewPort;            /* ViewPort in the client zone.*/
	int				mType;                  /* Type of Device.*/
	UINT			mViewType;              /* 2D or 3D.*/
	BOOL			mbFullScreen;
	BOOL			mbFreezed;
	char			mRed, mGreen, mBlue;    /* Background Color.*/
	CRect			m_stRectWhileFullscreen;
 
 
public:
	void					AfterCreate();
	int						GetNumber();
    GLI_tdxHandleToCamera	GetCamera();
	DEV_ViewPort *			GetViewPort()				{ return mpViewPort; };
    CWnd *					GetWindowParent()			{ return m_p_oWndParent; }
	DEV_MultiDevice *		GetParentMultiDevice()		{ return (DEV_MultiDevice *) m_p_oWndParent; }
	DEV_MultiDevice2D *		GetParentMultiDevice2D()	{ return (DEV_MultiDevice2D *) m_p_oWndParent; }
	DEV_MultiDevice3D *		GetParentMultiDevice3D()	{ return (DEV_MultiDevice3D *) m_p_oWndParent; }
	FRMSplitter	*			GetParentSplitter()			{ return (FRMSplitter *) GetParent()->GetParent(); }
	CPA_DialogBar *			GetParentDialogBar();
 
	CFrameWnd*				GetParentFrame();
 
	BOOL	        IsFreezed()	                                                { return mbFreezed; };
	void	        Freeze()	                                                { mbFreezed = TRUE; ShowWindow(SW_HIDE); };
	void	        Unfreeze()	                                                { mbFreezed = FALSE; ShowWindow(SW_SHOW); };
	void	        SetBackgroundColor(COLORREF Color);
	void	        SetBackgroundColor(char Red, char Green, char Blue);
	void	        GetBackgroundColor(char *Red, char *Green, char *Blue);
	void	        CreateDeviceBackground(void *, UINT);
	BOOL            IsFullScreen()	                                            { return mbFullScreen; };
	BOOL	        SwapFullScreen();
 
 
protected:
	/*{{AFX_MSG(DEV_Device)*/
	afx_msg void    OnDestroy();
	afx_msg void    OnSize(UINT nType, int cx, int cy);
	afx_msg int     OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message);
	afx_msg int     OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void    OnWindowPosChanging(WINDOWPOS FAR* lpwndpos);
	afx_msg void    OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
	afx_msg void    OnPaint();
    afx_msg BOOL    OnNcActivate(BOOL bActiv);
	/*}}AFX_MSG*/
 
	DECLARE_MESSAGE_MAP()
};
 
/*////////////////////////*/
 
 
#endif
 
 
#endif /* __DEVDEVIC_HPP__*/
