ReactOS  0.4.15-dev-506-ga3ec01c
editwnd.c
Go to the documentation of this file.
1 #include "precomp.h"
2 
3 static const TCHAR szEditWndClass[] = TEXT("WordPadEditWndClass");
4 
5 
6 static 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,
30  hInstance,
31  NULL);
32  if(Info->hEdit == NULL)
33  {
34  GetError(0);
35 
36  return FALSE;
37  }
38 
39  hfDefault = (HFONT) GetStockObject(DEFAULT_GUI_FONT);
40  SendMessage(Info->hEdit,
41  WM_SETFONT,
42  (WPARAM)hfDefault,
43  MAKELPARAM(FALSE, 0));
44 
45  return TRUE;
46 }
47 
48 
49 static LRESULT CALLBACK
51  UINT uMsg,
52  WPARAM wParam,
53  LPARAM lParam)
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,
98  SWP_NOZORDER);
99  }
100  }
101 
102  default:
103 HandleDefaultMessage:
104  Ret = DefMDIChildProc(hwnd,
105  uMsg,
106  wParam,
107  lParam);
108  break;
109  }
110 
111  return Ret;
112 
113 }
114 
115 
116 VOID
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 
131 BOOL
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,
151  WS_MAXIMIZE,
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 
172 BOOL
174 {
175  WNDCLASSEX wc = {0};
176 
177  wc.cbSize = sizeof(WNDCLASSEX);
179  wc.hInstance = hInstance;
180  wc.hIcon = LoadIcon(hInstance,
182  wc.hCursor = LoadCursor(NULL,
183  IDC_ARROW);
184  wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
185  wc.lpszMenuName = NULL;
189  IMAGE_ICON,
190  16,
191  16,
192  LR_SHARED);
193 
194  return RegisterClassEx(&wc) != (ATOM)0;
195 }
196 
197 VOID
199 {
201  hInstance);
202 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
VOID UninitEditWindowImpl(VOID)
Definition: editwnd.c:198
#define IDI_ICON
Definition: resource.h:5
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MAKEINTRESOURCE
Definition: winuser.h:591
static HICON
Definition: imagelist.c:84
LPCSTR lpszMenuName
Definition: winuser.h:3185
#define TRUE
Definition: types.h:120
#define LR_SHARED
Definition: winuser.h:1090
#define IMAGE_ICON
Definition: winuser.h:212
#define RegisterClassEx
Definition: winuser.h:5812
HCURSOR hCursor
Definition: winuser.h:3183
WNDPROC lpfnWndProc
Definition: winuser.h:3178
#define LoadLibrary
Definition: winbase.h:3702
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical 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:828
BOOL InitEditWindowImpl(VOID)
Definition: editwnd.c:173
LPCSTR lpszClassName
Definition: winuser.h:3186
WORD ATOM
Definition: dimm.idl:113
#define MAKELPARAM(l, h)
Definition: winuser.h:3983
#define ES_MULTILINE
Definition: pedump.c:667
#define CALLBACK
Definition: compat.h:27
#define ZeroMemory
Definition: winbase.h:1648
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_CHILD
Definition: pedump.c:617
HICON hIconSm
Definition: winuser.h:3187
#define SWP_NOZORDER
Definition: winuser.h:1232
LONG right
Definition: windef.h:308
CREATESTRUCTA * LPCREATESTRUCT
Definition: winuser.h:5701
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
struct TraceInfo Info
LPTSTR lpDocumentName
Definition: precomp.h:52
VOID GetError(VOID)
Definition: misc.c:192
HINSTANCE hInstance
Definition: charmap.c:20
HINSTANCE hInstance
Definition: winuser.h:3181
HWND hMdiClient
Definition: precomp.h:43
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CreateWindowEx
Definition: winuser.h:5730
#define CW_USEDEFAULT
Definition: winuser.h:225
#define GWLP_USERDATA
Definition: treelist.c:63
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
UINT cbSize
Definition: winuser.h:3176
HBRUSH hbrBackground
Definition: winuser.h:3184
#define DefMDIChildProc
Definition: ros2win.h:33
#define ES_AUTOVSCROLL
Definition: pedump.c:671
char TCHAR
Definition: xmlstorage.h:189
BOOL CreateEditWindow(struct _MAIN_WND_INFO *MainWnd, POPEN_EDIT_INFO OpenInfo)
Definition: editwnd.c:132
#define _T(x)
Definition: vfdio.h:22
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define WM_SIZE
Definition: winuser.h:1593
#define RICHEDIT_CLASS
Definition: richedit.h:55
#define WS_HSCROLL
Definition: pedump.c:628
#define DEFAULT_GUI_FONT
Definition: wingdi.h:908
HICON hIcon
Definition: winuser.h:3182
#define COLOR_BTNFACE
Definition: winuser.h:918
#define LRESULT
Definition: ole.h:14
#define CreateMDIWindow
Definition: winuser.h:5728
#define LoadCursor
Definition: winuser.h:5787
HANDLE ProcessHeap
Definition: servman.c:15
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define TEXT(s)
Definition: k32.h:26
struct _EDIT_WND_INFO * PEDIT_WND_INFO
static BOOL InitEditWnd(PEDIT_WND_INFO Info)
Definition: editwnd.c:7
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define WS_VSCROLL
Definition: pedump.c:627
static const TCHAR szEditWndClass[]
Definition: editwnd.c:3
#define WM_SETFONT
Definition: winuser.h:1632
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define IDC_ARROW
Definition: winuser.h:682
#define SendMessage
Definition: winuser.h:5818
#define WM_CREATE
Definition: winuser.h:1590
LONG bottom
Definition: windef.h:309
static LRESULT CALLBACK EditWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: editwnd.c:50
#define LoadImage
Definition: winuser.h:5790
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5694
#define LoadIcon
Definition: winuser.h:5788
#define GetWindowLongPtr
Definition: treelist.c:73
LONG_PTR LRESULT
Definition: windef.h:209
#define WS_VISIBLE
Definition: pedump.c:620
#define UnregisterClass
Definition: winuser.h:5836
LPARAM lParam
Definition: combotst.c:139
#define ES_AUTOHSCROLL
Definition: pedump.c:672
#define HeapFree(x, y, z)
Definition: compat.h:403
VOID SetEditorEnvironment(PEDIT_WND_INFO Info, BOOL Setup)
Definition: editwnd.c:117
#define WS_MAXIMIZE
Definition: pedump.c:623