1 | /* $Id: win32wnd.cpp,v 1.1 1999-09-15 23:19:01 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 <heapstring.h>
|
---|
24 | #include <win32wnd.h>
|
---|
25 | #include <spy.h>
|
---|
26 | #include "wndmsg.h"
|
---|
27 | #include "hooks.h"
|
---|
28 | #include <oslibwin.h>
|
---|
29 | #include <oslibutil.h>
|
---|
30 | #include <oslibgdi.h>
|
---|
31 | #include <oslibres.h>
|
---|
32 | #include "oslibdos.h"
|
---|
33 | #include <winres.h>
|
---|
34 | #include "syscolor.h"
|
---|
35 | #include "win32wndhandle.h"
|
---|
36 | #include "heapshared.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 | Win32Window *window = NULL;
|
---|
55 |
|
---|
56 | if(hwndMDIClient)
|
---|
57 | window = (Win32Window *)GetWindowFromHandle(hwndMDIClient);
|
---|
58 |
|
---|
59 | if(window)
|
---|
60 | {
|
---|
61 | switch(Msg)
|
---|
62 | {
|
---|
63 | case WM_NCACTIVATE:
|
---|
64 | window->SendMessageA(Msg, wParam, lParam);
|
---|
65 | break;
|
---|
66 |
|
---|
67 | #if 0
|
---|
68 | case WM_COMMAND:
|
---|
69 | ci = (MDICLIENTINFO*)wndPtr->wExtra;
|
---|
70 |
|
---|
71 | /* check for possible syscommands for maximized MDI child */
|
---|
72 | WIN_ReleaseWndPtr(wndPtr);
|
---|
73 |
|
---|
74 | if( ci && (
|
---|
75 | wParam < ci->idFirstChild ||
|
---|
76 | wParam >= ci->idFirstChild + ci->nActiveChildren
|
---|
77 | )){
|
---|
78 | if( (wParam - 0xF000) & 0xF00F ) break;
|
---|
79 | switch( wParam )
|
---|
80 | {
|
---|
81 | case SC_SIZE:
|
---|
82 | case SC_MOVE:
|
---|
83 | case SC_MINIMIZE:
|
---|
84 | case SC_MAXIMIZE:
|
---|
85 | case SC_NEXTWINDOW:
|
---|
86 | case SC_PREVWINDOW:
|
---|
87 | case SC_CLOSE:
|
---|
88 | case SC_RESTORE:
|
---|
89 | if( ci->hwndChildMaximized )
|
---|
90 | return SendMessage16( ci->hwndChildMaximized, WM_SYSCOMMAND,
|
---|
91 | wParam, lParam);
|
---|
92 | }
|
---|
93 | }
|
---|
94 | else
|
---|
95 | {
|
---|
96 | wndPtr = WIN_FindWndPtr(hwndMDIClient);
|
---|
97 | childHwnd = MDI_GetChildByID(wndPtr,wParam );
|
---|
98 | WIN_ReleaseWndPtr(wndPtr);
|
---|
99 |
|
---|
100 | if( childHwnd )
|
---|
101 | SendMessage16(hwndMDIClient, WM_MDIACTIVATE,
|
---|
102 | (WPARAM16)childHwnd , 0L);
|
---|
103 | }
|
---|
104 | break;
|
---|
105 | #endif
|
---|
106 |
|
---|
107 | case WM_SETFOCUS:
|
---|
108 | SetFocus(hwndMDIClient);
|
---|
109 | break;
|
---|
110 |
|
---|
111 | case WM_SIZE:
|
---|
112 | MoveWindow(hwndMDIClient, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
|
---|
113 | break;
|
---|
114 |
|
---|
115 | #if 0
|
---|
116 | case WM_NEXTMENU:
|
---|
117 | ci = (MDICLIENTINFO*)wndPtr->wExtra;
|
---|
118 |
|
---|
119 | if( !(wndPtr->parent->dwStyle & WS_MINIMIZE)
|
---|
120 | && ci->hwndActiveChild && !ci->hwndChildMaximized )
|
---|
121 | {
|
---|
122 | /* control menu is between the frame system menu and
|
---|
123 | * the first entry of menu bar */
|
---|
124 |
|
---|
125 | if( (wParam == VK_LEFT &&
|
---|
126 | wndPtr->parent->wIDmenu == LOWORD(lParam)) ||
|
---|
127 | (wParam == VK_RIGHT &&
|
---|
128 | GetSubMenu16(wndPtr->parent->hSysMenu, 0) == LOWORD(lParam)) )
|
---|
129 | {
|
---|
130 | LRESULT retvalue;
|
---|
131 | wndPtr = WIN_FindWndPtr(ci->hwndActiveChild);
|
---|
132 | retvalue = MAKELONG( GetSubMenu16(wndPtr->hSysMenu, 0),
|
---|
133 | ci->hwndActiveChild);
|
---|
134 | return retvalue;
|
---|
135 | }
|
---|
136 | }
|
---|
137 | break;
|
---|
138 | #endif
|
---|
139 | }
|
---|
140 | }
|
---|
141 | return DefWindowProcA(Msg, wParam, lParam);
|
---|
142 | }
|
---|
143 | //******************************************************************************
|
---|
144 | //******************************************************************************
|
---|
145 | LRESULT Win32Window::DefFrameProcW(HWND hwndMDIClient, UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
146 | {
|
---|
147 | Win32Window *window = NULL;
|
---|
148 |
|
---|
149 | if(hwndMDIClient)
|
---|
150 | window = (Win32Window *)GetWindowFromHandle(hwndMDIClient);
|
---|
151 |
|
---|
152 | if(window)
|
---|
153 | {
|
---|
154 | switch(Msg)
|
---|
155 | {
|
---|
156 | case WM_NCACTIVATE:
|
---|
157 | window->SendMessageW(Msg, wParam, lParam);
|
---|
158 | break;
|
---|
159 |
|
---|
160 | case WM_SETTEXT:
|
---|
161 | {
|
---|
162 | LPSTR txt = HEAP_strdupWtoA(GetProcessHeap(),0,(LPWSTR)lParam);
|
---|
163 | LRESULT ret = DefFrameProcA(hwndMDIClient, Msg, wParam, (DWORD)txt );
|
---|
164 | HeapFree(GetProcessHeap(),0,txt);
|
---|
165 | return ret;
|
---|
166 | }
|
---|
167 | case WM_NEXTMENU:
|
---|
168 | case WM_SETFOCUS:
|
---|
169 | case WM_SIZE:
|
---|
170 | return DefFrameProcA(hwndMDIClient, Msg, wParam, lParam );
|
---|
171 | }
|
---|
172 | }
|
---|
173 | return DefWindowProcW(Msg, wParam, lParam);
|
---|
174 | }
|
---|
175 | //******************************************************************************
|
---|
176 | //******************************************************************************
|
---|