| 1 | /* $Id: defwndproc.cpp,v 1.15 2001-06-09 14:50:17 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 | #include "win32dlg.h"
|
|---|
| 20 |
|
|---|
| 21 | #define DBG_LOCALLOG DBG_defwndproc
|
|---|
| 22 | #include "dbglocal.h"
|
|---|
| 23 |
|
|---|
| 24 | #ifdef DEBUG
|
|---|
| 25 | char *GetMsgText(int Msg);
|
|---|
| 26 | #endif
|
|---|
| 27 |
|
|---|
| 28 | //******************************************************************************
|
|---|
| 29 | //******************************************************************************
|
|---|
| 30 | LRESULT WIN32API DefWindowProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 31 | {
|
|---|
| 32 | Win32BaseWindow *window;
|
|---|
| 33 | LRESULT result;
|
|---|
| 34 |
|
|---|
| 35 | dprintf2(("DefWindowProcA %x %x %x %x", hwnd, Msg, wParam, lParam));
|
|---|
| 36 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
|---|
| 37 | if(!window) {
|
|---|
| 38 | dprintf(("DefWindowProcA, window %x not found", hwnd));
|
|---|
| 39 | return 0;
|
|---|
| 40 | }
|
|---|
| 41 | result = window->DefWindowProcA(Msg, wParam, lParam);
|
|---|
| 42 | RELEASE_WNDOBJ(window);
|
|---|
| 43 | return result;
|
|---|
| 44 | }
|
|---|
| 45 | //******************************************************************************
|
|---|
| 46 | //******************************************************************************
|
|---|
| 47 | LRESULT WIN32API DefWindowProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 48 | {
|
|---|
| 49 | Win32BaseWindow *window;
|
|---|
| 50 | LRESULT result;
|
|---|
| 51 |
|
|---|
| 52 | dprintf2(("DefWindowProcW %x %x %x %x", hwnd, Msg, wParam, lParam));
|
|---|
| 53 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
|---|
| 54 | if(!window) {
|
|---|
| 55 | dprintf(("DefWindowProcW, window %x not found", hwnd));
|
|---|
| 56 | return 0;
|
|---|
| 57 | }
|
|---|
| 58 | result = window->DefWindowProcW(Msg, wParam, lParam);
|
|---|
| 59 | RELEASE_WNDOBJ(window);
|
|---|
| 60 | return result;
|
|---|
| 61 | }
|
|---|
| 62 | //******************************************************************************
|
|---|
| 63 | //******************************************************************************
|
|---|
| 64 | LRESULT WIN32API DefDlgProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 65 | {
|
|---|
| 66 | Win32Dialog *dialog;
|
|---|
| 67 | LRESULT result;
|
|---|
| 68 |
|
|---|
| 69 | dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd);
|
|---|
| 70 | //TODO: Wrong check?
|
|---|
| 71 | // if(!dialog || !dialog->IsDialog()) {
|
|---|
| 72 | if(!dialog) {
|
|---|
| 73 | dprintf(("DefDlgProcA, window %x not found", hwnd));
|
|---|
| 74 | return 0;
|
|---|
| 75 | }
|
|---|
| 76 | if(dialog->IsDialog())
|
|---|
| 77 | result = dialog->DefDlgProcA(Msg, wParam, lParam);
|
|---|
| 78 | else result = dialog->DefWindowProcA(Msg, wParam, lParam);
|
|---|
| 79 | RELEASE_WNDOBJ(dialog);
|
|---|
| 80 | return result;
|
|---|
| 81 | }
|
|---|
| 82 | //******************************************************************************
|
|---|
| 83 | //******************************************************************************
|
|---|
| 84 | LRESULT WIN32API DefDlgProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 85 | {
|
|---|
| 86 | Win32Dialog *dialog;
|
|---|
| 87 | LRESULT result;
|
|---|
| 88 |
|
|---|
| 89 | dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd);
|
|---|
| 90 | //TODO: Wrong check?
|
|---|
| 91 | // if(!dialog || !dialog->IsDialog()) {
|
|---|
| 92 | if(!dialog) {
|
|---|
| 93 | dprintf(("DefDlgProcW, window %x not found", hwnd));
|
|---|
| 94 | return 0;
|
|---|
| 95 | }
|
|---|
| 96 | if(dialog->IsDialog())
|
|---|
| 97 | result = dialog->DefDlgProcW(Msg, wParam, lParam);
|
|---|
| 98 | else result = dialog->DefWindowProcW(Msg, wParam, lParam);
|
|---|
| 99 | RELEASE_WNDOBJ(dialog);
|
|---|
| 100 | return result;
|
|---|
| 101 | }
|
|---|
| 102 | //******************************************************************************
|
|---|
| 103 | //******************************************************************************
|
|---|
| 104 | LRESULT WIN32API DefFrameProcA(HWND hwndFrame, HWND hwndMDIClient, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 105 | {
|
|---|
| 106 | Win32Window *window;
|
|---|
| 107 | LRESULT result;
|
|---|
| 108 |
|
|---|
| 109 | window = (Win32Window *)Win32BaseWindow::GetWindowFromHandle(hwndFrame);
|
|---|
| 110 | if(!window) {
|
|---|
| 111 | dprintf(("DefFrameProcA, window %x not found", hwndFrame));
|
|---|
| 112 | return 0;
|
|---|
| 113 | }
|
|---|
| 114 | result = window->DefFrameProcA(hwndMDIClient, Msg, wParam, lParam);
|
|---|
| 115 | RELEASE_WNDOBJ(window);
|
|---|
| 116 | return result;
|
|---|
| 117 | }
|
|---|
| 118 | //******************************************************************************
|
|---|
| 119 | //******************************************************************************
|
|---|
| 120 | LRESULT WIN32API DefFrameProcW(HWND hwndFrame, HWND hwndMDIClient, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 121 | {
|
|---|
| 122 | Win32Window *window;
|
|---|
| 123 | LRESULT result;
|
|---|
| 124 |
|
|---|
| 125 | window = (Win32Window *)Win32BaseWindow::GetWindowFromHandle(hwndFrame);
|
|---|
| 126 | if(!window) {
|
|---|
| 127 | dprintf(("DefFrameProcW, window %x not found", hwndFrame));
|
|---|
| 128 | return 0;
|
|---|
| 129 | }
|
|---|
| 130 | result = window->DefFrameProcW(hwndMDIClient, Msg, wParam, lParam);
|
|---|
| 131 | RELEASE_WNDOBJ(window);
|
|---|
| 132 | return result;
|
|---|
| 133 | }
|
|---|
| 134 | //******************************************************************************
|
|---|
| 135 | //******************************************************************************
|
|---|
| 136 | LRESULT WIN32API DefMDIChildProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 137 | {
|
|---|
| 138 | Win32MDIChildWindow *window;
|
|---|
| 139 | LRESULT result;
|
|---|
| 140 |
|
|---|
| 141 | window = (Win32MDIChildWindow *)Win32BaseWindow::GetWindowFromHandle(hwnd);
|
|---|
| 142 | if(!window) {
|
|---|
| 143 | dprintf(("DefMDIProcA, window %x not found", hwnd));
|
|---|
| 144 | return 0;
|
|---|
| 145 | }
|
|---|
| 146 | if(!window->isMDIChild()) {
|
|---|
| 147 | dprintf(("App called DefMDIChildProcA for non-MDI window %x", hwnd));
|
|---|
| 148 | result = window->DefWindowProcA(Msg, wParam, lParam);
|
|---|
| 149 | }
|
|---|
| 150 | else result = window->DefMDIChildProcA(Msg, wParam, lParam);
|
|---|
| 151 | RELEASE_WNDOBJ(window);
|
|---|
| 152 | return result;
|
|---|
| 153 | }
|
|---|
| 154 | //******************************************************************************
|
|---|
| 155 | //******************************************************************************
|
|---|
| 156 | LRESULT WIN32API DefMDIChildProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 157 | {
|
|---|
| 158 | Win32MDIChildWindow *window;
|
|---|
| 159 | LRESULT result;
|
|---|
| 160 |
|
|---|
| 161 | window = (Win32MDIChildWindow *)Win32BaseWindow::GetWindowFromHandle(hwnd);
|
|---|
| 162 | if(!window) {
|
|---|
| 163 | dprintf(("DefMDIProcW, window %x not found", hwnd));
|
|---|
| 164 | return 0;
|
|---|
| 165 | }
|
|---|
| 166 | if(!window->isMDIChild()) {
|
|---|
| 167 | dprintf(("App called DefMDIChildProcA for non-MDI window %x", hwnd));
|
|---|
| 168 | result = window->DefWindowProcW(Msg, wParam, lParam);
|
|---|
| 169 | }
|
|---|
| 170 | else result = window->DefMDIChildProcW(Msg, wParam, lParam);
|
|---|
| 171 | RELEASE_WNDOBJ(window);
|
|---|
| 172 | return result;
|
|---|
| 173 | }
|
|---|
| 174 | //******************************************************************************
|
|---|
| 175 | //******************************************************************************
|
|---|