Leaked source code of windows server 2003
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.

127 lines
2.7 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. // This must come last
  27. TOOLTYPE_MAX
  28. };
  29. #define TOOL_CMD(index) ((index) + IDM_TOOLS_START)
  30. #define TOOL_INDEX(cmd) ((cmd) - IDM_TOOLS_START)
  31. #define TOOL_COUNT TOOL_INDEX(IDM_TOOLS_MAX)
  32. #define DEF_PENCOLOR RGB(0, 0, 0)
  33. #define DEF_HIGHLIGHTCOLOR RGB(255, 255, 0)
  34. #define NUM_OF_WIDTHS 4
  35. BOOL InitToolArray(void);
  36. void DestroyToolArray(void);
  37. //
  38. //
  39. // Class: WbTool
  40. //
  41. // Purpose: Base Tool class
  42. //
  43. //
  44. class WbTool
  45. {
  46. public:
  47. //
  48. // Constructors
  49. //
  50. WbTool(int toolType);
  51. ~WbTool();
  52. //
  53. // Return the type of the tool
  54. //
  55. virtual int ToolType(void) const { return m_toolType; }
  56. //
  57. // Return whether the tool supports various attributes
  58. //
  59. virtual BOOL HasColor(void) const; // Tool supports colors
  60. virtual BOOL HasWidth(void) const; // Tool supports widths
  61. virtual BOOL HasFont(void) const; // Tool supports font
  62. //
  63. // Return the handle of the cursor for the tool
  64. //
  65. virtual HCURSOR GetCursorForTool(void) const;
  66. //
  67. // Get/set the tool attributes
  68. //
  69. UINT GetWidthAtIndex(UINT uiIndex) const
  70. { return m_uiWidths[uiIndex]; }
  71. VOID SetWidthAtIndex(UINT uiIndex, UINT uiWidth)
  72. { m_uiWidths[uiIndex] = uiWidth; }
  73. void SetWidthIndex(UINT uiWidthIndex)
  74. { m_uiWidthIndexCur = uiWidthIndex; }
  75. void SetFont(HFONT hFont);
  76. void DeselectGraphic(void) { m_selectedTool = TOOLTYPE_MAX; }
  77. void SelectGraphic(DCWbGraphic* pGraphic);
  78. //
  79. // Return the pen attributes
  80. //
  81. COLORREF GetColor(void) const { return m_clrCur; }
  82. void SetColor(COLORREF clr) { m_clrCur = clr; }
  83. UINT GetWidth(void) const { return m_uiWidths[m_uiWidthIndexCur]; }
  84. UINT GetWidthIndex(void) const { return m_uiWidthIndexCur; }
  85. int GetROP(void) const;
  86. HFONT GetFont(void) { return(m_hFont); }
  87. protected:
  88. //
  89. // Tool type
  90. //
  91. int m_toolType;
  92. int m_selectedTool;
  93. //
  94. // Tool attributes
  95. //
  96. COLORREF m_clrCur;
  97. UINT m_uiWidths[NUM_OF_WIDTHS];
  98. UINT m_uiWidthIndexCur;
  99. HFONT m_hFont;
  100. };
  101. #endif // __TOOL_HPP_