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 class CPaintToolBar : public CWindow 18 { 19 public: 20 BOOL DoCreate(HWND hwndParent); 21 static LRESULT CALLBACK ToolBarWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 22 }; 23 24 class CToolBox : public CWindowImpl<CToolBox> 25 { 26 public: 27 DECLARE_WND_CLASS_EX(L"ToolBox", CS_DBLCLKS, COLOR_BTNFACE) 28 29 BEGIN_MSG_MAP(CToolBox) 30 MESSAGE_HANDLER(WM_CREATE, OnCreate) 31 MESSAGE_HANDLER(WM_SYSCOLORCHANGE, OnSysColorChange) 32 MESSAGE_HANDLER(WM_COMMAND, OnCommand) 33 MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) 34 MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) 35 MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) 36 MESSAGE_HANDLER(WM_TOOLSMODELTOOLCHANGED, OnToolsModelToolChanged) 37 END_MSG_MAP() 38 39 BOOL DoCreate(HWND hwndParent); 40 41 private: 42 CPaintToolBar toolbar; 43 44 LRESULT OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 45 LRESULT OnSysColorChange(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 46 LRESULT OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 47 LRESULT OnLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 48 LRESULT OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 49 LRESULT OnLButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 50 LRESULT OnToolsModelToolChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 51 }; 52