source: trunk/src/user32/new/defwndproc.cpp@ 328

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

* empty log message *

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