2 * PROJECT: PAINT for ReactOS
4 * FILE: base/applications/paint/textedit.c
5 * PURPOSE: Text editor and font chooser for the text tool
6 * PROGRAMMERS: Benedikt Freisen
9 /* INCLUDES *********************************************************/
14 /* FUNCTIONS ********************************************************/
19 WNDCLASSEX wclTextEdit
;
20 /* initializing and registering the window class used for the text editor */
21 wclTextEdit
.hInstance
= hProgInstance
;
22 wclTextEdit
.lpszClassName
= _T("TextEdit");
23 wclTextEdit
.lpfnWndProc
= TextEditWinProc
;
24 wclTextEdit
.style
= CS_DBLCLKS
;
25 wclTextEdit
.cbSize
= sizeof(WNDCLASSEX
);
26 wclTextEdit
.hIcon
= LoadIcon(hProgInstance
, MAKEINTRESOURCE(IDI_APPICON
));
27 wclTextEdit
.hIconSm
= LoadIcon(hProgInstance
, MAKEINTRESOURCE(IDI_APPICON
));
28 wclTextEdit
.hCursor
= LoadCursor(NULL
, IDC_ARROW
);
29 wclTextEdit
.lpszMenuName
= NULL
;
30 wclTextEdit
.cbClsExtra
= 0;
31 wclTextEdit
.cbWndExtra
= 0;
32 wclTextEdit
.hbrBackground
= GetSysColorBrush(COLOR_BTNFACE
);
33 RegisterClassEx (&wclTextEdit
);
37 TextEditWinProc(HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
44 GetClientRect(hwnd
, &clientRect
);
45 MoveWindow(hwndEditCtl
, clientRect
.left
, clientRect
.top
, RECT_WIDTH(clientRect
), RECT_HEIGHT(clientRect
), TRUE
);
49 ShowWindow(hwnd
, SW_HIDE
);
52 switch(HIWORD(wParam
))
56 HeapFree(GetProcessHeap(), 0, textToolText
);
57 textToolTextMaxLen
= GetWindowTextLength(hwndEditCtl
) + 1;
58 textToolText
= HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS
, sizeof(TCHAR
) * textToolTextMaxLen
);
59 GetWindowText(hwndEditCtl
, textToolText
, textToolTextMaxLen
);
60 ForceRefreshSelectionContents();
66 return DefWindowProc(hwnd
, message
, wParam
, lParam
);