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