home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / controls / circ2 / circ2ctl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-27  |  2.6 KB  |  95 lines

  1. // circ2ctl.h : Declaration of the CCirc2Ctrl OLE control class.
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1998 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CCirc2Ctrl : See circ2ctl.cpp for implementation.
  15.  
  16. class CCirc2Ctrl : public COleControl
  17. {
  18.     DECLARE_DYNCREATE(CCirc2Ctrl)
  19.  
  20. // Constructor
  21. public:
  22.     CCirc2Ctrl();
  23.  
  24. // Overrides
  25.  
  26.     // Drawing function
  27.     virtual void OnDraw(
  28.                 CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid);
  29.  
  30.     // Persistence
  31.     virtual void DoPropExchange(CPropExchange* pPX);
  32.  
  33.     // Reset control state
  34.     virtual void OnResetState();
  35.  
  36.     virtual BOOL OnMapPropertyToPage(DISPID dispid, LPCLSID lpclsid,
  37.         BOOL* pbPageOptional);
  38.  
  39. // Implementation
  40. protected:
  41.     ~CCirc2Ctrl();
  42.     void GetDrawRect(CRect* rc);
  43.     short m_circleOffset;
  44.     BOOL InBounds(short nOffset);
  45.     BOOL InCircle(CPoint& point);
  46.     void FlashColor(CDC* pdc);
  47.  
  48.     DECLARE_OLECREATE_EX(CCirc2Ctrl)    // Class factory and guid
  49.     DECLARE_OLETYPELIB(CCirc2Ctrl)      // GetTypeInfo
  50.     DECLARE_PROPPAGEIDS(CCirc2Ctrl)     // Property page IDs
  51.     DECLARE_OLECTLTYPE(CCirc2Ctrl)      // Type name and misc status
  52.  
  53. // Message maps
  54.     //{{AFX_MSG(CCirc2Ctrl)
  55.     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  56.     afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  57.     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  58.     afx_msg void OnSize(UINT nType, int cx, int cy);
  59.     //}}AFX_MSG
  60.     DECLARE_MESSAGE_MAP()
  61.  
  62. // Dispatch maps
  63.     //{{AFX_DISPATCH(CCirc2Ctrl)
  64.     OLE_COLOR m_flashColor;
  65.     BOOL m_circleShape;
  66.     afx_msg void OnCircleShapeChanged();
  67.     afx_msg short GetCircleOffset();
  68.     afx_msg void SetCircleOffset(short nNewValue);
  69.     //}}AFX_DISPATCH
  70.     DECLARE_DISPATCH_MAP()
  71.  
  72.     afx_msg void AboutBox();
  73.  
  74. // Event maps
  75.     //{{AFX_EVENT(CCirc2Ctrl)
  76.     void FireClickIn(OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y)
  77.         {FireEvent(eventidClickIn,EVENT_PARAM(VTS_XPOS_PIXELS  VTS_YPOS_PIXELS), x, y);}
  78.     void FireClickOut()
  79.         {FireEvent(eventidClickOut,EVENT_PARAM(VTS_NONE));}
  80.     //}}AFX_EVENT
  81.     DECLARE_EVENT_MAP()
  82.  
  83. // Dispatch and event IDs
  84. public:
  85.     enum {
  86.     //{{AFX_DISP_ID(CCirc2Ctrl)
  87.     dispidCircleShape = 2L,
  88.     dispidCircleOffset = 3L,
  89.     dispidFlashColor = 1L,
  90.     eventidClickIn = 1L,
  91.     eventidClickOut = 2L,
  92.     //}}AFX_DISP_ID
  93.     };
  94. };
  95.