source: trunk/src/user32/win32wnd.cpp

Last change on this file was 21916, checked in by dmik, 14 years ago

Merge branch gcc-kmk to trunk.

File size: 5.4 KB
RevLine 
[5935]1/* $Id: win32wnd.cpp,v 1.10 2001-06-09 14:50:23 sandervl Exp $ */
[2469]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>
[21916]23#include "win32wnd.h"
[2469]24#include <heapstring.h>
25#include <spy.h>
26#include "wndmsg.h"
[21916]27#include "oslibwin.h"
28#include "oslibutil.h"
29#include "oslibgdi.h"
30#include "oslibres.h"
[2469]31#include "oslibdos.h"
32#include "syscolor.h"
33#include "win32wndhandle.h"
34#include "mdi.h"
35#include "win32wmdiclient.h"
36
[2803]37#define DBG_LOCALLOG DBG_win32wnd
38#include "dbglocal.h"
[2469]39
40//******************************************************************************
41//******************************************************************************
42Win32Window::Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode)
43 : Win32BaseWindow(lpCreateStructA, classAtom, isUnicode)
44{
45}
46//******************************************************************************
47//******************************************************************************
48Win32Window::~Win32Window()
49{
50}
51//******************************************************************************
52//******************************************************************************
53LRESULT Win32Window::DefFrameProcA(HWND hwndMDIClient, UINT Msg, WPARAM wParam, LPARAM lParam)
54{
55 Win32MDIClientWindow *window = NULL;
[5935]56 HWND hwndChild;
[2469]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:
[5935]91 hwndChild = window->getMaximizedChild();
92 RELEASE_WNDOBJ(window);
93 if (hwndChild)
94 return ::SendMessageA(hwndChild, WM_SYSCOMMAND, wParam, lParam);
[2469]95 }
96 }
97 else
98 {
[5935]99 hwndChild = window->getChildByID(wParam);
100 if (hwndChild)
101 ::SendMessageA(window->getWindowHandle(),WM_MDIACTIVATE,(WPARAM)hwndChild,0L);
[2469]102 }
103 break;
104
105 case WM_SETFOCUS:
106 SetFocus(hwndMDIClient);
107 break;
108
109 case WM_SIZE:
110 MoveWindow(hwndMDIClient, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
111 break;
112
113#if 0
114 case WM_NEXTMENU:
115 ci = (MDICLIENTINFO*)wndPtr->wExtra;
116
117 if( !(wndPtr->parent->dwStyle & WS_MINIMIZE)
118 && ci->hwndActiveChild && !ci->hwndChildMaximized )
119 {
120 /* control menu is between the frame system menu and
121 * the first entry of menu bar */
122
123 if( (wParam == VK_LEFT &&
124 wndPtr->parent->wIDmenu == LOWORD(lParam)) ||
125 (wParam == VK_RIGHT &&
126 GetSubMenu16(wndPtr->parent->hSysMenu, 0) == LOWORD(lParam)) )
127 {
128 LRESULT retvalue;
129 wndPtr = WIN_FindWndPtr(ci->hwndActiveChild);
130 retvalue = MAKELONG( GetSubMenu16(wndPtr->hSysMenu, 0),
131 ci->hwndActiveChild);
132 return retvalue;
133 }
134 }
135 break;
136#endif
137 }
138 }
[5935]139 if(window) RELEASE_WNDOBJ(window);
[2469]140 return DefWindowProcA(Msg, wParam, lParam);
141}
142//******************************************************************************
143//******************************************************************************
144LRESULT Win32Window::DefFrameProcW(HWND hwndMDIClient, UINT Msg, WPARAM wParam, LPARAM lParam)
145{
[5935]146 switch(Msg)
[2469]147 {
148 case WM_NCACTIVATE:
[5935]149 ::SendMessageW(hwndMDIClient, Msg, wParam, lParam);
[2469]150 break;
151
152 case WM_SETTEXT:
153 {
154 LPSTR txt = HEAP_strdupWtoA(GetProcessHeap(),0,(LPWSTR)lParam);
155 LRESULT ret = DefFrameProcA(hwndMDIClient, Msg, wParam, (DWORD)txt );
156 HeapFree(GetProcessHeap(),0,txt);
157 return ret;
158 }
159 case WM_NEXTMENU:
160 case WM_SETFOCUS:
161 case WM_SIZE:
162 return DefFrameProcA(hwndMDIClient, Msg, wParam, lParam );
163 }
164 return DefWindowProcW(Msg, wParam, lParam);
165}
166//******************************************************************************
167//******************************************************************************
Note: See TracBrowser for help on using the repository browser.