1 /* 2 * PROJECT: PAINT for ReactOS 3 * LICENSE: LGPL 4 * FILE: base/applications/mspaint/textedit.h 5 * PURPOSE: Text editor and font chooser for the text tool 6 * PROGRAMMERS: Benedikt Freisen 7 */ 8 9 #pragma once 10 11 #define CX_MINTEXTEDIT 100 12 #define CY_MINTEXTEDIT 24 13 14 class CTextEditWindow : public CWindowImpl<CTextEditWindow> 15 { 16 public: 17 CTextEditWindow(); 18 19 HWND Create(HWND hwndParent); 20 void DoFillBack(HWND hwnd, HDC hDC); 21 void FixEditPos(LPCTSTR pszOldText); 22 void InvalidateEditRect(); 23 void UpdateFont(); 24 BOOL GetEditRect(LPRECT prc) const; 25 void ValidateEditRect(LPCRECT prc OPTIONAL); 26 HFONT GetFont() const { return m_hFont; } 27 28 BEGIN_MSG_MAP(CTextEditWindow) 29 MESSAGE_HANDLER(WM_CREATE, OnCreate) 30 MESSAGE_HANDLER(WM_CLOSE, OnClose) 31 MESSAGE_HANDLER(WM_TOOLSMODELTOOLCHANGED, OnToolsModelToolChanged) 32 MESSAGE_HANDLER(WM_TOOLSMODELSETTINGSCHANGED, OnToolsModelSettingsChanged) 33 MESSAGE_HANDLER(WM_TOOLSMODELZOOMCHANGED, OnToolsModelZoomChanged) 34 MESSAGE_HANDLER(WM_PALETTEMODELCOLORCHANGED, OnPaletteModelColorChanged) 35 MESSAGE_HANDLER(WM_CHAR, OnChar) 36 MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown) 37 MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkGnd) 38 MESSAGE_HANDLER(WM_PAINT, OnPaint) 39 MESSAGE_HANDLER(WM_NCPAINT, OnNCPaint) 40 MESSAGE_HANDLER(WM_NCCALCSIZE, OnNCCalcSize); 41 MESSAGE_HANDLER(WM_NCHITTEST, OnNCHitTest); 42 MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor); 43 MESSAGE_HANDLER(WM_MOVE, OnMove); 44 MESSAGE_HANDLER(WM_SIZE, OnSize); 45 MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown); 46 MESSAGE_HANDLER(EM_SETSEL, OnSetSel); 47 MESSAGE_HANDLER(WM_MOUSEWHEEL, OnMouseWheel); 48 END_MSG_MAP() 49 50 LRESULT OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 51 LRESULT OnClose(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 52 LRESULT OnToolsModelToolChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 53 LRESULT OnToolsModelSettingsChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 54 LRESULT OnToolsModelZoomChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 55 LRESULT OnPaletteModelColorChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 56 LRESULT OnChar(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 57 LRESULT OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 58 LRESULT OnLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 59 LRESULT OnEraseBkGnd(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 60 LRESULT OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 61 LRESULT OnNCPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 62 LRESULT OnNCCalcSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 63 LRESULT OnNCHitTest(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 64 LRESULT OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 65 LRESULT OnMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 66 LRESULT OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 67 LRESULT OnSetSel(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 68 LRESULT OnMouseWheel(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 69 70 protected: 71 HWND m_hwndParent; 72 HFONT m_hFont; 73 HFONT m_hFontZoomed; 74 LONG m_nAppIsMovingOrSizing; 75 RECT m_rc; 76 77 INT DoHitTest(RECT& rc, POINT pt); 78 void DrawGrip(HDC hDC, RECT& rc); 79 void Reposition(); 80 }; 81