| 1 | /* $Id: defwndproc.cpp,v 1.7 1999-08-31 17:14:51 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 | #include "win32wmdichild.h"
|
|---|
| 19 |
|
|---|
| 20 | #ifdef DEBUG
|
|---|
| 21 | char *GetMsgText(int Msg);
|
|---|
| 22 | #endif
|
|---|
| 23 |
|
|---|
| 24 | //******************************************************************************
|
|---|
| 25 | //******************************************************************************
|
|---|
| 26 | LRESULT WIN32API DefWindowProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 27 | {
|
|---|
| 28 | Win32BaseWindow *window;
|
|---|
| 29 |
|
|---|
| 30 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
|---|
| 31 | if(!window) {
|
|---|
| 32 | dprintf(("DefWindowProcA, window %x not found", hwnd));
|
|---|
| 33 | return 0;
|
|---|
| 34 | }
|
|---|
| 35 | return window->DefWindowProcA(Msg, wParam, lParam);
|
|---|
| 36 | }
|
|---|
| 37 | //******************************************************************************
|
|---|
| 38 | //******************************************************************************
|
|---|
| 39 | LRESULT WIN32API DefWindowProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 40 | {
|
|---|
| 41 | Win32BaseWindow *window;
|
|---|
| 42 |
|
|---|
| 43 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
|---|
| 44 | if(!window) {
|
|---|
| 45 | dprintf(("DefWindowProcW, window %x not found", hwnd));
|
|---|
| 46 | return 0;
|
|---|
| 47 | }
|
|---|
| 48 | return window->DefWindowProcW(Msg, wParam, lParam);
|
|---|
| 49 | }
|
|---|
| 50 | //******************************************************************************
|
|---|
| 51 | //******************************************************************************
|
|---|
| 52 | LRESULT WIN32API DefDlgProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 53 | {
|
|---|
| 54 | #ifdef DEBUG
|
|---|
| 55 | //// WriteLog("*DDP*");
|
|---|
| 56 | #endif
|
|---|
| 57 | switch(Msg) {
|
|---|
| 58 | case WM_SETREDRAW: //Open32 does not set the visible flag
|
|---|
| 59 | if(wParam)
|
|---|
| 60 | SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
|
|---|
| 61 | else
|
|---|
| 62 | SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
|
|---|
| 63 | return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
|
|---|
| 64 | case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
|
|---|
| 65 | return(TRUE);
|
|---|
| 66 | case WM_CTLCOLORMSGBOX:
|
|---|
| 67 | case WM_CTLCOLOREDIT:
|
|---|
| 68 | case WM_CTLCOLORLISTBOX:
|
|---|
| 69 | case WM_CTLCOLORBTN:
|
|---|
| 70 | case WM_CTLCOLORDLG:
|
|---|
| 71 | case WM_CTLCOLORSTATIC:
|
|---|
| 72 | case WM_CTLCOLORSCROLLBAR:
|
|---|
| 73 | SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
|
|---|
| 74 | SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
|
|---|
| 75 | return GetSysColorBrush(COLOR_BTNFACE);
|
|---|
| 76 |
|
|---|
| 77 | case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
|
|---|
| 78 | dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
|
|---|
| 79 | return 0;
|
|---|
| 80 |
|
|---|
| 81 | default:
|
|---|
| 82 | return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
|
|---|
| 83 | }
|
|---|
| 84 | }
|
|---|
| 85 | //******************************************************************************
|
|---|
| 86 | //NOTE: Unicode msg translation!
|
|---|
| 87 | //******************************************************************************
|
|---|
| 88 | LRESULT WIN32API DefDlgProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 89 | {
|
|---|
| 90 | #ifdef DEBUG
|
|---|
| 91 | //// WriteLog("*DDPW*");
|
|---|
| 92 | #endif
|
|---|
| 93 | switch(Msg) {
|
|---|
| 94 | case WM_SETREDRAW: //Open32 does not set the visible flag
|
|---|
| 95 | if(wParam)
|
|---|
| 96 | SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
|
|---|
| 97 | else
|
|---|
| 98 | SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
|
|---|
| 99 | return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
|
|---|
| 100 | case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
|
|---|
| 101 | return(TRUE);
|
|---|
| 102 | case WM_CTLCOLORMSGBOX:
|
|---|
| 103 | case WM_CTLCOLOREDIT:
|
|---|
| 104 | case WM_CTLCOLORLISTBOX:
|
|---|
| 105 | case WM_CTLCOLORBTN:
|
|---|
| 106 | case WM_CTLCOLORDLG:
|
|---|
| 107 | case WM_CTLCOLORSTATIC:
|
|---|
| 108 | case WM_CTLCOLORSCROLLBAR:
|
|---|
| 109 | SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
|
|---|
| 110 | SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
|
|---|
| 111 | return GetSysColorBrush(COLOR_BTNFACE);
|
|---|
| 112 |
|
|---|
| 113 | case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
|
|---|
| 114 | dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
|
|---|
| 115 | return 0;
|
|---|
| 116 |
|
|---|
| 117 | default:
|
|---|
| 118 | return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
|
|---|
| 119 | }
|
|---|
| 120 | }
|
|---|
| 121 | //******************************************************************************
|
|---|
| 122 | //******************************************************************************
|
|---|
| 123 | LRESULT WIN32API DefFrameProcA(HWND hwndFrame, HWND hwndMDIClient, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 124 | {
|
|---|
| 125 | Win32Window *window;
|
|---|
| 126 |
|
|---|
| 127 | window = (Win32Window *)Win32BaseWindow::GetWindowFromHandle(hwndFrame);
|
|---|
| 128 | if(!window) {
|
|---|
| 129 | dprintf(("DefFrameProcA, window %x not found", hwndFrame));
|
|---|
| 130 | return 0;
|
|---|
| 131 | }
|
|---|
| 132 | return window->DefFrameProcA(hwndMDIClient, Msg, wParam, lParam);
|
|---|
| 133 | }
|
|---|
| 134 | //******************************************************************************
|
|---|
| 135 | //******************************************************************************
|
|---|
| 136 | LRESULT WIN32API DefFrameProcW(HWND hwndFrame, HWND hwndMDIClient, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 137 | {
|
|---|
| 138 | Win32Window *window;
|
|---|
| 139 |
|
|---|
| 140 | window = (Win32Window *)Win32BaseWindow::GetWindowFromHandle(hwndFrame);
|
|---|
| 141 | if(!window) {
|
|---|
| 142 | dprintf(("DefFrameProcW, window %x not found", hwndFrame));
|
|---|
| 143 | return 0;
|
|---|
| 144 | }
|
|---|
| 145 | return window->DefFrameProcW(hwndMDIClient, Msg, wParam, lParam);
|
|---|
| 146 | }
|
|---|
| 147 | //******************************************************************************
|
|---|
| 148 | //******************************************************************************
|
|---|
| 149 | LRESULT WIN32API DefMDIChildProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 150 | {
|
|---|
| 151 | Win32MDIChildWindow *window;
|
|---|
| 152 |
|
|---|
| 153 | window = (Win32MDIChildWindow *)Win32BaseWindow::GetWindowFromHandle(hwnd);
|
|---|
| 154 | if(!window) {
|
|---|
| 155 | dprintf(("DefMDIProcA, window %x not found", hwnd));
|
|---|
| 156 | return 0;
|
|---|
| 157 | }
|
|---|
| 158 | return window->DefMDIChildProcA(Msg, wParam, lParam);
|
|---|
| 159 | }
|
|---|
| 160 | //******************************************************************************
|
|---|
| 161 | //******************************************************************************
|
|---|
| 162 | LRESULT WIN32API DefMDIChildProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 163 | {
|
|---|
| 164 | Win32MDIChildWindow *window;
|
|---|
| 165 |
|
|---|
| 166 | window = (Win32MDIChildWindow *)Win32BaseWindow::GetWindowFromHandle(hwnd);
|
|---|
| 167 | if(!window) {
|
|---|
| 168 | dprintf(("DefMDIProcW, window %x not found", hwnd));
|
|---|
| 169 | return 0;
|
|---|
| 170 | }
|
|---|
| 171 | return window->DefMDIChildProcW(Msg, wParam, lParam);
|
|---|
| 172 | }
|
|---|
| 173 | //******************************************************************************
|
|---|
| 174 | //******************************************************************************
|
|---|