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

  1. // SmileCtl.h : Declaration of the CSmileCtrl OLE control class.
  2.  
  3. /////////////////////////////////////////////////////////////////////////////
  4. // CSmileCtrl : See SmileCtl.cpp for implementation.
  5.  
  6. class CSmileCtrl : public COleControl
  7. {
  8.     DECLARE_DYNCREATE(CSmileCtrl)
  9.  
  10. // Constructor
  11. public:
  12.     CSmileCtrl();
  13.  
  14.  
  15. // Attributes
  16. protected:
  17.     BOOL    m_bWink;        // Determines if Eye should 'blink'
  18.  
  19. // Overrides
  20. public:
  21.     // Drawing function
  22.     virtual void OnDraw(
  23.                 CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid);
  24.  
  25.     // Persistence
  26.     virtual void DoPropExchange(CPropExchange* pPX);
  27.  
  28.     // Reset control state
  29.     virtual void OnResetState();
  30.  
  31. // Implementation
  32. protected:
  33.     ~CSmileCtrl();
  34.  
  35.     // Hit Testing Helper
  36.     BOOL InEllipse(const CPoint& pt, int x1, int y1, int x2, int y2);
  37.  
  38.  
  39.     DECLARE_OLECREATE_EX(CSmileCtrl)    // Class factory and guid
  40.     DECLARE_OLETYPELIB(CSmileCtrl)      // GetTypeInfo
  41. #ifndef _RUNTIME
  42.     DECLARE_PROPPAGEIDS(CSmileCtrl)     // Property page IDs
  43. #endif
  44.     DECLARE_OLECTLTYPE(CSmileCtrl)      // Type name and misc status
  45.  
  46. // Message maps
  47.     //{{AFX_MSG(CSmileCtrl)
  48.     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  49.     //}}AFX_MSG
  50.     DECLARE_MESSAGE_MAP()
  51.  
  52. // Dispatch maps
  53.     //{{AFX_DISPATCH(CSmileCtrl)
  54.     BOOL m_bSad;
  55.     afx_msg void OnSadChanged();
  56.     afx_msg void Beep();
  57.     afx_msg void Wink(BOOL bWink);
  58.     //}}AFX_DISPATCH
  59.     DECLARE_DISPATCH_MAP()
  60.  
  61.     afx_msg void AboutBox();
  62.  
  63. // Event maps
  64.     //{{AFX_EVENT(CSmileCtrl)
  65.     void FireOutside()
  66.         {FireEvent(eventidOutside,EVENT_PARAM(VTS_NONE));}
  67.     void FireInside(OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y)
  68.         {FireEvent(eventidInside,EVENT_PARAM(VTS_XPOS_PIXELS  VTS_YPOS_PIXELS), x, y);}
  69.     //}}AFX_EVENT
  70.     DECLARE_EVENT_MAP()
  71.  
  72. // Dispatch and event IDs
  73. public:
  74.     enum {
  75.     //{{AFX_DISP_ID(CSmileCtrl)
  76.     dispidSad = 1L,
  77.     dispidBeep = 2L,
  78.     dispidWink = 3L,
  79.     eventidOutside = 1L,
  80.     eventidInside = 2L,
  81.     //}}AFX_DISP_ID
  82.     };
  83. };
  84.