xref: /reactos/base/applications/mspaint/toolbox.h (revision 7d2f6b65)
1 /*
2  * PROJECT:    PAINT for ReactOS
3  * LICENSE:    LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
4  * PURPOSE:    Window procedure of the main window and all children apart from
5  *             hPalWin, hToolSettings and hSelection
6  * COPYRIGHT:  Copyright 2015 Benedikt Freisen <b.freisen@gmx.net>
7  */
8 
9 #pragma once
10 
11 #define TOOLBAR_ROWS        8
12 #define TOOLBAR_COLUMNS     2
13 #define CXY_TB_BUTTON       25
14 #define CX_TOOLBAR          (TOOLBAR_COLUMNS * CXY_TB_BUTTON)
15 #define CY_TOOLBAR          (TOOLBAR_ROWS * CXY_TB_BUTTON)
16 
17 #define WM_TOOLBARHIT   (WM_APP + 1)
18 
19 class CPaintToolBar : public CWindow
20 {
21 public:
22     BOOL DoCreate(HWND hwndParent);
23     static LRESULT CALLBACK ToolBarWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
24 };
25 
26 class CToolBox : public CWindowImpl<CToolBox>
27 {
28 public:
29     DECLARE_WND_CLASS_EX(_T("ToolBox"), CS_DBLCLKS, COLOR_BTNFACE)
30 
31     BEGIN_MSG_MAP(CToolBox)
32         MESSAGE_HANDLER(WM_CREATE, OnCreate)
33         MESSAGE_HANDLER(WM_SYSCOLORCHANGE, OnSysColorChange)
34         MESSAGE_HANDLER(WM_COMMAND, OnCommand)
35         MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
36         MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
37         MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp)
38         MESSAGE_HANDLER(WM_TOOLSMODELTOOLCHANGED, OnToolsModelToolChanged)
39         MESSAGE_HANDLER(WM_TOOLBARHIT, OnToolBarHit)
40     END_MSG_MAP()
41 
42     BOOL DoCreate(HWND hwndParent);
43 
44 private:
45     CPaintToolBar toolbar;
46 
47     LRESULT OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
48     LRESULT OnSysColorChange(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
49     LRESULT OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
50     LRESULT OnLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
51     LRESULT OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
52     LRESULT OnLButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
53     LRESULT OnToolsModelToolChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
54     LRESULT OnToolBarHit(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
55 };
56