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