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