| 1 | /* $Id: oslibwin.cpp,v 1.59 2000-01-09 15:56:03 sandervl Exp $ */
|
|---|
| 2 | /*
|
|---|
| 3 | * Window API wrappers for OS/2
|
|---|
| 4 | *
|
|---|
| 5 | *
|
|---|
| 6 | * Copyright 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 | #define INCL_WIN
|
|---|
| 14 | #define INCL_PM
|
|---|
| 15 | #include <os2.h>
|
|---|
| 16 | #include <os2wrap.h>
|
|---|
| 17 | #include <stdlib.h>
|
|---|
| 18 | #include <string.h>
|
|---|
| 19 |
|
|---|
| 20 | #include <misc.h>
|
|---|
| 21 | #include "win32type.h"
|
|---|
| 22 | #include <winconst.h>
|
|---|
| 23 | #include "oslibwin.h"
|
|---|
| 24 | #include "oslibutil.h"
|
|---|
| 25 | #include "oslibmsg.h"
|
|---|
| 26 | #include "oslibgdi.h"
|
|---|
| 27 | #include "pmwindow.h"
|
|---|
| 28 |
|
|---|
| 29 | #define HAS_3DFRAME(exStyle) \
|
|---|
| 30 | ((exStyle & WS_EX_CLIENTEDGE_W) || (exStyle & WS_EX_STATICEDGE_W) || (exStyle & WS_EX_WINDOWEDGE_W))
|
|---|
| 31 |
|
|---|
| 32 | //******************************************************************************
|
|---|
| 33 | //******************************************************************************
|
|---|
| 34 | BOOL OSLibWinSetParent(HWND hwnd, HWND hwndParent, ULONG fRedraw)
|
|---|
| 35 | {
|
|---|
| 36 | if(hwndParent == OSLIB_HWND_DESKTOP)
|
|---|
| 37 | {
|
|---|
| 38 | hwndParent = HWND_DESKTOP;
|
|---|
| 39 | }
|
|---|
| 40 | else
|
|---|
| 41 | if(hwndParent == OSLIB_HWND_OBJECT) {
|
|---|
| 42 | hwndParent = HWND_OBJECT;
|
|---|
| 43 | }
|
|---|
| 44 | return (WinSetParent(hwnd, hwndParent, fRedraw) == 0);
|
|---|
| 45 | }
|
|---|
| 46 | //******************************************************************************
|
|---|
| 47 | //******************************************************************************
|
|---|
| 48 | BOOL OSLibWinSetOwner(HWND hwnd, HWND hwndOwner)
|
|---|
| 49 | {
|
|---|
| 50 | return WinSetOwner(hwnd, hwndOwner);
|
|---|
| 51 | }
|
|---|
| 52 | //******************************************************************************
|
|---|
| 53 | //******************************************************************************
|
|---|
| 54 | HWND OSLibWinCreateWindow(HWND hwndParent, ULONG dwWinStyle, ULONG dwFrameStyle,
|
|---|
| 55 | char *pszName, HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame,
|
|---|
| 56 | ULONG id, BOOL fTaskList)
|
|---|
| 57 | {
|
|---|
| 58 | HWND hwndClient;
|
|---|
| 59 |
|
|---|
| 60 | dprintf(("WinCreateWindow %x %x %x %s", hwndParent, dwWinStyle, dwFrameStyle, pszName));
|
|---|
| 61 |
|
|---|
| 62 | if(pszName && *pszName == 0) {
|
|---|
| 63 | pszName = NULL;
|
|---|
| 64 | }
|
|---|
| 65 | if(hwndParent == OSLIB_HWND_DESKTOP) {
|
|---|
| 66 | hwndParent = HWND_DESKTOP;
|
|---|
| 67 | }
|
|---|
| 68 | if(Owner == OSLIB_HWND_DESKTOP) {
|
|---|
| 69 | Owner = HWND_DESKTOP;
|
|---|
| 70 | }
|
|---|
| 71 | ULONG dwClientStyle;
|
|---|
| 72 |
|
|---|
| 73 | BOOL TopLevel = hwndParent == HWND_DESKTOP;
|
|---|
| 74 | // if(dwFrameStyle & FCF_TITLEBAR)
|
|---|
| 75 | // TopLevel = TRUE;
|
|---|
| 76 |
|
|---|
| 77 | FRAMECDATA FCData = {sizeof (FRAMECDATA), 0, 0, 0};
|
|---|
| 78 |
|
|---|
| 79 | dwClientStyle = dwWinStyle & ~(WS_TABSTOP | WS_GROUP | WS_CLIPSIBLINGS);
|
|---|
| 80 |
|
|---|
| 81 | dwFrameStyle |= FCF_NOBYTEALIGN;
|
|---|
| 82 | if(fTaskList)
|
|---|
| 83 | {
|
|---|
| 84 | dwFrameStyle |= FCF_TASKLIST | FCF_NOMOVEWITHOWNER;
|
|---|
| 85 | }
|
|---|
| 86 |
|
|---|
| 87 | dwWinStyle &= ~WS_CLIPCHILDREN;
|
|---|
| 88 | FCData.flCreateFlags = dwFrameStyle;
|
|---|
| 89 |
|
|---|
| 90 | *hwndFrame = WinCreateWindow (hwndParent,
|
|---|
| 91 | TopLevel ? WC_FRAME : WIN32_INNERFRAME,
|
|---|
| 92 | pszName, dwWinStyle, 0, 0, 50, 30,
|
|---|
| 93 | hwndParent, HWND_TOP,
|
|---|
| 94 | id, &FCData, NULL);
|
|---|
| 95 | if (*hwndFrame) {
|
|---|
| 96 | hwndClient = WinCreateWindow (*hwndFrame, WIN32_STDCLASS,
|
|---|
| 97 | NULL, dwClientStyle, 0, 0, 0, 0,
|
|---|
| 98 | *hwndFrame, HWND_TOP, FID_CLIENT, NULL, NULL);
|
|---|
| 99 |
|
|---|
| 100 | if (hwndClient != NULLHANDLE) {
|
|---|
| 101 | WinSendMsg (*hwndFrame, WM_UPDATEFRAME, 0, 0);
|
|---|
| 102 | }
|
|---|
| 103 | return hwndClient;
|
|---|
| 104 | }
|
|---|
| 105 | dprintf(("OSLibWinCreateWindow: (FRAME) WinCreateStdWindow failed (%x)", WinGetLastError(GetThreadHAB())));
|
|---|
| 106 | return 0;
|
|---|
| 107 | }
|
|---|
| 108 | //******************************************************************************
|
|---|
| 109 | //******************************************************************************
|
|---|
| 110 | BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG *dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle, ULONG *borderWidth, ULONG *borderHeight)
|
|---|
| 111 | {
|
|---|
| 112 | *OSWinStyle = 0;
|
|---|
| 113 | *OSFrameStyle = 0;
|
|---|
| 114 | *borderWidth = 0;
|
|---|
| 115 | *borderHeight = 0;
|
|---|
| 116 |
|
|---|
| 117 | /* Window styles */
|
|---|
| 118 | if(dwStyle & WS_MINIMIZE_W)
|
|---|
| 119 | *OSWinStyle |= WS_MINIMIZED;
|
|---|
| 120 | //Done explicitely in CreateWindowExA
|
|---|
| 121 | #if 1
|
|---|
| 122 | if(dwStyle & WS_VISIBLE_W)
|
|---|
| 123 | *OSWinStyle |= WS_VISIBLE;
|
|---|
| 124 | #endif
|
|---|
| 125 | if(dwStyle & WS_DISABLED_W)
|
|---|
| 126 | *OSWinStyle |= WS_DISABLED;
|
|---|
| 127 | if(dwStyle & WS_CLIPSIBLINGS_W)
|
|---|
| 128 | *OSWinStyle |= WS_CLIPSIBLINGS;
|
|---|
| 129 | if(dwStyle & WS_CLIPCHILDREN_W)
|
|---|
| 130 | *OSWinStyle |= WS_CLIPCHILDREN;
|
|---|
| 131 | if(dwStyle & WS_MAXIMIZE_W)
|
|---|
| 132 | *OSWinStyle |= WS_MAXIMIZED;
|
|---|
| 133 | if(dwStyle & WS_GROUP_W)
|
|---|
| 134 | *OSWinStyle |= WS_GROUP;
|
|---|
| 135 | if(dwStyle & WS_TABSTOP_W)
|
|---|
| 136 | *OSWinStyle |= WS_TABSTOP;
|
|---|
| 137 |
|
|---|
| 138 | if(dwStyle & WS_CHILD_W && !((dwStyle & WS_CAPTION_W) == WS_CAPTION_W))
|
|---|
| 139 | {
|
|---|
| 140 | //SvL: Causes crash in VPBuddy if enabled -> find bug
|
|---|
| 141 | #if 0
|
|---|
| 142 | if (!HAS_3DFRAME(*dwExStyle) && (dwStyle & (WS_DLGFRAME_W | WS_THICKFRAME_W))) *dwExStyle |= WS_EX_DLGMODALFRAME_W;
|
|---|
| 143 | #endif
|
|---|
| 144 |
|
|---|
| 145 | if (*dwExStyle & WS_EX_CLIENTEDGE_W)
|
|---|
| 146 | {
|
|---|
| 147 | *OSFrameStyle |= FCF_SIZEBORDER;
|
|---|
| 148 | *borderHeight = *borderWidth = 2;
|
|---|
| 149 | }
|
|---|
| 150 | else
|
|---|
| 151 | if (*dwExStyle & WS_EX_DLGMODALFRAME_W)
|
|---|
| 152 | {
|
|---|
| 153 | *OSFrameStyle |= FCF_SIZEBORDER;
|
|---|
| 154 | *borderHeight = *borderWidth = 3;
|
|---|
| 155 | }
|
|---|
| 156 | else
|
|---|
| 157 | if (*dwExStyle & WS_EX_STATICEDGE_W)
|
|---|
| 158 | {
|
|---|
| 159 | *OSFrameStyle |= FCF_SIZEBORDER;
|
|---|
| 160 | *borderHeight = *borderWidth = 2;
|
|---|
| 161 | }
|
|---|
| 162 | else
|
|---|
| 163 | if(dwStyle & WS_BORDER_W)
|
|---|
| 164 | {
|
|---|
| 165 | *OSFrameStyle |= FCF_BORDER;
|
|---|
| 166 | *borderHeight = *borderWidth = 1;
|
|---|
| 167 | }
|
|---|
| 168 | else if (*dwExStyle & WS_EX_WINDOWEDGE_W); //no border
|
|---|
| 169 |
|
|---|
| 170 | if(dwStyle & WS_VSCROLL_W)
|
|---|
| 171 | *OSFrameStyle |= FCF_VERTSCROLL;
|
|---|
| 172 | if(dwStyle & WS_HSCROLL_W)
|
|---|
| 173 | *OSFrameStyle |= FCF_HORZSCROLL;
|
|---|
| 174 | }
|
|---|
| 175 | else
|
|---|
| 176 | {
|
|---|
| 177 | if((dwStyle & WS_CAPTION_W) == WS_DLGFRAME_W) {
|
|---|
| 178 | *OSFrameStyle |= FCF_DLGBORDER;
|
|---|
| 179 | *borderHeight = *borderWidth = 2; //TODO: Correct?
|
|---|
| 180 | }
|
|---|
| 181 | else
|
|---|
| 182 | {
|
|---|
| 183 | if((dwStyle & WS_CAPTION_W) == WS_CAPTION_W) {
|
|---|
| 184 | *OSFrameStyle |= (FCF_TITLEBAR | FCF_BORDER);
|
|---|
| 185 | *borderHeight = *borderWidth = 1;
|
|---|
| 186 | }
|
|---|
| 187 | else
|
|---|
| 188 | if(dwStyle & WS_BORDER_W) {
|
|---|
| 189 | *OSFrameStyle |= FCF_BORDER;
|
|---|
| 190 | *borderHeight = *borderWidth = 1;
|
|---|
| 191 | }
|
|---|
| 192 | }
|
|---|
| 193 |
|
|---|
| 194 | if(dwStyle & WS_VSCROLL_W)
|
|---|
| 195 | *OSFrameStyle |= FCF_VERTSCROLL;
|
|---|
| 196 | if(dwStyle & WS_HSCROLL_W)
|
|---|
| 197 | *OSFrameStyle |= FCF_HORZSCROLL;
|
|---|
| 198 |
|
|---|
| 199 | if(dwStyle & WS_THICKFRAME_W)
|
|---|
| 200 | *OSFrameStyle |= FCF_SIZEBORDER; //??
|
|---|
| 201 |
|
|---|
| 202 | //SvL: We subclass the titlebar control when win32 look is selected
|
|---|
| 203 | if(fOS2Look) {
|
|---|
| 204 | if(dwStyle & WS_SYSMENU_W)
|
|---|
| 205 | *OSFrameStyle |= FCF_SYSMENU;
|
|---|
| 206 | if(dwStyle & WS_MINIMIZEBOX_W)
|
|---|
| 207 | *OSFrameStyle |= FCF_MINBUTTON;
|
|---|
| 208 | if(dwStyle & WS_MAXIMIZEBOX_W)
|
|---|
| 209 | *OSFrameStyle |= FCF_MAXBUTTON;
|
|---|
| 210 | }
|
|---|
| 211 |
|
|---|
| 212 | if(*dwExStyle & WS_EX_DLGMODALFRAME_W)
|
|---|
| 213 | *OSFrameStyle |= FCF_DLGBORDER;
|
|---|
| 214 | }
|
|---|
| 215 |
|
|---|
| 216 | //Clear certain frame bits when the window doesn't have a titlebar
|
|---|
| 217 | if(!(*OSFrameStyle & FCF_TITLEBAR)) {
|
|---|
| 218 | *OSFrameStyle &= ~(FCF_MINBUTTON|FCF_MAXBUTTON|FCF_SYSMENU);
|
|---|
| 219 | }
|
|---|
| 220 | return TRUE;
|
|---|
| 221 | }
|
|---|
| 222 | //******************************************************************************
|
|---|
| 223 | //******************************************************************************
|
|---|
| 224 | BOOL OSLibWinSetWindowULong(HWND hwnd, ULONG offset, ULONG value)
|
|---|
| 225 | {
|
|---|
| 226 | if(offset == OSLIB_QWL_USER)
|
|---|
| 227 | offset = QWL_USER;
|
|---|
| 228 |
|
|---|
| 229 | return WinSetWindowULong(hwnd, offset, value);
|
|---|
| 230 | }
|
|---|
| 231 | //******************************************************************************
|
|---|
| 232 | //******************************************************************************
|
|---|
| 233 | ULONG OSLibWinGetWindowULong(HWND hwnd, ULONG offset)
|
|---|
| 234 | {
|
|---|
| 235 | if(offset == OSLIB_QWL_USER)
|
|---|
| 236 | offset = QWL_USER;
|
|---|
| 237 |
|
|---|
| 238 | return WinQueryWindowULong(hwnd, offset);
|
|---|
| 239 | }
|
|---|
| 240 | //******************************************************************************
|
|---|
| 241 | //******************************************************************************
|
|---|
| 242 | BOOL OSLibWinAlarm(HWND hwndDeskTop,ULONG flStyle)
|
|---|
| 243 | {
|
|---|
| 244 | return WinAlarm(hwndDeskTop,flStyle);
|
|---|
| 245 | }
|
|---|
| 246 | //******************************************************************************
|
|---|
| 247 | //******************************************************************************
|
|---|
| 248 | APIRET OSLibDosBeep(ULONG freg,ULONG dur)
|
|---|
| 249 | {
|
|---|
| 250 | return DosBeep(freg,dur);
|
|---|
| 251 | }
|
|---|
| 252 | //******************************************************************************
|
|---|
| 253 | //******************************************************************************
|
|---|
| 254 | HWND OSLibWinQueryFocus(HWND hwndDeskTop)
|
|---|
| 255 | {
|
|---|
| 256 | return WinQueryFocus(hwndDeskTop);
|
|---|
| 257 | }
|
|---|
| 258 | //******************************************************************************
|
|---|
| 259 | //******************************************************************************
|
|---|
| 260 | HWND OSLibWinWindowFromID(HWND hwndParent,ULONG id)
|
|---|
| 261 | {
|
|---|
| 262 | return WinWindowFromID(hwndParent,id);
|
|---|
| 263 | }
|
|---|
| 264 | //******************************************************************************
|
|---|
| 265 | //******************************************************************************
|
|---|
| 266 | BOOL OSLibWinSetFocus(HWND hwndDeskTop,HWND hwndNewFocus, BOOL activate)
|
|---|
| 267 | {
|
|---|
| 268 | return WinFocusChange (hwndDeskTop, hwndNewFocus, activate ? FC_NOLOSEACTIVE : 0);
|
|---|
| 269 | }
|
|---|
| 270 | //******************************************************************************
|
|---|
| 271 | //******************************************************************************
|
|---|
| 272 | BOOL OSLibWinIsChild (HWND hwnd, HWND hwndOf)
|
|---|
| 273 | {
|
|---|
| 274 | return WinIsChild (hwnd, hwndOf);
|
|---|
| 275 | }
|
|---|
| 276 | //******************************************************************************
|
|---|
| 277 | //******************************************************************************
|
|---|
| 278 | ULONG OSLibGetWindowHeight(HWND hwnd)
|
|---|
| 279 | {
|
|---|
| 280 | RECTL rect;
|
|---|
| 281 |
|
|---|
| 282 | return (WinQueryWindowRect(hwnd,&rect)) ? rect.yTop-rect.yBottom:0;
|
|---|
| 283 | }
|
|---|
| 284 | //******************************************************************************
|
|---|
| 285 | //******************************************************************************
|
|---|
| 286 | LONG OSLibWinQuerySysValue(HWND hwndDeskTop,LONG iSysValue)
|
|---|
| 287 | {
|
|---|
| 288 | return WinQuerySysValue(hwndDeskTop,iSysValue);
|
|---|
| 289 | }
|
|---|
| 290 | //******************************************************************************
|
|---|
| 291 | //******************************************************************************
|
|---|
| 292 | ULONG OSLibWinQueryDlgItemText(HWND hwndDlg,ULONG idItem,LONG cchBufferMax,char* pchBuffer)
|
|---|
| 293 | {
|
|---|
| 294 | return WinQueryDlgItemText(hwndDlg,idItem,cchBufferMax,pchBuffer);
|
|---|
| 295 | }
|
|---|
| 296 | //******************************************************************************
|
|---|
| 297 | //******************************************************************************
|
|---|
| 298 | BOOL OSLibWinSetDlgItemText(HWND hwndDlg,ULONG idItem,char* pszText)
|
|---|
| 299 | {
|
|---|
| 300 | return WinSetDlgItemText(hwndDlg,idItem,pszText);
|
|---|
| 301 | }
|
|---|
| 302 | //******************************************************************************
|
|---|
| 303 | //******************************************************************************
|
|---|
| 304 | BOOL OSLibWinQueryPointerPos(HWND hwndDeskTop,PPOINT pptlPoint)
|
|---|
| 305 | {
|
|---|
| 306 | return WinQueryPointerPos(hwndDeskTop,(PPOINTL)pptlPoint);
|
|---|
| 307 | }
|
|---|
| 308 | //******************************************************************************
|
|---|
| 309 | //******************************************************************************
|
|---|
| 310 | HWND OSLibWinQueryWindow(HWND hwnd, ULONG lCode)
|
|---|
| 311 | {
|
|---|
| 312 | return WinQueryWindow(hwnd, lCode);
|
|---|
| 313 | }
|
|---|
| 314 | //******************************************************************************
|
|---|
| 315 | //******************************************************************************
|
|---|
| 316 | BOOL OSLibWinSetMultWindowPos(PSWP pswp, ULONG num)
|
|---|
| 317 | {
|
|---|
| 318 | return WinSetMultWindowPos(GetThreadHAB(), pswp, num);
|
|---|
| 319 | }
|
|---|
| 320 | //******************************************************************************
|
|---|
| 321 | //******************************************************************************
|
|---|
| 322 | BOOL OSLibWinShowWindow(HWND hwnd, ULONG fl)
|
|---|
| 323 | {
|
|---|
| 324 | BOOL rc = 1;
|
|---|
| 325 |
|
|---|
| 326 | if(fl & SWP_SHOW) {
|
|---|
| 327 | rc = WinShowWindow(hwnd, TRUE);
|
|---|
| 328 | }
|
|---|
| 329 | if(rc == 0)
|
|---|
| 330 | dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
|
|---|
| 331 | rc = WinSetWindowPos(hwnd, 0, 0, 0, 0, 0, fl);
|
|---|
| 332 | if(rc == 0)
|
|---|
| 333 | dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
|
|---|
| 334 | return rc;
|
|---|
| 335 | }
|
|---|
| 336 | //******************************************************************************
|
|---|
| 337 | //******************************************************************************
|
|---|
| 338 | BOOL OSLibWinDestroyWindow(HWND hwnd)
|
|---|
| 339 | {
|
|---|
| 340 | return WinDestroyWindow(hwnd);
|
|---|
| 341 | }
|
|---|
| 342 | //******************************************************************************
|
|---|
| 343 | //******************************************************************************
|
|---|
| 344 | BOOL OSLibWinQueryWindowRect(HWND hwnd, PRECT pRect, int RelativeTo)
|
|---|
| 345 | {
|
|---|
| 346 | BOOL rc;
|
|---|
| 347 | RECTLOS2 rectl;
|
|---|
| 348 |
|
|---|
| 349 | rc = WinQueryWindowRect(hwnd, (PRECTL)&rectl);
|
|---|
| 350 | if(rc) {
|
|---|
| 351 | if(RelativeTo == RELATIVE_TO_SCREEN) {
|
|---|
| 352 | mapOS2ToWin32Rect(hwnd,OSLIB_HWND_DESKTOP,&rectl,pRect);
|
|---|
| 353 | }
|
|---|
| 354 | else mapOS2ToWin32Rect(hwnd,&rectl,pRect);
|
|---|
| 355 | }
|
|---|
| 356 | else memset(pRect, 0, sizeof(RECT));
|
|---|
| 357 | return rc;
|
|---|
| 358 | }
|
|---|
| 359 | //******************************************************************************
|
|---|
| 360 | //******************************************************************************
|
|---|
| 361 | BOOL OSLibWinIsIconic(HWND hwnd)
|
|---|
| 362 | {
|
|---|
| 363 | SWP swp;
|
|---|
| 364 | BOOL rc;
|
|---|
| 365 |
|
|---|
| 366 | rc = WinQueryWindowPos(hwnd, &swp);
|
|---|
| 367 | if(rc == FALSE) {
|
|---|
| 368 | dprintf(("OSLibWinIsIconic: WinQueryWindowPos %x failed", hwnd));
|
|---|
| 369 | return FALSE;
|
|---|
| 370 | }
|
|---|
| 371 |
|
|---|
| 372 | if(swp.fl & SWP_MINIMIZE)
|
|---|
| 373 | return TRUE;
|
|---|
| 374 | else return FALSE;
|
|---|
| 375 | }
|
|---|
| 376 | //******************************************************************************
|
|---|
| 377 | //******************************************************************************
|
|---|
| 378 | BOOL OSLibWinSetActiveWindow(HWND hwnd)
|
|---|
| 379 | {
|
|---|
| 380 | return WinSetActiveWindow(HWND_DESKTOP, hwnd);
|
|---|
| 381 | }
|
|---|
| 382 | //******************************************************************************
|
|---|
| 383 | //******************************************************************************
|
|---|
| 384 | BOOL OSLibWinSetFocus(HWND hwnd)
|
|---|
| 385 | {
|
|---|
| 386 | return WinSetFocus(HWND_DESKTOP, hwnd);
|
|---|
| 387 | }
|
|---|
| 388 | //******************************************************************************
|
|---|
| 389 | //******************************************************************************
|
|---|
| 390 | BOOL OSLibWinEnableWindow(HWND hwnd, BOOL fEnable)
|
|---|
| 391 | {
|
|---|
| 392 | BOOL rc;
|
|---|
| 393 | HWND hwndClient;
|
|---|
| 394 |
|
|---|
| 395 | rc = WinEnableWindow(hwnd, fEnable);
|
|---|
| 396 | hwndClient = WinWindowFromID(hwnd, FID_CLIENT);
|
|---|
| 397 | if(hwndClient) {
|
|---|
| 398 | WinEnableWindow(hwndClient, fEnable);
|
|---|
| 399 | }
|
|---|
| 400 | return rc;
|
|---|
| 401 | }
|
|---|
| 402 | //******************************************************************************
|
|---|
| 403 | //******************************************************************************
|
|---|
| 404 | BOOL OSLibWinIsWindowEnabled(HWND hwnd)
|
|---|
| 405 | {
|
|---|
| 406 | return WinIsWindowEnabled(hwnd);
|
|---|
| 407 | }
|
|---|
| 408 | //******************************************************************************
|
|---|
| 409 | //******************************************************************************
|
|---|
| 410 | BOOL OSLibWinIsWindowVisible(HWND hwnd)
|
|---|
| 411 | {
|
|---|
| 412 | return WinIsWindowVisible(hwnd);
|
|---|
| 413 | }
|
|---|
| 414 | //******************************************************************************
|
|---|
| 415 | //******************************************************************************
|
|---|
| 416 | BOOL OSLibWinQueryActiveWindow()
|
|---|
| 417 | {
|
|---|
| 418 | return WinQueryActiveWindow(HWND_DESKTOP);
|
|---|
| 419 | }
|
|---|
| 420 | //******************************************************************************
|
|---|
| 421 | //******************************************************************************
|
|---|
| 422 | LONG OSLibWinQueryWindowTextLength(HWND hwnd)
|
|---|
| 423 | {
|
|---|
| 424 | return WinQueryWindowTextLength(hwnd);
|
|---|
| 425 | }
|
|---|
| 426 | //******************************************************************************
|
|---|
| 427 | //******************************************************************************
|
|---|
| 428 | LONG OSLibWinQueryWindowText(HWND hwnd, LONG length, LPSTR lpsz)
|
|---|
| 429 | {
|
|---|
| 430 | return WinQueryWindowText(hwnd, length, lpsz);
|
|---|
| 431 | }
|
|---|
| 432 | //******************************************************************************
|
|---|
| 433 | //******************************************************************************
|
|---|
| 434 | BOOL OSLibWinSetWindowText(HWND hwnd, LPSTR lpsz)
|
|---|
| 435 | {
|
|---|
| 436 | return WinSetWindowText(hwnd, lpsz);
|
|---|
| 437 | }
|
|---|
| 438 | //******************************************************************************
|
|---|
| 439 | //******************************************************************************
|
|---|
| 440 | BOOL OSLibWinFlashWindow(HWND hwnd, BOOL fFlash)
|
|---|
| 441 | {
|
|---|
| 442 | return WinFlashWindow(hwnd, fFlash);
|
|---|
| 443 | }
|
|---|
| 444 | //******************************************************************************
|
|---|
| 445 | //******************************************************************************
|
|---|
| 446 | HWND OSLibWinWindowFromPoint(HWND hwnd, PVOID ppoint)
|
|---|
| 447 | {
|
|---|
| 448 | return WinWindowFromPoint((hwnd == OSLIB_HWND_DESKTOP) ? HWND_DESKTOP : hwnd, (PPOINTL)ppoint, TRUE);
|
|---|
| 449 | }
|
|---|
| 450 | //******************************************************************************
|
|---|
| 451 | //******************************************************************************
|
|---|
| 452 | BOOL OSLibWinMinimizeWindow(HWND hwnd)
|
|---|
| 453 | {
|
|---|
| 454 | return WinSetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_MINIMIZE);
|
|---|
| 455 | }
|
|---|
| 456 | //******************************************************************************
|
|---|
| 457 | //******************************************************************************
|
|---|
| 458 | BOOL OSLibWinGetBorderSize(HWND hwnd, OSLIBPOINT *pointl)
|
|---|
| 459 | {
|
|---|
| 460 | pointl->x = 0;
|
|---|
| 461 | pointl->y = 0;
|
|---|
| 462 | return (BOOL) WinSendMsg(hwnd, WM_QUERYBORDERSIZE, MPFROMP( &pointl), 0);
|
|---|
| 463 | }
|
|---|
| 464 | //******************************************************************************
|
|---|
| 465 | //******************************************************************************
|
|---|
| 466 | BOOL OSLibWinSetIcon(HWND hwnd, HANDLE hIcon)
|
|---|
| 467 | {
|
|---|
| 468 | return (BOOL) WinSendMsg(hwnd, WM_SETICON, (MPARAM)hIcon, 0);
|
|---|
| 469 | }
|
|---|
| 470 | //******************************************************************************
|
|---|
| 471 | //******************************************************************************
|
|---|
| 472 | BOOL OSLibWinQueryWindowPos (HWND hwnd, PSWP pswp)
|
|---|
| 473 | {
|
|---|
| 474 | return WinQueryWindowPos(hwnd, pswp);
|
|---|
| 475 | }
|
|---|
| 476 | //******************************************************************************
|
|---|
| 477 | //******************************************************************************
|
|---|
| 478 | void OSLibMapSWPtoWINDOWPOS(PSWP pswp, PWINDOWPOS pwpos, PSWP pswpOld, HWND hParent, HWND hFrame)
|
|---|
| 479 | {
|
|---|
| 480 | HWND hWindow = pswp->hwnd;
|
|---|
| 481 | HWND hWndInsertAfter = pswp->hwndInsertBehind;
|
|---|
| 482 | long x = pswp->x;
|
|---|
| 483 | long y = pswp->y;
|
|---|
| 484 | long cx = pswp->cx;
|
|---|
| 485 | long cy = pswp->cy;
|
|---|
| 486 | UINT fuFlags = (UINT)pswp->fl;
|
|---|
| 487 | ULONG parentHeight;
|
|---|
| 488 |
|
|---|
| 489 | HWND hWinAfter;
|
|---|
| 490 | ULONG flags = 0;
|
|---|
| 491 | SWP swpFrame, swpClient;
|
|---|
| 492 | POINTL point;
|
|---|
| 493 |
|
|---|
| 494 | HWND hWnd = (hWindow == HWND_DESKTOP) ? HWND_DESKTOP_W: hWindow;
|
|---|
| 495 |
|
|---|
| 496 | if (hWndInsertAfter == HWND_TOP)
|
|---|
| 497 | hWinAfter = HWND_TOP_W;
|
|---|
| 498 | else if (hWndInsertAfter == HWND_BOTTOM)
|
|---|
| 499 | hWinAfter = HWND_BOTTOM_W;
|
|---|
| 500 | else
|
|---|
| 501 | hWinAfter = (HWND) hWndInsertAfter;
|
|---|
| 502 |
|
|---|
| 503 | //***********************************
|
|---|
| 504 | // convert PM flags to Windows flags
|
|---|
| 505 | //***********************************
|
|---|
| 506 | if (!(fuFlags & SWP_SIZE)) flags |= SWP_NOSIZE_W;
|
|---|
| 507 | if (!(fuFlags & SWP_MOVE)) flags |= SWP_NOMOVE_W;
|
|---|
| 508 | if (!(fuFlags & SWP_ZORDER)) flags |= SWP_NOZORDER_W;
|
|---|
| 509 | if ( fuFlags & SWP_NOREDRAW) flags |= SWP_NOREDRAW_W;
|
|---|
| 510 | if (!(fuFlags & SWP_ACTIVATE)) flags |= SWP_NOACTIVATE_W;
|
|---|
| 511 | if ( fuFlags & SWP_SHOW) flags |= SWP_SHOWWINDOW_W;
|
|---|
| 512 | if ( fuFlags & SWP_HIDE) flags |= SWP_HIDEWINDOW_W;
|
|---|
| 513 | if ( fuFlags & SWP_NOADJUST) flags |= SWP_NOSENDCHANGING_W;
|
|---|
| 514 |
|
|---|
| 515 | WinQueryWindowPos(hFrame, &swpFrame);
|
|---|
| 516 |
|
|---|
| 517 | if(fuFlags & (SWP_MOVE | SWP_SIZE))
|
|---|
| 518 | {
|
|---|
| 519 | point.x = swpFrame.x;
|
|---|
| 520 | point.y = swpFrame.y;
|
|---|
| 521 | if(hParent)
|
|---|
| 522 | {
|
|---|
| 523 | WinMapWindowPoints(hParent, HWND_DESKTOP, &point, 1);
|
|---|
| 524 | }
|
|---|
| 525 | point.y = ScreenHeight-point.y-swpFrame.cy;
|
|---|
| 526 |
|
|---|
| 527 | cy = swpFrame.cy;
|
|---|
| 528 | cx = swpFrame.cx;
|
|---|
| 529 | x = point.x;
|
|---|
| 530 | y = point.y;
|
|---|
| 531 |
|
|---|
| 532 | if ((pswp->x == pswpOld->x) && (pswp->y == pswpOld->y))
|
|---|
| 533 | flags |= SWP_NOMOVE_W;
|
|---|
| 534 |
|
|---|
| 535 | if ((pswp->cx == pswpOld->cx) && (pswp->cy == pswpOld->cy))
|
|---|
| 536 | flags |= SWP_NOSIZE_W;
|
|---|
| 537 |
|
|---|
| 538 | if (fuFlags & SWP_SIZE)
|
|---|
| 539 | {
|
|---|
| 540 | if (pswp->cy != pswpOld->cy)
|
|---|
| 541 | {
|
|---|
| 542 | flags &= ~SWP_NOMOVE_W;
|
|---|
| 543 | }
|
|---|
| 544 | }
|
|---|
| 545 | }
|
|---|
| 546 |
|
|---|
| 547 | pswpOld->x = pswp->x;
|
|---|
| 548 | pswpOld->y = swpFrame.cy-pswp->y-pswp->cy;
|
|---|
| 549 | pswpOld->cx = pswp->cx;
|
|---|
| 550 | pswpOld->cy = pswp->cy;
|
|---|
| 551 |
|
|---|
| 552 | dprintf(("window (%d,%d)(%d,%d) client (%d,%d)(%d,%d)",
|
|---|
| 553 | x,y,cx,cy, pswpOld->x,pswpOld->y,pswpOld->cx,pswpOld->cy));
|
|---|
| 554 |
|
|---|
| 555 | pwpos->flags = (UINT)flags;
|
|---|
| 556 | pwpos->cy = cy;
|
|---|
| 557 | pwpos->cx = cx;
|
|---|
| 558 | pwpos->x = x;
|
|---|
| 559 | pwpos->y = y;
|
|---|
| 560 | pwpos->hwndInsertAfter = hWinAfter;
|
|---|
| 561 | pwpos->hwnd = hWindow;
|
|---|
| 562 | }
|
|---|
| 563 | //******************************************************************************
|
|---|
| 564 | //******************************************************************************
|
|---|
| 565 | void OSLibMapSWPtoWINDOWPOSFrame(PSWP pswp, struct tagWINDOWPOS *pwpos, PSWP pswpOld, HWND hParent, HWND hFrame)
|
|---|
| 566 | {
|
|---|
| 567 | HWND hWindow = pswp->hwnd;
|
|---|
| 568 | HWND hWndInsertAfter = pswp->hwndInsertBehind;
|
|---|
| 569 | long x = pswp->x;
|
|---|
| 570 | long y = pswp->y;
|
|---|
| 571 | long cx = pswp->cx;
|
|---|
| 572 | long cy = pswp->cy;
|
|---|
| 573 | UINT fuFlags = (UINT)pswp->fl;
|
|---|
| 574 | ULONG parentHeight;
|
|---|
| 575 |
|
|---|
| 576 | HWND hWinAfter;
|
|---|
| 577 | ULONG flags = 0;
|
|---|
| 578 | SWP swpClient;
|
|---|
| 579 | POINTL point;
|
|---|
| 580 |
|
|---|
| 581 | HWND hWnd = (hWindow == HWND_DESKTOP) ? HWND_DESKTOP_W: hWindow;
|
|---|
| 582 |
|
|---|
| 583 | if (hWndInsertAfter == HWND_TOP)
|
|---|
| 584 | hWinAfter = HWND_TOP_W;
|
|---|
| 585 | else if (hWndInsertAfter == HWND_BOTTOM)
|
|---|
| 586 | hWinAfter = HWND_BOTTOM_W;
|
|---|
| 587 | else
|
|---|
| 588 | hWinAfter = (HWND) hWndInsertAfter;
|
|---|
| 589 |
|
|---|
| 590 | //***********************************
|
|---|
| 591 | // convert PM flags to Windows flags
|
|---|
| 592 | //***********************************
|
|---|
| 593 | if (!(fuFlags & SWP_SIZE)) flags |= SWP_NOSIZE_W;
|
|---|
| 594 | if (!(fuFlags & SWP_MOVE)) flags |= SWP_NOMOVE_W;
|
|---|
| 595 | if (!(fuFlags & SWP_ZORDER)) flags |= SWP_NOZORDER_W;
|
|---|
| 596 | if ( fuFlags & SWP_NOREDRAW) flags |= SWP_NOREDRAW_W;
|
|---|
| 597 | if (!(fuFlags & SWP_ACTIVATE)) flags |= SWP_NOACTIVATE_W;
|
|---|
| 598 | if ( fuFlags & SWP_SHOW) flags |= SWP_SHOWWINDOW_W;
|
|---|
| 599 | if ( fuFlags & SWP_HIDE) flags |= SWP_HIDEWINDOW_W;
|
|---|
| 600 | if ( fuFlags & SWP_NOADJUST) flags |= SWP_NOSENDCHANGING_W;
|
|---|
| 601 |
|
|---|
| 602 | WinQueryWindowPos(WinWindowFromID(hFrame, FID_CLIENT), &swpClient);
|
|---|
| 603 |
|
|---|
| 604 | if(fuFlags & (SWP_MOVE | SWP_SIZE))
|
|---|
| 605 | {
|
|---|
| 606 | point.x = x;
|
|---|
| 607 | point.y = y;
|
|---|
| 608 | if(hParent)
|
|---|
| 609 | {
|
|---|
| 610 | WinMapWindowPoints(hParent, HWND_DESKTOP, &point, 1);
|
|---|
| 611 | }
|
|---|
| 612 | point.y = ScreenHeight-point.y-cy;
|
|---|
| 613 |
|
|---|
| 614 | x = point.x;
|
|---|
| 615 | y = point.y;
|
|---|
| 616 |
|
|---|
| 617 | if ((pswp->x == pswpOld->x) && (pswp->y == pswpOld->y))
|
|---|
| 618 | flags |= SWP_NOMOVE_W;
|
|---|
| 619 |
|
|---|
| 620 | if ((pswp->cx == pswpOld->cx) && (pswp->cy == pswpOld->cy))
|
|---|
| 621 | flags |= SWP_NOSIZE_W;
|
|---|
| 622 |
|
|---|
| 623 | if (fuFlags & SWP_SIZE)
|
|---|
| 624 | {
|
|---|
| 625 | if (pswp->cy != pswpOld->cy)
|
|---|
| 626 | {
|
|---|
| 627 | flags &= ~SWP_NOMOVE_W;
|
|---|
| 628 | }
|
|---|
| 629 | }
|
|---|
| 630 | }
|
|---|
| 631 |
|
|---|
| 632 | pswpOld->x = swpClient.x;
|
|---|
| 633 | pswpOld->y = pswp->cy-swpClient.y-swpClient.cy;
|
|---|
| 634 | pswpOld->cx = swpClient.cx;
|
|---|
| 635 | pswpOld->cy = swpClient.cy;
|
|---|
| 636 |
|
|---|
| 637 | dprintf(("window (%d,%d)(%d,%d) client (%d,%d)(%d,%d)",
|
|---|
| 638 | x,y,cx,cy, pswpOld->x,pswpOld->y,pswpOld->cx,pswpOld->cy));
|
|---|
| 639 |
|
|---|
| 640 | pwpos->flags = (UINT)flags;
|
|---|
| 641 | pwpos->cy = cy;
|
|---|
| 642 | pwpos->cx = cx;
|
|---|
| 643 | pwpos->x = x;
|
|---|
| 644 | pwpos->y = y;
|
|---|
| 645 | pwpos->hwndInsertAfter = hWinAfter;
|
|---|
| 646 | pwpos->hwnd = hWindow;
|
|---|
| 647 | }
|
|---|
| 648 | //******************************************************************************
|
|---|
| 649 | //******************************************************************************
|
|---|
| 650 | void OSLibMapWINDOWPOStoSWP(PWINDOWPOS pwpos, PSWP pswp, PSWP pswpOld, HWND hParent, HWND hFrame)
|
|---|
| 651 | {
|
|---|
| 652 | BOOL fCvt = FALSE;
|
|---|
| 653 |
|
|---|
| 654 | HWND hWnd = pwpos->hwnd;
|
|---|
| 655 | HWND hWndInsertAfter = pwpos->hwndInsertAfter;
|
|---|
| 656 | long x = pwpos->x;
|
|---|
| 657 | long y = pwpos->y;
|
|---|
| 658 | long cx = pwpos->cx;
|
|---|
| 659 | long cy = pwpos->cy;
|
|---|
| 660 | UINT fuFlags = pwpos->flags;
|
|---|
| 661 | ULONG parentHeight;
|
|---|
| 662 |
|
|---|
| 663 | HWND hWinAfter;
|
|---|
| 664 | ULONG flags = 0;
|
|---|
| 665 | HWND hWindow = hWnd ? (HWND)hWnd : HWND_DESKTOP;
|
|---|
| 666 |
|
|---|
| 667 | if (hWndInsertAfter == HWND_TOPMOST_W)
|
|---|
| 668 | // hWinAfter = HWND_TOPMOST;
|
|---|
| 669 | hWinAfter = HWND_TOP;
|
|---|
| 670 | else if (hWndInsertAfter == HWND_NOTOPMOST_W)
|
|---|
| 671 | // hWinAfter = HWND_NOTOPMOST;
|
|---|
| 672 | hWinAfter = HWND_TOP;
|
|---|
| 673 | else if (hWndInsertAfter == HWND_TOP_W)
|
|---|
| 674 | hWinAfter = HWND_TOP;
|
|---|
| 675 | else if (hWndInsertAfter == HWND_BOTTOM_W)
|
|---|
| 676 | hWinAfter = HWND_BOTTOM;
|
|---|
| 677 | else
|
|---|
| 678 | hWinAfter = (HWND) hWndInsertAfter;
|
|---|
| 679 |
|
|---|
| 680 | if (!(fuFlags & SWP_NOSIZE_W )) flags |= SWP_SIZE;
|
|---|
| 681 | if (!(fuFlags & SWP_NOMOVE_W )) flags |= SWP_MOVE;
|
|---|
| 682 | if (!(fuFlags & SWP_NOZORDER_W )) flags |= SWP_ZORDER;
|
|---|
| 683 | if ( fuFlags & SWP_NOREDRAW_W ) flags |= SWP_NOREDRAW;
|
|---|
| 684 | if (!(fuFlags & SWP_NOACTIVATE_W)) flags |= SWP_ACTIVATE;
|
|---|
| 685 | if ( fuFlags & SWP_SHOWWINDOW_W) flags |= SWP_SHOW;
|
|---|
| 686 | if ( fuFlags & SWP_HIDEWINDOW_W) flags |= SWP_HIDE;
|
|---|
| 687 | if ( fuFlags & SWP_NOSENDCHANGING_W) flags |= SWP_NOADJUST;
|
|---|
| 688 |
|
|---|
| 689 | if (flags & (SWP_MOVE | SWP_SIZE))
|
|---|
| 690 | {
|
|---|
| 691 | if (hParent == NULLHANDLE)
|
|---|
| 692 | parentHeight = ScreenHeight;
|
|---|
| 693 | else
|
|---|
| 694 | parentHeight = OSLibGetWindowHeight(hParent);
|
|---|
| 695 |
|
|---|
| 696 | if ((flags & SWP_MOVE) == 0)
|
|---|
| 697 | {
|
|---|
| 698 | x = pswpOld->x;
|
|---|
| 699 | y = pswpOld->y;
|
|---|
| 700 |
|
|---|
| 701 | if (!((y == 0) && (pswpOld->cy == 0)))
|
|---|
| 702 | {
|
|---|
| 703 | y = parentHeight-y-pswpOld->cy;
|
|---|
| 704 | }
|
|---|
| 705 | }
|
|---|
| 706 |
|
|---|
| 707 | if (flags & SWP_SIZE)
|
|---|
| 708 | {
|
|---|
| 709 | if (cy != pswpOld->cy)
|
|---|
| 710 | flags |= SWP_MOVE;
|
|---|
| 711 | }
|
|---|
| 712 | else
|
|---|
| 713 | {
|
|---|
| 714 | cx = pswpOld->cx;
|
|---|
| 715 | cy = pswpOld->cy;
|
|---|
| 716 | }
|
|---|
| 717 | y = parentHeight-y-cy;
|
|---|
| 718 |
|
|---|
| 719 |
|
|---|
| 720 | if ((pswpOld->x == x) && (pswpOld->y == y))
|
|---|
| 721 | flags &= ~SWP_MOVE;
|
|---|
| 722 |
|
|---|
| 723 | if ((pswpOld->cx == cx) && (pswpOld->cy == cy))
|
|---|
| 724 | flags &= ~SWP_SIZE;
|
|---|
| 725 | }
|
|---|
| 726 |
|
|---|
| 727 | pswp->fl = flags;
|
|---|
| 728 | pswp->cy = cy;
|
|---|
| 729 | pswp->cx = cx;
|
|---|
| 730 | pswp->x = x;
|
|---|
| 731 | pswp->y = y;
|
|---|
| 732 | pswp->hwndInsertBehind = hWinAfter;
|
|---|
| 733 | pswp->hwnd = hWindow;
|
|---|
| 734 | pswp->ulReserved1 = 0;
|
|---|
| 735 | pswp->ulReserved2 = 0;
|
|---|
| 736 | }
|
|---|
| 737 | //******************************************************************************
|
|---|
| 738 | //Position in screen coordinates
|
|---|
| 739 | //******************************************************************************
|
|---|
| 740 | void OSLibMapWINDOWPOStoSWPFrame(PWINDOWPOS pwpos, PSWP pswp, PSWP pswpOld, HWND hParent, HWND hFrame)
|
|---|
| 741 | {
|
|---|
| 742 | BOOL fCvt = FALSE;
|
|---|
| 743 |
|
|---|
| 744 | HWND hWnd = pwpos->hwnd;
|
|---|
| 745 | HWND hWndInsertAfter = pwpos->hwndInsertAfter;
|
|---|
| 746 | long x = pwpos->x;
|
|---|
| 747 | long y = pwpos->y;
|
|---|
| 748 | long cx = pwpos->cx;
|
|---|
| 749 | long cy = pwpos->cy;
|
|---|
| 750 | UINT fuFlags = pwpos->flags;
|
|---|
| 751 | ULONG parentHeight;
|
|---|
| 752 | POINTL point;
|
|---|
| 753 |
|
|---|
| 754 | HWND hWinAfter;
|
|---|
| 755 | ULONG flags = 0;
|
|---|
| 756 | HWND hWindow = hWnd ? (HWND)hWnd : HWND_DESKTOP;
|
|---|
| 757 |
|
|---|
| 758 | if (hWndInsertAfter == HWND_TOPMOST_W)
|
|---|
| 759 | // hWinAfter = HWND_TOPMOST;
|
|---|
| 760 | hWinAfter = HWND_TOP;
|
|---|
| 761 | else if (hWndInsertAfter == HWND_NOTOPMOST_W)
|
|---|
| 762 | // hWinAfter = HWND_NOTOPMOST;
|
|---|
| 763 | hWinAfter = HWND_TOP;
|
|---|
| 764 | else if (hWndInsertAfter == HWND_TOP_W)
|
|---|
| 765 | hWinAfter = HWND_TOP;
|
|---|
| 766 | else if (hWndInsertAfter == HWND_BOTTOM_W)
|
|---|
| 767 | hWinAfter = HWND_BOTTOM;
|
|---|
| 768 | else
|
|---|
| 769 | hWinAfter = (HWND) hWndInsertAfter;
|
|---|
| 770 |
|
|---|
| 771 | if (!(fuFlags & SWP_NOSIZE_W )) flags |= SWP_SIZE;
|
|---|
| 772 | if (!(fuFlags & SWP_NOMOVE_W )) flags |= SWP_MOVE;
|
|---|
| 773 | if (!(fuFlags & SWP_NOZORDER_W )) flags |= SWP_ZORDER;
|
|---|
| 774 | if ( fuFlags & SWP_NOREDRAW_W ) flags |= SWP_NOREDRAW;
|
|---|
| 775 | if (!(fuFlags & SWP_NOACTIVATE_W)) flags |= SWP_ACTIVATE;
|
|---|
| 776 | if ( fuFlags & SWP_SHOWWINDOW_W) flags |= SWP_SHOW;
|
|---|
| 777 | if ( fuFlags & SWP_HIDEWINDOW_W) flags |= SWP_HIDE;
|
|---|
| 778 | if ( fuFlags & SWP_NOSENDCHANGING_W) flags |= SWP_NOADJUST;
|
|---|
| 779 |
|
|---|
| 780 | if (flags & (SWP_MOVE | SWP_SIZE))
|
|---|
| 781 | {
|
|---|
| 782 | point.x = x;
|
|---|
| 783 | point.y = y;
|
|---|
| 784 |
|
|---|
| 785 | if(hParent) {
|
|---|
| 786 | parentHeight = OSLibGetWindowHeight(hParent);
|
|---|
| 787 |
|
|---|
| 788 | point.y = ScreenHeight-point.y-cy;
|
|---|
| 789 | WinMapWindowPoints(HWND_DESKTOP, hParent, &point, 1);
|
|---|
| 790 | point.y = parentHeight-point.y-cy;
|
|---|
| 791 | }
|
|---|
| 792 | else parentHeight = ScreenHeight;
|
|---|
| 793 |
|
|---|
| 794 | x = point.x;
|
|---|
| 795 | y = point.y;
|
|---|
| 796 |
|
|---|
| 797 | if (flags & SWP_SIZE)
|
|---|
| 798 | {
|
|---|
| 799 | if (cy != pswpOld->cy)
|
|---|
| 800 | flags |= SWP_MOVE;
|
|---|
| 801 | }
|
|---|
| 802 | else
|
|---|
| 803 | {
|
|---|
| 804 | cx = pswpOld->cx;
|
|---|
| 805 | cy = pswpOld->cy;
|
|---|
| 806 | }
|
|---|
| 807 | y = parentHeight-y-cy;
|
|---|
| 808 |
|
|---|
| 809 |
|
|---|
| 810 | if ((pswpOld->x == x) && (pswpOld->y == y))
|
|---|
| 811 | flags &= ~SWP_MOVE;
|
|---|
| 812 |
|
|---|
| 813 | if ((pswpOld->cx == cx) && (pswpOld->cy == cy))
|
|---|
| 814 | flags &= ~SWP_SIZE;
|
|---|
| 815 | }
|
|---|
| 816 |
|
|---|
| 817 | pswp->fl = flags;
|
|---|
| 818 | pswp->cy = cy;
|
|---|
| 819 | pswp->cx = cx;
|
|---|
| 820 | pswp->x = x;
|
|---|
| 821 | pswp->y = y;
|
|---|
| 822 | pswp->hwndInsertBehind = hWinAfter;
|
|---|
| 823 | pswp->hwnd = hWindow;
|
|---|
| 824 | pswp->ulReserved1 = 0;
|
|---|
| 825 | pswp->ulReserved2 = 0;
|
|---|
| 826 | }
|
|---|
| 827 | //******************************************************************************
|
|---|
| 828 | //******************************************************************************
|
|---|
| 829 | BOOL OSLibWinCalcFrameRect(HWND hwndFrame, RECT *pRect, BOOL fClient)
|
|---|
| 830 | {
|
|---|
| 831 | BOOL rc;
|
|---|
| 832 |
|
|---|
| 833 | WinMapWindowPoints(hwndFrame, HWND_DESKTOP, (PPOINTL)pRect, 2);
|
|---|
| 834 |
|
|---|
| 835 | rc = WinCalcFrameRect(hwndFrame, (PRECTL)pRect, fClient);
|
|---|
| 836 | WinMapWindowPoints(HWND_DESKTOP, hwndFrame, (PPOINTL)pRect, 2);
|
|---|
| 837 |
|
|---|
| 838 | return rc;
|
|---|
| 839 | }
|
|---|
| 840 | //******************************************************************************
|
|---|
| 841 | //******************************************************************************
|
|---|
| 842 | BOOL OSLibGetMinMaxInfo(HWND hwndFrame, MINMAXINFO *pMinMax)
|
|---|
| 843 | {
|
|---|
| 844 | TRACKINFO tinfo;
|
|---|
| 845 |
|
|---|
| 846 | memset(&tinfo, 0, sizeof(TRACKINFO));
|
|---|
| 847 | WinSendMsg(hwndFrame, WM_QUERYTRACKINFO, (MPARAM)0,(MPARAM)&tinfo);
|
|---|
| 848 |
|
|---|
| 849 | pMinMax->ptMinTrackSize.x = tinfo.ptlMinTrackSize.x;
|
|---|
| 850 | pMinMax->ptMinTrackSize.y = tinfo.ptlMinTrackSize.y;
|
|---|
| 851 | pMinMax->ptMaxTrackSize.x = tinfo.ptlMaxTrackSize.x;
|
|---|
| 852 | pMinMax->ptMaxTrackSize.y = tinfo.ptlMaxTrackSize.y;
|
|---|
| 853 | return TRUE;
|
|---|
| 854 | }
|
|---|
| 855 | //******************************************************************************
|
|---|
| 856 | //******************************************************************************
|
|---|
| 857 | HWND OSLibWinBeginEnumWindows(HWND hwnd)
|
|---|
| 858 | {
|
|---|
| 859 | if(hwnd == OSLIB_HWND_DESKTOP) hwnd = HWND_DESKTOP;
|
|---|
| 860 | else
|
|---|
| 861 | if(hwnd == OSLIB_HWND_OBJECT) hwnd = HWND_OBJECT;
|
|---|
| 862 |
|
|---|
| 863 | return WinBeginEnumWindows(hwnd);
|
|---|
| 864 | }
|
|---|
| 865 | //******************************************************************************
|
|---|
| 866 | //******************************************************************************
|
|---|
| 867 | HWND OSLibWinGetNextWindow(HWND hwndEnum)
|
|---|
| 868 | {
|
|---|
| 869 | return WinGetNextWindow(hwndEnum);
|
|---|
| 870 | }
|
|---|
| 871 | //******************************************************************************
|
|---|
| 872 | //******************************************************************************
|
|---|
| 873 | HWND OSLibWinQueryClientWindow(HWND hwndFrame)
|
|---|
| 874 | {
|
|---|
| 875 | HWND hwndClient = 0;
|
|---|
| 876 |
|
|---|
| 877 | if(((ULONG)WinSendMsg(hwndFrame, WM_QUERYFRAMEINFO, NULL, NULL)) & FI_FRAME)
|
|---|
| 878 | hwndClient = WinWindowFromID(hwndFrame, FID_CLIENT);
|
|---|
| 879 |
|
|---|
| 880 | return hwndClient;
|
|---|
| 881 | }
|
|---|
| 882 | //******************************************************************************
|
|---|
| 883 | //******************************************************************************
|
|---|
| 884 | BOOL OSLibWinEndEnumWindows(HWND hwndEnum)
|
|---|
| 885 | {
|
|---|
| 886 | return WinEndEnumWindows(hwndEnum);
|
|---|
| 887 | }
|
|---|
| 888 | //******************************************************************************
|
|---|
| 889 | //******************************************************************************
|
|---|
| 890 | BOOL OSLibWinQueryWindowProcess(HWND hwnd, ULONG *pid, ULONG *tid)
|
|---|
| 891 | {
|
|---|
| 892 | return WinQueryWindowProcess(hwnd, pid, tid);
|
|---|
| 893 | }
|
|---|
| 894 | //******************************************************************************
|
|---|
| 895 | //******************************************************************************
|
|---|
| 896 | BOOL OSLibWinMapWindowPoints (HWND hwndFrom, HWND hwndTo, OSLIBPOINT *pptl, ULONG num)
|
|---|
| 897 | {
|
|---|
| 898 | return WinMapWindowPoints (hwndFrom, hwndTo, (PPOINTL)pptl, num);
|
|---|
| 899 | }
|
|---|
| 900 | //******************************************************************************
|
|---|
| 901 | //******************************************************************************
|
|---|
| 902 | BOOL OSLibWinEnableScrollBar(HWND hwndParent, int scrollBar, BOOL fEnable)
|
|---|
| 903 | {
|
|---|
| 904 | HWND hwndScroll;
|
|---|
| 905 |
|
|---|
| 906 | if(scrollBar == OSLIB_VSCROLL) {
|
|---|
| 907 | hwndScroll = WinWindowFromID(hwndParent, FID_VERTSCROLL);
|
|---|
| 908 | }
|
|---|
| 909 | else hwndScroll = WinWindowFromID(hwndParent, FID_HORZSCROLL);
|
|---|
| 910 |
|
|---|
| 911 | if(hwndScroll == NULL)
|
|---|
| 912 | return FALSE;
|
|---|
| 913 |
|
|---|
| 914 | return WinEnableWindow(hwndScroll, fEnable);
|
|---|
| 915 | }
|
|---|
| 916 | //******************************************************************************
|
|---|
| 917 | //******************************************************************************
|
|---|
| 918 | HWND OSLibWinQueryObjectWindow(VOID)
|
|---|
| 919 | {
|
|---|
| 920 | return WinQueryObjectWindow(HWND_DESKTOP);
|
|---|
| 921 | }
|
|---|
| 922 | //******************************************************************************
|
|---|
| 923 | //******************************************************************************
|
|---|
| 924 | ULONG OSLibWinGetScrollPos(HWND hwndParent, HWND hwndScroll)
|
|---|
| 925 | {
|
|---|
| 926 | if(hwndScroll == NULL)
|
|---|
| 927 | return 0;
|
|---|
| 928 |
|
|---|
| 929 | return (ULONG)WinSendMsg(hwndScroll, SBM_QUERYPOS, 0, 0);
|
|---|
| 930 | }
|
|---|
| 931 | //******************************************************************************
|
|---|
| 932 | //******************************************************************************
|
|---|
| 933 | ULONG OSLibWinSetScrollPos(HWND hwndParent, HWND hwndScroll, int pos, int fRedraw)
|
|---|
| 934 | {
|
|---|
| 935 | ULONG oldPos;
|
|---|
| 936 |
|
|---|
| 937 | if(hwndScroll == NULL)
|
|---|
| 938 | return 0;
|
|---|
| 939 |
|
|---|
| 940 | oldPos = (ULONG)WinSendMsg(hwndScroll, SBM_QUERYPOS, 0, 0);
|
|---|
| 941 |
|
|---|
| 942 | if(WinSendMsg(hwndScroll, SBM_SETPOS, MPFROMSHORT(pos), MPFROMLONG(fRedraw)) == FALSE)
|
|---|
| 943 | return 0;
|
|---|
| 944 |
|
|---|
| 945 | return oldPos;
|
|---|
| 946 | }
|
|---|
| 947 | //******************************************************************************
|
|---|
| 948 | //******************************************************************************
|
|---|
| 949 | BOOL OSLibWinSetScrollRange(HWND hwndParent, HWND hwndScroll, int minpos,
|
|---|
| 950 | int maxpos, int fRedraw)
|
|---|
| 951 | {
|
|---|
| 952 | if(hwndScroll == NULL)
|
|---|
| 953 | return 0;
|
|---|
| 954 |
|
|---|
| 955 | return (BOOL)WinSendMsg( hwndScroll, SBM_SETSCROLLBAR,
|
|---|
| 956 | MPFROMLONG(WinSendMsg(hwndScroll, SBM_QUERYPOS, 0, 0)),
|
|---|
| 957 | MPFROM2SHORT( minpos ,maxpos ) );
|
|---|
| 958 | }
|
|---|
| 959 | //******************************************************************************
|
|---|
| 960 | //******************************************************************************
|
|---|
| 961 | BOOL OSLibWinSetScrollPageSize(HWND hwndParent, HWND hwndScroll, int pagesize,
|
|---|
| 962 | int totalsize, int fRedraw)
|
|---|
| 963 | {
|
|---|
| 964 | if(hwndScroll == NULL)
|
|---|
| 965 | return 0;
|
|---|
| 966 |
|
|---|
| 967 | return (BOOL)WinSendMsg( hwndScroll, SBM_SETTHUMBSIZE,
|
|---|
| 968 | MPFROM2SHORT(pagesize, totalsize),
|
|---|
| 969 | 0);
|
|---|
| 970 | }
|
|---|
| 971 | //******************************************************************************
|
|---|
| 972 | //******************************************************************************
|
|---|
| 973 | void OSLibTranslateScrollCmdAndMsg(ULONG *msg, ULONG *scrollcmd)
|
|---|
| 974 | {
|
|---|
| 975 | switch(*scrollcmd)
|
|---|
| 976 | {
|
|---|
| 977 | case SB_LINEUP:
|
|---|
| 978 | *scrollcmd = SB_LINEUP_W;
|
|---|
| 979 | break;
|
|---|
| 980 | case SB_LINEDOWN:
|
|---|
| 981 | *scrollcmd = SB_LINEDOWN_W;
|
|---|
| 982 | break;
|
|---|
| 983 | case SB_PAGEUP:
|
|---|
| 984 | *scrollcmd = SB_PAGEUP_W;
|
|---|
| 985 | break;
|
|---|
| 986 | case SB_PAGEDOWN:
|
|---|
| 987 | *scrollcmd = SB_PAGEDOWN_W;
|
|---|
| 988 | break;
|
|---|
| 989 | case SB_SLIDERTRACK:
|
|---|
| 990 | *scrollcmd = SB_THUMBTRACK_W;
|
|---|
| 991 | break;
|
|---|
| 992 | case SB_SLIDERPOSITION:
|
|---|
| 993 | *scrollcmd = SB_THUMBPOSITION_W;
|
|---|
| 994 | break;
|
|---|
| 995 | case SB_ENDSCROLL:
|
|---|
| 996 | *scrollcmd = SB_ENDSCROLL_W;
|
|---|
| 997 | break;
|
|---|
| 998 | }
|
|---|
| 999 | *msg = (*msg == WM_HSCROLL) ? WM_HSCROLL_W : WM_VSCROLL_W;
|
|---|
| 1000 | return;
|
|---|
| 1001 | }
|
|---|
| 1002 | //******************************************************************************
|
|---|
| 1003 | //******************************************************************************
|
|---|
| 1004 | void OSLibSetWindowStyle(HWND hwnd, ULONG dwStyle, BOOL fTaskList)
|
|---|
| 1005 | {
|
|---|
| 1006 | ULONG OSWinStyle, OSFrameStyle, borderWidth, borderHeight,dwExStyle;
|
|---|
| 1007 |
|
|---|
| 1008 | OSLibWinConvertStyle(dwStyle, &dwExStyle, &OSWinStyle, &OSFrameStyle, &borderWidth, &borderHeight);
|
|---|
| 1009 |
|
|---|
| 1010 | if(fTaskList)
|
|---|
| 1011 | {
|
|---|
| 1012 | OSFrameStyle |= FCF_TASKLIST | FCF_NOMOVEWITHOWNER;
|
|---|
| 1013 | }
|
|---|
| 1014 |
|
|---|
| 1015 | // OSWinStyle = OSWinStyle & ~(WS_TABSTOP | WS_GROUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
|
|---|
| 1016 | OSWinStyle = OSWinStyle & ~(WS_TABSTOP | WS_GROUP | WS_CLIPCHILDREN);
|
|---|
| 1017 |
|
|---|
| 1018 | WinSetWindowULong(hwnd, QWL_STYLE,
|
|---|
| 1019 | (WinQueryWindowULong(hwnd, QWL_STYLE) & ~0xffff0000) |
|
|---|
| 1020 | OSWinStyle);
|
|---|
| 1021 |
|
|---|
| 1022 | if(OSFrameStyle & FCF_TITLEBAR)
|
|---|
| 1023 | {
|
|---|
| 1024 | WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_TITLEBAR), hwnd, FALSE);
|
|---|
| 1025 | WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_MENU), hwnd, FALSE);
|
|---|
| 1026 | }
|
|---|
| 1027 | else
|
|---|
| 1028 | {
|
|---|
| 1029 | WinSetParent(WinWindowFromID(hwnd, FID_TITLEBAR), HWND_OBJECT, FALSE);
|
|---|
| 1030 | WinSetParent(WinWindowFromID(hwnd, FID_MENU), HWND_OBJECT, FALSE);
|
|---|
| 1031 | }
|
|---|
| 1032 | if(OSFrameStyle & FCF_SYSMENU)
|
|---|
| 1033 | WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_SYSMENU), hwnd, FALSE);
|
|---|
| 1034 | else
|
|---|
| 1035 | WinSetParent(WinWindowFromID(hwnd, FID_SYSMENU), HWND_OBJECT, FALSE);
|
|---|
| 1036 |
|
|---|
| 1037 | if((OSFrameStyle & FCF_MINBUTTON) || (OSFrameStyle & FCF_MAXBUTTON))
|
|---|
| 1038 | WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_MINMAX), hwnd, FALSE);
|
|---|
| 1039 | else
|
|---|
| 1040 | WinSetParent(WinWindowFromID(hwnd, FID_MINMAX), HWND_OBJECT, FALSE);
|
|---|
| 1041 |
|
|---|
| 1042 | if(OSFrameStyle & FCF_VERTSCROLL)
|
|---|
| 1043 | WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_VERTSCROLL), hwnd, FALSE);
|
|---|
| 1044 | else
|
|---|
| 1045 | WinSetParent(WinWindowFromID(hwnd, FID_VERTSCROLL), HWND_OBJECT, FALSE);
|
|---|
| 1046 |
|
|---|
| 1047 | if(OSFrameStyle & FCF_HORZSCROLL)
|
|---|
| 1048 | WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_HORZSCROLL), hwnd, FALSE);
|
|---|
| 1049 | else
|
|---|
| 1050 | WinSetParent(WinWindowFromID(hwnd, FID_HORZSCROLL), HWND_OBJECT, FALSE);
|
|---|
| 1051 |
|
|---|
| 1052 | #if 0
|
|---|
| 1053 | WNDPARAMS wndparam = {0};
|
|---|
| 1054 | FRAMECDATA framecdata = {0};
|
|---|
| 1055 |
|
|---|
| 1056 | framecdata.cb = sizeof(FRAMECDATA);
|
|---|
| 1057 |
|
|---|
| 1058 | wndparam.fsStatus = WPM_CTLDATA;
|
|---|
| 1059 | wndparam.cbCtlData = framecdata.cb;
|
|---|
| 1060 | wndparam.pCtlData = (PVOID)&framecdata;
|
|---|
| 1061 | WinSendMsg(hwnd, WM_QUERYWINDOWPARAMS, &wndparam, 0);
|
|---|
| 1062 |
|
|---|
| 1063 | wndparam.fsStatus = WPM_CTLDATA;
|
|---|
| 1064 | wndparam.pCtlData = (PVOID)&framecdata;
|
|---|
| 1065 | framecdata.flCreateFlags = OSFrameStyle;
|
|---|
| 1066 | WinSendMsg(hwnd, WM_SETWINDOWPARAMS, &wndparam, 0);
|
|---|
| 1067 | #endif
|
|---|
| 1068 |
|
|---|
| 1069 | WinSendMsg(hwnd, WM_UPDATEFRAME,
|
|---|
| 1070 | MPFROMLONG(FCF_TITLEBAR | FCF_SYSMENU | FCF_MINMAX |
|
|---|
| 1071 | FCF_MENU | FCF_VERTSCROLL | FCF_HORZSCROLL),
|
|---|
| 1072 | MPVOID);
|
|---|
| 1073 | }
|
|---|
| 1074 | //******************************************************************************
|
|---|
| 1075 | //******************************************************************************
|
|---|
| 1076 | HWND OSLibWinObjectWindowFromID(HWND hwndOwner, ULONG ID)
|
|---|
| 1077 | {
|
|---|
| 1078 | HWND hwndNext, hwndFound=0;
|
|---|
| 1079 | HENUM henum;
|
|---|
| 1080 |
|
|---|
| 1081 | henum = WinBeginEnumWindows(HWND_OBJECT);
|
|---|
| 1082 | while ((hwndNext = WinGetNextWindow(henum)) != 0)
|
|---|
| 1083 | {
|
|---|
| 1084 | if(WinQueryWindow(hwndNext, QW_OWNER) == hwndOwner &&
|
|---|
| 1085 | WinQueryWindowUShort(hwndNext, QWS_ID) == ID)
|
|---|
| 1086 | {
|
|---|
| 1087 | hwndFound = hwndNext;
|
|---|
| 1088 | break;
|
|---|
| 1089 | }
|
|---|
| 1090 | }
|
|---|
| 1091 | WinEndEnumWindows(henum);
|
|---|
| 1092 | return hwndFound;
|
|---|
| 1093 | }
|
|---|
| 1094 | //******************************************************************************
|
|---|
| 1095 | //******************************************************************************
|
|---|
| 1096 | BOOL OSLibSetWindowID(HWND hwnd, ULONG value)
|
|---|
| 1097 | {
|
|---|
| 1098 | dprintf(("OSLibSetWindowID hwnd:%x ID:%x", hwnd, value));
|
|---|
| 1099 | return WinSetWindowULong(hwnd, QWS_ID, value);
|
|---|
| 1100 | }
|
|---|
| 1101 | //******************************************************************************
|
|---|
| 1102 | //******************************************************************************
|
|---|
| 1103 | PVOID OSLibWinSubclassWindow(HWND hwnd,PVOID newWndProc)
|
|---|
| 1104 | {
|
|---|
| 1105 | return WinSubclassWindow(hwnd,(PFNWP)newWndProc);
|
|---|
| 1106 | }
|
|---|
| 1107 | //******************************************************************************
|
|---|
| 1108 | //******************************************************************************
|
|---|
| 1109 | BOOL OSLibSetWindowRestoreRect(HWND hwnd, PRECT pRect)
|
|---|
| 1110 | {
|
|---|
| 1111 | ULONG yHeight = OSLibGetWindowHeight(WinQueryWindow(hwnd, QW_PARENT));
|
|---|
| 1112 |
|
|---|
| 1113 | WinSetWindowUShort(hwnd, QWS_XRESTORE, (USHORT)pRect->left );
|
|---|
| 1114 | WinSetWindowUShort(hwnd, QWS_YRESTORE, (USHORT)(yHeight - pRect->top -
|
|---|
| 1115 | (pRect->bottom - pRect->top)));
|
|---|
| 1116 | WinSetWindowUShort(hwnd, QWS_CXRESTORE, (USHORT)(pRect->right - pRect->left));
|
|---|
| 1117 | WinSetWindowUShort(hwnd, QWS_CYRESTORE, (USHORT)(pRect->bottom - pRect->top));
|
|---|
| 1118 | return TRUE;
|
|---|
| 1119 | }
|
|---|
| 1120 | //******************************************************************************
|
|---|
| 1121 | //******************************************************************************
|
|---|
| 1122 | BOOL OSLibSetWindowMinPos(HWND hwnd, ULONG x, ULONG y)
|
|---|
| 1123 | {
|
|---|
| 1124 | ULONG yHeight = OSLibGetWindowHeight(WinQueryWindow(hwnd, QW_PARENT));
|
|---|
| 1125 |
|
|---|
| 1126 | WinSetWindowUShort(hwnd, QWS_XMINIMIZE, (USHORT)x );
|
|---|
| 1127 | WinSetWindowUShort(hwnd, QWS_YMINIMIZE, (USHORT)(yHeight - y -
|
|---|
| 1128 | ( 2 * WinQuerySysValue( HWND_DESKTOP, SV_CYSIZEBORDER)) -
|
|---|
| 1129 | WinQuerySysValue( HWND_DESKTOP, SV_CYICON)));
|
|---|
| 1130 | return TRUE;
|
|---|
| 1131 | }
|
|---|
| 1132 | //******************************************************************************
|
|---|
| 1133 | //******************************************************************************
|
|---|
| 1134 | BOOL OSLibWinGetKeyboardStateTable(unsigned char *PMKeyState)
|
|---|
| 1135 | {
|
|---|
| 1136 | return WinSetKeyboardStateTable(HWND_DESKTOP, (PBYTE)&PMKeyState, FALSE );
|
|---|
| 1137 | }
|
|---|
| 1138 | //******************************************************************************
|
|---|
| 1139 | //******************************************************************************
|
|---|
| 1140 | BOOL OSLibWinSetKeyboardStateTable(unsigned char *PMKeyState)
|
|---|
| 1141 | {
|
|---|
| 1142 | return WinSetKeyboardStateTable(HWND_DESKTOP, (PBYTE)&PMKeyState, TRUE );
|
|---|
| 1143 | }
|
|---|
| 1144 | //******************************************************************************
|
|---|
| 1145 | //******************************************************************************
|
|---|
| 1146 | BOOL OSLibWinEnableWindowUpdate(HWND hwnd,BOOL fEnable)
|
|---|
| 1147 | {
|
|---|
| 1148 | return WinEnableWindowUpdate(hwnd,fEnable);
|
|---|
| 1149 | }
|
|---|
| 1150 | //******************************************************************************
|
|---|
| 1151 | //******************************************************************************
|
|---|
| 1152 | ULONG OSLibWinGetLastError()
|
|---|
| 1153 | {
|
|---|
| 1154 | return WinGetLastError(GetThreadHAB()) & 0xFFFF;
|
|---|
| 1155 | }
|
|---|
| 1156 | //******************************************************************************
|
|---|
| 1157 | //TODO: Include scroll bars?
|
|---|
| 1158 | //******************************************************************************
|
|---|
| 1159 | HWND OSLibWinIsFrameControl(HWND hwnd)
|
|---|
| 1160 | {
|
|---|
| 1161 | HWND hwndFrame = WinQueryWindow(hwnd, QW_PARENT);
|
|---|
| 1162 |
|
|---|
| 1163 | if(hwnd == WinWindowFromID(hwndFrame, FID_TITLEBAR)) {
|
|---|
| 1164 | return hwndFrame;
|
|---|
| 1165 | }
|
|---|
| 1166 | if(hwnd == WinWindowFromID(hwndFrame, FID_MENU)) {
|
|---|
| 1167 | return hwndFrame;
|
|---|
| 1168 | }
|
|---|
| 1169 | return 0;
|
|---|
| 1170 | }
|
|---|
| 1171 | //******************************************************************************
|
|---|
| 1172 | //******************************************************************************
|
|---|
| 1173 | HWND OSLibWinGetFrameControlHandle(HWND hwndFrame, int framecontrol)
|
|---|
| 1174 | {
|
|---|
| 1175 | switch(framecontrol) {
|
|---|
| 1176 | case OSLIB_FID_TITLEBAR:
|
|---|
| 1177 | framecontrol = FID_TITLEBAR;
|
|---|
| 1178 | break;
|
|---|
| 1179 | case OSLIB_FID_SYSMENU:
|
|---|
| 1180 | framecontrol = FID_SYSMENU;
|
|---|
| 1181 | break;
|
|---|
| 1182 | case OSLIB_FID_MENU:
|
|---|
| 1183 | framecontrol = FID_MENU;
|
|---|
| 1184 | break;
|
|---|
| 1185 | default:
|
|---|
| 1186 | return 0;
|
|---|
| 1187 | }
|
|---|
| 1188 | return WinWindowFromID(hwndFrame, framecontrol);
|
|---|
| 1189 | }
|
|---|
| 1190 | //******************************************************************************
|
|---|
| 1191 | //******************************************************************************
|
|---|