source: trunk/src/user32/old/defwndproc.cpp@ 2013

Last change on this file since 2013 was 950, checked in by sandervl, 26 years ago

Moved old user32 here

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