home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / atl / atltangram / atlgdiworld / atltangramgdivisual.h < prev    next >
C/C++ Source or Header  |  1998-03-26  |  2KB  |  82 lines

  1. // AtlTangramGdiVisual.h : Declaration of the CAtlTangramGdiVisual
  2.  
  3. #ifndef __ATLTANGRAMGDIVISUAL_H_
  4. #define __ATLTANGRAMGDIVISUAL_H_
  5.  
  6. #include "resource.h"       // main symbols
  7. #include "util.h"
  8. #include "AtlEvent_i.h"
  9.  
  10.  
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CAtlTangramGdiVisual
  13. class ATL_NO_VTABLE CAtlTangramGdiVisual :
  14.     public CComObjectRootEx<CComSingleThreadModel>,
  15.     public CComCoClass<CAtlTangramGdiVisual, &CLSID_AtlTangramGdiVisual>,
  16.     public IAtlTangramGdiVisual,
  17.     public IATLTangramModelEvent   // event sink interface
  18. {
  19. public:
  20.     CAtlTangramGdiVisual():
  21.         m_pGdiWorld(0),
  22.         m_pModel(0),
  23.         m_pIConnectionPoint(0),
  24.         m_ptVertices(0),
  25.         m_dwCookie(0),
  26.         m_bSelected(FALSE)
  27.     {
  28.     }
  29.  
  30.     ~CAtlTangramGdiVisual();
  31.  
  32. DECLARE_REGISTRY_RESOURCEID(IDR_ATLTANGRAMGDIVISUAL)
  33.  
  34. BEGIN_COM_MAP(CAtlTangramGdiVisual)
  35.     COM_INTERFACE_ENTRY(IAtlTangramGdiVisual)
  36.     COM_INTERFACE_ENTRY(IAtlTangramVisual)
  37.     COM_INTERFACE_ENTRY(IATLTangramModelEvent)
  38. END_COM_MAP()
  39.  
  40. public:
  41.  
  42.     // IAtlTangramVisual
  43.     virtual HRESULT __stdcall GetModel( const IID& iid, IUnknown** ppI) ;
  44.     virtual HRESULT __stdcall SetSelected(BOOL bSelected) ;
  45.  
  46.     // IAtlTangramGdiVisual
  47.     virtual HRESULT __stdcall Initialize(IATLTangramModel* pModel, IAtlTangramGdiWorld* pWorld) ;
  48.     virtual HRESULT __stdcall IsPtIn(POINT pt) ;
  49.     virtual HRESULT __stdcall GetBoundingRect(RECT* pBoundingRect) ;
  50.     virtual HRESULT __stdcall DrawOn(IAtlTangramCanvas* pCanvas) ;
  51.  
  52.     // ITangramModelEvent
  53.     virtual HRESULT __stdcall OnModelChange() ;
  54.  
  55.     // Helper function
  56.     void SyncToModel() ;
  57.  
  58.     HRESULT __stdcall AdviseConnectionPoint(IATLTangramModel* pModel);
  59.     STDMETHOD(ReleaseConnectionPoint)();
  60.  
  61. // Member Variables
  62. private:
  63.     // Event Sink support.
  64.     IConnectionPoint* m_pIConnectionPoint ;
  65.     DWORD m_dwCookie ;
  66.  
  67.     // Backpointer to parent World component.
  68.     IAtlTangramGdiWorld* m_pGdiWorld ;
  69.  
  70.     // Pointer to associated model.
  71.     IATLTangramModel* m_pModel ;
  72.  
  73.     // Array of vertices.
  74.     POINT* m_ptVertices ;
  75.     long m_cVertices ;
  76.  
  77.     // Selection status.
  78.     BOOL m_bSelected ;
  79. };
  80.  
  81. #endif //__ATLTANGRAMGDIVISUAL_H_
  82.