ReactOS  0.4.12-dev-721-g03c3dd5
toolbox.cpp
Go to the documentation of this file.
1 /*
2  * PROJECT: PAINT for ReactOS
3  * LICENSE: LGPL
4  * FILE: base/applications/mspaint/toolbox.cpp
5  * PURPOSE: Window procedure of the main window and all children apart from
6  * hPalWin, hToolSettings and hSelection
7  * PROGRAMMERS: Benedikt Freisen
8  */
9 
10 /* INCLUDES *********************************************************/
11 
12 #include "precomp.h"
13 
14 /* FUNCTIONS ********************************************************/
15 
17 {
18  HIMAGELIST hImageList;
19  HBITMAP tempBm;
20  int i;
21  TCHAR tooltips[16][30];
22 
23  /*
24  * FIXME: Unintentionally there is a line above the tool bar (hidden by y-offset).
25  * To prevent cropping of the buttons height has been increased from 200 to 205
26  */
27  RECT toolbarPos = {1, -2, 1 + 50, -2 + 205};
30  hImageList = ImageList_Create(16, 16, ILC_COLOR24 | ILC_MASK, 16, 0);
31  toolbar.SendMessage(TB_SETIMAGELIST, 0, (LPARAM) hImageList);
33  ImageList_AddMasked(hImageList, tempBm, 0xff00ff);
34  DeleteObject(tempBm);
36 
37  for(i = 0; i < 16; i++)
38  {
39  TBBUTTON tbbutton;
40  int wrapnow = 0;
41 
42  if (i % 2 == 1)
43  wrapnow = TBSTATE_WRAP;
44 
46  ZeroMemory(&tbbutton, sizeof(TBBUTTON));
47  tbbutton.iString = (INT_PTR) tooltips[i];
48  tbbutton.fsStyle = TBSTYLE_CHECKGROUP;
49  tbbutton.fsState = TBSTATE_ENABLED | wrapnow;
50  tbbutton.idCommand = ID_FREESEL + i;
51  tbbutton.iBitmap = i;
52  toolbar.SendMessage(TB_ADDBUTTONS, 1, (LPARAM) &tbbutton);
53  }
54 
58 
59  return 0;
60 }
61 
63 {
65  return 0;
66 }
67 
69 {
71  return 0;
72 }
73 
75 {
76  switch (LOWORD(wParam))
77  {
78  case ID_FREESEL:
80  break;
81  case ID_RECTSEL:
83  break;
84  case ID_RUBBER:
86  break;
87  case ID_FILL:
89  break;
90  case ID_COLOR:
92  break;
93  case ID_ZOOM:
95  break;
96  case ID_PEN:
98  break;
99  case ID_BRUSH:
101  break;
102  case ID_AIRBRUSH:
104  break;
105  case ID_TEXT:
107  break;
108  case ID_LINE:
110  break;
111  case ID_BEZIER:
113  break;
114  case ID_RECT:
116  break;
117  case ID_SHAPE:
119  break;
120  case ID_ELLIPSE:
122  break;
123  case ID_RRECT:
125  break;
126  }
127  return 0;
128 }
129 
131 {
132  selectionWindow.ShowWindow(SW_HIDE);
133  pointSP = 0; // resets the point-buffer of the polygon and bezier functions
134  return 0;
135 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1608
ToolsModel toolsModel
Definition: main.cpp:18
#define TB_SETBUTTONSIZE
Definition: commctrl.h:1107
#define TB_BUTTONSTRUCTSIZE
Definition: commctrl.h:1106
#define TRUE
Definition: types.h:120
#define ID_RRECT
Definition: definitions.h:132
#define ID_SHAPE
Definition: definitions.h:130
#define HBITMAP
Definition: msvc.h:28
#define SW_HIDE
Definition: winuser.h:762
#define ID_RUBBER
Definition: definitions.h:119
#define MAKELPARAM(l, h)
Definition: winuser.h:3915
#define ID_BRUSH
Definition: definitions.h:124
#define ID_TEXT
Definition: definitions.h:126
#define ZeroMemory
Definition: winbase.h:1635
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define IDS_TOOLTIP1
Definition: definitions.h:212
#define WS_CHILD
Definition: pedump.c:617
int32_t INT_PTR
Definition: typedefs.h:62
BYTE fsStyle
Definition: commctrl.h:924
WPARAM wParam
Definition: combotst.c:138
#define ID_BEZIER
Definition: definitions.h:128
#define CCS_VERT
Definition: commctrl.h:2221
UINT_PTR WPARAM
Definition: windef.h:207
#define ID_LINE
Definition: definitions.h:127
#define TB_SETMAXTEXTROWS
Definition: commctrl.h:1134
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LRESULT OnToolsModelToolChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: toolbox.cpp:130
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:769
#define TBSTYLE_CHECKGROUP
Definition: commctrl.h:957
LONG_PTR LPARAM
Definition: windef.h:208
#define ID_FILL
Definition: definitions.h:120
#define TOOLBARCLASSNAME
Definition: commctrl.h:918
smooth NULL
Definition: ftsmooth.c:416
#define ID_AIRBRUSH
Definition: definitions.h:125
#define CCS_NOPARENTALIGN
Definition: commctrl.h:2218
void SetActiveTool(int nActiveTool)
Definition: toolsmodel.cpp:65
INT_PTR iString
Definition: commctrl.h:931
int iBitmap
Definition: commctrl.h:921
LRESULT OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: toolbox.cpp:74
#define TB_SETIMAGELIST
Definition: commctrl.h:1122
char TCHAR
Definition: xmlstorage.h:189
unsigned int BOOL
Definition: ntddk_ex.h:94
LRESULT OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: toolbox.cpp:16
HWND Create(LPCTSTR lpstrWndClass, HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
Definition: atlwin.h:383
#define ILC_COLOR24
Definition: commctrl.h:342
#define ID_RECTSEL
Definition: definitions.h:118
short pointSP
Definition: mouse.cpp:53
unsigned int UINT
Definition: ndis.h:50
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:961
#define ID_COLOR
Definition: definitions.h:121
#define CCS_NORESIZE
Definition: commctrl.h:2217
#define ID_FREESEL
Definition: definitions.h:117
#define ID_ZOOM
Definition: definitions.h:122
int idCommand
Definition: commctrl.h:922
#define TB_ADDBUTTONS
Definition: commctrl.h:1243
#define TB_CHECKBUTTON
Definition: commctrl.h:1015
#define ILC_MASK
Definition: commctrl.h:336
HWND m_hWnd
Definition: atlwin.h:268
LRESULT OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: toolbox.cpp:62
#define LoadCursor
Definition: winuser.h:5678
LONG_PTR GetWindowLongPtr(int nIndex) const
Definition: atlwin.h:744
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define IMAGE_BITMAP
Definition: winuser.h:211
#define ID_PEN
Definition: definitions.h:123
LRESULT OnSysColorChange(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: toolbox.cpp:68
#define IDC_ARROW
Definition: winuser.h:682
#define GWLP_HINSTANCE
Definition: winuser.h:850
#define TBSTATE_ENABLED
Definition: commctrl.h:946
#define IDB_TOOLBARICONS
Definition: definitions.h:32
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1048
#define TBSTATE_WRAP
Definition: commctrl.h:949
#define ID_ELLIPSE
Definition: definitions.h:131
#define LoadImage
Definition: winuser.h:5681
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:528
BYTE fsState
Definition: commctrl.h:923
LONG_PTR LRESULT
Definition: windef.h:209
#define WS_VISIBLE
Definition: pedump.c:620
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define LoadString
Definition: winuser.h:5685
CSelectionWindow selectionWindow
Definition: main.cpp:70
#define ID_RECT
Definition: definitions.h:129
CWindow toolbar
Definition: toolbox.h:25