1 | /* $Id: defwndproc.cpp,v 1.1 1999-07-14 08:35:34 sandervl Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Win32 default window API functions for OS/2
|
---|
5 | *
|
---|
6 | * Copyright 1998 Sander van Leeuwen
|
---|
7 | *
|
---|
8 | *
|
---|
9 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
10 | *
|
---|
11 | */
|
---|
12 | #include "user32.h"
|
---|
13 | #include "syscolor.h"
|
---|
14 |
|
---|
15 | #ifdef DEBUG
|
---|
16 | char *GetMsgText(int Msg);
|
---|
17 | #endif
|
---|
18 |
|
---|
19 | //******************************************************************************
|
---|
20 | //******************************************************************************
|
---|
21 | LRESULT WIN32API DefWindowProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
22 | {
|
---|
23 | #ifdef DEBUG
|
---|
24 | //// WriteLog("DEFWNDPROC ");
|
---|
25 | //// WriteLog("*DWP*");
|
---|
26 | #endif
|
---|
27 | switch(Msg) {
|
---|
28 | case WM_SETREDRAW: //Open32 does not set the visible flag
|
---|
29 | if(wParam)
|
---|
30 | SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
|
---|
31 | else SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
|
---|
32 |
|
---|
33 | return O32_DefWindowProc(hwnd, Msg, wParam, lParam);
|
---|
34 | case WM_NCCREATE://SvL: YAFMO (yet another feature missing in Open32)
|
---|
35 | return(TRUE);
|
---|
36 | case WM_CTLCOLORMSGBOX:
|
---|
37 | case WM_CTLCOLOREDIT:
|
---|
38 | case WM_CTLCOLORLISTBOX:
|
---|
39 | case WM_CTLCOLORBTN:
|
---|
40 | case WM_CTLCOLORDLG:
|
---|
41 | case WM_CTLCOLORSTATIC:
|
---|
42 | case WM_CTLCOLORSCROLLBAR:
|
---|
43 | SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
|
---|
44 | SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
|
---|
45 | return GetSysColorBrush(COLOR_BTNFACE);
|
---|
46 |
|
---|
47 | case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
|
---|
48 | dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
|
---|
49 | return 0;
|
---|
50 |
|
---|
51 | case WM_MOUSEACTIVATE:
|
---|
52 | {
|
---|
53 | DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
|
---|
54 | DWORD dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
|
---|
55 | dprintf(("DefWndProc: WM_MOUSEACTIVATE for %x Msg %s", hwnd, GetMsgText(HIWORD(lParam))));
|
---|
56 | if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) )
|
---|
57 | {
|
---|
58 | LRESULT rc = SendMessageA(GetParent(hwnd), WM_MOUSEACTIVATE, wParam, lParam );
|
---|
59 | if(rc) return rc;
|
---|
60 | }
|
---|
61 | return (LOWORD(lParam) == HTCAPTION) ? MA_NOACTIVATE : MA_ACTIVATE;
|
---|
62 | }
|
---|
63 | case WM_SETCURSOR:
|
---|
64 | {
|
---|
65 | DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
|
---|
66 | DWORD dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
|
---|
67 | dprintf(("DefWndProc: WM_SETCURSOR for %x Msg %s", hwnd, GetMsgText(HIWORD(lParam))));
|
---|
68 | if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) )
|
---|
69 | {
|
---|
70 | LRESULT rc = SendMessageA(GetParent(hwnd), WM_SETCURSOR, wParam, lParam);
|
---|
71 | if(rc) return rc;
|
---|
72 | }
|
---|
73 | return O32_DefWindowProc(hwnd, Msg, wParam, lParam);
|
---|
74 | }
|
---|
75 | default:
|
---|
76 | return O32_DefWindowProc(hwnd, Msg, wParam, lParam);
|
---|
77 | }
|
---|
78 | }
|
---|
79 | //******************************************************************************
|
---|
80 | //NOTE: Unicode msg translation!
|
---|
81 | //******************************************************************************
|
---|
82 | LRESULT WIN32API DefWindowProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
83 | {
|
---|
84 | #ifdef DEBUG
|
---|
85 | //// WriteLog("*DWPW*");
|
---|
86 | #endif
|
---|
87 | switch(Msg) {
|
---|
88 | case WM_SETREDRAW: //Open32 does not set the visible flag
|
---|
89 | if(wParam)
|
---|
90 | SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
|
---|
91 | else
|
---|
92 | SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
|
---|
93 | return O32_DefWindowProc(hwnd, Msg, wParam, lParam);
|
---|
94 | case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
|
---|
95 | return(TRUE);
|
---|
96 | case WM_CTLCOLORMSGBOX:
|
---|
97 | case WM_CTLCOLOREDIT:
|
---|
98 | case WM_CTLCOLORLISTBOX:
|
---|
99 | case WM_CTLCOLORBTN:
|
---|
100 | case WM_CTLCOLORDLG:
|
---|
101 | case WM_CTLCOLORSTATIC:
|
---|
102 | case WM_CTLCOLORSCROLLBAR:
|
---|
103 | SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
|
---|
104 | SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
|
---|
105 | return GetSysColorBrush(COLOR_BTNFACE);
|
---|
106 |
|
---|
107 | case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
|
---|
108 | dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
|
---|
109 | return 0;
|
---|
110 |
|
---|
111 | default:
|
---|
112 | return O32_DefWindowProc(hwnd, Msg, wParam, lParam);
|
---|
113 | }
|
---|
114 | }
|
---|
115 | //******************************************************************************
|
---|
116 | //******************************************************************************
|
---|
117 | LRESULT WIN32API DefDlgProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
118 | {
|
---|
119 | #ifdef DEBUG
|
---|
120 | //// WriteLog("*DDP*");
|
---|
121 | #endif
|
---|
122 | switch(Msg) {
|
---|
123 | case WM_SETREDRAW: //Open32 does not set the visible flag
|
---|
124 | if(wParam)
|
---|
125 | SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
|
---|
126 | else
|
---|
127 | SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
|
---|
128 | return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
|
---|
129 | case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
|
---|
130 | return(TRUE);
|
---|
131 | case WM_CTLCOLORMSGBOX:
|
---|
132 | case WM_CTLCOLOREDIT:
|
---|
133 | case WM_CTLCOLORLISTBOX:
|
---|
134 | case WM_CTLCOLORBTN:
|
---|
135 | case WM_CTLCOLORDLG:
|
---|
136 | case WM_CTLCOLORSTATIC:
|
---|
137 | case WM_CTLCOLORSCROLLBAR:
|
---|
138 | SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
|
---|
139 | SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
|
---|
140 | return GetSysColorBrush(COLOR_BTNFACE);
|
---|
141 |
|
---|
142 | case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
|
---|
143 | dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
|
---|
144 | return 0;
|
---|
145 |
|
---|
146 | default:
|
---|
147 | return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
|
---|
148 | }
|
---|
149 | }
|
---|
150 | //******************************************************************************
|
---|
151 | //NOTE: Unicode msg translation!
|
---|
152 | //******************************************************************************
|
---|
153 | LRESULT WIN32API DefDlgProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
154 | {
|
---|
155 | #ifdef DEBUG
|
---|
156 | //// WriteLog("*DDPW*");
|
---|
157 | #endif
|
---|
158 | switch(Msg) {
|
---|
159 | case WM_SETREDRAW: //Open32 does not set the visible flag
|
---|
160 | if(wParam)
|
---|
161 | SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
|
---|
162 | else
|
---|
163 | SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
|
---|
164 | return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
|
---|
165 | case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
|
---|
166 | return(TRUE);
|
---|
167 | case WM_CTLCOLORMSGBOX:
|
---|
168 | case WM_CTLCOLOREDIT:
|
---|
169 | case WM_CTLCOLORLISTBOX:
|
---|
170 | case WM_CTLCOLORBTN:
|
---|
171 | case WM_CTLCOLORDLG:
|
---|
172 | case WM_CTLCOLORSTATIC:
|
---|
173 | case WM_CTLCOLORSCROLLBAR:
|
---|
174 | SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
|
---|
175 | SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
|
---|
176 | return GetSysColorBrush(COLOR_BTNFACE);
|
---|
177 |
|
---|
178 | case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
|
---|
179 | dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
|
---|
180 | return 0;
|
---|
181 |
|
---|
182 | default:
|
---|
183 | return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
|
---|
184 | }
|
---|
185 | }
|
---|
186 | //******************************************************************************
|
---|
187 | //******************************************************************************
|
---|
188 | LRESULT WIN32API DefFrameProcA(HWND hwndFrame, HWND hwndClient, UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
189 | {
|
---|
190 | #ifdef DEBUG
|
---|
191 | //// WriteLog("*DFP*");
|
---|
192 | #endif
|
---|
193 | switch(Msg) {
|
---|
194 | case WM_SETREDRAW: //Open32 does not set the visible flag
|
---|
195 | if(wParam)
|
---|
196 | SetWindowLongA (hwndClient, GWL_STYLE, GetWindowLongA (hwndClient, GWL_STYLE) | WS_VISIBLE);
|
---|
197 | else
|
---|
198 | SetWindowLongA (hwndClient, GWL_STYLE, GetWindowLongA (hwndClient, GWL_STYLE) & ~WS_VISIBLE);
|
---|
199 | return O32_DefFrameProc(hwndFrame, hwndClient, Msg, wParam, lParam);
|
---|
200 | case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
|
---|
201 | return(TRUE);
|
---|
202 | case WM_CTLCOLORMSGBOX:
|
---|
203 | case WM_CTLCOLOREDIT:
|
---|
204 | case WM_CTLCOLORLISTBOX:
|
---|
205 | case WM_CTLCOLORBTN:
|
---|
206 | case WM_CTLCOLORDLG:
|
---|
207 | case WM_CTLCOLORSTATIC:
|
---|
208 | case WM_CTLCOLORSCROLLBAR:
|
---|
209 | SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
|
---|
210 | SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
|
---|
211 | return GetSysColorBrush(COLOR_BTNFACE);
|
---|
212 |
|
---|
213 | case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
|
---|
214 | dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwndFrame));
|
---|
215 | return 0;
|
---|
216 |
|
---|
217 | default:
|
---|
218 | return O32_DefFrameProc(hwndFrame, hwndClient, Msg, wParam, lParam);
|
---|
219 | }
|
---|
220 | }
|
---|
221 | //******************************************************************************
|
---|
222 | //NOTE: Unicode msg translation!
|
---|
223 | //******************************************************************************
|
---|
224 | LRESULT WIN32API DefFrameProcW(HWND hwndFrame, HWND hwndClient, UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
225 | {
|
---|
226 | #ifdef DEBUG
|
---|
227 | //// WriteLog("*DFPW*");
|
---|
228 | #endif
|
---|
229 | switch(Msg) {
|
---|
230 | case WM_SETREDRAW: //Open32 does not set the visible flag
|
---|
231 | if(wParam)
|
---|
232 | SetWindowLongA (hwndClient, GWL_STYLE, GetWindowLongA (hwndClient, GWL_STYLE) | WS_VISIBLE);
|
---|
233 | else
|
---|
234 | SetWindowLongA (hwndClient, GWL_STYLE, GetWindowLongA (hwndClient, GWL_STYLE) & ~WS_VISIBLE);
|
---|
235 | return O32_DefFrameProc(hwndFrame, hwndClient, Msg, wParam, lParam);
|
---|
236 | case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
|
---|
237 | return(TRUE);
|
---|
238 | case WM_CTLCOLORMSGBOX:
|
---|
239 | case WM_CTLCOLOREDIT:
|
---|
240 | case WM_CTLCOLORLISTBOX:
|
---|
241 | case WM_CTLCOLORBTN:
|
---|
242 | case WM_CTLCOLORDLG:
|
---|
243 | case WM_CTLCOLORSTATIC:
|
---|
244 | case WM_CTLCOLORSCROLLBAR:
|
---|
245 | SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
|
---|
246 | SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
|
---|
247 | return GetSysColorBrush(COLOR_BTNFACE);
|
---|
248 |
|
---|
249 | case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
|
---|
250 | dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwndFrame));
|
---|
251 | return 0;
|
---|
252 |
|
---|
253 | default:
|
---|
254 | return O32_DefFrameProc(hwndFrame, hwndClient, Msg, wParam, lParam);
|
---|
255 | }
|
---|
256 | }
|
---|
257 | //******************************************************************************
|
---|
258 | //******************************************************************************
|
---|
259 | LRESULT WIN32API DefMDIChildProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
260 | {
|
---|
261 | #ifdef DEBUG
|
---|
262 | //// WriteLog("*DMP*");
|
---|
263 | #endif
|
---|
264 | switch(Msg) {
|
---|
265 | case WM_SETREDRAW: //Open32 does not set the visible flag
|
---|
266 | if(wParam)
|
---|
267 | SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
|
---|
268 | else
|
---|
269 | SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
|
---|
270 | return O32_DefMDIChildProc(hwnd, Msg, wParam, lParam);
|
---|
271 | case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
|
---|
272 | return(TRUE);
|
---|
273 | case WM_CTLCOLORMSGBOX:
|
---|
274 | case WM_CTLCOLOREDIT:
|
---|
275 | case WM_CTLCOLORLISTBOX:
|
---|
276 | case WM_CTLCOLORBTN:
|
---|
277 | case WM_CTLCOLORDLG:
|
---|
278 | case WM_CTLCOLORSTATIC:
|
---|
279 | case WM_CTLCOLORSCROLLBAR:
|
---|
280 | SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
|
---|
281 | SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
|
---|
282 | return GetSysColorBrush(COLOR_BTNFACE);
|
---|
283 |
|
---|
284 | case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
|
---|
285 | dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
|
---|
286 | return 0;
|
---|
287 |
|
---|
288 | default:
|
---|
289 | return O32_DefMDIChildProc(hwnd, Msg, wParam, lParam);
|
---|
290 | }
|
---|
291 | }
|
---|
292 | //******************************************************************************
|
---|
293 | //NOTE: Unicode msg translation!
|
---|
294 | //******************************************************************************
|
---|
295 | LRESULT WIN32API DefMDIChildProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
296 | {
|
---|
297 | #ifdef DEBUG
|
---|
298 | //// WriteLog("*DMPW*");
|
---|
299 | #endif
|
---|
300 | switch(Msg) {
|
---|
301 | case WM_SETREDRAW: //Open32 does not set the visible flag
|
---|
302 | if(wParam)
|
---|
303 | SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
|
---|
304 | else
|
---|
305 | SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
|
---|
306 | return O32_DefMDIChildProc(hwnd, Msg, wParam, lParam);
|
---|
307 | case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
|
---|
308 | return(TRUE);
|
---|
309 | case WM_CTLCOLORMSGBOX:
|
---|
310 | case WM_CTLCOLOREDIT:
|
---|
311 | case WM_CTLCOLORLISTBOX:
|
---|
312 | case WM_CTLCOLORBTN:
|
---|
313 | case WM_CTLCOLORDLG:
|
---|
314 | case WM_CTLCOLORSTATIC:
|
---|
315 | case WM_CTLCOLORSCROLLBAR:
|
---|
316 | SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
|
---|
317 | SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
|
---|
318 | return GetSysColorBrush(COLOR_BTNFACE);
|
---|
319 |
|
---|
320 | case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
|
---|
321 | dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
|
---|
322 | return 0;
|
---|
323 |
|
---|
324 | default:
|
---|
325 | return O32_DefMDIChildProc(hwnd, Msg, wParam, lParam);
|
---|
326 | }
|
---|
327 | }
|
---|
328 | //******************************************************************************
|
---|
329 | //******************************************************************************
|
---|