| 1 | /* $Id: win32wbase.h,v 1.158 2004-04-20 10:11:44 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 <winuser32.h> | 
|---|
| 19 | #include <winres.h> | 
|---|
| 20 | #include <scroll.h> | 
|---|
| 21 |  | 
|---|
| 22 | #include "win32class.h" | 
|---|
| 23 | #include "gen_object.h" | 
|---|
| 24 | #include "win32wndchild.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 MAX_OPENDCS               8 | 
|---|
| 40 |  | 
|---|
| 41 | #define TYPE_ASCII        0 | 
|---|
| 42 | #define TYPE_UNICODE          1 | 
|---|
| 43 |  | 
|---|
| 44 | #define GW_HWNDNEXTCHILD          (0x10000 | GW_HWNDNEXT) | 
|---|
| 45 | #define GW_HWNDPREVCHILD          (0x10000 | GW_HWNDPREV) | 
|---|
| 46 | #define GW_HWNDFIRSTCHILD         (0x10000 | GW_CHILD) | 
|---|
| 47 | #define GW_HWNDLASTCHILD          (0x10000 | GW_HWNDLAST) | 
|---|
| 48 |  | 
|---|
| 49 | #ifdef DEBUG | 
|---|
| 50 | #define RELEASE_WNDOBJ(a)       { a->release(__FUNCTION__, __LINE__); a = NULL; } | 
|---|
| 51 | #else | 
|---|
| 52 | #define RELEASE_WNDOBJ(a)       { a->release(); a = NULL; } | 
|---|
| 53 | #endif | 
|---|
| 54 |  | 
|---|
| 55 | typedef struct { | 
|---|
| 56 | USHORT           cb; | 
|---|
| 57 | Win32BaseWindow *win32wnd; | 
|---|
| 58 | ULONG            win32CreateStruct;      //or dialog create dword | 
|---|
| 59 | } CUSTOMWNDDATA; | 
|---|
| 60 |  | 
|---|
| 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 |  | 
|---|
| 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) && \ | 
|---|
| 74 | !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME)) | 
|---|
| 75 | #if 0 | 
|---|
| 76 | (((style) & WS_THICKFRAME) && \ | 
|---|
| 77 | !((exStyle) & WS_EX_DLGMODALFRAME) && \ | 
|---|
| 78 | !((style) & WS_CHILD)) | 
|---|
| 79 | #endif | 
|---|
| 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 |  | 
|---|
| 102 | #define HAS_MENU() (!(getStyle() & WS_CHILD) && (getWindowId() != 0)) | 
|---|
| 103 |  | 
|---|
| 104 | #define STATE_INIT           0   //initial state | 
|---|
| 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 |  | 
|---|
| 113 | class Win32BaseWindow : public GenericObject, public ChildWindow | 
|---|
| 114 | { | 
|---|
| 115 | public: | 
|---|
| 116 | Win32BaseWindow(); | 
|---|
| 117 | Win32BaseWindow(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode); | 
|---|
| 118 |  | 
|---|
| 119 | virtual        ~Win32BaseWindow(); | 
|---|
| 120 |  | 
|---|
| 121 | virtual  ULONG  MsgCreate(HWND hwndOS2); | 
|---|
| 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); | 
|---|
| 129 | ULONG  MsgActivate(BOOL fActivate, BOOL fMinimized, HWND hwnd, HWND hwndOS2Win); | 
|---|
| 130 | ULONG  MsgChildActivate(BOOL fActivate); | 
|---|
| 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); | 
|---|
| 139 | ULONG  MsgNCPaint(PRECT pUpdateRect, HRGN hrgnUpdate); | 
|---|
| 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(); | 
|---|
| 146 | void   MsgGetText(char *wndtext, ULONG textlength); | 
|---|
| 147 |  | 
|---|
| 148 | virtual  LONG   SetWindowLong(int index, ULONG value, BOOL fUnicode); | 
|---|
| 149 | virtual  ULONG  GetWindowLong(int index, BOOL fUnicode); | 
|---|
| 150 | virtual  WORD   SetWindowWord(int index, WORD value); | 
|---|
| 151 | virtual  WORD   GetWindowWord(int index); | 
|---|
| 152 |  | 
|---|
| 153 | DWORD  getStyle()                      { return dwStyle; }; | 
|---|
| 154 | DWORD  getOldStyle()                   { return dwOldStyle; }; | 
|---|
| 155 | void   setStyle(DWORD newstyle)        { dwStyle = newstyle; }; | 
|---|
| 156 | void   setOldStyle(DWORD oldStyle)     { dwOldStyle = oldStyle; }; | 
|---|
| 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; }; | 
|---|
| 163 | HWND   getOS2FrameWindowHandle()       { return OS2HwndFrame; }; | 
|---|
| 164 | HWND   getLastActive()                 { return hwndLastActive; }; | 
|---|
| 165 | void   setLastActive(HWND _hwndLastActive) | 
|---|
| 166 | { hwndLastActive = _hwndLastActive; }; | 
|---|
| 167 | BOOL   isDragDropActive()              { return fIsDragDropActive; }; | 
|---|
| 168 | void   setDragDropActive(BOOL fActive) { fIsDragDropActive = fActive; }; | 
|---|
| 169 |  | 
|---|
| 170 | Win32WndClass *getWindowClass()                { return windowClass; }; | 
|---|
| 171 |  | 
|---|
| 172 | LONG   getLastHitTestVal()             { return lastHitTestVal; } | 
|---|
| 173 | void   setLastHitTestVal(LONG hittest) { lastHitTestVal = hittest; } | 
|---|
| 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(); | 
|---|
| 181 | virtual  BOOL   isDesktopWindow(); | 
|---|
| 182 | virtual  BOOL   isFakeWindow(); | 
|---|
| 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)           { dwIDMenu = 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 | virtual  PRECT  getWindowRect(); | 
|---|
| 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 | DWORD  getCBExtra()                    { return cbExtra; }; | 
|---|
| 222 | PVOID  getExtraPtr()                   { return pExtra; }; | 
|---|
| 223 |  | 
|---|
| 224 | void   SetSysMenu(HMENU hSystemMenu)       { hSysMenu = hSystemMenu; }; | 
|---|
| 225 | HMENU  GetSysMenu()                        { return hSysMenu; } | 
|---|
| 226 |  | 
|---|
| 227 | HICON  IconForWindow(WPARAM fType); | 
|---|
| 228 |  | 
|---|
| 229 | void   SetWindowRegion(HRGN hRegion)       { hWindowRegion = hRegion; }; | 
|---|
| 230 | HRGN   GetWindowRegion()                   { return hWindowRegion; }; | 
|---|
| 231 |  | 
|---|
| 232 | //Save old clip region for CS_OWNDC windows (in BeginPaint) | 
|---|
| 233 | HRGN   GetClipRegion()                   { return hClipRegion; }; | 
|---|
| 234 | HRGN   GetVisRegion()                    { return hVisRegion; }; | 
|---|
| 235 | void   SaveClipRegion(HRGN hrgnClip)     { hClipRegion = hrgnClip; }; | 
|---|
| 236 | void   SaveVisRegion(HRGN hrgnVis)       { hVisRegion = hrgnVis; }; | 
|---|
| 237 |  | 
|---|
| 238 | void   saveAndValidateUpdateRegion(); | 
|---|
| 239 | void   checkForDirtyUpdateRegion(); | 
|---|
| 240 | BOOL   hasDirtUpdateRegion()             { return fDirtyUpdateRegion; }; | 
|---|
| 241 |  | 
|---|
| 242 | BOOL   ShowWindow(ULONG nCmdShow); | 
|---|
| 243 | virtual  BOOL   SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags, BOOL fShowWindow = FALSE); | 
|---|
| 244 | BOOL   SetWindowPlacement(WINDOWPLACEMENT *winpos); | 
|---|
| 245 | BOOL   GetWindowPlacement(LPWINDOWPLACEMENT winpos); | 
|---|
| 246 | BOOL   ScrollWindow(int dx, int dy); | 
|---|
| 247 | virtual  BOOL   DestroyWindow(); | 
|---|
| 248 | HWND   SetActiveWindow(); | 
|---|
| 249 | BOOL   DeactivateChildWindow(); | 
|---|
| 250 | HWND   GetParent(); | 
|---|
| 251 | HWND   SetParent(HWND hwndNewParent); | 
|---|
| 252 |  | 
|---|
| 253 | BOOL   IsChild(HWND hwndParent); | 
|---|
| 254 |  | 
|---|
| 255 | HWND   GetTopWindow(); | 
|---|
| 256 | HWND   GetTopParent(); | 
|---|
| 257 |  | 
|---|
| 258 | PVOID  getOldPMWindowProc()                   { return pfnOldPMWndProc; }; | 
|---|
| 259 | void   setOldPMWindowProc(PVOID pfnPMWndProc) { pfnOldPMWndProc = pfnPMWndProc; }; | 
|---|
| 260 |  | 
|---|
| 261 | virtual HWND   GetWindow(UINT uCmd); | 
|---|
| 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; }; | 
|---|
| 273 | BOOL   CanReceiveSizeMsgs()          { return state >= STATE_PRE_WMCREATE; }; | 
|---|
| 274 | BOOL   IsParentChanging()            { return fParentChange; }; | 
|---|
| 275 | BOOL   IsWindowCreated()             { return state >= STATE_PRE_WMNCCREATE; } | 
|---|
| 276 | BOOL   IsWindowDestroyed()           { return state >= STATE_DESTROYED; }; | 
|---|
| 277 | BOOL   IsWindowIconic(); | 
|---|
| 278 |  | 
|---|
| 279 | //hack alert (see DestroyWindow) | 
|---|
| 280 | BOOL   IsChildDestructionInProgress() { return fChildDestructionInProgress; }; | 
|---|
| 281 | void   SetChildDestructionInProgress(BOOL fDestuctionInProgress) | 
|---|
| 282 | { | 
|---|
| 283 | fChildDestructionInProgress = fDestuctionInProgress; | 
|---|
| 284 | }; | 
|---|
| 285 | //hack end | 
|---|
| 286 |  | 
|---|
| 287 | //Window procedure type | 
|---|
| 288 | BOOL   IsWindowUnicode(); | 
|---|
| 289 | BOOL   IsMixMaxStateChanging()       { return fMinMaxChange; }; | 
|---|
| 290 |  | 
|---|
| 291 | BOOL   setVisibleRgnNotifyProc(VISRGN_NOTIFY_PROC lpNotifyProc, DWORD dwUserData); | 
|---|
| 292 | void   callVisibleRgnNotifyProc(BOOL fDrawingAllowed); | 
|---|
| 293 | BOOL   isLocked()                            { return fWindowLocked; }; | 
|---|
| 294 |  | 
|---|
| 295 | BOOL   queryOpenDCs(HDC *phdcWindow, int chdcWindow, int *pnrdcs); | 
|---|
| 296 | void   addOpenDC(HDC hdc); | 
|---|
| 297 | void   removeOpenDC(HDC hdc); | 
|---|
| 298 |  | 
|---|
| 299 | int    GetWindowTextLength(BOOL fUnicode); | 
|---|
| 300 | int    GetWindowTextLengthA() { return GetWindowTextLength(FALSE); }; | 
|---|
| 301 | int    GetWindowTextLengthW() { return GetWindowTextLength(TRUE);  }; | 
|---|
| 302 |  | 
|---|
| 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! | 
|---|
| 313 | int    getWindowNameLengthA()        { return windowNameLengthA; }; | 
|---|
| 314 | int    getWindowNameLengthW()        { return windowNameLengthW; }; | 
|---|
| 315 | Win32WndClass  *getClass()  { return windowClass; }; | 
|---|
| 316 | Win32BaseWindow *getOwner() { return owner; }; | 
|---|
| 317 | void    setOwner(Win32BaseWindow *newOwner) { owner = newOwner; }; | 
|---|
| 318 |  | 
|---|
| 319 |  | 
|---|
| 320 | DWORD  getThreadId()        { return dwThreadId; }; | 
|---|
| 321 | DWORD  getProcessId()       { return dwProcessId; }; | 
|---|
| 322 |  | 
|---|
| 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 |  | 
|---|
| 333 | HWND FindWindowById(int id); | 
|---|
| 334 |  | 
|---|
| 335 | static HWND FindWindowEx(HWND hwndParent, HWND hwndChildAfter, ATOM atom, LPSTR lpszWindow); | 
|---|
| 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 |  | 
|---|
| 342 | BOOL   isComingToTop()         { return fComingToTop; }; | 
|---|
| 343 | void   setComingToTop(BOOL fTop)   { fComingToTop = fTop; }; | 
|---|
| 344 | BOOL   isInTasklist()                  { return fTaskList; }; | 
|---|
| 345 |  | 
|---|
| 346 | //window property methods | 
|---|
| 347 | HANDLE getProp(LPCSTR str); | 
|---|
| 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); | 
|---|
| 352 |  | 
|---|
| 353 | #ifdef DEBUG | 
|---|
| 354 | LONG addRef(); | 
|---|
| 355 | LONG release(const char *function = __FUNCTION__, int line = __LINE__ ); | 
|---|
| 356 | #endif | 
|---|
| 357 |  | 
|---|
| 358 | //Locates window in linked list and increases reference count (if found) | 
|---|
| 359 | //Window object must be unreferenced after usage | 
|---|
| 360 | static Win32BaseWindow *GetWindowFromHandle(HWND hwnd); | 
|---|
| 361 | static Win32BaseWindow *GetWindowFromOS2Handle(HWND hwnd); | 
|---|
| 362 | static Win32BaseWindow *GetWindowFromOS2FrameHandle(HWND hwnd); | 
|---|
| 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 |  | 
|---|
| 372 | void    NotifyFrameChanged(WINDOWPOS *wpos, RECT *oldClientRect); | 
|---|
| 373 |  | 
|---|
| 374 | //called in destructor to remove all (if any) window properties | 
|---|
| 375 | void    removeWindowProps(); | 
|---|
| 376 | PROPERTY   *findWindowProperty(LPCSTR str); | 
|---|
| 377 |  | 
|---|
| 378 | HWND    OS2Hwnd, OS2HwndFrame; | 
|---|
| 379 | HMENU   hSysMenu; | 
|---|
| 380 | HWND    Win32Hwnd, Win32HwndOrg; | 
|---|
| 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 | 
|---|
| 387 | ULONG   dwOldStyle;             //Used to determine which frame control buttons to change (OS/2 mode) | 
|---|
| 388 | WNDPROC   win32wndproc;           //GWL_WNDPROC | 
|---|
| 389 | ULONG   hInstance;              //GWL_HINSTANCE | 
|---|
| 390 | //Moved in ChildWindow class | 
|---|
| 391 | /////   Win32BaseWindow *parent;                    //GWL_HWNDPARENT | 
|---|
| 392 | ULONG   dwIDMenu;               //GWL_ID | 
|---|
| 393 | ULONG   userData;               //GWL_USERDATA | 
|---|
| 394 | HWND    hwndLastActive;         // last active popup handle | 
|---|
| 395 |  | 
|---|
| 396 | ULONG   cbExtra; | 
|---|
| 397 | PVOID   pExtra; | 
|---|
| 398 |  | 
|---|
| 399 | HWND   hwndLinkAfter; | 
|---|
| 400 | DWORD   flags; | 
|---|
| 401 | DWORD   contextHelpId; | 
|---|
| 402 | DWORD   hotkey; | 
|---|
| 403 | LONG    lastHitTestVal;         //Last value returned by WM_NCHITTEST handler | 
|---|
| 404 |  | 
|---|
| 405 | HWND    OS2HwndModalDialog; | 
|---|
| 406 |  | 
|---|
| 407 | ULONG    fFirstShow:1, | 
|---|
| 408 | fIsDialog:1, | 
|---|
| 409 | fIsModalDialog:1, | 
|---|
| 410 | fIsModalDialogOwner:1, | 
|---|
| 411 | fParentChange:1, | 
|---|
| 412 | fDestroyWindowCalled:1, //DestroyWindow was called for this window | 
|---|
| 413 | fChildDestructionInProgress:1, | 
|---|
| 414 | fTaskList:1,            //should be listed in PM tasklist or not | 
|---|
| 415 | fXDefault:1, | 
|---|
| 416 | fCXDefault:1, | 
|---|
| 417 | fParentDC:1, | 
|---|
| 418 | fComingToTop:1, | 
|---|
| 419 | isUnicode:1, | 
|---|
| 420 | fMinMaxChange:1,        //set when switching between min/max/restored state | 
|---|
| 421 | fPMUpdateRegionChanged:1, //set when PM update has changed -> erase background must be sent during next BeginPaint | 
|---|
| 422 | fEraseBkgndFlag:1, | 
|---|
| 423 | fIsDragDropActive:1, | 
|---|
| 424 | fDirtyUpdateRegion:1, | 
|---|
| 425 | fWindowLocked:1; | 
|---|
| 426 |  | 
|---|
| 427 | ULONG   state; | 
|---|
| 428 | HRGN    hWindowRegion; | 
|---|
| 429 | HRGN    hClipRegion, hVisRegion; | 
|---|
| 430 | HRGN    hUpdateRegion; | 
|---|
| 431 |  | 
|---|
| 432 | DWORD   dwThreadId;             //id of thread that created this window | 
|---|
| 433 | DWORD   dwProcessId;            //id of process that created this window | 
|---|
| 434 |  | 
|---|
| 435 | //array of open window DCs | 
|---|
| 436 | HDC     hdcWindow[MAX_OPENDCS]; | 
|---|
| 437 | int     nrOpenDCs; | 
|---|
| 438 |  | 
|---|
| 439 | Win32BaseWindow *owner; | 
|---|
| 440 | HICON   hIcon,hIconSm; | 
|---|
| 441 |  | 
|---|
| 442 | char   *windowNameA; | 
|---|
| 443 | WCHAR  *windowNameW; | 
|---|
| 444 | int     windowNameLengthA; | 
|---|
| 445 | int     windowNameLengthW; | 
|---|
| 446 |  | 
|---|
| 447 | char   *userWindowBytes; | 
|---|
| 448 | ULONG   nrUserWindowBytes; | 
|---|
| 449 |  | 
|---|
| 450 | RECT    rectWindow;  //relative to parent | 
|---|
| 451 | RECT    rectClient;  //relative to frame | 
|---|
| 452 | WINDOWPLACEMENT windowpos; | 
|---|
| 453 |  | 
|---|
| 454 | PVOID   pfnOldPMWndProc; | 
|---|
| 455 |  | 
|---|
| 456 | PROPERTY   *propertyList; | 
|---|
| 457 |  | 
|---|
| 458 | VISRGN_NOTIFY_PROC lpVisRgnNotifyProc; | 
|---|
| 459 | DWORD   dwVisRgnNotifyParam; | 
|---|
| 460 |  | 
|---|
| 461 | HANDLE  hTaskList; //PM specific (switchentry handle) | 
|---|
| 462 |  | 
|---|
| 463 | CREATESTRUCTA  *tmpcs; //temporary pointer to CREATESTRUCT used in CreateWindowEx | 
|---|
| 464 | int     sw;    //set in CreateWindowExA, used in MsgCreate method | 
|---|
| 465 |  | 
|---|
| 466 | SCROLLBAR_INFO *vertScrollInfo; | 
|---|
| 467 | SCROLLBAR_INFO *horzScrollInfo; | 
|---|
| 468 |  | 
|---|
| 469 | Win32WndClass  *windowClass; | 
|---|
| 470 |  | 
|---|
| 471 | static GenericObject *windows; | 
|---|
| 472 | static VMutex         critsect; | 
|---|
| 473 |  | 
|---|
| 474 | private: | 
|---|
| 475 | #ifndef OS2_INCLUDED | 
|---|
| 476 | void  GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack ); | 
|---|
| 477 | UINT  MinMaximize(UINT cmd, LPRECT lpRect); | 
|---|
| 478 | LONG  HandleWindowPosChanging(WINDOWPOS *winpos); | 
|---|
| 479 | LONG  HandleNCActivate(WPARAM wParam); | 
|---|
| 480 | VOID  TrackMinMaxHelpBox(WORD wParam); | 
|---|
| 481 | VOID  TrackCloseButton(WORD wParam); | 
|---|
| 482 | VOID  TrackScrollBar(WPARAM wParam,POINT pt); | 
|---|
| 483 | LONG  HandleNCLButtonDown(WPARAM wParam,LPARAM lParam); | 
|---|
| 484 | LONG  HandleNCLButtonDblClk(WPARAM wParam,LPARAM lParam); | 
|---|
| 485 | LONG  HandleNCRButtonUp(WPARAM wParam,LPARAM lParam); | 
|---|
| 486 | VOID  AdjustRectOuter(LPRECT rect,BOOL menu); | 
|---|
| 487 | VOID  AdjustRectInner(LPRECT rect); | 
|---|
| 488 | LONG  HandleNCCalcSize(BOOL calcValidRects,RECT *winRect); | 
|---|
| 489 | VOID  DrawFrame(HDC hdc,RECT *rect,BOOL dlgFrame,BOOL active); | 
|---|
| 490 | void  FixCoordinates( CREATESTRUCTA *cs, INT *sw); | 
|---|
| 491 | public: | 
|---|
| 492 | VOID  GetInsideRect(RECT *rect); | 
|---|
| 493 | LONG  HandleNCHitTest(POINT pt); | 
|---|
| 494 | BOOL  GetSysPopupPos(RECT* rect); | 
|---|
| 495 | BOOL  DrawSysButton(HDC hdc,RECT *rect); | 
|---|
| 496 | private: | 
|---|
| 497 | BOOL  DrawGrayButton(HDC hdc,int x,int y); | 
|---|
| 498 | VOID  DrawCloseButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed); | 
|---|
| 499 | VOID  DrawMaxButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed); | 
|---|
| 500 | VOID  DrawMinButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed); | 
|---|
| 501 | VOID  DrawContextHelpButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed); | 
|---|
| 502 | VOID  DrawCaption(HDC hdc,RECT *rect,BOOL active); | 
|---|
| 503 | VOID  DoNCPaint(HRGN clip,BOOL suppress_menupaint); | 
|---|
| 504 | LONG  HandleNCPaint(HRGN clip); | 
|---|
| 505 | LONG  HandleSysCommand(WPARAM wParam, POINT *pt32); | 
|---|
| 506 |  | 
|---|
| 507 | LONG  SendNCCalcSize(BOOL calcValidRect, | 
|---|
| 508 | RECT *newWindowRect, RECT *oldWindowRect, | 
|---|
| 509 | RECT *oldClientRect, WINDOWPOS *winpos, | 
|---|
| 510 | RECT *newClientRect ); | 
|---|
| 511 |  | 
|---|
| 512 | #else | 
|---|
| 513 | friend BOOL  OS2ToWinMsgTranslate(void *pThdb, QMSG *os2Msg, MSG *winMsg, BOOL isUnicode, BOOL fTranslateExtraMsgs); | 
|---|
| 514 | #endif | 
|---|
| 515 |  | 
|---|
| 516 | public: | 
|---|
| 517 |  | 
|---|
| 518 | VOID  AdjustMaximizedRect(LPRECT rect); | 
|---|
| 519 | VOID  AdjustTrackInfo(PPOINT minTrackSize,PPOINT maxTrackSize); | 
|---|
| 520 |  | 
|---|
| 521 | //Temporary hack for CS_CLASSDC style (do the same as for CS_OWNDC) | 
|---|
| 522 | #ifndef OS2_INCLUDED | 
|---|
| 523 | BOOL   isOwnDC() { return (windowClass && (windowClass->getStyle() & (CS_OWNDC|CS_CLASSDC))); } | 
|---|
| 524 | #else | 
|---|
| 525 | BOOL   isOwnDC() { return (windowClass && (windowClass->getStyle() & (CS_OWNDC_W|CS_CLASSDC_W))); } | 
|---|
| 526 | #endif | 
|---|
| 527 |  | 
|---|
| 528 | HDC    getOwnDC() { return ownDC; } | 
|---|
| 529 | void   setOwnDC(HDC hdc) { ownDC = hdc; } | 
|---|
| 530 | protected: | 
|---|
| 531 | HDC    ownDC; | 
|---|
| 532 |  | 
|---|
| 533 | public: | 
|---|
| 534 | VOID   setEraseBkgnd (BOOL erase)      { fEraseBkgndFlag = erase; } | 
|---|
| 535 | BOOL   needsEraseBkgnd()               { return fEraseBkgndFlag; } | 
|---|
| 536 |  | 
|---|
| 537 | void   SetPMUpdateRegionChanged(BOOL changed)  { fPMUpdateRegionChanged = changed; }; | 
|---|
| 538 | BOOL   hasPMUpdateRegionChanged()              { return fPMUpdateRegionChanged; }; | 
|---|
| 539 | }; | 
|---|
| 540 |  | 
|---|
| 541 | #endif //__cplusplus | 
|---|
| 542 |  | 
|---|
| 543 | #endif //__WIN32WNDBASE_H__ | 
|---|