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