| 1 | /* $Id: win32wnd.cpp,v 1.9 2000-05-28 16:43:48 sandervl Exp $ */ | 
|---|
| 2 | /* | 
|---|
| 3 | * Win32 Window Class for OS/2 | 
|---|
| 4 | * | 
|---|
| 5 | * Copyright 1998-1999 Sander van Leeuwen (sandervl@xs4all.nl) | 
|---|
| 6 | * Copyright 1999      Daniela Engert (dani@ngrt.de) | 
|---|
| 7 | * | 
|---|
| 8 | * Parts based on Wine (windows\mdi.c) (990815) | 
|---|
| 9 | * | 
|---|
| 10 | * Copyright 1994, Bob Amstadt | 
|---|
| 11 | *           1995,1996 Alex Korobka | 
|---|
| 12 | * | 
|---|
| 13 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 14 | * | 
|---|
| 15 | */ | 
|---|
| 16 | #include <os2win.h> | 
|---|
| 17 | #include <win.h> | 
|---|
| 18 | #include <stdlib.h> | 
|---|
| 19 | #include <string.h> | 
|---|
| 20 | #include <stdarg.h> | 
|---|
| 21 | #include <assert.h> | 
|---|
| 22 | #include <misc.h> | 
|---|
| 23 | #include <win32wnd.h> | 
|---|
| 24 | #include <heapstring.h> | 
|---|
| 25 | #include <spy.h> | 
|---|
| 26 | #include "wndmsg.h" | 
|---|
| 27 | #include <oslibwin.h> | 
|---|
| 28 | #include <oslibutil.h> | 
|---|
| 29 | #include <oslibgdi.h> | 
|---|
| 30 | #include <oslibres.h> | 
|---|
| 31 | #include "oslibdos.h" | 
|---|
| 32 | #include "syscolor.h" | 
|---|
| 33 | #include "win32wndhandle.h" | 
|---|
| 34 | #include "mdi.h" | 
|---|
| 35 | #include "win32wmdiclient.h" | 
|---|
| 36 |  | 
|---|
| 37 | #define DBG_LOCALLOG    DBG_win32wnd | 
|---|
| 38 | #include "dbglocal.h" | 
|---|
| 39 |  | 
|---|
| 40 | //****************************************************************************** | 
|---|
| 41 | //****************************************************************************** | 
|---|
| 42 | Win32Window::Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode) | 
|---|
| 43 | : Win32BaseWindow(lpCreateStructA, classAtom, isUnicode) | 
|---|
| 44 | { | 
|---|
| 45 | } | 
|---|
| 46 | //****************************************************************************** | 
|---|
| 47 | //****************************************************************************** | 
|---|
| 48 | Win32Window::~Win32Window() | 
|---|
| 49 | { | 
|---|
| 50 | } | 
|---|
| 51 | //****************************************************************************** | 
|---|
| 52 | //****************************************************************************** | 
|---|
| 53 | LRESULT Win32Window::DefFrameProcA(HWND hwndMDIClient, UINT Msg, WPARAM wParam, LPARAM lParam) | 
|---|
| 54 | { | 
|---|
| 55 | Win32MDIClientWindow *window = NULL; | 
|---|
| 56 | Win32MDIChildWindow *child; | 
|---|
| 57 |  | 
|---|
| 58 | if(hwndMDIClient) | 
|---|
| 59 | window = (Win32MDIClientWindow*)GetWindowFromHandle(hwndMDIClient); | 
|---|
| 60 |  | 
|---|
| 61 | if (window && window->isMDIClient()) | 
|---|
| 62 | { | 
|---|
| 63 | switch(Msg) | 
|---|
| 64 | { | 
|---|
| 65 | case WM_NCACTIVATE: | 
|---|
| 66 | window->SendMessageA(Msg, wParam, lParam); | 
|---|
| 67 | break; | 
|---|
| 68 |  | 
|---|
| 69 | #if 0 | 
|---|
| 70 | case WM_SETTEXT: | 
|---|
| 71 | //CB: infinite loop | 
|---|
| 72 | window->updateFrameText(MDI_REPAINTFRAME,(LPCSTR)lParam); | 
|---|
| 73 | return 0; | 
|---|
| 74 | #endif | 
|---|
| 75 |  | 
|---|
| 76 | case WM_COMMAND: | 
|---|
| 77 | /* check for possible syscommands for maximized MDI child */ | 
|---|
| 78 | if(wParam <  window->getFirstChildId() || wParam >= window->getFirstChildId()+window->getNrOfChildren()) | 
|---|
| 79 | { | 
|---|
| 80 | if( (wParam - 0xF000) & 0xF00F ) break; | 
|---|
| 81 | switch( wParam ) | 
|---|
| 82 | { | 
|---|
| 83 | case SC_SIZE: | 
|---|
| 84 | case SC_MOVE: | 
|---|
| 85 | case SC_MINIMIZE: | 
|---|
| 86 | case SC_MAXIMIZE: | 
|---|
| 87 | case SC_NEXTWINDOW: | 
|---|
| 88 | case SC_PREVWINDOW: | 
|---|
| 89 | case SC_CLOSE: | 
|---|
| 90 | case SC_RESTORE: | 
|---|
| 91 | child = window->getMaximizedChild(); | 
|---|
| 92 | if (child) | 
|---|
| 93 | return ::SendMessageA(child->getWindowHandle(),WM_SYSCOMMAND,wParam,lParam); | 
|---|
| 94 | } | 
|---|
| 95 | } | 
|---|
| 96 | else | 
|---|
| 97 | { | 
|---|
| 98 | child = window->getChildByID(wParam); | 
|---|
| 99 | if (child) | 
|---|
| 100 | ::SendMessageA(window->getWindowHandle(),WM_MDIACTIVATE,(WPARAM)child->getWindowHandle(),0L); | 
|---|
| 101 | } | 
|---|
| 102 | break; | 
|---|
| 103 |  | 
|---|
| 104 | case WM_SETFOCUS: | 
|---|
| 105 | SetFocus(hwndMDIClient); | 
|---|
| 106 | break; | 
|---|
| 107 |  | 
|---|
| 108 | case WM_SIZE: | 
|---|
| 109 | MoveWindow(hwndMDIClient, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE); | 
|---|
| 110 | break; | 
|---|
| 111 |  | 
|---|
| 112 | #if 0 | 
|---|
| 113 | case WM_NEXTMENU: | 
|---|
| 114 | ci     = (MDICLIENTINFO*)wndPtr->wExtra; | 
|---|
| 115 |  | 
|---|
| 116 | if( !(wndPtr->parent->dwStyle & WS_MINIMIZE) | 
|---|
| 117 | && ci->hwndActiveChild && !ci->hwndChildMaximized ) | 
|---|
| 118 | { | 
|---|
| 119 | /* control menu is between the frame system menu and | 
|---|
| 120 | * the first entry of menu bar */ | 
|---|
| 121 |  | 
|---|
| 122 | if( (wParam == VK_LEFT && | 
|---|
| 123 | wndPtr->parent->wIDmenu == LOWORD(lParam)) || | 
|---|
| 124 | (wParam == VK_RIGHT && | 
|---|
| 125 | GetSubMenu16(wndPtr->parent->hSysMenu, 0) == LOWORD(lParam)) ) | 
|---|
| 126 | { | 
|---|
| 127 | LRESULT retvalue; | 
|---|
| 128 | wndPtr = WIN_FindWndPtr(ci->hwndActiveChild); | 
|---|
| 129 | retvalue = MAKELONG( GetSubMenu16(wndPtr->hSysMenu, 0), | 
|---|
| 130 | ci->hwndActiveChild); | 
|---|
| 131 | return retvalue; | 
|---|
| 132 | } | 
|---|
| 133 | } | 
|---|
| 134 | break; | 
|---|
| 135 | #endif | 
|---|
| 136 | } | 
|---|
| 137 | } | 
|---|
| 138 | return DefWindowProcA(Msg, wParam, lParam); | 
|---|
| 139 | } | 
|---|
| 140 | //****************************************************************************** | 
|---|
| 141 | //****************************************************************************** | 
|---|
| 142 | LRESULT Win32Window::DefFrameProcW(HWND hwndMDIClient, UINT Msg, WPARAM wParam, LPARAM lParam) | 
|---|
| 143 | { | 
|---|
| 144 | Win32Window *window = NULL; | 
|---|
| 145 |  | 
|---|
| 146 | if(hwndMDIClient) | 
|---|
| 147 | window = (Win32Window *)GetWindowFromHandle(hwndMDIClient); | 
|---|
| 148 |  | 
|---|
| 149 | if(window) | 
|---|
| 150 | { | 
|---|
| 151 | switch(Msg) | 
|---|
| 152 | { | 
|---|
| 153 | case WM_NCACTIVATE: | 
|---|
| 154 | window->SendMessageW(Msg, wParam, lParam); | 
|---|
| 155 | break; | 
|---|
| 156 |  | 
|---|
| 157 | case WM_SETTEXT: | 
|---|
| 158 | { | 
|---|
| 159 | LPSTR txt = HEAP_strdupWtoA(GetProcessHeap(),0,(LPWSTR)lParam); | 
|---|
| 160 | LRESULT ret = DefFrameProcA(hwndMDIClient, Msg, wParam, (DWORD)txt ); | 
|---|
| 161 | HeapFree(GetProcessHeap(),0,txt); | 
|---|
| 162 | return ret; | 
|---|
| 163 | } | 
|---|
| 164 | case WM_NEXTMENU: | 
|---|
| 165 | case WM_SETFOCUS: | 
|---|
| 166 | case WM_SIZE: | 
|---|
| 167 | return DefFrameProcA(hwndMDIClient, Msg, wParam, lParam ); | 
|---|
| 168 | } | 
|---|
| 169 | } | 
|---|
| 170 | return DefWindowProcW(Msg, wParam, lParam); | 
|---|
| 171 | } | 
|---|
| 172 | //****************************************************************************** | 
|---|
| 173 | //****************************************************************************** | 
|---|