1 | /* $Id: win32wnd.cpp,v 1.8 2000-02-16 14:28:24 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 <winres.h>
|
---|
33 | #include "syscolor.h"
|
---|
34 | #include "win32wndhandle.h"
|
---|
35 | #include "mdi.h"
|
---|
36 | #include "win32wmdiclient.h"
|
---|
37 |
|
---|
38 | #define DBG_LOCALLOG DBG_win32wnd
|
---|
39 | #include "dbglocal.h"
|
---|
40 |
|
---|
41 | //******************************************************************************
|
---|
42 | //******************************************************************************
|
---|
43 | Win32Window::Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode)
|
---|
44 | : Win32BaseWindow(lpCreateStructA, classAtom, isUnicode)
|
---|
45 | {
|
---|
46 | }
|
---|
47 | //******************************************************************************
|
---|
48 | //******************************************************************************
|
---|
49 | Win32Window::~Win32Window()
|
---|
50 | {
|
---|
51 | }
|
---|
52 | //******************************************************************************
|
---|
53 | //******************************************************************************
|
---|
54 | LRESULT Win32Window::DefFrameProcA(HWND hwndMDIClient, UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
55 | {
|
---|
56 | Win32MDIClientWindow *window = NULL;
|
---|
57 | Win32MDIChildWindow *child;
|
---|
58 |
|
---|
59 | if(hwndMDIClient)
|
---|
60 | window = (Win32MDIClientWindow*)GetWindowFromHandle(hwndMDIClient);
|
---|
61 |
|
---|
62 | if (window && window->isMDIClient())
|
---|
63 | {
|
---|
64 | switch(Msg)
|
---|
65 | {
|
---|
66 | case WM_NCACTIVATE:
|
---|
67 | window->SendMessageA(Msg, wParam, lParam);
|
---|
68 | break;
|
---|
69 |
|
---|
70 | #if 0
|
---|
71 | case WM_SETTEXT:
|
---|
72 | //CB: infinite loop
|
---|
73 | window->updateFrameText(MDI_REPAINTFRAME,(LPCSTR)lParam);
|
---|
74 | return 0;
|
---|
75 | #endif
|
---|
76 |
|
---|
77 | case WM_COMMAND:
|
---|
78 | /* check for possible syscommands for maximized MDI child */
|
---|
79 | if(wParam < window->getFirstChildId() || wParam >= window->getFirstChildId()+window->getNrOfChildren())
|
---|
80 | {
|
---|
81 | if( (wParam - 0xF000) & 0xF00F ) break;
|
---|
82 | switch( wParam )
|
---|
83 | {
|
---|
84 | case SC_SIZE:
|
---|
85 | case SC_MOVE:
|
---|
86 | case SC_MINIMIZE:
|
---|
87 | case SC_MAXIMIZE:
|
---|
88 | case SC_NEXTWINDOW:
|
---|
89 | case SC_PREVWINDOW:
|
---|
90 | case SC_CLOSE:
|
---|
91 | case SC_RESTORE:
|
---|
92 | child = window->getMaximizedChild();
|
---|
93 | if (child)
|
---|
94 | return ::SendMessageA(child->getWindowHandle(),WM_SYSCOMMAND,wParam,lParam);
|
---|
95 | }
|
---|
96 | }
|
---|
97 | else
|
---|
98 | {
|
---|
99 | child = window->getChildByID(wParam);
|
---|
100 | if (child)
|
---|
101 | ::SendMessageA(window->getWindowHandle(),WM_MDIACTIVATE,(WPARAM)child->getWindowHandle(),0L);
|
---|
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 | }
|
---|
139 | return DefWindowProcA(Msg, wParam, lParam);
|
---|
140 | }
|
---|
141 | //******************************************************************************
|
---|
142 | //******************************************************************************
|
---|
143 | LRESULT Win32Window::DefFrameProcW(HWND hwndMDIClient, UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
144 | {
|
---|
145 | Win32Window *window = NULL;
|
---|
146 |
|
---|
147 | if(hwndMDIClient)
|
---|
148 | window = (Win32Window *)GetWindowFromHandle(hwndMDIClient);
|
---|
149 |
|
---|
150 | if(window)
|
---|
151 | {
|
---|
152 | switch(Msg)
|
---|
153 | {
|
---|
154 | case WM_NCACTIVATE:
|
---|
155 | window->SendMessageW(Msg, wParam, lParam);
|
---|
156 | break;
|
---|
157 |
|
---|
158 | case WM_SETTEXT:
|
---|
159 | {
|
---|
160 | LPSTR txt = HEAP_strdupWtoA(GetProcessHeap(),0,(LPWSTR)lParam);
|
---|
161 | LRESULT ret = DefFrameProcA(hwndMDIClient, Msg, wParam, (DWORD)txt );
|
---|
162 | HeapFree(GetProcessHeap(),0,txt);
|
---|
163 | return ret;
|
---|
164 | }
|
---|
165 | case WM_NEXTMENU:
|
---|
166 | case WM_SETFOCUS:
|
---|
167 | case WM_SIZE:
|
---|
168 | return DefFrameProcA(hwndMDIClient, Msg, wParam, lParam );
|
---|
169 | }
|
---|
170 | }
|
---|
171 | return DefWindowProcW(Msg, wParam, lParam);
|
---|
172 | }
|
---|
173 | //******************************************************************************
|
---|
174 | //******************************************************************************
|
---|