Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
2.3 KiB

  1. //
  2. // TOOL.HPP
  3. // Tool Classes
  4. //
  5. // Copyright Microsoft 1998-
  6. //
  7. #ifndef __TOOL_HPP_
  8. #define __TOOL_HPP_
  9. class DCWbGraphic;
  10. //
  11. // Tool types
  12. //
  13. #define TOOLTYPE_FIRST 0
  14. enum
  15. {
  16. TOOLTYPE_SELECT = TOOLTYPE_FIRST,
  17. TOOLTYPE_ERASER,
  18. TOOLTYPE_TEXT,
  19. TOOLTYPE_HIGHLIGHT,
  20. TOOLTYPE_PEN,
  21. TOOLTYPE_LINE,
  22. TOOLTYPE_BOX,
  23. TOOLTYPE_FILLEDBOX,
  24. TOOLTYPE_ELLIPSE,
  25. TOOLTYPE_FILLEDELLIPSE,
  26. TOOLTYPE_REMOTEPOINTER,
  27. // This must come last
  28. TOOLTYPE_MAX
  29. };
  30. #define TOOL_INDEX(cmd) ((cmd) - IDM_TOOLS_START)
  31. #define DEF_PENCOLOR RGB(0, 0, 0)
  32. #define DEF_HIGHLIGHTCOLOR RGB(255, 255, 0)
  33. #define NUM_OF_WIDTHS 4
  34. //
  35. //
  36. // Class: WbTool
  37. //
  38. // Purpose: Base Tool class
  39. //
  40. //
  41. class WbTool
  42. {
  43. public:
  44. //
  45. // Constructors
  46. //
  47. WbTool(int toolType);
  48. ~WbTool();
  49. //
  50. // Return the type of the tool
  51. //
  52. int ToolType(void) { return m_toolType; }
  53. //
  54. // Return whether the tool supports various attributes
  55. //
  56. BOOL HasColor(void); // Tool supports colors
  57. BOOL HasWidth(void); // Tool supports widths
  58. BOOL HasFont(void); // Tool supports font
  59. //
  60. // Return the handle of the cursor for the tool
  61. //
  62. HCURSOR GetCursorForTool(void);
  63. //
  64. // Get/set the tool attributes
  65. //
  66. UINT GetWidthAtIndex(UINT uiIndex){ return m_uiWidths[uiIndex]; }
  67. VOID SetWidthAtIndex(UINT uiIndex, UINT uiWidth)
  68. { m_uiWidths[uiIndex] = uiWidth; }
  69. void SetFont(HFONT hFont);
  70. void DeselectGraphic(void) { m_selectedTool = TOOLTYPE_MAX; }
  71. void SelectGraphic(T126Obj* pGraphic);
  72. //
  73. // Return the pen attributes
  74. //
  75. COLORREF GetColor(void) { return m_clrCur; }
  76. void SetColor(COLORREF clr) { m_clrCur = clr; }
  77. UINT GetWidth(void) { return m_uiWidths[m_uiWidthIndexCur]; }
  78. void SetWidthIndex(UINT uiWidthIndex){ m_uiWidthIndexCur = uiWidthIndex; }
  79. UINT GetWidthIndex(void) { return m_uiWidthIndexCur; }
  80. int GetROP(void);
  81. HFONT GetFont(void) { return(m_hFont); }
  82. protected:
  83. //
  84. // Tool type
  85. //
  86. int m_toolType;
  87. int m_selectedTool;
  88. //
  89. // Tool attributes
  90. //
  91. COLORREF m_clrCur;
  92. UINT m_uiWidths[NUM_OF_WIDTHS];
  93. UINT m_uiWidthIndexCur;
  94. HFONT m_hFont;
  95. };
  96. #endif // __TOOL_HPP_