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

  1. // drawtool.h - interface for CDrawTool and derivatives
  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. #ifndef __DRAWTOOL_H__
  15. #define __DRAWTOOL_H__
  16.  
  17. #include "drawobj.h"
  18.  
  19. class CDrawView;
  20.  
  21. enum DrawShape
  22. {
  23.     selection,
  24.     line,
  25.     rect,
  26.     roundRect,
  27.     ellipse,
  28.     poly
  29. };
  30.  
  31. class CDrawTool
  32. {
  33. // Constructors
  34. public:
  35.     CDrawTool(DrawShape nDrawShape);
  36.  
  37. // Overridables
  38.     virtual void OnLButtonDown(CDrawView* pView, UINT nFlags, const CPoint& point);
  39.     virtual void OnLButtonDblClk(CDrawView* pView, UINT nFlags, const CPoint& point);
  40.     virtual void OnLButtonUp(CDrawView* pView, UINT nFlags, const CPoint& point);
  41.     virtual void OnMouseMove(CDrawView* pView, UINT nFlags, const CPoint& point);
  42.     virtual void OnEditProperties(CDrawView* pView);
  43.     virtual void OnCancel();
  44.  
  45. // Attributes
  46.     DrawShape m_drawShape;
  47.  
  48.     static CDrawTool* FindTool(DrawShape drawShape);
  49.     static CPtrList c_tools;
  50.     static CPoint c_down;
  51.     static UINT c_nDownFlags;
  52.     static CPoint c_last;
  53.     static DrawShape c_drawShape;
  54. };
  55.  
  56. class CSelectTool : public CDrawTool
  57. {
  58. // Constructors
  59. public:
  60.     CSelectTool();
  61.  
  62. // Implementation
  63.     virtual void OnLButtonDown(CDrawView* pView, UINT nFlags, const CPoint& point);
  64.     virtual void OnLButtonDblClk(CDrawView* pView, UINT nFlags, const CPoint& point);
  65.     virtual void OnLButtonUp(CDrawView* pView, UINT nFlags, const CPoint& point);
  66.     virtual void OnMouseMove(CDrawView* pView, UINT nFlags, const CPoint& point);
  67.     virtual void OnEditProperties(CDrawView* pView);
  68. };
  69.  
  70. class CRectTool : public CDrawTool
  71. {
  72. // Constructors
  73. public:
  74.     CRectTool(DrawShape drawShape);
  75.  
  76. // Implementation
  77.     virtual void OnLButtonDown(CDrawView* pView, UINT nFlags, const CPoint& point);
  78.     virtual void OnLButtonDblClk(CDrawView* pView, UINT nFlags, const CPoint& point);
  79.     virtual void OnLButtonUp(CDrawView* pView, UINT nFlags, const CPoint& point);
  80.     virtual void OnMouseMove(CDrawView* pView, UINT nFlags, const CPoint& point);
  81. };
  82.  
  83. class CPolyTool : public CDrawTool
  84. {
  85. // Constructors
  86. public:
  87.     CPolyTool();
  88.  
  89. // Implementation
  90.     virtual void OnLButtonDown(CDrawView* pView, UINT nFlags, const CPoint& point);
  91.     virtual void OnLButtonDblClk(CDrawView* pView, UINT nFlags, const CPoint& point);
  92.     virtual void OnLButtonUp(CDrawView* pView, UINT nFlags, const CPoint& point);
  93.     virtual void OnMouseMove(CDrawView* pView, UINT nFlags, const CPoint& point);
  94.     virtual void OnCancel();
  95.  
  96.     CDrawPoly* m_pDrawObj;
  97. };
  98.  
  99. ////////////////////////////////////////////////////////////////////////////
  100.  
  101. #endif // __DRAWTOOL_H__
  102.