| 1 | /* $Id: win32wbase.h,v 1.143 2002-06-02 19:34:36 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 HAS_DLGFRAME(style,exStyle) \
|
|---|
| 86 | (((exStyle) & WS_EX_DLGMODALFRAME) || \
|
|---|
| 87 | (((style) & WS_DLGFRAME) && !((style) & WS_THICKFRAME)))
|
|---|
| 88 |
|
|---|
| 89 | #define HAS_THICKFRAME(style,exStyle) \
|
|---|
| 90 | (((style) & WS_THICKFRAME) && \
|
|---|
| 91 | !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME))
|
|---|
| 92 | #if 0
|
|---|
| 93 | (((style) & WS_THICKFRAME) && \
|
|---|
| 94 | !((exStyle) & WS_EX_DLGMODALFRAME) && \
|
|---|
| 95 | !((style) & WS_CHILD))
|
|---|
| 96 | #endif
|
|---|
| 97 |
|
|---|
| 98 | #define HAS_THINFRAME(style) \
|
|---|
| 99 | (((style) & WS_BORDER) || !((style) & (WS_CHILD | WS_POPUP)))
|
|---|
| 100 |
|
|---|
| 101 | #define HAS_BIGFRAME(style,exStyle) \
|
|---|
| 102 | (((style) & (WS_THICKFRAME | WS_DLGFRAME)) || \
|
|---|
| 103 | ((exStyle) & WS_EX_DLGMODALFRAME))
|
|---|
| 104 |
|
|---|
| 105 | #define HAS_ANYFRAME(style,exStyle) \
|
|---|
| 106 | (((style) & (WS_THICKFRAME | WS_DLGFRAME | WS_BORDER)) || \
|
|---|
| 107 | ((exStyle) & WS_EX_DLGMODALFRAME) || \
|
|---|
| 108 | !((style) & (WS_CHILD | WS_POPUP)))
|
|---|
| 109 |
|
|---|
| 110 | #define HAS_3DFRAME(exStyle) \
|
|---|
| 111 | ((exStyle & WS_EX_CLIENTEDGE) || (exStyle & WS_EX_STATICEDGE) || (exStyle & WS_EX_WINDOWEDGE))
|
|---|
| 112 |
|
|---|
| 113 | #define HAS_BORDER(style, exStyle) \
|
|---|
| 114 | ((style & WS_BORDER) || HAS_THICKFRAME(style) || HAS_DLGFRAME(style,exStyle))
|
|---|
| 115 |
|
|---|
| 116 | #define IS_OVERLAPPED(style) \
|
|---|
| 117 | !(style & (WS_CHILD | WS_POPUP))
|
|---|
| 118 |
|
|---|
| 119 | #define HAS_MENU() (!(getStyle() & WS_CHILD) && (getWindowId() != 0))
|
|---|
| 120 |
|
|---|
| 121 | #define STATE_INIT 0 //initial state
|
|---|
| 122 | #define STATE_PRE_WMNCCREATE 1 //before WM_NCCREATE
|
|---|
| 123 | #define STATE_POST_WMNCCREATE 2 //after WM_NCCREATE
|
|---|
| 124 | #define STATE_PRE_WMCREATE 3 //before WM_CREATE
|
|---|
| 125 | #define STATE_POST_WMCREATE 4 //after WM_CREATE
|
|---|
| 126 | #define STATE_CREATED 5 //after successful return of WinCreateWindow
|
|---|
| 127 | #define STATE_DESTROYED 6 //DestroyWindow called for window
|
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 | class Win32BaseWindow : public GenericObject, public ChildWindow
|
|---|
| 131 | {
|
|---|
| 132 | public:
|
|---|
| 133 | Win32BaseWindow();
|
|---|
| 134 | Win32BaseWindow(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode);
|
|---|
| 135 | Win32BaseWindow(HWND hwndOS2, ATOM classAtom);
|
|---|
| 136 |
|
|---|
| 137 | virtual ~Win32BaseWindow();
|
|---|
| 138 |
|
|---|
| 139 | virtual ULONG MsgCreate(HWND hwndOS2);
|
|---|
| 140 | ULONG MsgQuit();
|
|---|
| 141 | ULONG MsgClose();
|
|---|
| 142 | ULONG MsgDestroy();
|
|---|
| 143 | virtual ULONG MsgEnable(BOOL fEnable);
|
|---|
| 144 | ULONG MsgShow(BOOL fShow);
|
|---|
| 145 | ULONG MsgPosChanging(LPARAM lp);
|
|---|
| 146 | ULONG MsgPosChanged(LPARAM lp);
|
|---|
| 147 | ULONG MsgActivate(BOOL fActivate, BOOL fMinimized, HWND hwnd, HWND hwndOS2Win);
|
|---|
| 148 | ULONG MsgChildActivate(BOOL fActivate);
|
|---|
| 149 | ULONG MsgSetFocus(HWND hwnd);
|
|---|
| 150 | ULONG MsgKillFocus(HWND hwnd);
|
|---|
| 151 | ULONG MsgScroll(ULONG msg, ULONG scrollCode, ULONG scrollPos);
|
|---|
| 152 | ULONG MsgButton(MSG *msg);
|
|---|
| 153 | ULONG MsgMouseMove(MSG *msg);
|
|---|
| 154 | ULONG MsgChar(MSG *msg);
|
|---|
| 155 | ULONG MsgPaint(ULONG tmp1, BOOL select = TRUE);
|
|---|
| 156 | ULONG MsgEraseBackGround(HDC hdc);
|
|---|
| 157 | ULONG MsgNCPaint(PRECT pUpdateRect);
|
|---|
| 158 | ULONG MsgFormatFrame(WINDOWPOS *lpWndPos);
|
|---|
| 159 | ULONG DispatchMsgA(MSG *msg);
|
|---|
| 160 | ULONG DispatchMsgW(MSG *msg);
|
|---|
| 161 |
|
|---|
| 162 | ULONG MsgSetText(LPSTR lpsz, LONG cch);
|
|---|
| 163 | ULONG MsgGetTextLength();
|
|---|
| 164 | void MsgGetText(char *wndtext, ULONG textlength);
|
|---|
| 165 |
|
|---|
| 166 | virtual LONG SetWindowLong(int index, ULONG value, BOOL fUnicode);
|
|---|
| 167 | virtual ULONG GetWindowLong(int index, BOOL fUnicode);
|
|---|
| 168 | virtual WORD SetWindowWord(int index, WORD value);
|
|---|
| 169 | virtual WORD GetWindowWord(int index);
|
|---|
| 170 |
|
|---|
| 171 | DWORD getStyle() { return dwStyle; };
|
|---|
| 172 | DWORD getOldStyle() { return dwOldStyle; };
|
|---|
| 173 | void setStyle(DWORD newstyle) { dwStyle = newstyle; };
|
|---|
| 174 | void setOldStyle(DWORD oldStyle) { dwOldStyle = oldStyle; };
|
|---|
| 175 | DWORD getExStyle() { return dwExStyle; };
|
|---|
| 176 | void setExStyle(DWORD newexstyle) { dwExStyle = newexstyle; };
|
|---|
| 177 | ULONG getInstance() { return hInstance; };
|
|---|
| 178 | void setInstance(ULONG newinstance) { hInstance = newinstance; };
|
|---|
| 179 | HWND getWindowHandle() { return Win32Hwnd; };
|
|---|
| 180 | HWND getOS2WindowHandle() { return OS2Hwnd; };
|
|---|
| 181 | HWND getOS2FrameWindowHandle() { return OS2HwndFrame; };
|
|---|
| 182 | HWND getLastActive() { return hwndLastActive; };
|
|---|
| 183 | void setLastActive(HWND _hwndLastActive)
|
|---|
| 184 | { hwndLastActive = _hwndLastActive; };
|
|---|
| 185 | BOOL isDragDropActive() { return fIsDragDropActive; };
|
|---|
| 186 | void setDragDropActive(BOOL fActive) { fIsDragDropActive = fActive; };
|
|---|
| 187 |
|
|---|
| 188 | Win32WndClass *getWindowClass() { return windowClass; };
|
|---|
| 189 |
|
|---|
| 190 | LONG getLastHitTestVal() { return lastHitTestVal; }
|
|---|
| 191 | void setLastHitTestVal(LONG hittest) { lastHitTestVal = hittest; }
|
|---|
| 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 |
|
|---|
| 324 | DWORD getThreadId() { return dwThreadId; };
|
|---|
| 325 | DWORD getProcessId() { return dwProcessId; };
|
|---|
| 326 |
|
|---|
| 327 | SCROLLBAR_INFO *getScrollInfo(int nBar);
|
|---|
| 328 |
|
|---|
| 329 | LRESULT DefWindowProcA(UINT Msg, WPARAM wParam, LPARAM lParam);
|
|---|
| 330 | LRESULT DefWindowProcW(UINT msg, WPARAM wParam, LPARAM lParam);
|
|---|
| 331 |
|
|---|
| 332 | LRESULT DefWndControlColor(UINT ctlType, HDC hdc);
|
|---|
| 333 | LRESULT DefWndPrint(HDC hdc,ULONG uFlags);
|
|---|
| 334 |
|
|---|
| 335 | void NotifyParent(UINT Msg, WPARAM wParam, LPARAM lParam);
|
|---|
| 336 |
|
|---|
| 337 | HWND FindWindowById(int id);
|
|---|
| 338 |
|
|---|
| 339 | static HWND FindWindowEx(HWND hwndParent, HWND hwndChildAfter, ATOM atom, LPSTR lpszWindow);
|
|---|
| 340 |
|
|---|
| 341 | BOOL EnumChildWindows(WNDENUMPROC lpfn, LPARAM lParam);
|
|---|
| 342 | BOOL EnumThreadWindows(DWORD dwThreadId, WNDENUMPROC lpfn, LPARAM lParam);
|
|---|
| 343 | BOOL EnumWindows(WNDENUMPROC lpfn, LPARAM lParam);
|
|---|
| 344 |
|
|---|
| 345 |
|
|---|
| 346 | BOOL isComingToTop() { return fComingToTop; };
|
|---|
| 347 | void setComingToTop(BOOL fTop) { fComingToTop = fTop; };
|
|---|
| 348 | BOOL isInTasklist() { return fTaskList; };
|
|---|
| 349 |
|
|---|
| 350 | //window property methods
|
|---|
| 351 | HANDLE getProp(LPCSTR str);
|
|---|
| 352 | BOOL setProp(LPCSTR str, HANDLE handle);
|
|---|
| 353 | HANDLE removeProp(LPCSTR str);
|
|---|
| 354 | INT enumPropsExA(PROPENUMPROCEXA func, LPARAM lParam);
|
|---|
| 355 | INT enumPropsExW(PROPENUMPROCEXW func, LPARAM lParam);
|
|---|
| 356 |
|
|---|
| 357 | #ifdef DEBUG
|
|---|
| 358 | LONG addRef();
|
|---|
| 359 | LONG release(char *function = __FUNCTION__, int line = __LINE__ );
|
|---|
| 360 | #endif
|
|---|
| 361 |
|
|---|
| 362 | //Locates window in linked list and increases reference count (if found)
|
|---|
| 363 | //Window object must be unreferenced after usage
|
|---|
| 364 | static Win32BaseWindow *GetWindowFromHandle(HWND hwnd);
|
|---|
| 365 | static Win32BaseWindow *GetWindowFromOS2Handle(HWND hwnd);
|
|---|
| 366 | static Win32BaseWindow *GetWindowFromOS2FrameHandle(HWND hwnd);
|
|---|
| 367 |
|
|---|
| 368 | static void DestroyAll();
|
|---|
| 369 |
|
|---|
| 370 | protected:
|
|---|
| 371 | #ifndef OS2_INCLUDED
|
|---|
| 372 | BOOL CreateWindowExA(CREATESTRUCTA *lpCreateStruct, ATOM classAtom);
|
|---|
| 373 | #endif
|
|---|
| 374 | void Init();
|
|---|
| 375 |
|
|---|
| 376 | void NotifyFrameChanged(WINDOWPOS *wpos, RECT *oldClientRect);
|
|---|
| 377 |
|
|---|
| 378 | //called in destructor to remove all (if any) window properties
|
|---|
| 379 | void removeWindowProps();
|
|---|
| 380 | PROPERTY *findWindowProperty(LPCSTR str);
|
|---|
| 381 |
|
|---|
| 382 | HWND OS2Hwnd, OS2HwndFrame;
|
|---|
| 383 | HMENU hSysMenu;
|
|---|
| 384 | HWND Win32Hwnd;
|
|---|
| 385 |
|
|---|
| 386 | int posx, posy, width, height;
|
|---|
| 387 |
|
|---|
| 388 | // values normally contained in the standard window words
|
|---|
| 389 | ULONG dwExStyle; //GWL_EXSTYLE
|
|---|
| 390 | ULONG dwStyle; //GWL_STYLE
|
|---|
| 391 | ULONG dwOldStyle; //Used to determine which frame control buttons to change (OS/2 mode)
|
|---|
| 392 | WNDPROC win32wndproc; //GWL_WNDPROC
|
|---|
| 393 | ULONG hInstance; //GWL_HINSTANCE
|
|---|
| 394 | //Moved in ChildWindow class
|
|---|
| 395 | ///// Win32BaseWindow *parent; //GWL_HWNDPARENT
|
|---|
| 396 | ULONG dwIDMenu; //GWL_ID
|
|---|
| 397 | ULONG userData; //GWL_USERDATA
|
|---|
| 398 | HWND hwndLastActive; // last active popup handle
|
|---|
| 399 |
|
|---|
| 400 | ULONG cbExtra;
|
|---|
| 401 | PVOID pExtra;
|
|---|
| 402 |
|
|---|
| 403 | HWND hwndLinkAfter;
|
|---|
| 404 | DWORD flags;
|
|---|
| 405 | DWORD contextHelpId;
|
|---|
| 406 | DWORD hotkey;
|
|---|
| 407 | LONG lastHitTestVal; //Last value returned by WM_NCHITTEST handler
|
|---|
| 408 |
|
|---|
| 409 | HWND OS2HwndModalDialog;
|
|---|
| 410 |
|
|---|
| 411 | ULONG fFirstShow:1,
|
|---|
| 412 | fIsDialog:1,
|
|---|
| 413 | fIsModalDialog:1,
|
|---|
| 414 | fIsModalDialogOwner:1,
|
|---|
| 415 | fParentChange:1,
|
|---|
| 416 | fDestroyWindowCalled:1, //DestroyWindow was called for this window
|
|---|
| 417 | fTaskList:1, //should be listed in PM tasklist or not
|
|---|
| 418 | fXDefault:1,
|
|---|
| 419 | fCXDefault:1,
|
|---|
| 420 | fParentDC:1,
|
|---|
| 421 | fComingToTop:1,
|
|---|
| 422 | isUnicode:1,
|
|---|
| 423 | fMinMaxChange:1, //set when switching between min/max/restored state
|
|---|
| 424 | fVisibleRegionChanged:1, //set when visible region has changed -> erase background must be sent during next BeginPaint
|
|---|
| 425 | fEraseBkgndFlag:1,
|
|---|
| 426 | fIsDragDropActive:1,
|
|---|
| 427 | fFakeWindow:1;
|
|---|
| 428 |
|
|---|
| 429 | ULONG state;
|
|---|
| 430 | HRGN hWindowRegion;
|
|---|
| 431 | HRGN hClipRegion;
|
|---|
| 432 |
|
|---|
| 433 | DWORD dwThreadId; //id of thread that created this window
|
|---|
| 434 | DWORD dwProcessId; //id of process that created this window
|
|---|
| 435 |
|
|---|
| 436 | Win32BaseWindow *owner;
|
|---|
| 437 | HICON hIcon,hIconSm;
|
|---|
| 438 |
|
|---|
| 439 | char *windowNameA;
|
|---|
| 440 | WCHAR *windowNameW;
|
|---|
| 441 | int windowNameLength;
|
|---|
| 442 |
|
|---|
| 443 | char *userWindowBytes;
|
|---|
| 444 | ULONG nrUserWindowBytes;
|
|---|
| 445 |
|
|---|
| 446 | RECT rectWindow; //relative to parent
|
|---|
| 447 | RECT rectClient; //relative to frame
|
|---|
| 448 | WINDOWPLACEMENT windowpos;
|
|---|
| 449 |
|
|---|
| 450 | PROPERTY *propertyList;
|
|---|
| 451 |
|
|---|
| 452 | VISRGN_NOTIFY_PROC lpVisRgnNotifyProc;
|
|---|
| 453 | DWORD dwVisRgnNotifyParam;
|
|---|
| 454 |
|
|---|
| 455 | HANDLE hTaskList; //PM specific (switchentry handle)
|
|---|
| 456 |
|
|---|
| 457 | CREATESTRUCTA *tmpcs; //temporary pointer to CREATESTRUCT used in CreateWindowEx
|
|---|
| 458 | ULONG sw; //set in CreateWindowExA, used in MsgCreate method
|
|---|
| 459 |
|
|---|
| 460 | SCROLLBAR_INFO *vertScrollInfo;
|
|---|
| 461 | SCROLLBAR_INFO *horzScrollInfo;
|
|---|
| 462 |
|
|---|
| 463 | Win32WndClass *windowClass;
|
|---|
| 464 |
|
|---|
| 465 | static GenericObject *windows;
|
|---|
| 466 | static CRITICAL_SECTION critsect;
|
|---|
| 467 |
|
|---|
| 468 | private:
|
|---|
| 469 | #ifndef OS2_INCLUDED
|
|---|
| 470 | void GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack );
|
|---|
| 471 | UINT MinMaximize(UINT cmd, LPRECT lpRect);
|
|---|
| 472 | LONG HandleWindowPosChanging(WINDOWPOS *winpos);
|
|---|
| 473 | LONG HandleNCActivate(WPARAM wParam);
|
|---|
| 474 | VOID TrackMinMaxHelpBox(WORD wParam);
|
|---|
| 475 | VOID TrackCloseButton(WORD wParam);
|
|---|
| 476 | VOID TrackScrollBar(WPARAM wParam,POINT pt);
|
|---|
| 477 | LONG HandleNCLButtonDown(WPARAM wParam,LPARAM lParam);
|
|---|
| 478 | LONG HandleNCLButtonDblClk(WPARAM wParam,LPARAM lParam);
|
|---|
| 479 | LONG HandleNCRButtonUp(WPARAM wParam,LPARAM lParam);
|
|---|
| 480 | VOID AdjustRectOuter(LPRECT rect,BOOL menu);
|
|---|
| 481 | VOID AdjustRectInner(LPRECT rect);
|
|---|
| 482 | LONG HandleNCCalcSize(BOOL calcValidRects,RECT *winRect);
|
|---|
| 483 | VOID DrawFrame(HDC hdc,RECT *rect,BOOL dlgFrame,BOOL active);
|
|---|
| 484 | public:
|
|---|
| 485 | VOID GetInsideRect(RECT *rect);
|
|---|
| 486 | LONG HandleNCHitTest(POINT pt);
|
|---|
| 487 | BOOL GetSysPopupPos(RECT* rect);
|
|---|
| 488 | private:
|
|---|
| 489 | BOOL DrawSysButton(HDC hdc,RECT *rect);
|
|---|
| 490 | BOOL DrawGrayButton(HDC hdc,int x,int y);
|
|---|
| 491 | VOID DrawCloseButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed);
|
|---|
| 492 | VOID DrawMaxButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed);
|
|---|
| 493 | VOID DrawMinButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed);
|
|---|
| 494 | VOID DrawContextHelpButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed);
|
|---|
| 495 | VOID DrawCaption(HDC hdc,RECT *rect,BOOL active);
|
|---|
| 496 | VOID DoNCPaint(HRGN clip,BOOL suppress_menupaint);
|
|---|
| 497 | LONG HandleNCPaint(HRGN clip);
|
|---|
| 498 | LONG HandleSysCommand(WPARAM wParam, POINT *pt32);
|
|---|
| 499 |
|
|---|
| 500 | LONG SendNCCalcSize(BOOL calcValidRect,
|
|---|
| 501 | RECT *newWindowRect, RECT *oldWindowRect,
|
|---|
| 502 | RECT *oldClientRect, WINDOWPOS *winpos,
|
|---|
| 503 | RECT *newClientRect );
|
|---|
| 504 |
|
|---|
| 505 | #else
|
|---|
| 506 | friend BOOL OS2ToWinMsgTranslate(void *pThdb, QMSG *os2Msg, MSG *winMsg, BOOL isUnicode, BOOL fTranslateExtraMsgs);
|
|---|
| 507 | #endif
|
|---|
| 508 |
|
|---|
| 509 | public:
|
|---|
| 510 | void SetFakeOpen32() { WinSetDAXData (OS2Hwnd, &fakeWinBase); }
|
|---|
| 511 | void RemoveFakeOpen32() { WinSetDAXData (OS2Hwnd, NULL); }
|
|---|
| 512 |
|
|---|
| 513 | fakeOpen32WinBaseClass fakeWinBase;
|
|---|
| 514 |
|
|---|
| 515 | VOID AdjustMaximizedRect(LPRECT rect);
|
|---|
| 516 | VOID AdjustTrackInfo(PPOINT minTrackSize,PPOINT maxTrackSize);
|
|---|
| 517 |
|
|---|
| 518 | //Temporary hack for CS_CLASSDC style (do the same as for CS_OWNDC)
|
|---|
| 519 | #ifndef OS2_INCLUDED
|
|---|
| 520 | BOOL isOwnDC() { return (windowClass && windowClass->getStyle() & (CS_OWNDC|CS_CLASSDC)); }
|
|---|
| 521 | #else
|
|---|
| 522 | BOOL isOwnDC() { return (windowClass && windowClass->getStyle() & (CS_OWNDC_W|CS_CLASSDC_W)); }
|
|---|
| 523 | #endif
|
|---|
| 524 |
|
|---|
| 525 | HDC getOwnDC() { return ownDC; }
|
|---|
| 526 | void setOwnDC(HDC hdc) { ownDC = hdc; }
|
|---|
| 527 | protected:
|
|---|
| 528 | HDC ownDC;
|
|---|
| 529 |
|
|---|
| 530 | public:
|
|---|
| 531 | VOID setEraseBkgnd (BOOL erase) { fEraseBkgndFlag = erase; }
|
|---|
| 532 | BOOL needsEraseBkgnd() { return fEraseBkgndFlag; }
|
|---|
| 533 | };
|
|---|
| 534 |
|
|---|
| 535 | #endif //__cplusplus
|
|---|
| 536 |
|
|---|
| 537 | #endif //__WIN32WNDBASE_H__
|
|---|