ReactOS  0.4.15-dev-5137-g826bd41
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  virtual void OnFinishDraw();
64 
65  void beginEvent();
66  void endEvent();
67  void reset();
68 
70 };
71 
73 {
74 private:
83  int m_zoom;
86 
88 
89 public:
90  ToolsModel();
91  ~ToolsModel();
92  int GetLineWidth() const;
93  void SetLineWidth(int nLineWidth);
94  int GetShapeStyle() const;
95  void SetShapeStyle(int nShapeStyle);
96  int GetBrushStyle() const;
97  void SetBrushStyle(int nBrushStyle);
98  TOOLTYPE GetActiveTool() const;
99  TOOLTYPE GetOldActiveTool() const;
100  void SetActiveTool(TOOLTYPE nActiveTool);
101  int GetAirBrushWidth() const;
102  void SetAirBrushWidth(int nAirBrushWidth);
103  int GetRubberRadius() const;
104  void SetRubberRadius(int nRubberRadius);
106  void SetBackgroundTransparent(BOOL bTransparent);
107  int GetZoom() const;
108  void SetZoom(int nZoom);
109 
110  void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick);
111  void OnMouseMove(BOOL bLeftButton, LONG x, LONG y);
112  void OnButtonUp(BOOL bLeftButton, LONG x, LONG y);
113  void OnCancelDraw();
114  void OnFinishDraw();
115 
116  void resetTool();
117  void selectAll();
118 
119  void NotifyToolChanged();
121  void NotifyZoomChanged();
122 };
static POINT pointStack[256]
Definition: toolsmodel.h:40
ToolBase * m_pToolObject
Definition: toolsmodel.h:85
void resetTool()
Definition: toolsmodel.cpp:231
void OnCancelDraw()
Definition: toolsmodel.cpp:215
int m_rubberRadius
Definition: toolsmodel.h:81
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:79
int GetBrushStyle() const
Definition: toolsmodel.cpp:65
int m_zoom
Definition: toolsmodel.h:83
int32_t INT
Definition: typedefs.h:58
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
Definition: toolsmodel.cpp:191
int GetRubberRadius() const
Definition: toolsmodel.cpp:124
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
Definition: toolsmodel.cpp:199
virtual void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
Definition: toolsmodel.h:50
BOOL m_transpBg
Definition: toolsmodel.h:82
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
void OnFinishDraw()
Definition: toolsmodel.cpp:223
int m_airBrushWidth
Definition: toolsmodel.h:80
virtual void OnCancelDraw()
Definition: mouse.cpp:85
void SetBackgroundTransparent(BOOL bTransparent)
Definition: toolsmodel.cpp:140
void endEvent()
Definition: mouse.cpp:102
void SetAirBrushWidth(int nAirBrushWidth)
Definition: toolsmodel.cpp:118
TOOLTYPE m_activeTool
Definition: toolsmodel.h:78
static INT pointSP
Definition: toolsmodel.h:39
ToolBase * m_tools[TOOL_MAX+1]
Definition: toolsmodel.h:84
static ToolBase * createToolObject(TOOLTYPE type)
Definition: mouse.cpp:764
int GetLineWidth() const
Definition: toolsmodel.cpp:43
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
Definition: toolsmodel.cpp:207
COLORREF m_bg
Definition: toolsmodel.h:38
int GetShapeStyle() const
Definition: toolsmodel.cpp:54
int m_brushStyle
Definition: toolsmodel.h:77
DWORD COLORREF
Definition: windef.h:300
ToolBase(TOOLTYPE tool)
Definition: toolsmodel.h:42
void NotifyZoomChanged()
Definition: toolsmodel.cpp:181
void NotifyToolChanged()
Definition: toolsmodel.cpp:159
virtual void OnFinishDraw()
Definition: mouse.cpp:90
TOOLTYPE GetOldActiveTool() const
Definition: toolsmodel.cpp:81
void NotifyToolSettingsChanged()
Definition: toolsmodel.cpp:171
int GetZoom() const
Definition: toolsmodel.cpp:148
void selectAll()
Definition: toolsmodel.cpp:236
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:153
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:95
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:113
TOOLTYPE m_tool
Definition: toolsmodel.h:36
#define NULL
Definition: types.h:112
void SetRubberRadius(int nRubberRadius)
Definition: toolsmodel.cpp:129
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:75
BOOL IsBackgroundTransparent() const
Definition: toolsmodel.cpp:135
int m_shapeStyle
Definition: toolsmodel.h:76