| 1 | /* $Id: win32wnd.cpp,v 1.38 2000-01-01 14:57:32 cbratschi 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 <winres.h>
|
|---|
| 33 | #include "syscolor.h"
|
|---|
| 34 | #include "win32wndhandle.h"
|
|---|
| 35 | #include "mdi.h"
|
|---|
| 36 | #include "win32wmdiclient.h"
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 | //******************************************************************************
|
|---|
| 40 | //******************************************************************************
|
|---|
| 41 | Win32Window::Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode)
|
|---|
| 42 | : Win32BaseWindow(lpCreateStructA, classAtom, isUnicode)
|
|---|
| 43 | {
|
|---|
| 44 | }
|
|---|
| 45 | //******************************************************************************
|
|---|
| 46 | //******************************************************************************
|
|---|
| 47 | Win32Window::~Win32Window()
|
|---|
| 48 | {
|
|---|
| 49 | }
|
|---|
| 50 | //******************************************************************************
|
|---|
| 51 | //******************************************************************************
|
|---|
| 52 | LRESULT Win32Window::DefFrameProcA(HWND hwndMDIClient, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 53 | {
|
|---|
| 54 | Win32MDIClientWindow *window = NULL;
|
|---|
| 55 | Win32MDIChildWindow *child;
|
|---|
| 56 |
|
|---|
| 57 | if(hwndMDIClient)
|
|---|
| 58 | window = (Win32MDIClientWindow*)GetWindowFromHandle(hwndMDIClient);
|
|---|
| 59 |
|
|---|
| 60 | if (window && window->isMDIClient())
|
|---|
| 61 | {
|
|---|
| 62 | switch(Msg)
|
|---|
| 63 | {
|
|---|
| 64 | case WM_NCACTIVATE:
|
|---|
| 65 | window->SendMessageA(Msg, wParam, lParam);
|
|---|
| 66 | break;
|
|---|
| 67 |
|
|---|
| 68 | #if 0
|
|---|
| 69 | case WM_SETTEXT:
|
|---|
| 70 | //CB: infinite loop
|
|---|
| 71 | window->updateFrameText(MDI_REPAINTFRAME,(LPCSTR)lParam);
|
|---|
| 72 | return 0;
|
|---|
| 73 | #endif
|
|---|
| 74 |
|
|---|
| 75 | case WM_COMMAND:
|
|---|
| 76 | /* check for possible syscommands for maximized MDI child */
|
|---|
| 77 | if(wParam < window->getFirstChildId() || wParam >= window->getFirstChildId()+window->getNrOfChildren())
|
|---|
| 78 | {
|
|---|
| 79 | if( (wParam - 0xF000) & 0xF00F ) break;
|
|---|
| 80 | switch( wParam )
|
|---|
| 81 | {
|
|---|
| 82 | case SC_SIZE:
|
|---|
| 83 | case SC_MOVE:
|
|---|
| 84 | case SC_MINIMIZE:
|
|---|
| 85 | case SC_MAXIMIZE:
|
|---|
| 86 | case SC_NEXTWINDOW:
|
|---|
| 87 | case SC_PREVWINDOW:
|
|---|
| 88 | case SC_CLOSE:
|
|---|
| 89 | case SC_RESTORE:
|
|---|
| 90 | child = window->getMaximizedChild();
|
|---|
| 91 | if (child)
|
|---|
| 92 | return ::SendMessageA(child->getWindowHandle(),WM_SYSCOMMAND,wParam,lParam);
|
|---|
| 93 | }
|
|---|
| 94 | }
|
|---|
| 95 | else
|
|---|
| 96 | {
|
|---|
| 97 | child = window->getChildByID(wParam);
|
|---|
| 98 | if (child)
|
|---|
| 99 | ::SendMessageA(window->getWindowHandle(),WM_MDIACTIVATE,(WPARAM)child->getWindowHandle(),0L);
|
|---|
| 100 | }
|
|---|
| 101 | break;
|
|---|
| 102 |
|
|---|
| 103 | case WM_SETFOCUS:
|
|---|
| 104 | SetFocus(hwndMDIClient);
|
|---|
| 105 | break;
|
|---|
| 106 |
|
|---|
| 107 | case WM_SIZE:
|
|---|
| 108 | MoveWindow(hwndMDIClient, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
|
|---|
| 109 | break;
|
|---|
| 110 |
|
|---|
| 111 | #if 0
|
|---|
| 112 | case WM_NEXTMENU:
|
|---|
| 113 | ci = (MDICLIENTINFO*)wndPtr->wExtra;
|
|---|
| 114 |
|
|---|
| 115 | if( !(wndPtr->parent->dwStyle & WS_MINIMIZE)
|
|---|
| 116 | && ci->hwndActiveChild && !ci->hwndChildMaximized )
|
|---|
| 117 | {
|
|---|
| 118 | /* control menu is between the frame system menu and
|
|---|
| 119 | * the first entry of menu bar */
|
|---|
| 120 |
|
|---|
| 121 | if( (wParam == VK_LEFT &&
|
|---|
| 122 | wndPtr->parent->wIDmenu == LOWORD(lParam)) ||
|
|---|
| 123 | (wParam == VK_RIGHT &&
|
|---|
| 124 | GetSubMenu16(wndPtr->parent->hSysMenu, 0) == LOWORD(lParam)) )
|
|---|
| 125 | {
|
|---|
| 126 | LRESULT retvalue;
|
|---|
| 127 | wndPtr = WIN_FindWndPtr(ci->hwndActiveChild);
|
|---|
| 128 | retvalue = MAKELONG( GetSubMenu16(wndPtr->hSysMenu, 0),
|
|---|
| 129 | ci->hwndActiveChild);
|
|---|
| 130 | return retvalue;
|
|---|
| 131 | }
|
|---|
| 132 | }
|
|---|
| 133 | break;
|
|---|
| 134 | #endif
|
|---|
| 135 | }
|
|---|
| 136 | }
|
|---|
| 137 | return DefWindowProcA(Msg, wParam, lParam);
|
|---|
| 138 | }
|
|---|
| 139 | //******************************************************************************
|
|---|
| 140 | //******************************************************************************
|
|---|
| 141 | LRESULT Win32Window::DefFrameProcW(HWND hwndMDIClient, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 142 | {
|
|---|
| 143 | Win32Window *window = NULL;
|
|---|
| 144 |
|
|---|
| 145 | if(hwndMDIClient)
|
|---|
| 146 | window = (Win32Window *)GetWindowFromHandle(hwndMDIClient);
|
|---|
| 147 |
|
|---|
| 148 | if(window)
|
|---|
| 149 | {
|
|---|
| 150 | switch(Msg)
|
|---|
| 151 | {
|
|---|
| 152 | case WM_NCACTIVATE:
|
|---|
| 153 | window->SendMessageW(Msg, wParam, lParam);
|
|---|
| 154 | break;
|
|---|
| 155 |
|
|---|
| 156 | case WM_SETTEXT:
|
|---|
| 157 | {
|
|---|
| 158 | LPSTR txt = HEAP_strdupWtoA(GetProcessHeap(),0,(LPWSTR)lParam);
|
|---|
| 159 | LRESULT ret = DefFrameProcA(hwndMDIClient, Msg, wParam, (DWORD)txt );
|
|---|
| 160 | HeapFree(GetProcessHeap(),0,txt);
|
|---|
| 161 | return ret;
|
|---|
| 162 | }
|
|---|
| 163 | case WM_NEXTMENU:
|
|---|
| 164 | case WM_SETFOCUS:
|
|---|
| 165 | case WM_SIZE:
|
|---|
| 166 | return DefFrameProcA(hwndMDIClient, Msg, wParam, lParam );
|
|---|
| 167 | }
|
|---|
| 168 | }
|
|---|
| 169 | return DefWindowProcW(Msg, wParam, lParam);
|
|---|
| 170 | }
|
|---|
| 171 | //******************************************************************************
|
|---|
| 172 | //******************************************************************************
|
|---|