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 palette window 5 * COPYRIGHT: Copyright 2015 Benedikt Freisen <b.freisen@gmx.net> 6 */ 7 8 #pragma once 9 10 #define CXY_COLORBOX 16 /* width / height of a normal color box */ 11 #define CXY_BIGBOX (CXY_COLORBOX * 2) /* width / height of the big box */ 12 #define CY_PALETTE (8 + CXY_BIGBOX + 8) 13 14 class CPaletteWindow : public CWindowImpl<CPaletteWindow> 15 { 16 public: 17 DECLARE_WND_CLASS_EX(L"Palette", CS_DBLCLKS, COLOR_BTNFACE) 18 19 BEGIN_MSG_MAP(CPaletteWindow) 20 MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd) 21 MESSAGE_HANDLER(WM_PAINT, OnPaint) 22 MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) 23 MESSAGE_HANDLER(WM_RBUTTONDOWN, OnRButtonDown) 24 MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDblClk) 25 MESSAGE_HANDLER(WM_RBUTTONDBLCLK, OnRButtonDblClk) 26 MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) 27 MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) 28 MESSAGE_HANDLER(WM_PALETTEMODELCOLORCHANGED, OnPaletteModelColorChanged) 29 END_MSG_MAP() 30 31 CPaletteWindow(); 32 virtual ~CPaletteWindow(); 33 34 protected: 35 HBITMAP m_hbmCached; // Cached buffer bitmap 36 37 LRESULT OnEraseBkgnd(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 38 LRESULT OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 39 LRESULT OnLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 40 LRESULT OnRButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 41 LRESULT OnLButtonDblClk(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 42 LRESULT OnRButtonDblClk(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 43 LRESULT OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 44 LRESULT OnLButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 45 LRESULT OnPaletteModelColorChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 46 47 protected: 48 INT DoHitTest(INT xPos, INT yPos) const; 49 }; 50