ReactOS  0.4.15-dev-3728-ga92304f
toolsmodel.h
Go to the documentation of this file.
1 /*
2  * PROJECT: PAINT for ReactOS
3  * LICENSE: LGPL
4  * FILE: base/applications/mspaint/toolsmodel.h
5  * PURPOSE: Keep track of tool parameters, notify listeners
6  * PROGRAMMERS: Benedikt Freisen
7  */
8 
9 #pragma once
10 
12 {
16  TOOL_FILL = 4,
18  TOOL_ZOOM = 6,
19  TOOL_PEN = 7,
22  TOOL_TEXT = 10,
23  TOOL_LINE = 11,
25  TOOL_RECT = 13,
26  TOOL_SHAPE = 14,
28  TOOL_RRECT = 16,
30 };
31 
32 /* CLASSES **********************************************************/
33 
34 struct ToolBase
35 {
39  static INT pointSP;
40  static POINT pointStack[256];
41 
42  ToolBase(TOOLTYPE tool) : m_tool(tool), m_hdc(NULL)
43  {
44  }
45 
46  virtual ~ToolBase()
47  {
48  }
49 
50  virtual void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
51  {
52  }
53 
54  virtual void OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
55  {
56  }
57 
58  virtual void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
59  {
60  }
61 
62  virtual void OnCancelDraw();
63 
64  void beginEvent();
65  void endEvent();
66  void reset();
67 
69 };
70 
72 {
73 private:
82  int m_zoom;
85 
87 
88 public:
89  ToolsModel();
90  ~ToolsModel();
91  int GetLineWidth() const;
92  void SetLineWidth(int nLineWidth);
93  int GetShapeStyle() const;
94  void SetShapeStyle(int nShapeStyle);
95  int GetBrushStyle() const;
96  void SetBrushStyle(int nBrushStyle);
97  TOOLTYPE GetActiveTool() const;
98  TOOLTYPE GetOldActiveTool() const;
99  void SetActiveTool(TOOLTYPE nActiveTool);
100  int GetAirBrushWidth() const;
101  void SetAirBrushWidth(int nAirBrushWidth);
102  int GetRubberRadius() const;
103  void SetRubberRadius(int nRubberRadius);
105  void SetBackgroundTransparent(BOOL bTransparent);
106  int GetZoom() const;
107  void SetZoom(int nZoom);
108 
109  void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick);
110  void OnMouseMove(BOOL bLeftButton, LONG x, LONG y);
111  void OnButtonUp(BOOL bLeftButton, LONG x, LONG y);
112  void OnCancelDraw();
113 
114  void resetTool();
115  void selectAll();
116 
117  void NotifyToolChanged();
119  void NotifyZoomChanged();
120 };
static POINT pointStack[256]
Definition: toolsmodel.h:40
ToolBase * m_pToolObject
Definition: toolsmodel.h:84
void resetTool()
Definition: toolsmodel.cpp:220
void OnCancelDraw()
Definition: toolsmodel.cpp:213
int m_rubberRadius
Definition: toolsmodel.h:80
HDC m_hdc
Definition: toolsmodel.h:37
static HDC
Definition: imagelist.c:92
void SetLineWidth(int nLineWidth)
Definition: toolsmodel.cpp:48
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
TOOLTYPE m_oldActiveTool
Definition: toolsmodel.h:78
int GetBrushStyle() const
Definition: toolsmodel.cpp:65
int m_zoom
Definition: toolsmodel.h:82
int32_t INT
Definition: typedefs.h:58
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
Definition: toolsmodel.cpp:189
int GetRubberRadius() const
Definition: toolsmodel.cpp:127
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
Definition: toolsmodel.cpp:197
virtual void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
Definition: toolsmodel.h:50
BOOL m_transpBg
Definition: toolsmodel.h:81
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
int m_airBrushWidth
Definition: toolsmodel.h:79
virtual void OnCancelDraw()
Definition: mouse.cpp:81
void SetBackgroundTransparent(BOOL bTransparent)
Definition: toolsmodel.cpp:143
void endEvent()
Definition: mouse.cpp:93
void SetAirBrushWidth(int nAirBrushWidth)
Definition: toolsmodel.cpp:121
TOOLTYPE m_activeTool
Definition: toolsmodel.h:77
static INT pointSP
Definition: toolsmodel.h:39
ToolBase * m_tools[TOOL_MAX+1]
Definition: toolsmodel.h:83
static ToolBase * createToolObject(TOOLTYPE type)
Definition: mouse.cpp:679
int GetLineWidth() const
Definition: toolsmodel.cpp:43
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
Definition: toolsmodel.cpp:205
COLORREF m_bg
Definition: toolsmodel.h:38
int GetShapeStyle() const
Definition: toolsmodel.cpp:54
int m_brushStyle
Definition: toolsmodel.h:76
DWORD COLORREF
Definition: windef.h:300
ToolBase(TOOLTYPE tool)
Definition: toolsmodel.h:42
void NotifyZoomChanged()
Definition: toolsmodel.cpp:180
void NotifyToolChanged()
Definition: toolsmodel.cpp:160
TOOLTYPE GetOldActiveTool() const
Definition: toolsmodel.cpp:81
void NotifyToolSettingsChanged()
Definition: toolsmodel.cpp:172
int GetZoom() const
Definition: toolsmodel.cpp:149
void selectAll()
Definition: toolsmodel.cpp:225
void reset()
Definition: mouse.cpp:76
TOOLTYPE GetActiveTool() const
Definition: toolsmodel.cpp:76
COLORREF m_fg
Definition: toolsmodel.h:38
virtual void OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
Definition: toolsmodel.h:54
void SetZoom(int nZoom)
Definition: toolsmodel.cpp:154
virtual void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
Definition: toolsmodel.h:58
void SetShapeStyle(int nShapeStyle)
Definition: toolsmodel.cpp:59
void beginEvent()
Definition: mouse.cpp:86
void SetBrushStyle(int nBrushStyle)
Definition: toolsmodel.cpp:70
void SetActiveTool(TOOLTYPE nActiveTool)
Definition: toolsmodel.cpp:86
ToolBase * GetOrCreateTool(TOOLTYPE nTool)
Definition: toolsmodel.cpp:35
virtual ~ToolBase()
Definition: toolsmodel.h:46
int GetAirBrushWidth() const
Definition: toolsmodel.cpp:116
TOOLTYPE m_tool
Definition: toolsmodel.h:36
#define NULL
Definition: types.h:112
void SetRubberRadius(int nRubberRadius)
Definition: toolsmodel.cpp:132
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
TOOLTYPE
Definition: toolsmodel.h:11
int m_lineWidth
Definition: toolsmodel.h:74
BOOL IsBackgroundTransparent() const
Definition: toolsmodel.cpp:138
int m_shapeStyle
Definition: toolsmodel.h:75