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

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

Mouse message handling changes

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