2 * PROJECT: PAINT for ReactOS
4 * FILE: base/applications/mspaint/textedit.cpp
5 * PURPOSE: Text editor and font chooser for the text tool
6 * PROGRAMMERS: Benedikt Freisen
9 /* INCLUDES *********************************************************/
13 /* FUNCTIONS ********************************************************/
14 LRESULT
CTextEditWindow::OnCreate(UINT nMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
)
16 /* creating the edit control within the editor window */
17 RECT editControlPos
= {0, 0, 0 + 100, 0 + 100};
18 editControl
.Create(_T("EDIT"), m_hWnd
, editControlPos
, NULL
,
19 WS_CHILD
| WS_VISIBLE
| WS_BORDER
| WS_HSCROLL
| WS_VSCROLL
| ES_MULTILINE
| ES_NOHIDESEL
| ES_AUTOHSCROLL
| ES_AUTOVSCROLL
,
24 LRESULT
CTextEditWindow::OnSize(UINT nMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
)
27 GetClientRect(&clientRect
);
28 editControl
.MoveWindow(clientRect
.left
, clientRect
.top
, RECT_WIDTH(clientRect
), RECT_HEIGHT(clientRect
), TRUE
);
32 LRESULT
CTextEditWindow::OnClose(UINT nMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
)
38 LRESULT
CTextEditWindow::OnCommand(UINT nMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
)
40 switch(HIWORD(wParam
))
44 HeapFree(GetProcessHeap(), 0, textToolText
);
45 textToolTextMaxLen
= editControl
.GetWindowTextLength() + 1;
46 textToolText
= (LPTSTR
) HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS
, sizeof(TCHAR
) * textToolTextMaxLen
);
47 editControl
.GetWindowText(textToolText
, textToolTextMaxLen
);
48 ForceRefreshSelectionContents();
55 LRESULT
CTextEditWindow::OnToolsModelToolChanged(UINT nMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
)
57 ShowWindow((wParam
== TOOL_TEXT
) ? SW_SHOW
: SW_HIDE
);