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

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

Redesign; base class for all window types

File size: 8.4 KB
Line 
1/* $Id: defwndproc.cpp,v 1.6 1999-08-30 11:59:53 sandervl Exp $ */
2
3/*
4 * Win32 default window API functions for OS/2
5 *
6 * Copyright 1998 Sander van Leeuwen
7 *
8 *
9 * TODO: Incomplete default window handlers + incorrect handler (defframe)
10 *
11 * Project Odin Software License can be found in LICENSE.TXT
12 *
13 */
14#include "user32.h"
15#include "syscolor.h"
16#include "win32wbase.h"
17#include "win32wnd.h"
18
19#ifdef DEBUG
20char *GetMsgText(int Msg);
21#endif
22
23//******************************************************************************
24//******************************************************************************
25LRESULT WIN32API DefWindowProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
26{
27 Win32BaseWindow *window;
28
29 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
30 if(!window) {
31 dprintf(("DefWindowProcA, window %x not found", hwnd));
32 return 0;
33 }
34 return window->DefWindowProcA(Msg, wParam, lParam);
35}
36//******************************************************************************
37//******************************************************************************
38LRESULT WIN32API DefWindowProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
39{
40 Win32BaseWindow *window;
41
42 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
43 if(!window) {
44 dprintf(("DefWindowProcW, window %x not found", hwnd));
45 return 0;
46 }
47 return window->DefWindowProcW(Msg, wParam, lParam);
48}
49//******************************************************************************
50//******************************************************************************
51LRESULT WIN32API DefDlgProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
52{
53#ifdef DEBUG
54//// WriteLog("*DDP*");
55#endif
56 switch(Msg) {
57 case WM_SETREDRAW: //Open32 does not set the visible flag
58 if(wParam)
59 SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
60 else
61 SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
62 return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
63 case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
64 return(TRUE);
65 case WM_CTLCOLORMSGBOX:
66 case WM_CTLCOLOREDIT:
67 case WM_CTLCOLORLISTBOX:
68 case WM_CTLCOLORBTN:
69 case WM_CTLCOLORDLG:
70 case WM_CTLCOLORSTATIC:
71 case WM_CTLCOLORSCROLLBAR:
72 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
73 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
74 return GetSysColorBrush(COLOR_BTNFACE);
75
76 case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
77 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
78 return 0;
79
80 default:
81 return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
82 }
83}
84//******************************************************************************
85//NOTE: Unicode msg translation!
86//******************************************************************************
87LRESULT WIN32API DefDlgProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
88{
89#ifdef DEBUG
90//// WriteLog("*DDPW*");
91#endif
92 switch(Msg) {
93 case WM_SETREDRAW: //Open32 does not set the visible flag
94 if(wParam)
95 SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
96 else
97 SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
98 return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
99 case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
100 return(TRUE);
101 case WM_CTLCOLORMSGBOX:
102 case WM_CTLCOLOREDIT:
103 case WM_CTLCOLORLISTBOX:
104 case WM_CTLCOLORBTN:
105 case WM_CTLCOLORDLG:
106 case WM_CTLCOLORSTATIC:
107 case WM_CTLCOLORSCROLLBAR:
108 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
109 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
110 return GetSysColorBrush(COLOR_BTNFACE);
111
112 case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
113 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
114 return 0;
115
116 default:
117 return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
118 }
119}
120//******************************************************************************
121//******************************************************************************
122LRESULT WIN32API DefFrameProcA(HWND hwndFrame, HWND hwndMDIClient, UINT Msg, WPARAM wParam, LPARAM lParam)
123{
124 Win32Window *window;
125
126 window = (Win32Window *)Win32BaseWindow::GetWindowFromHandle(hwndFrame);
127 if(!window) {
128 dprintf(("DefFrameProcA, window %x not found", hwndFrame));
129 return 0;
130 }
131 return window->DefFrameProcA(hwndMDIClient, Msg, wParam, lParam);
132}
133//******************************************************************************
134//******************************************************************************
135LRESULT WIN32API DefFrameProcW(HWND hwndFrame, HWND hwndMDIClient, UINT Msg, WPARAM wParam, LPARAM lParam)
136{
137 Win32Window *window;
138
139 window = (Win32Window *)Win32BaseWindow::GetWindowFromHandle(hwndFrame);
140 if(!window) {
141 dprintf(("DefFrameProcW, window %x not found", hwndFrame));
142 return 0;
143 }
144 return window->DefFrameProcW(hwndMDIClient, Msg, wParam, lParam);
145}
146//******************************************************************************
147//******************************************************************************
148LRESULT WIN32API DefMDIChildProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
149{
150#ifdef DEBUG
151//// WriteLog("*DMP*");
152#endif
153 switch(Msg) {
154 case WM_SETREDRAW: //Open32 does not set the visible flag
155 if(wParam)
156 SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
157 else
158 SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
159 return O32_DefMDIChildProc(hwnd, Msg, wParam, lParam);
160 case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
161 return(TRUE);
162 case WM_CTLCOLORMSGBOX:
163 case WM_CTLCOLOREDIT:
164 case WM_CTLCOLORLISTBOX:
165 case WM_CTLCOLORBTN:
166 case WM_CTLCOLORDLG:
167 case WM_CTLCOLORSTATIC:
168 case WM_CTLCOLORSCROLLBAR:
169 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
170 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
171 return GetSysColorBrush(COLOR_BTNFACE);
172
173 case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
174 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
175 return 0;
176
177 default:
178 return O32_DefMDIChildProc(hwnd, Msg, wParam, lParam);
179 }
180}
181//******************************************************************************
182//NOTE: Unicode msg translation!
183//******************************************************************************
184LRESULT WIN32API DefMDIChildProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
185{
186#ifdef DEBUG
187//// WriteLog("*DMPW*");
188#endif
189 switch(Msg) {
190 case WM_SETREDRAW: //Open32 does not set the visible flag
191 if(wParam)
192 SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
193 else
194 SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
195 return O32_DefMDIChildProc(hwnd, Msg, wParam, lParam);
196 case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
197 return(TRUE);
198 case WM_CTLCOLORMSGBOX:
199 case WM_CTLCOLOREDIT:
200 case WM_CTLCOLORLISTBOX:
201 case WM_CTLCOLORBTN:
202 case WM_CTLCOLORDLG:
203 case WM_CTLCOLORSTATIC:
204 case WM_CTLCOLORSCROLLBAR:
205 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
206 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
207 return GetSysColorBrush(COLOR_BTNFACE);
208
209 case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
210 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
211 return 0;
212
213 default:
214 return O32_DefMDIChildProc(hwnd, Msg, wParam, lParam);
215 }
216}
217//******************************************************************************
218//******************************************************************************
Note: See TracBrowser for help on using the repository browser.