/*=========================================================================*/
/* DEVViewp.hpp :	Viewport used by the Device.*/
/* 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 __DEVVIEWP_HPP__
#define __DEVVIEWP_HPP__
 
#include "geo.h"
#include "gli.h"
#include "CPAMCapt.hpp"
 
/****************************************/
#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_PaintParent()                 ((DEV_Device *) GetDevice())->SendMessage(WM_PAINT)
#define M_PaintParentOf(instance)                 ((DEV_Device *) instance->GetDevice())->SendMessage(WM_PAINT)
/*
#define M_GetParentDevice()             ((DEV_Device *) GetDevice())
#define M_VGetParentMultiDevice()       ((DEV_MultiDevice *)   (((DEV_Device *) GetDevice())->GetWindowParent()))
#define M_VGetParentMultiDevice2D()     ((DEV_MultiDevice2D *) (((DEV_Device *) GetDevice())->GetWindowParent()))
#define M_VGetParentMultiDevice3D()     ((DEV_MultiDevice3D *) (((DEV_Device *) GetDevice())->GetWindowParent()))
#define M_GetParentContact()            (M_VGetParentMultiDevice()->GetContact())
#define M_VGetParentDialogBar()		(&(((FRMBaseMenu*)(M_VGetParentMultiDevice()->GetParent()->GetParent()))->m_oGeneralDialogBar)) 
*/
/*
#define M_VGetParentMultiDeviceOf(instance)       ((DEV_MultiDevice *)   (((DEV_Device *) instance->GetDevice())->GetWindowParent()))
#define M_VGetParentMultiDevice3DOf(instance)     ((DEV_MultiDevice3D *) (((DEV_Device *) instance->GetDevice())->GetWindowParent()))
#define M_GetParentContactOf(instance)            (M_VGetParentMultiDeviceOf(instance)->GetContact())
*/
#define M_VGetParentMultiDeviceOf(instance)       (instance->GetParentMultiDevice())
#define M_VGetParentMultiDevice3DOf(instance)     (instance->GetParentMultiDevice3D())
#define M_GetParentContactOf(instance)            (M_VGetParentMultiDeviceOf(instance)->GetContact())
 
 
class DEV_Device;
class DEV_MultiDevice;
class DEV_MultiDevice2D;
class DEV_MultiDevice3D;
class CPA_Contact;
class FRMBaseMenu;
class CPA_DialogBar;
 
class CPA_EXPORT DEV_ViewPort : public CWnd
#ifdef ACTIVE_EDITOR		/* MR0902*/
, public CPA_MouseCapturer
#endif
{
protected:
    DEV_Device  *m_p_oDevice;
 
public:
	DEV_ViewPort();
	virtual ~DEV_ViewPort();
 
#ifdef ACTIVE_EDITOR		/* MR0902*/
 /*any class deriving from CPA_MouseCapturer one must declare this method as is*/
 CWnd *m_p_oGrabCapture() { return m_p_oGrabCaptureFor(this); }
#endif
 
public:
	GLD_tdhViewport m_hDisplayViewport;
	GLD_tdhDevice   m_hDisplayDevice;
 
public:
	virtual void		CreateViewPort(void *, GLD_tdhDevice) = 0;
	GLD_tdhViewport		GetDisplayViewport()	{ return m_hDisplayViewport; };
    DEV_Device *		GetDevice()				{ return m_p_oDevice; }
	DEV_MultiDevice *	GetParentMultiDevice();
	DEV_MultiDevice2D * GetParentMultiDevice2D();
	DEV_MultiDevice3D * GetParentMultiDevice3D();
	CPA_Contact	*		GetParentContact();
	CPA_DialogBar *		GetParentDialogBar();
 
#ifdef ACTIVE_EDITOR
	FRMBaseMenu 		*GetParentFrame();
#else
	CFrameWnd			*GetParentFrame();
#endif
 
 
protected:
	/*{{AFX_MSG(DEV_ViewPort)*/
	afx_msg void OnWindowPosChanging(WINDOWPOS FAR* lpwndpos);
	afx_msg void OnPaint();
	/*}}AFX_MSG*/
 
#ifdef ACTIVE_EDITOR
	/*{{AFX_MSG(DEV_Device)*/
    afx_msg int  OnCreate( LPCREATESTRUCT );
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
    virtual BOOL OnCommand (WPARAM wParam, LPARAM lParam);
/*    afx_msg void OnCommandRange(UINT uiId);*/
    afx_msg void OnUpdateCommandUIRange(CCmdUI *);
	/*}}AFX_MSG*/
#endif /* ACTIVE_EDITOR*/
	DECLARE_MESSAGE_MAP()
};
 
/*///////////////////////////////////////////////////////////////////////////*/
 
#endif /* __DEVVIEWP_HPP__*/
