| 1 | /* $Id: defwndproc.cpp,v 1.16 2001-09-19 15:39:47 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 "win32dlg.h" | 
|---|
| 18 |  | 
|---|
| 19 | #define DBG_LOCALLOG    DBG_defwndproc | 
|---|
| 20 | #include "dbglocal.h" | 
|---|
| 21 |  | 
|---|
| 22 | #ifdef DEBUG | 
|---|
| 23 | char *GetMsgText(int Msg); | 
|---|
| 24 | #endif | 
|---|
| 25 |  | 
|---|
| 26 | //****************************************************************************** | 
|---|
| 27 | //****************************************************************************** | 
|---|
| 28 | LRESULT WIN32API DefWindowProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) | 
|---|
| 29 | { | 
|---|
| 30 | Win32BaseWindow *window; | 
|---|
| 31 | LRESULT result; | 
|---|
| 32 |  | 
|---|
| 33 | dprintf2(("DefWindowProcA %x %x %x %x", hwnd, Msg, wParam, lParam)); | 
|---|
| 34 | window = Win32BaseWindow::GetWindowFromHandle(hwnd); | 
|---|
| 35 | if(!window) { | 
|---|
| 36 | dprintf(("DefWindowProcA, window %x not found", hwnd)); | 
|---|
| 37 | return 0; | 
|---|
| 38 | } | 
|---|
| 39 | result = window->DefWindowProcA(Msg, wParam, lParam); | 
|---|
| 40 | RELEASE_WNDOBJ(window); | 
|---|
| 41 | return result; | 
|---|
| 42 | } | 
|---|
| 43 | //****************************************************************************** | 
|---|
| 44 | //****************************************************************************** | 
|---|
| 45 | LRESULT WIN32API DefWindowProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) | 
|---|
| 46 | { | 
|---|
| 47 | Win32BaseWindow *window; | 
|---|
| 48 | LRESULT result; | 
|---|
| 49 |  | 
|---|
| 50 | dprintf2(("DefWindowProcW %x %x %x %x", hwnd, Msg, wParam, lParam)); | 
|---|
| 51 | window = Win32BaseWindow::GetWindowFromHandle(hwnd); | 
|---|
| 52 | if(!window) { | 
|---|
| 53 | dprintf(("DefWindowProcW, window %x not found", hwnd)); | 
|---|
| 54 | return 0; | 
|---|
| 55 | } | 
|---|
| 56 | result = window->DefWindowProcW(Msg, wParam, lParam); | 
|---|
| 57 | RELEASE_WNDOBJ(window); | 
|---|
| 58 | return result; | 
|---|
| 59 | } | 
|---|
| 60 | //****************************************************************************** | 
|---|
| 61 | //****************************************************************************** | 
|---|
| 62 | LRESULT WIN32API DefDlgProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) | 
|---|
| 63 | { | 
|---|
| 64 | Win32Dialog *dialog; | 
|---|
| 65 | LRESULT result; | 
|---|
| 66 |  | 
|---|
| 67 | dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd); | 
|---|
| 68 | //TODO: Wrong check? | 
|---|
| 69 | //    if(!dialog || !dialog->IsDialog()) { | 
|---|
| 70 | if(!dialog) { | 
|---|
| 71 | dprintf(("DefDlgProcA, window %x not found", hwnd)); | 
|---|
| 72 | return 0; | 
|---|
| 73 | } | 
|---|
| 74 | if(dialog->IsDialog()) | 
|---|
| 75 | result = dialog->DefDlgProcA(Msg, wParam, lParam); | 
|---|
| 76 | else result = dialog->DefWindowProcA(Msg, wParam, lParam); | 
|---|
| 77 | RELEASE_WNDOBJ(dialog); | 
|---|
| 78 | return result; | 
|---|
| 79 | } | 
|---|
| 80 | //****************************************************************************** | 
|---|
| 81 | //****************************************************************************** | 
|---|
| 82 | LRESULT WIN32API DefDlgProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) | 
|---|
| 83 | { | 
|---|
| 84 | Win32Dialog *dialog; | 
|---|
| 85 | LRESULT result; | 
|---|
| 86 |  | 
|---|
| 87 | dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd); | 
|---|
| 88 | //TODO: Wrong check? | 
|---|
| 89 | //    if(!dialog || !dialog->IsDialog()) { | 
|---|
| 90 | if(!dialog) { | 
|---|
| 91 | dprintf(("DefDlgProcW, window %x not found", hwnd)); | 
|---|
| 92 | return 0; | 
|---|
| 93 | } | 
|---|
| 94 | if(dialog->IsDialog()) | 
|---|
| 95 | result = dialog->DefDlgProcW(Msg, wParam, lParam); | 
|---|
| 96 | else result = dialog->DefWindowProcW(Msg, wParam, lParam); | 
|---|
| 97 | RELEASE_WNDOBJ(dialog); | 
|---|
| 98 | return result; | 
|---|
| 99 | } | 
|---|
| 100 | //****************************************************************************** | 
|---|
| 101 | //****************************************************************************** | 
|---|