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