1 | /* $Id: win32wbase.h,v 1.138 2002-01-12 14:09:31 sandervl Exp $ */
|
---|
2 | /*
|
---|
3 | * Win32 Window Base Class for OS/2
|
---|
4 | *
|
---|
5 | *
|
---|
6 | * Copyright 1998-1999 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
7 | * Copyright 1999 Daniela Engert (dani@ngrt.de)
|
---|
8 | *
|
---|
9 | *
|
---|
10 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
11 | *
|
---|
12 | */
|
---|
13 | #ifndef __WIN32WNDBASE_H__
|
---|
14 | #define __WIN32WNDBASE_H__
|
---|
15 |
|
---|
16 | #ifdef __cplusplus
|
---|
17 |
|
---|
18 | #include <win32class.h>
|
---|
19 | #include "open32wbase.h"
|
---|
20 | #include <gen_object.h>
|
---|
21 | #include <win32wndchild.h>
|
---|
22 | #include <winuser32.h>
|
---|
23 | #include <winres.h>
|
---|
24 | #include <scroll.h>
|
---|
25 |
|
---|
26 | class Win32BaseWindow;
|
---|
27 |
|
---|
28 | #define OFFSET_RESERVED 0 //reserved for odin apps (such as Opera)
|
---|
29 | #define OFFSET_WIN32WNDPTR 4
|
---|
30 | #define OFFSET_WIN32PM_MAGIC 8
|
---|
31 | #define OFFSET_WIN32FLAGS 12
|
---|
32 | #define NROF_WIN32WNDBYTES 16
|
---|
33 |
|
---|
34 | #define WINDOWFLAG_ACTIVE 1
|
---|
35 |
|
---|
36 | #define WIN32PM_MAGIC 0x12345678
|
---|
37 | #define CheckMagicDword(a) (a==WIN32PM_MAGIC)
|
---|
38 |
|
---|
39 | #define TYPE_ASCII 0
|
---|
40 | #define TYPE_UNICODE 1
|
---|
41 |
|
---|
42 | #define GW_HWNDNEXTCHILD (0x10000 | GW_HWNDNEXT)
|
---|
43 | #define GW_HWNDPREVCHILD (0x10000 | GW_HWNDPREV)
|
---|
44 | #define GW_HWNDFIRSTCHILD (0x10000 | GW_CHILD)
|
---|
45 | #define GW_HWNDLASTCHILD (0x10000 | GW_HWNDLAST)
|
---|
46 |
|
---|
47 | #ifdef DEBUG
|
---|
48 | #define RELEASE_WNDOBJ(a) { a->release(__FUNCTION__, __LINE__); a = NULL; }
|
---|
49 | #else
|
---|
50 | #define RELEASE_WNDOBJ(a) { a->release(); a = NULL; }
|
---|
51 | #endif
|
---|
52 |
|
---|
53 | typedef struct {
|
---|
54 | USHORT cb;
|
---|
55 | Win32BaseWindow *win32wnd;
|
---|
56 | ULONG win32CreateStruct; //or dialog create dword
|
---|
57 | } CUSTOMWNDDATA;
|
---|
58 |
|
---|
59 | typedef struct tagPROPERTY
|
---|
60 | {
|
---|
61 | struct tagPROPERTY *next; /* Next property in window list */
|
---|
62 | HANDLE handle; /* User's data */
|
---|
63 | LPSTR string; /* Property string (or atom) */
|
---|
64 | } PROPERTY;
|
---|
65 |
|
---|
66 | //PostThreadMessage is done through Open32; which means the message id will be translated
|
---|
67 | //(0xc00 added)
|
---|
68 | #define OPEN32_MSGDIFF 0xC00
|
---|
69 | #define WIN32APP_POSTMSG (0x1000+OPEN32_MSGDIFF)
|
---|
70 |
|
---|
71 | //PM doesn't allow SetFocus during WM_SETFOCUS message processing; must delay
|
---|
72 | //this by posting a message
|
---|
73 | //NOTE Must be smaller than WIN32APP_POSTMSG!
|
---|
74 | #define WIN32APP_SETFOCUSMSG (WIN32APP_POSTMSG-1)
|
---|
75 |
|
---|
76 | #define WIN32MSG_MAGICA 0x12345678
|
---|
77 | #define WIN32MSG_MAGICW 0x12345679
|
---|
78 |
|
---|
79 | typedef struct
|
---|
80 | {
|
---|
81 | ULONG wParam;
|
---|
82 | ULONG lParam;
|
---|
83 | } POSTMSG_PACKET;
|
---|
84 |
|
---|
85 | #define BROADCAST_SEND 0
|
---|
86 | #define BROADCAST_POST 1
|
---|
87 |
|
---|
88 | #define HAS_DLGFRAME(style,exStyle) \
|
---|
89 | (((exStyle) & WS_EX_DLGMODALFRAME) || \
|
---|
90 | (((style) & WS_DLGFRAME) && !((style) & WS_THICKFRAME)))
|
---|
91 |
|
---|
92 | #define HAS_THICKFRAME(style,exStyle) \
|
---|
93 | (((style) & WS_THICKFRAME) && \
|
---|
94 | !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME))
|
---|
95 | #if 0
|
---|
96 | (((style) & WS_THICKFRAME) && \
|
---|
97 | !((exStyle) & WS_EX_DLGMODALFRAME) && \
|
---|
98 | !((style) & WS_CHILD))
|
---|
99 | #endif
|
---|
100 |
|
---|
101 | #define HAS_THINFRAME(style) \
|
---|
102 | (((style) & WS_BORDER) || !((style) & (WS_CHILD | WS_POPUP)))
|
---|
103 |
|
---|
104 | #define HAS_BIGFRAME(style,exStyle) \
|
---|
105 | (((style) & (WS_THICKFRAME | WS_DLGFRAME)) || \
|
---|
106 | ((exStyle) & WS_EX_DLGMODALFRAME))
|
---|
107 |
|
---|
108 | #define HAS_ANYFRAME(style,exStyle) \
|
---|
109 | (((style) & (WS_THICKFRAME | WS_DLGFRAME | WS_BORDER)) || \
|
---|
110 | ((exStyle) & WS_EX_DLGMODALFRAME) || \
|
---|
111 | !((style) & (WS_CHILD | WS_POPUP)))
|
---|
112 |
|
---|
113 | #define HAS_3DFRAME(exStyle) \
|
---|
114 | ((exStyle & WS_EX_CLIENTEDGE) || (exStyle & WS_EX_STATICEDGE) || (exStyle & WS_EX_WINDOWEDGE))
|
---|
115 |
|
---|
116 | #define HAS_BORDER(style, exStyle) \
|
---|
117 | ((style & WS_BORDER) || HAS_THICKFRAME(style) || HAS_DLGFRAME(style,exStyle))
|
---|
118 |
|
---|
119 | #define IS_OVERLAPPED(style) \
|
---|
120 | !(style & (WS_CHILD | WS_POPUP))
|
---|
121 |
|
---|
122 | #define HAS_MENU() (!(getStyle() & WS_CHILD) && (getWindowId() != 0))
|
---|
123 |
|
---|
124 | #define STATE_INIT 0 //initial state
|
---|
125 | #define STATE_PRE_WMNCCREATE 1 //before WM_NCCREATE
|
---|
126 | #define STATE_POST_WMNCCREATE 2 //after WM_NCCREATE
|
---|
127 | #define STATE_PRE_WMCREATE 3 //before WM_CREATE
|
---|
128 | #define STATE_POST_WMCREATE 4 //after WM_CREATE
|
---|
129 | #define STATE_CREATED 5 //after successful return of WinCreateWindow
|
---|
130 | #define STATE_DESTROYED 6 //DestroyWindow called for window
|
---|
131 |
|
---|
132 |
|
---|
133 | class Win32BaseWindow : public GenericObject, public ChildWindow
|
---|
134 | {
|
---|
135 | public:
|
---|
136 | Win32BaseWindow();
|
---|
137 | Win32BaseWindow(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode);
|
---|
138 | Win32BaseWindow(HWND hwndOS2, ATOM classAtom);
|
---|
139 |
|
---|
140 | virtual ~Win32BaseWindow();
|
---|
141 |
|
---|
142 | virtual ULONG MsgCreate(HWND hwndOS2);
|
---|
143 | ULONG MsgQuit();
|
---|
144 | ULONG MsgClose();
|
---|
145 | ULONG MsgDestroy();
|
---|
146 | virtual ULONG MsgEnable(BOOL fEnable);
|
---|
147 | ULONG MsgShow(BOOL fShow);
|
---|
148 | ULONG MsgPosChanging(LPARAM lp);
|
---|
149 | ULONG MsgPosChanged(LPARAM lp);
|
---|
150 | ULONG MsgActivate(BOOL fActivate, BOOL fMinimized, HWND hwnd, HWND hwndOS2Win);
|
---|
151 | ULONG MsgChildActivate(BOOL fActivate);
|
---|
152 | ULONG MsgSetFocus(HWND hwnd);
|
---|
153 | ULONG MsgKillFocus(HWND hwnd);
|
---|
154 | ULONG MsgScroll(ULONG msg, ULONG scrollCode, ULONG scrollPos);
|
---|
155 | ULONG MsgButton(MSG *msg);
|
---|
156 | ULONG MsgMouseMove(MSG *msg);
|
---|
157 | ULONG MsgChar(MSG *msg);
|
---|
158 | ULONG MsgPaint(ULONG tmp1, BOOL select = TRUE);
|
---|
159 | ULONG MsgEraseBackGround(HDC hdc);
|
---|
160 | ULONG MsgNCPaint(PRECT pUpdateRect);
|
---|
161 | ULONG MsgFormatFrame(WINDOWPOS *lpWndPos);
|
---|
162 | ULONG DispatchMsgA(MSG *msg);
|
---|
163 | ULONG DispatchMsgW(MSG *msg);
|
---|
164 |
|
---|
165 | ULONG MsgSetText(LPSTR lpsz, LONG cch);
|
---|
166 | ULONG MsgGetTextLength();
|
---|
167 | void MsgGetText(char *wndtext, ULONG textlength);
|
---|
168 |
|
---|
169 | virtual LONG SetWindowLong(int index, ULONG value, BOOL fUnicode);
|
---|
170 | virtual ULONG GetWindowLong(int index, BOOL fUnicode);
|
---|
171 | virtual WORD SetWindowWord(int index, WORD value);
|
---|
172 | virtual WORD GetWindowWord(int index);
|
---|
173 |
|
---|
174 | DWORD getStyle() { return dwStyle; };
|
---|
175 | DWORD getOldStyle() { return dwOldStyle; };
|
---|
176 | void setStyle(DWORD newstyle) { dwStyle = newstyle; };
|
---|
177 | void setOldStyle(DWORD oldStyle) { dwOldStyle = oldStyle; };
|
---|
178 | DWORD getExStyle() { return dwExStyle; };
|
---|
179 | void setExStyle(DWORD newexstyle) { dwExStyle = newexstyle; };
|
---|
180 | ULONG getInstance() { return hInstance; };
|
---|
181 | void setInstance(ULONG newinstance) { hInstance = newinstance; };
|
---|
182 | HWND getWindowHandle() { return Win32Hwnd; };
|
---|
183 | HWND getOS2WindowHandle() { return OS2Hwnd; };
|
---|
184 | HWND getOS2FrameWindowHandle() { return OS2HwndFrame; };
|
---|
185 | HWND getLastActive() { return hwndLastActive; };
|
---|
186 | void setLastActive(HWND _hwndLastActive)
|
---|
187 | { hwndLastActive = _hwndLastActive; };
|
---|
188 |
|
---|
189 | Win32WndClass *getWindowClass() { return windowClass; };
|
---|
190 |
|
---|
191 | LONG getLastHitTestVal() { return lastHitTestVal; }
|
---|
192 |
|
---|
193 | DWORD getWindowContextHelpId() { return contextHelpId; };
|
---|
194 | void setWindowContextHelpId(DWORD id){ contextHelpId = id; };
|
---|
195 |
|
---|
196 | BOOL isFrameWindow();
|
---|
197 | virtual BOOL isMDIClient();
|
---|
198 | virtual BOOL isMDIChild();
|
---|
199 | virtual BOOL isDesktopWindow();
|
---|
200 |
|
---|
201 | BOOL fHasParentDC() { return fParentDC; };
|
---|
202 |
|
---|
203 | Win32BaseWindow *getParent();
|
---|
204 | void setParent(Win32BaseWindow *pwindow) { setParentOfChild((ChildWindow *)pwindow); };
|
---|
205 | WNDPROC getWindowProc() { return win32wndproc; };
|
---|
206 | void setWindowProc(WNDPROC newproc) { win32wndproc = newproc; };
|
---|
207 | DWORD getWindowId() { return dwIDMenu; };
|
---|
208 | void setWindowId(DWORD id) { dwIDMenu = id; };
|
---|
209 | ULONG getWindowHeight() { return rectWindow.bottom - rectWindow.top; };
|
---|
210 | ULONG getWindowWidth() { return rectWindow.right - rectWindow.left; };
|
---|
211 | ULONG getClientHeight() { return rectClient.bottom - rectClient.top; };
|
---|
212 | ULONG getClientWidth() { return rectClient.right - rectClient.left; };
|
---|
213 | BOOL isChild();
|
---|
214 | PRECT getClientRectPtr() { return &rectClient; };
|
---|
215 | void getClientRect(PRECT rect)
|
---|
216 | {
|
---|
217 | *rect = rectClient;
|
---|
218 | rect->right -= rect->left;
|
---|
219 | rect->bottom -= rect->top;
|
---|
220 | rect->left = rect->top = 0;
|
---|
221 | }
|
---|
222 | void setClientRect(PRECT rect) { rectClient = *rect; };
|
---|
223 | PRECT getWindowRect() { return &rectWindow; };
|
---|
224 | void setClientRect(LONG left, LONG top, LONG right, LONG bottom)
|
---|
225 | {
|
---|
226 | rectClient.left = left; rectClient.top = top;
|
---|
227 | rectClient.right = right; rectClient.bottom = bottom;
|
---|
228 | };
|
---|
229 | void setWindowRect(LONG left, LONG top, LONG right, LONG bottom)
|
---|
230 | {
|
---|
231 | rectWindow.left = left; rectWindow.top = top;
|
---|
232 | rectWindow.right = right; rectWindow.bottom = bottom;
|
---|
233 | };
|
---|
234 | void setWindowRect(PRECT rect) { rectWindow = *rect; };
|
---|
235 | DWORD getFlags() { return flags; };
|
---|
236 | void setFlags(DWORD newflags) { flags = newflags; };
|
---|
237 |
|
---|
238 | DWORD getCBExtra() { return cbExtra; };
|
---|
239 | PVOID getExtraPtr() { return pExtra; };
|
---|
240 |
|
---|
241 | void SetSysMenu(HMENU hSystemMenu) { hSysMenu = hSystemMenu; };
|
---|
242 | HMENU GetSysMenu() { return hSysMenu; }
|
---|
243 |
|
---|
244 | HICON IconForWindow(WPARAM fType);
|
---|
245 |
|
---|
246 | void SetWindowRegion(HRGN hRegion) { hWindowRegion = hRegion; };
|
---|
247 | HRGN GetWindowRegion() { return hWindowRegion; };
|
---|
248 |
|
---|
249 | //Save old clip region for CS_OWNDC windows (in BeginPaint)
|
---|
250 | HRGN GetClipRegion() { return hClipRegion; };
|
---|
251 | void SetClipRegion(HRGN hRegion) { hClipRegion = hRegion; };
|
---|
252 |
|
---|
253 | BOOL ShowWindow(ULONG nCmdShow);
|
---|
254 | BOOL SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags);
|
---|
255 | BOOL SetWindowPlacement(WINDOWPLACEMENT *winpos);
|
---|
256 | BOOL GetWindowPlacement(LPWINDOWPLACEMENT winpos);
|
---|
257 | BOOL ScrollWindow(int dx, int dy);
|
---|
258 | virtual BOOL DestroyWindow();
|
---|
259 | HWND SetActiveWindow();
|
---|
260 | BOOL DeactivateChildWindow();
|
---|
261 | HWND GetParent();
|
---|
262 | HWND SetParent(HWND hwndNewParent);
|
---|
263 |
|
---|
264 | BOOL IsChild(HWND hwndParent);
|
---|
265 |
|
---|
266 | HWND GetTopWindow();
|
---|
267 | HWND GetTopParent();
|
---|
268 |
|
---|
269 | HWND GetWindow(UINT uCmd);
|
---|
270 | virtual BOOL EnableWindow(BOOL fEnable);
|
---|
271 | BOOL CloseWindow();
|
---|
272 | static HWND GetActiveWindow();
|
---|
273 | //Window handle has already been verified, so just return true
|
---|
274 | BOOL IsWindow() { return TRUE; };
|
---|
275 | BOOL IsDialog() { return fIsDialog; };
|
---|
276 | BOOL IsModalDialog() { return fIsModalDialog; };
|
---|
277 | BOOL IsModalDialogOwner() { return fIsModalDialogOwner; };
|
---|
278 | VOID setModalDialogOwner(BOOL fMDO) { fIsModalDialogOwner = fMDO; };
|
---|
279 | VOID setOS2HwndModalDialog(HWND aHwnd) { OS2HwndModalDialog = aHwnd; };
|
---|
280 | HWND getOS2HwndModalDialog() { return OS2HwndModalDialog; };
|
---|
281 | BOOL CanReceiveSizeMsgs() { return state >= STATE_PRE_WMCREATE; };
|
---|
282 | BOOL IsParentChanging() { return fParentChange; };
|
---|
283 | BOOL IsWindowCreated() { return state >= STATE_PRE_WMNCCREATE; }
|
---|
284 | BOOL IsWindowDestroyed() { return state >= STATE_DESTROYED; };
|
---|
285 | BOOL IsWindowIconic();
|
---|
286 | //Window procedure type
|
---|
287 | BOOL IsWindowUnicode();
|
---|
288 | BOOL IsMixMaxStateChanging() { return fMinMaxChange; };
|
---|
289 |
|
---|
290 | void SetVisibleRegionChanged(BOOL changed) { fVisibleRegionChanged = changed; };
|
---|
291 | BOOL IsVisibleRegionChanged() { return fVisibleRegionChanged; };
|
---|
292 | BOOL setVisibleRgnNotifyProc(VISRGN_NOTIFY_PROC lpNotifyProc, DWORD dwUserData)
|
---|
293 | {
|
---|
294 | lpVisRgnNotifyProc = lpNotifyProc;
|
---|
295 | dwVisRgnNotifyParam = dwUserData;
|
---|
296 | return TRUE;
|
---|
297 | }
|
---|
298 | void callVisibleRgnNotifyProc(BOOL fDrawingAllowed)
|
---|
299 | {
|
---|
300 | if(lpVisRgnNotifyProc) {
|
---|
301 | lpVisRgnNotifyProc(getWindowHandle(), fDrawingAllowed, dwVisRgnNotifyParam);
|
---|
302 | }
|
---|
303 | }
|
---|
304 | int GetWindowTextLength(BOOL fUnicode);
|
---|
305 | int GetWindowTextLengthA() { return GetWindowTextLength(FALSE); };
|
---|
306 | int GetWindowTextLengthW() { return GetWindowTextLength(TRUE); };
|
---|
307 |
|
---|
308 | int GetWindowTextA(LPSTR lpsz, int cch);
|
---|
309 | int GetWindowTextW(LPWSTR lpsz, int cch);
|
---|
310 | BOOL SetWindowTextA(LPSTR lpsz);
|
---|
311 | BOOL SetWindowTextW(LPWSTR lpsz);
|
---|
312 | BOOL hasWindowName(LPSTR wndname, BOOL fUnicode = 0);
|
---|
313 | CHAR *getWindowNamePtrA();
|
---|
314 | WCHAR *getWindowNamePtrW();
|
---|
315 | VOID freeWindowNamePtr(PVOID namePtr);
|
---|
316 | CHAR *getWindowNameA() { return windowNameA; }; //only for MDI windows!
|
---|
317 | WCHAR *getWindowNameW() { return windowNameW; }; //only for MDI windows!
|
---|
318 | int getWindowNameLength() { return windowNameLength; };
|
---|
319 | Win32WndClass *getClass() { return windowClass; };
|
---|
320 | Win32BaseWindow *getOwner() { return owner; };
|
---|
321 | void setOwner(Win32BaseWindow *newOwner) { owner = newOwner; };
|
---|
322 |
|
---|
323 | SCROLLBAR_INFO *getScrollInfo(int nBar);
|
---|
324 |
|
---|
325 | LRESULT SendMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
|
---|
326 | LRESULT SendMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
|
---|
327 | static LRESULT BroadcastMessageA(int type, UINT msg, WPARAM wParam, LPARAM lParam);
|
---|
328 | static LRESULT BroadcastMessageW(int type, UINT msg, WPARAM wParam, LPARAM lParam);
|
---|
329 | void CallWindowHookProc(ULONG hooktype, ULONG Msg, WPARAM wParam, LPARAM lParam, BOOL fUnicode = FALSE);
|
---|
330 |
|
---|
331 | LRESULT DefWindowProcA(UINT Msg, WPARAM wParam, LPARAM lParam);
|
---|
332 | LRESULT DefWindowProcW(UINT msg, WPARAM wParam, LPARAM lParam);
|
---|
333 |
|
---|
334 | LRESULT DefWndControlColor(UINT ctlType, HDC hdc);
|
---|
335 | LRESULT DefWndPrint(HDC hdc,ULONG uFlags);
|
---|
336 |
|
---|
337 | void NotifyParent(UINT Msg, WPARAM wParam, LPARAM lParam);
|
---|
338 |
|
---|
339 | HWND FindWindowById(int id);
|
---|
340 |
|
---|
341 | static HWND FindWindowEx(HWND hwndParent, HWND hwndChildAfter, ATOM atom, LPSTR lpszWindow);
|
---|
342 |
|
---|
343 | BOOL EnumChildWindows(WNDENUMPROC lpfn, LPARAM lParam);
|
---|
344 | BOOL EnumThreadWindows(DWORD dwThreadId, WNDENUMPROC lpfn, LPARAM lParam);
|
---|
345 | BOOL EnumWindows(WNDENUMPROC lpfn, LPARAM lParam);
|
---|
346 |
|
---|
347 |
|
---|
348 | BOOL isComingToTop() { return fComingToTop; };
|
---|
349 | void setComingToTop(BOOL fTop) { fComingToTop = fTop; };
|
---|
350 | BOOL isInTasklist() { return fTaskList; };
|
---|
351 |
|
---|
352 | //window property methods
|
---|
353 | HANDLE getProp(LPCSTR str);
|
---|
354 | BOOL setProp(LPCSTR str, HANDLE handle);
|
---|
355 | HANDLE removeProp(LPCSTR str);
|
---|
356 | INT enumPropsExA(PROPENUMPROCEXA func, LPARAM lParam);
|
---|
357 | INT enumPropsExW(PROPENUMPROCEXW func, LPARAM lParam);
|
---|
358 |
|
---|
359 | #ifdef DEBUG
|
---|
360 | LONG addRef();
|
---|
361 | LONG release(char *function = __FUNCTION__, int line = __LINE__ );
|
---|
362 | #endif
|
---|
363 |
|
---|
364 | //Locates window in linked list and increases reference count (if found)
|
---|
365 | //Window object must be unreferenced after usage
|
---|
366 | static Win32BaseWindow *GetWindowFromHandle(HWND hwnd);
|
---|
367 | static Win32BaseWindow *GetWindowFromOS2Handle(HWND hwnd);
|
---|
368 | static Win32BaseWindow *GetWindowFromOS2FrameHandle(HWND hwnd);
|
---|
369 |
|
---|
370 | static void DestroyAll();
|
---|
371 |
|
---|
372 | protected:
|
---|
373 | #ifndef OS2_INCLUDED
|
---|
374 | BOOL CreateWindowExA(CREATESTRUCTA *lpCreateStruct, ATOM classAtom);
|
---|
375 | #endif
|
---|
376 | LRESULT SendInternalMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
|
---|
377 | LRESULT SendInternalMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
|
---|
378 | void Init();
|
---|
379 |
|
---|
380 | void NotifyFrameChanged(WINDOWPOS *wpos, RECT *oldClientRect);
|
---|
381 |
|
---|
382 | //called in destructor to remove all (if any) window properties
|
---|
383 | void removeWindowProps();
|
---|
384 | PROPERTY *findWindowProperty(LPCSTR str);
|
---|
385 |
|
---|
386 | HWND OS2Hwnd, OS2HwndFrame;
|
---|
387 | HMENU hSysMenu;
|
---|
388 | HWND Win32Hwnd;
|
---|
389 |
|
---|
390 | int posx, posy, width, height;
|
---|
391 |
|
---|
392 | // values normally contained in the standard window words
|
---|
393 | ULONG dwExStyle; //GWL_EXSTYLE
|
---|
394 | ULONG dwStyle; //GWL_STYLE
|
---|
395 | ULONG dwOldStyle; //Used to determine which frame control buttons to change (OS/2 mode)
|
---|
396 | WNDPROC win32wndproc; //GWL_WNDPROC
|
---|
397 | ULONG hInstance; //GWL_HINSTANCE
|
---|
398 | //Moved in ChildWindow class
|
---|
399 | ///// Win32BaseWindow *parent; //GWL_HWNDPARENT
|
---|
400 | ULONG dwIDMenu; //GWL_ID
|
---|
401 | ULONG userData; //GWL_USERDATA
|
---|
402 | HWND hwndLastActive; // last active popup handle
|
---|
403 |
|
---|
404 | ULONG cbExtra;
|
---|
405 | PVOID pExtra;
|
---|
406 |
|
---|
407 | HWND hwndLinkAfter;
|
---|
408 | DWORD flags;
|
---|
409 | DWORD contextHelpId;
|
---|
410 | DWORD hotkey;
|
---|
411 | LONG lastHitTestVal; //Last value returned by WM_NCHITTEST handler
|
---|
412 |
|
---|
413 | HWND OS2HwndModalDialog;
|
---|
414 |
|
---|
415 | ULONG fFirstShow:1,
|
---|
416 | fIsDialog:1,
|
---|
417 | fIsModalDialog:1,
|
---|
418 | fIsModalDialogOwner:1,
|
---|
419 | fInternalMsg:1, //Used to distinguish between messages
|
---|
420 | //sent by PM and those sent by apps
|
---|
421 | fParentChange:1,
|
---|
422 | fDestroyWindowCalled:1, //DestroyWindow was called for this window
|
---|
423 | fTaskList:1, //should be listed in PM tasklist or not
|
---|
424 | fXDefault:1,
|
---|
425 | fCXDefault:1,
|
---|
426 | fParentDC:1,
|
---|
427 | fComingToTop:1,
|
---|
428 | isUnicode:1,
|
---|
429 | fMinMaxChange:1, //set when switching between min/max/restored state
|
---|
430 | fVisibleRegionChanged:1, //set when visible region has changed -> erase background must be sent during next BeginPaint
|
---|
431 | fEraseBkgndFlag:1,
|
---|
432 | fFakeWindow:1;
|
---|
433 |
|
---|
434 | ULONG state;
|
---|
435 | HRGN hWindowRegion;
|
---|
436 | HRGN hClipRegion;
|
---|
437 |
|
---|
438 | DWORD dwThreadId; //id of thread that created this window
|
---|
439 | DWORD dwProcessId; //id of process that created this window
|
---|
440 |
|
---|
441 | Win32BaseWindow *owner;
|
---|
442 | HICON hIcon,hIconSm;
|
---|
443 |
|
---|
444 | char *windowNameA;
|
---|
445 | WCHAR *windowNameW;
|
---|
446 | int windowNameLength;
|
---|
447 |
|
---|
448 | char *userWindowBytes;
|
---|
449 | ULONG nrUserWindowBytes;
|
---|
450 |
|
---|
451 | RECT rectWindow; //relative to parent
|
---|
452 | RECT rectClient; //relative to frame
|
---|
453 | WINDOWPLACEMENT windowpos;
|
---|
454 |
|
---|
455 | PROPERTY *propertyList;
|
---|
456 |
|
---|
457 | VISRGN_NOTIFY_PROC lpVisRgnNotifyProc;
|
---|
458 | DWORD dwVisRgnNotifyParam;
|
---|
459 |
|
---|
460 | HANDLE hTaskList; //PM specific (switchentry handle)
|
---|
461 |
|
---|
462 | CREATESTRUCTA *tmpcs; //temporary pointer to CREATESTRUCT used in CreateWindowEx
|
---|
463 | ULONG sw; //set in CreateWindowExA, used in MsgCreate method
|
---|
464 |
|
---|
465 | SCROLLBAR_INFO *vertScrollInfo;
|
---|
466 | SCROLLBAR_INFO *horzScrollInfo;
|
---|
467 |
|
---|
468 | Win32WndClass *windowClass;
|
---|
469 |
|
---|
470 | static GenericObject *windows;
|
---|
471 | static CRITICAL_SECTION critsect;
|
---|
472 |
|
---|
473 | private:
|
---|
474 | #ifndef OS2_INCLUDED
|
---|
475 | void GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack );
|
---|
476 | UINT MinMaximize(UINT cmd, LPRECT lpRect);
|
---|
477 | LONG HandleWindowPosChanging(WINDOWPOS *winpos);
|
---|
478 | LONG HandleNCActivate(WPARAM wParam);
|
---|
479 | VOID TrackMinMaxHelpBox(WORD wParam);
|
---|
480 | VOID TrackCloseButton(WORD wParam);
|
---|
481 | VOID TrackScrollBar(WPARAM wParam,POINT pt);
|
---|
482 | LONG HandleNCLButtonDown(WPARAM wParam,LPARAM lParam);
|
---|
483 | LONG HandleNCLButtonDblClk(WPARAM wParam,LPARAM lParam);
|
---|
484 | LONG HandleNCRButtonUp(WPARAM wParam,LPARAM lParam);
|
---|
485 | VOID AdjustRectOuter(LPRECT rect,BOOL menu);
|
---|
486 | VOID AdjustRectInner(LPRECT rect);
|
---|
487 | LONG HandleNCCalcSize(BOOL calcValidRects,RECT *winRect);
|
---|
488 | VOID DrawFrame(HDC hdc,RECT *rect,BOOL dlgFrame,BOOL active);
|
---|
489 | public:
|
---|
490 | VOID GetInsideRect(RECT *rect);
|
---|
491 | LONG HandleNCHitTest(POINT pt);
|
---|
492 | BOOL GetSysPopupPos(RECT* rect);
|
---|
493 | private:
|
---|
494 | BOOL DrawSysButton(HDC hdc,RECT *rect);
|
---|
495 | BOOL DrawGrayButton(HDC hdc,int x,int y);
|
---|
496 | VOID DrawCloseButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed);
|
---|
497 | VOID DrawMaxButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed);
|
---|
498 | VOID DrawMinButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed);
|
---|
499 | VOID DrawContextHelpButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed);
|
---|
500 | VOID DrawCaption(HDC hdc,RECT *rect,BOOL active);
|
---|
501 | VOID DoNCPaint(HRGN clip,BOOL suppress_menupaint);
|
---|
502 | LONG HandleNCPaint(HRGN clip);
|
---|
503 | LONG HandleSysCommand(WPARAM wParam, POINT *pt32);
|
---|
504 |
|
---|
505 | LONG SendNCCalcSize(BOOL calcValidRect,
|
---|
506 | RECT *newWindowRect, RECT *oldWindowRect,
|
---|
507 | RECT *oldClientRect, WINDOWPOS *winpos,
|
---|
508 | RECT *newClientRect );
|
---|
509 |
|
---|
510 | #else
|
---|
511 | friend BOOL OS2ToWinMsgTranslate(void *pThdb, QMSG *os2Msg, MSG *winMsg, BOOL isUnicode, BOOL fTranslateExtraMsgs);
|
---|
512 | #endif
|
---|
513 |
|
---|
514 | public:
|
---|
515 | void SetFakeOpen32() { WinSetDAXData (OS2Hwnd, &fakeWinBase); }
|
---|
516 | void RemoveFakeOpen32() { WinSetDAXData (OS2Hwnd, NULL); }
|
---|
517 |
|
---|
518 | fakeOpen32WinBaseClass fakeWinBase;
|
---|
519 |
|
---|
520 | VOID AdjustMaximizedRect(LPRECT rect);
|
---|
521 | VOID AdjustTrackInfo(PPOINT minTrackSize,PPOINT maxTrackSize);
|
---|
522 |
|
---|
523 | //Temporary hack for CS_CLASSDC style (do the same as for CS_OWNDC)
|
---|
524 | #ifndef OS2_INCLUDED
|
---|
525 | BOOL isOwnDC() { return (windowClass && windowClass->getStyle() & (CS_OWNDC|CS_CLASSDC)); }
|
---|
526 | #else
|
---|
527 | BOOL isOwnDC() { return (windowClass && windowClass->getStyle() & (CS_OWNDC_W|CS_CLASSDC_W)); }
|
---|
528 | #endif
|
---|
529 |
|
---|
530 | HDC getOwnDC() { return ownDC; }
|
---|
531 | void setOwnDC(HDC hdc) { ownDC = hdc; }
|
---|
532 | protected:
|
---|
533 | HDC ownDC;
|
---|
534 |
|
---|
535 | public:
|
---|
536 | VOID setEraseBkgnd (BOOL erase) { fEraseBkgndFlag = erase; }
|
---|
537 | BOOL needsEraseBkgnd() { return fEraseBkgndFlag; }
|
---|
538 | };
|
---|
539 |
|
---|
540 | #endif //__cplusplus
|
---|
541 |
|
---|
542 | #endif //__WIN32WNDBASE_H__
|
---|