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