ReactOS 0.4.15-dev-8100-g1887773
editwnd.c
Go to the documentation of this file.
1#include "precomp.h"
2
3static const TCHAR szEditWndClass[] = TEXT("WordPadEditWndClass");
4
5
6static BOOL
8{
9 HANDLE hDLL;
10 HFONT hfDefault;
11
12 hDLL = LoadLibrary(_T("RICHED20.DLL"));
13 if (hDLL == NULL)
14 {
15 GetError(0);
16 return FALSE;
17 }
18
19 Info->hEdit = CreateWindowEx(0, //WS_EX_CLIENTEDGE,
21 NULL,
24 0,
25 0,
26 100,
27 100,
28 Info->hSelf,
29 NULL,
31 NULL);
32 if(Info->hEdit == NULL)
33 {
34 GetError(0);
35
36 return FALSE;
37 }
38
40 SendMessage(Info->hEdit,
42 (WPARAM)hfDefault,
43 MAKELPARAM(FALSE, 0));
44
45 return TRUE;
46}
47
48
49static LRESULT CALLBACK
51 UINT uMsg,
54{
56 LRESULT Ret = 0;
57
58 /* Get the window context */
61 if (Info == NULL && uMsg != WM_CREATE)
62 {
63 goto HandleDefaultMessage;
64 }
65
66 switch (uMsg)
67 {
68 case WM_CREATE:
69 {
71 Info->hSelf = hwnd;
72
75 (LONG_PTR)Info);
76
77 if (!InitEditWnd(Info))
78 {
79 Ret = (LRESULT)-1;
80 break;
81 }
82 break;
83 }
84
85 case WM_SIZE:
86 {
87 RECT rcClient;
88
89 if (GetClientRect(Info->hSelf,
90 &rcClient))
91 {
92 SetWindowPos(Info->hEdit,
93 NULL,
94 0,
95 0,
96 rcClient.right,
97 rcClient.bottom,
99 }
100 }
101
102 default:
103HandleDefaultMessage:
104 Ret = DefMDIChildProc(hwnd,
105 uMsg,
106 wParam,
107 lParam);
108 break;
109 }
110
111 return Ret;
112
113}
114
115
116VOID
118 BOOL Setup)
119{
120 if (Setup)
121 {
122 /* FIXME - setup editor environment (e.g. show toolbars, enable menus etc) */
123 }
124 else
125 {
126 /* FIXME - cleanup editor environment (e.g. hide toolbars, disable menus etc) */
127 }
128}
129
130
131BOOL
133 POPEN_EDIT_INFO OpenInfo)
134{
136 HWND hWndEditor;
137
139 0,
140 sizeof(EDIT_WND_INFO));
141 if (Info != NULL)
142 {
144 sizeof(EDIT_WND_INFO));
145 Info->MainWnd = MainWnd;
146 Info->MdiEditorType = metImageEditor;
147 Info->OpenInfo = OpenInfo;
148
149 hWndEditor = CreateMDIWindow(szEditWndClass,
150 OpenInfo->lpDocumentName,
156 MainWnd->hMdiClient,
157 hInstance,
158 (LPARAM)Info);
159
160 if (hWndEditor != NULL)
161 return TRUE;
162
163
165 0,
166 Info);
167 }
168
169 return FALSE;
170}
171
172BOOL
174{
175 WNDCLASSEX wc = {0};
176
177 wc.cbSize = sizeof(WNDCLASSEX);
179 wc.hInstance = hInstance;
183 IDC_ARROW);
184 wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
185 wc.lpszMenuName = NULL;
190 16,
191 16,
192 LR_SHARED);
193
194 return RegisterClassEx(&wc) != (ATOM)0;
195}
196
197VOID
199{
201 hInstance);
202}
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE ACPI_HANDLE *OutHandle ACPI_HANDLE *OutHandle void *Context void *Context ACPI_EVENT_HANDLER Handler UINT32 UINT32 ACPI_GPE_HANDLER void *Context UINT32 ACPI_NOTIFY_HANDLER void *Context ACPI_ADR_SPACE_TYPE ACPI_ADR_SPACE_HANDLER ACPI_ADR_SPACE_SETUP Setup
Definition: acpixf.h:834
#define IDI_ICON
Definition: resource.h:5
VOID GetError(VOID)
Definition: misc.c:192
HANDLE ProcessHeap
Definition: servman.c:15
HINSTANCE hInstance
Definition: charmap.c:19
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
WORD ATOM
Definition: dimm.idl:113
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
static const TCHAR szEditWndClass[]
Definition: editwnd.c:3
static LRESULT CALLBACK EditWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: editwnd.c:50
VOID SetEditorEnvironment(PEDIT_WND_INFO Info, BOOL Setup)
Definition: editwnd.c:117
BOOL CreateEditWindow(struct _MAIN_WND_INFO *MainWnd, POPEN_EDIT_INFO OpenInfo)
Definition: editwnd.c:132
VOID UninitEditWindowImpl(VOID)
Definition: editwnd.c:198
BOOL InitEditWindowImpl(VOID)
Definition: editwnd.c:173
static BOOL InitEditWnd(PEDIT_WND_INFO Info)
Definition: editwnd.c:7
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TEXT(s)
Definition: k32.h:26
@ metImageEditor
Definition: precomp.h:34
struct _EDIT_WND_INFO * PEDIT_WND_INFO
static HICON
Definition: imagelist.c:84
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define LRESULT
Definition: ole.h:14
#define WS_CHILD
Definition: pedump.c:617
#define ES_AUTOVSCROLL
Definition: pedump.c:671
#define WS_MAXIMIZE
Definition: pedump.c:623
#define WS_VSCROLL
Definition: pedump.c:627
#define ES_AUTOHSCROLL
Definition: pedump.c:672
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_HSCROLL
Definition: pedump.c:628
#define ES_MULTILINE
Definition: pedump.c:667
#define RICHEDIT_CLASS
Definition: richedit.h:55
#define DefMDIChildProc
Definition: ros2win.h:33
HWND hMdiClient
Definition: precomp.h:43
LPTSTR lpDocumentName
Definition: precomp.h:52
HINSTANCE hInstance
Definition: winuser.h:3206
HCURSOR hCursor
Definition: winuser.h:3208
LPCSTR lpszMenuName
Definition: winuser.h:3210
HICON hIconSm
Definition: winuser.h:3212
UINT cbSize
Definition: winuser.h:3201
WNDPROC lpfnWndProc
Definition: winuser.h:3203
LPCSTR lpszClassName
Definition: winuser.h:3211
HICON hIcon
Definition: winuser.h:3207
HBRUSH hbrBackground
Definition: winuser.h:3209
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
#define GWLP_USERDATA
Definition: treelist.c:63
#define _T(x)
Definition: vfdio.h:22
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
#define ZeroMemory
Definition: winbase.h:1712
#define LoadLibrary
Definition: winbase.h:3862
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define DEFAULT_GUI_FONT
Definition: wingdi.h:909
#define CreateWindowEx
Definition: winuser.h:5755
CREATESTRUCTA * LPCREATESTRUCT
Definition: winuser.h:5726
#define MAKELPARAM(l, h)
Definition: winuser.h:4008
#define IMAGE_ICON
Definition: winuser.h:212
#define WM_CREATE
Definition: winuser.h:1608
#define CreateMDIWindow
Definition: winuser.h:5753
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define WM_SIZE
Definition: winuser.h:1611
#define IDC_ARROW
Definition: winuser.h:687
#define UnregisterClass
Definition: winuser.h:5861
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define RegisterClassEx
Definition: winuser.h:5837
#define WM_SETFONT
Definition: winuser.h:1650
#define LoadIcon
Definition: winuser.h:5813
#define SendMessage
Definition: winuser.h:5843
#define LoadCursor
Definition: winuser.h:5812
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5719
#define LR_SHARED
Definition: winuser.h:1100
#define CW_USEDEFAULT
Definition: winuser.h:225
#define LoadImage
Definition: winuser.h:5815
#define SWP_NOZORDER
Definition: winuser.h:1247
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define COLOR_BTNFACE
Definition: winuser.h:928
char TCHAR
Definition: xmlstorage.h:189