1 | /* $Id: win32wbase.h,v 1.156 2003-11-12 14:10:21 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 <gen_object.h>
|
---|
20 | #include <win32wndchild.h>
|
---|
21 | #include <winuser32.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 | #define MAX_OPENDCS 8
|
---|
39 |
|
---|
40 | #define TYPE_ASCII 0
|
---|
41 | #define TYPE_UNICODE 1
|
---|
42 |
|
---|
43 | #define GW_HWNDNEXTCHILD (0x10000 | GW_HWNDNEXT)
|
---|
44 | #define GW_HWNDPREVCHILD (0x10000 | GW_HWNDPREV)
|
---|
45 | #define GW_HWNDFIRSTCHILD (0x10000 | GW_CHILD)
|
---|
46 | #define GW_HWNDLASTCHILD (0x10000 | GW_HWNDLAST)
|
---|
47 |
|
---|
48 | #ifdef DEBUG
|
---|
49 | #define RELEASE_WNDOBJ(a) { a->release(__FUNCTION__, __LINE__); a = NULL; }
|
---|
50 | #else
|
---|
51 | #define RELEASE_WNDOBJ(a) { a->release(); a = NULL; }
|
---|
52 | #endif
|
---|
53 |
|
---|
54 | typedef struct {
|
---|
55 | USHORT cb;
|
---|
56 | Win32BaseWindow *win32wnd;
|
---|
57 | ULONG win32CreateStruct; //or dialog create dword
|
---|
58 | } CUSTOMWNDDATA;
|
---|
59 |
|
---|
60 | typedef struct tagPROPERTY
|
---|
61 | {
|
---|
62 | struct tagPROPERTY *next; /* Next property in window list */
|
---|
63 | HANDLE handle; /* User's data */
|
---|
64 | LPSTR string; /* Property string (or atom) */
|
---|
65 | } PROPERTY;
|
---|
66 |
|
---|
67 | #define HAS_DLGFRAME(style,exStyle) \
|
---|
68 | (((exStyle) & WS_EX_DLGMODALFRAME) || \
|
---|
69 | (((style) & WS_DLGFRAME) && !((style) & WS_THICKFRAME)))
|
---|
70 |
|
---|
71 | #define HAS_THICKFRAME(style,exStyle) \
|
---|
72 | (((style) & WS_THICKFRAME) && \
|
---|
73 | !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME))
|
---|
74 | #if 0
|
---|
75 | (((style) & WS_THICKFRAME) && \
|
---|
76 | !((exStyle) & WS_EX_DLGMODALFRAME) && \
|
---|
77 | !((style) & WS_CHILD))
|
---|
78 | #endif
|
---|
79 |
|
---|
80 | #define HAS_THINFRAME(style) \
|
---|
81 | (((style) & WS_BORDER) || !((style) & (WS_CHILD | WS_POPUP)))
|
---|
82 |
|
---|
83 | #define HAS_BIGFRAME(style,exStyle) \
|
---|
84 | (((style) & (WS_THICKFRAME | WS_DLGFRAME)) || \
|
---|
85 | ((exStyle) & WS_EX_DLGMODALFRAME))
|
---|
86 |
|
---|
87 | #define HAS_ANYFRAME(style,exStyle) \
|
---|
88 | (((style) & (WS_THICKFRAME | WS_DLGFRAME | WS_BORDER)) || \
|
---|
89 | ((exStyle) & WS_EX_DLGMODALFRAME) || \
|
---|
90 | !((style) & (WS_CHILD | WS_POPUP)))
|
---|
91 |
|
---|
92 | #define HAS_3DFRAME(exStyle) \
|
---|
93 | ((exStyle & WS_EX_CLIENTEDGE) || (exStyle & WS_EX_STATICEDGE) || (exStyle & WS_EX_WINDOWEDGE))
|
---|
94 |
|
---|
95 | #define HAS_BORDER(style, exStyle) \
|
---|
96 | ((style & WS_BORDER) || HAS_THICKFRAME(style) || HAS_DLGFRAME(style,exStyle))
|
---|
97 |
|
---|
98 | #define IS_OVERLAPPED(style) \
|
---|
99 | !(style & (WS_CHILD | WS_POPUP))
|
---|
100 |
|
---|
101 | #define HAS_MENU() (!(getStyle() & WS_CHILD) && (getWindowId() != 0))
|
---|
102 |
|
---|
103 | #define STATE_INIT 0 //initial state
|
---|
104 | #define STATE_PRE_WMNCCREATE 1 //before WM_NCCREATE
|
---|
105 | #define STATE_POST_WMNCCREATE 2 //after WM_NCCREATE
|
---|
106 | #define STATE_PRE_WMCREATE 3 //before WM_CREATE
|
---|
107 | #define STATE_POST_WMCREATE 4 //after WM_CREATE
|
---|
108 | #define STATE_CREATED 5 //after successful return of WinCreateWindow
|
---|
109 | #define STATE_DESTROYED 6 //DestroyWindow called for window
|
---|
110 |
|
---|
111 |
|
---|
112 | class Win32BaseWindow : public GenericObject, public ChildWindow
|
---|
113 | {
|
---|
114 | public:
|
---|
115 | Win32BaseWindow();
|
---|
116 | Win32BaseWindow(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode);
|
---|
117 |
|
---|
118 | virtual ~Win32BaseWindow();
|
---|
119 |
|
---|
120 | virtual ULONG MsgCreate(HWND hwndOS2);
|
---|
121 | ULONG MsgQuit();
|
---|
122 | ULONG MsgClose();
|
---|
123 | ULONG MsgDestroy();
|
---|
124 | virtual ULONG MsgEnable(BOOL fEnable);
|
---|
125 | ULONG MsgShow(BOOL fShow);
|
---|
126 | ULONG MsgPosChanging(LPARAM lp);
|
---|
127 | ULONG MsgPosChanged(LPARAM lp);
|
---|
128 | ULONG MsgActivate(BOOL fActivate, BOOL fMinimized, HWND hwnd, HWND hwndOS2Win);
|
---|
129 | ULONG MsgChildActivate(BOOL fActivate);
|
---|
130 | ULONG MsgSetFocus(HWND hwnd);
|
---|
131 | ULONG MsgKillFocus(HWND hwnd);
|
---|
132 | ULONG MsgScroll(ULONG msg, ULONG scrollCode, ULONG scrollPos);
|
---|
133 | ULONG MsgButton(MSG *msg);
|
---|
134 | ULONG MsgMouseMove(MSG *msg);
|
---|
135 | ULONG MsgChar(MSG *msg);
|
---|
136 | ULONG MsgPaint(ULONG tmp1, BOOL select = TRUE);
|
---|
137 | ULONG MsgEraseBackGround(HDC hdc);
|
---|
138 | ULONG MsgNCPaint(PRECT pUpdateRect, HRGN hrgnUpdate);
|
---|
139 | ULONG MsgFormatFrame(WINDOWPOS *lpWndPos);
|
---|
140 | ULONG DispatchMsgA(MSG *msg);
|
---|
141 | ULONG DispatchMsgW(MSG *msg);
|
---|
142 |
|
---|
143 | ULONG MsgSetText(LPSTR lpsz, LONG cch);
|
---|
144 | ULONG MsgGetTextLength();
|
---|
145 | void MsgGetText(char *wndtext, ULONG textlength);
|
---|
146 |
|
---|
147 | virtual LONG SetWindowLong(int index, ULONG value, BOOL fUnicode);
|
---|
148 | virtual ULONG GetWindowLong(int index, BOOL fUnicode);
|
---|
149 | virtual WORD SetWindowWord(int index, WORD value);
|
---|
150 | virtual WORD GetWindowWord(int index);
|
---|
151 |
|
---|
152 | DWORD getStyle() { return dwStyle; };
|
---|
153 | DWORD getOldStyle() { return dwOldStyle; };
|
---|
154 | void setStyle(DWORD newstyle) { dwStyle = newstyle; };
|
---|
155 | void setOldStyle(DWORD oldStyle) { dwOldStyle = oldStyle; };
|
---|
156 | DWORD getExStyle() { return dwExStyle; };
|
---|
157 | void setExStyle(DWORD newexstyle) { dwExStyle = newexstyle; };
|
---|
158 | ULONG getInstance() { return hInstance; };
|
---|
159 | void setInstance(ULONG newinstance) { hInstance = newinstance; };
|
---|
160 | HWND getWindowHandle() { return Win32Hwnd; };
|
---|
161 | HWND getOS2WindowHandle() { return OS2Hwnd; };
|
---|
162 | HWND getOS2FrameWindowHandle() { return OS2HwndFrame; };
|
---|
163 | HWND getLastActive() { return hwndLastActive; };
|
---|
164 | void setLastActive(HWND _hwndLastActive)
|
---|
165 | { hwndLastActive = _hwndLastActive; };
|
---|
166 | BOOL isDragDropActive() { return fIsDragDropActive; };
|
---|
167 | void setDragDropActive(BOOL fActive) { fIsDragDropActive = fActive; };
|
---|
168 |
|
---|
169 | Win32WndClass *getWindowClass() { return windowClass; };
|
---|
170 |
|
---|
171 | LONG getLastHitTestVal() { return lastHitTestVal; }
|
---|
172 | void setLastHitTestVal(LONG hittest) { lastHitTestVal = hittest; }
|
---|
173 |
|
---|
174 | DWORD getWindowContextHelpId() { return contextHelpId; };
|
---|
175 | void setWindowContextHelpId(DWORD id){ contextHelpId = id; };
|
---|
176 |
|
---|
177 | BOOL isFrameWindow();
|
---|
178 | virtual BOOL isMDIClient();
|
---|
179 | virtual BOOL isMDIChild();
|
---|
180 | virtual BOOL isDesktopWindow();
|
---|
181 | virtual BOOL isFakeWindow();
|
---|
182 |
|
---|
183 | BOOL fHasParentDC() { return fParentDC; };
|
---|
184 |
|
---|
185 | Win32BaseWindow *getParent();
|
---|
186 | void setParent(Win32BaseWindow *pwindow) { setParentOfChild((ChildWindow *)pwindow); };
|
---|
187 | WNDPROC getWindowProc() { return win32wndproc; };
|
---|
188 | void setWindowProc(WNDPROC newproc) { win32wndproc = newproc; };
|
---|
189 | DWORD getWindowId() { return dwIDMenu; };
|
---|
190 | void setWindowId(DWORD id) { dwIDMenu = id; };
|
---|
191 | ULONG getWindowHeight() { return rectWindow.bottom - rectWindow.top; };
|
---|
192 | ULONG getWindowWidth() { return rectWindow.right - rectWindow.left; };
|
---|
193 | ULONG getClientHeight() { return rectClient.bottom - rectClient.top; };
|
---|
194 | ULONG getClientWidth() { return rectClient.right - rectClient.left; };
|
---|
195 | BOOL isChild();
|
---|
196 | PRECT getClientRectPtr() { return &rectClient; };
|
---|
197 | void getClientRect(PRECT rect)
|
---|
198 | {
|
---|
199 | *rect = rectClient;
|
---|
200 | rect->right -= rect->left;
|
---|
201 | rect->bottom -= rect->top;
|
---|
202 | rect->left = rect->top = 0;
|
---|
203 | }
|
---|
204 | void setClientRect(PRECT rect) { rectClient = *rect; };
|
---|
205 | virtual PRECT getWindowRect();
|
---|
206 | void setClientRect(LONG left, LONG top, LONG right, LONG bottom)
|
---|
207 | {
|
---|
208 | rectClient.left = left; rectClient.top = top;
|
---|
209 | rectClient.right = right; rectClient.bottom = bottom;
|
---|
210 | };
|
---|
211 | void setWindowRect(LONG left, LONG top, LONG right, LONG bottom)
|
---|
212 | {
|
---|
213 | rectWindow.left = left; rectWindow.top = top;
|
---|
214 | rectWindow.right = right; rectWindow.bottom = bottom;
|
---|
215 | };
|
---|
216 | void setWindowRect(PRECT rect) { rectWindow = *rect; };
|
---|
217 | DWORD getFlags() { return flags; };
|
---|
218 | void setFlags(DWORD newflags) { flags = newflags; };
|
---|
219 |
|
---|
220 | DWORD getCBExtra() { return cbExtra; };
|
---|
221 | PVOID getExtraPtr() { return pExtra; };
|
---|
222 |
|
---|
223 | void SetSysMenu(HMENU hSystemMenu) { hSysMenu = hSystemMenu; };
|
---|
224 | HMENU GetSysMenu() { return hSysMenu; }
|
---|
225 |
|
---|
226 | HICON IconForWindow(WPARAM fType);
|
---|
227 |
|
---|
228 | void SetWindowRegion(HRGN hRegion) { hWindowRegion = hRegion; };
|
---|
229 | HRGN GetWindowRegion() { return hWindowRegion; };
|
---|
230 |
|
---|
231 | //Save old clip region for CS_OWNDC windows (in BeginPaint)
|
---|
232 | HRGN GetClipRegion() { return hClipRegion; };
|
---|
233 | HRGN GetVisRegion() { return hVisRegion; };
|
---|
234 | void SaveClipRegion(HRGN hrgnClip) { hClipRegion = hrgnClip; };
|
---|
235 | void SaveVisRegion(HRGN hrgnVis) { hVisRegion = hrgnVis; };
|
---|
236 |
|
---|
237 | void saveAndValidateUpdateRegion();
|
---|
238 | void checkForDirtyUpdateRegion();
|
---|
239 | BOOL hasDirtUpdateRegion() { return fDirtyUpdateRegion; };
|
---|
240 |
|
---|
241 | BOOL ShowWindow(ULONG nCmdShow);
|
---|
242 | virtual BOOL SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags, BOOL fShowWindow = FALSE);
|
---|
243 | BOOL SetWindowPlacement(WINDOWPLACEMENT *winpos);
|
---|
244 | BOOL GetWindowPlacement(LPWINDOWPLACEMENT winpos);
|
---|
245 | BOOL ScrollWindow(int dx, int dy);
|
---|
246 | virtual BOOL DestroyWindow();
|
---|
247 | HWND SetActiveWindow();
|
---|
248 | BOOL DeactivateChildWindow();
|
---|
249 | HWND GetParent();
|
---|
250 | HWND SetParent(HWND hwndNewParent);
|
---|
251 |
|
---|
252 | BOOL IsChild(HWND hwndParent);
|
---|
253 |
|
---|
254 | HWND GetTopWindow();
|
---|
255 | HWND GetTopParent();
|
---|
256 |
|
---|
257 | PVOID getOldPMWindowProc() { return pfnOldPMWndProc; };
|
---|
258 | void setOldPMWindowProc(PVOID pfnPMWndProc) { pfnOldPMWndProc = pfnPMWndProc; };
|
---|
259 |
|
---|
260 | HWND GetWindow(UINT uCmd);
|
---|
261 | virtual BOOL EnableWindow(BOOL fEnable);
|
---|
262 | BOOL CloseWindow();
|
---|
263 | static HWND GetActiveWindow();
|
---|
264 | //Window handle has already been verified, so just return true
|
---|
265 | BOOL IsWindow() { return TRUE; };
|
---|
266 | BOOL IsDialog() { return fIsDialog; };
|
---|
267 | BOOL IsModalDialog() { return fIsModalDialog; };
|
---|
268 | BOOL IsModalDialogOwner() { return fIsModalDialogOwner; };
|
---|
269 | VOID setModalDialogOwner(BOOL fMDO) { fIsModalDialogOwner = fMDO; };
|
---|
270 | VOID setOS2HwndModalDialog(HWND aHwnd) { OS2HwndModalDialog = aHwnd; };
|
---|
271 | HWND getOS2HwndModalDialog() { return OS2HwndModalDialog; };
|
---|
272 | BOOL CanReceiveSizeMsgs() { return state >= STATE_PRE_WMCREATE; };
|
---|
273 | BOOL IsParentChanging() { return fParentChange; };
|
---|
274 | BOOL IsWindowCreated() { return state >= STATE_PRE_WMNCCREATE; }
|
---|
275 | BOOL IsWindowDestroyed() { return state >= STATE_DESTROYED; };
|
---|
276 | BOOL IsWindowIconic();
|
---|
277 |
|
---|
278 | //hack alert (see DestroyWindow)
|
---|
279 | BOOL IsChildDestructionInProgress() { return fChildDestructionInProgress; };
|
---|
280 | void SetChildDestructionInProgress(BOOL fDestuctionInProgress)
|
---|
281 | {
|
---|
282 | fChildDestructionInProgress = fDestuctionInProgress;
|
---|
283 | };
|
---|
284 | //hack end
|
---|
285 |
|
---|
286 | //Window procedure type
|
---|
287 | BOOL IsWindowUnicode();
|
---|
288 | BOOL IsMixMaxStateChanging() { return fMinMaxChange; };
|
---|
289 |
|
---|
290 | BOOL setVisibleRgnNotifyProc(VISRGN_NOTIFY_PROC lpNotifyProc, DWORD dwUserData);
|
---|
291 | void callVisibleRgnNotifyProc(BOOL fDrawingAllowed);
|
---|
292 | BOOL isLocked() { return fWindowLocked; };
|
---|
293 |
|
---|
294 | BOOL queryOpenDCs(HDC *phdcWindow, int chdcWindow, int *pnrdcs);
|
---|
295 | void addOpenDC(HDC hdc);
|
---|
296 | void removeOpenDC(HDC hdc);
|
---|
297 |
|
---|
298 | int GetWindowTextLength(BOOL fUnicode);
|
---|
299 | int GetWindowTextLengthA() { return GetWindowTextLength(FALSE); };
|
---|
300 | int GetWindowTextLengthW() { return GetWindowTextLength(TRUE); };
|
---|
301 |
|
---|
302 | int GetWindowTextA(LPSTR lpsz, int cch);
|
---|
303 | int GetWindowTextW(LPWSTR lpsz, int cch);
|
---|
304 | BOOL SetWindowTextA(LPSTR lpsz);
|
---|
305 | BOOL SetWindowTextW(LPWSTR lpsz);
|
---|
306 | BOOL hasWindowName(LPSTR wndname, BOOL fUnicode = 0);
|
---|
307 | CHAR *getWindowNamePtrA();
|
---|
308 | WCHAR *getWindowNamePtrW();
|
---|
309 | VOID freeWindowNamePtr(PVOID namePtr);
|
---|
310 | CHAR *getWindowNameA() { return windowNameA; }; //only for MDI windows!
|
---|
311 | WCHAR *getWindowNameW() { return windowNameW; }; //only for MDI windows!
|
---|
312 | int getWindowNameLengthA() { return windowNameLengthA; };
|
---|
313 | int getWindowNameLengthW() { return windowNameLengthW; };
|
---|
314 | Win32WndClass *getClass() { return windowClass; };
|
---|
315 | Win32BaseWindow *getOwner() { return owner; };
|
---|
316 | void setOwner(Win32BaseWindow *newOwner) { owner = newOwner; };
|
---|
317 |
|
---|
318 |
|
---|
319 | DWORD getThreadId() { return dwThreadId; };
|
---|
320 | DWORD getProcessId() { return dwProcessId; };
|
---|
321 |
|
---|
322 | SCROLLBAR_INFO *getScrollInfo(int nBar);
|
---|
323 |
|
---|
324 | LRESULT DefWindowProcA(UINT Msg, WPARAM wParam, LPARAM lParam);
|
---|
325 | LRESULT DefWindowProcW(UINT msg, WPARAM wParam, LPARAM lParam);
|
---|
326 |
|
---|
327 | LRESULT DefWndControlColor(UINT ctlType, HDC hdc);
|
---|
328 | LRESULT DefWndPrint(HDC hdc,ULONG uFlags);
|
---|
329 |
|
---|
330 | void NotifyParent(UINT Msg, WPARAM wParam, LPARAM lParam);
|
---|
331 |
|
---|
332 | HWND FindWindowById(int id);
|
---|
333 |
|
---|
334 | static HWND FindWindowEx(HWND hwndParent, HWND hwndChildAfter, ATOM atom, LPSTR lpszWindow);
|
---|
335 |
|
---|
336 | BOOL EnumChildWindows(WNDENUMPROC lpfn, LPARAM lParam);
|
---|
337 | BOOL EnumThreadWindows(DWORD dwThreadId, WNDENUMPROC lpfn, LPARAM lParam);
|
---|
338 | BOOL EnumWindows(WNDENUMPROC lpfn, LPARAM lParam);
|
---|
339 |
|
---|
340 |
|
---|
341 | BOOL isComingToTop() { return fComingToTop; };
|
---|
342 | void setComingToTop(BOOL fTop) { fComingToTop = fTop; };
|
---|
343 | BOOL isInTasklist() { return fTaskList; };
|
---|
344 |
|
---|
345 | //window property methods
|
---|
346 | HANDLE getProp(LPCSTR str);
|
---|
347 | BOOL setProp(LPCSTR str, HANDLE handle);
|
---|
348 | HANDLE removeProp(LPCSTR str);
|
---|
349 | INT enumPropsExA(PROPENUMPROCEXA func, LPARAM lParam);
|
---|
350 | INT enumPropsExW(PROPENUMPROCEXW func, LPARAM lParam);
|
---|
351 |
|
---|
352 | #ifdef DEBUG
|
---|
353 | LONG addRef();
|
---|
354 | LONG release(char *function = __FUNCTION__, int line = __LINE__ );
|
---|
355 | #endif
|
---|
356 |
|
---|
357 | //Locates window in linked list and increases reference count (if found)
|
---|
358 | //Window object must be unreferenced after usage
|
---|
359 | static Win32BaseWindow *GetWindowFromHandle(HWND hwnd);
|
---|
360 | static Win32BaseWindow *GetWindowFromOS2Handle(HWND hwnd);
|
---|
361 | static Win32BaseWindow *GetWindowFromOS2FrameHandle(HWND hwnd);
|
---|
362 |
|
---|
363 | static void DestroyAll();
|
---|
364 |
|
---|
365 | protected:
|
---|
366 | #ifndef OS2_INCLUDED
|
---|
367 | BOOL CreateWindowExA(CREATESTRUCTA *lpCreateStruct, ATOM classAtom);
|
---|
368 | #endif
|
---|
369 | void Init();
|
---|
370 |
|
---|
371 | void NotifyFrameChanged(WINDOWPOS *wpos, RECT *oldClientRect);
|
---|
372 |
|
---|
373 | //called in destructor to remove all (if any) window properties
|
---|
374 | void removeWindowProps();
|
---|
375 | PROPERTY *findWindowProperty(LPCSTR str);
|
---|
376 |
|
---|
377 | HWND OS2Hwnd, OS2HwndFrame;
|
---|
378 | HMENU hSysMenu;
|
---|
379 | HWND Win32Hwnd;
|
---|
380 |
|
---|
381 | int posx, posy, width, height;
|
---|
382 |
|
---|
383 | // values normally contained in the standard window words
|
---|
384 | ULONG dwExStyle; //GWL_EXSTYLE
|
---|
385 | ULONG dwStyle; //GWL_STYLE
|
---|
386 | ULONG dwOldStyle; //Used to determine which frame control buttons to change (OS/2 mode)
|
---|
387 | WNDPROC win32wndproc; //GWL_WNDPROC
|
---|
388 | ULONG hInstance; //GWL_HINSTANCE
|
---|
389 | //Moved in ChildWindow class
|
---|
390 | ///// Win32BaseWindow *parent; //GWL_HWNDPARENT
|
---|
391 | ULONG dwIDMenu; //GWL_ID
|
---|
392 | ULONG userData; //GWL_USERDATA
|
---|
393 | HWND hwndLastActive; // last active popup handle
|
---|
394 |
|
---|
395 | ULONG cbExtra;
|
---|
396 | PVOID pExtra;
|
---|
397 |
|
---|
398 | HWND hwndLinkAfter;
|
---|
399 | DWORD flags;
|
---|
400 | DWORD contextHelpId;
|
---|
401 | DWORD hotkey;
|
---|
402 | LONG lastHitTestVal; //Last value returned by WM_NCHITTEST handler
|
---|
403 |
|
---|
404 | HWND OS2HwndModalDialog;
|
---|
405 |
|
---|
406 | ULONG fFirstShow:1,
|
---|
407 | fIsDialog:1,
|
---|
408 | fIsModalDialog:1,
|
---|
409 | fIsModalDialogOwner:1,
|
---|
410 | fParentChange:1,
|
---|
411 | fDestroyWindowCalled:1, //DestroyWindow was called for this window
|
---|
412 | fChildDestructionInProgress:1,
|
---|
413 | fTaskList:1, //should be listed in PM tasklist or not
|
---|
414 | fXDefault:1,
|
---|
415 | fCXDefault:1,
|
---|
416 | fParentDC:1,
|
---|
417 | fComingToTop:1,
|
---|
418 | isUnicode:1,
|
---|
419 | fMinMaxChange:1, //set when switching between min/max/restored state
|
---|
420 | fPMUpdateRegionChanged:1, //set when PM update has changed -> erase background must be sent during next BeginPaint
|
---|
421 | fEraseBkgndFlag:1,
|
---|
422 | fIsDragDropActive:1,
|
---|
423 | fDirtyUpdateRegion:1,
|
---|
424 | fWindowLocked:1;
|
---|
425 |
|
---|
426 | ULONG state;
|
---|
427 | HRGN hWindowRegion;
|
---|
428 | HRGN hClipRegion, hVisRegion;
|
---|
429 | HRGN hUpdateRegion;
|
---|
430 |
|
---|
431 | DWORD dwThreadId; //id of thread that created this window
|
---|
432 | DWORD dwProcessId; //id of process that created this window
|
---|
433 |
|
---|
434 | //array of open window DCs
|
---|
435 | HDC hdcWindow[MAX_OPENDCS];
|
---|
436 | int nrOpenDCs;
|
---|
437 |
|
---|
438 | Win32BaseWindow *owner;
|
---|
439 | HICON hIcon,hIconSm;
|
---|
440 |
|
---|
441 | char *windowNameA;
|
---|
442 | WCHAR *windowNameW;
|
---|
443 | int windowNameLengthA;
|
---|
444 | int windowNameLengthW;
|
---|
445 |
|
---|
446 | char *userWindowBytes;
|
---|
447 | ULONG nrUserWindowBytes;
|
---|
448 |
|
---|
449 | RECT rectWindow; //relative to parent
|
---|
450 | RECT rectClient; //relative to frame
|
---|
451 | WINDOWPLACEMENT windowpos;
|
---|
452 |
|
---|
453 | PVOID pfnOldPMWndProc;
|
---|
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 | int 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 | void FixCoordinates( CREATESTRUCTA *cs, INT *sw);
|
---|
490 | public:
|
---|
491 | VOID GetInsideRect(RECT *rect);
|
---|
492 | LONG HandleNCHitTest(POINT pt);
|
---|
493 | BOOL GetSysPopupPos(RECT* rect);
|
---|
494 | BOOL DrawSysButton(HDC hdc,RECT *rect);
|
---|
495 | private:
|
---|
496 | BOOL DrawGrayButton(HDC hdc,int x,int y);
|
---|
497 | VOID DrawCloseButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed);
|
---|
498 | VOID DrawMaxButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed);
|
---|
499 | VOID DrawMinButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed);
|
---|
500 | VOID DrawContextHelpButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed);
|
---|
501 | VOID DrawCaption(HDC hdc,RECT *rect,BOOL active);
|
---|
502 | VOID DoNCPaint(HRGN clip,BOOL suppress_menupaint);
|
---|
503 | LONG HandleNCPaint(HRGN clip);
|
---|
504 | LONG HandleSysCommand(WPARAM wParam, POINT *pt32);
|
---|
505 |
|
---|
506 | LONG SendNCCalcSize(BOOL calcValidRect,
|
---|
507 | RECT *newWindowRect, RECT *oldWindowRect,
|
---|
508 | RECT *oldClientRect, WINDOWPOS *winpos,
|
---|
509 | RECT *newClientRect );
|
---|
510 |
|
---|
511 | #else
|
---|
512 | friend BOOL OS2ToWinMsgTranslate(void *pThdb, QMSG *os2Msg, MSG *winMsg, BOOL isUnicode, BOOL fTranslateExtraMsgs);
|
---|
513 | #endif
|
---|
514 |
|
---|
515 | public:
|
---|
516 |
|
---|
517 | VOID AdjustMaximizedRect(LPRECT rect);
|
---|
518 | VOID AdjustTrackInfo(PPOINT minTrackSize,PPOINT maxTrackSize);
|
---|
519 |
|
---|
520 | //Temporary hack for CS_CLASSDC style (do the same as for CS_OWNDC)
|
---|
521 | #ifndef OS2_INCLUDED
|
---|
522 | BOOL isOwnDC() { return (windowClass && windowClass->getStyle() & (CS_OWNDC|CS_CLASSDC)); }
|
---|
523 | #else
|
---|
524 | BOOL isOwnDC() { return (windowClass && windowClass->getStyle() & (CS_OWNDC_W|CS_CLASSDC_W)); }
|
---|
525 | #endif
|
---|
526 |
|
---|
527 | HDC getOwnDC() { return ownDC; }
|
---|
528 | void setOwnDC(HDC hdc) { ownDC = hdc; }
|
---|
529 | protected:
|
---|
530 | HDC ownDC;
|
---|
531 |
|
---|
532 | public:
|
---|
533 | VOID setEraseBkgnd (BOOL erase) { fEraseBkgndFlag = erase; }
|
---|
534 | BOOL needsEraseBkgnd() { return fEraseBkgndFlag; }
|
---|
535 |
|
---|
536 | void SetPMUpdateRegionChanged(BOOL changed) { fPMUpdateRegionChanged = changed; };
|
---|
537 | BOOL hasPMUpdateRegionChanged() { return fPMUpdateRegionChanged; };
|
---|
538 | };
|
---|
539 |
|
---|
540 | #endif //__cplusplus
|
---|
541 |
|
---|
542 | #endif //__WIN32WNDBASE_H__
|
---|