Changeset 1336 for trunk/src/user32/win32wbase.cpp
- Timestamp:
- Oct 17, 1999, 5:46:10 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/win32wbase.cpp
r1333 r1336 1 /* $Id: win32wbase.cpp,v 1.4 8 1999-10-17 12:17:45 cbratschiExp $ */1 /* $Id: win32wbase.cpp,v 1.49 1999-10-17 15:46:09 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 1238 1238 return NULL; 1239 1239 } 1240 //******************************************************************************1241 //TODO: Not complete1242 //******************************************************************************1243 LONG Win32BaseWindow::setScrollInfo(int nBar, SCROLLINFO *info, int fRedraw)1244 {1245 SCROLLBAR_INFO *infoPtr;1246 HWND hwndScroll;1247 ULONG scrollType;1248 int new_flags;1249 1250 //CB: handled internally1251 return 0;1252 1253 switch(nBar) {1254 case SB_HORZ:1255 if(!horzScrollInfo) {1256 return 0;1257 }1258 infoPtr = horzScrollInfo;1259 hwndScroll = hwndHorzScroll;1260 scrollType = OSLIB_HSCROLL;1261 break;1262 case SB_VERT:1263 if(!vertScrollInfo) {1264 return 0;1265 }1266 infoPtr = vertScrollInfo;1267 hwndScroll = hwndVertScroll;1268 scrollType = OSLIB_VSCROLL;1269 break;1270 default:1271 return 0;1272 }1273 1274 if (info->fMask & ~(SIF_ALL | SIF_DISABLENOSCROLL)) return 0;1275 if ((info->cbSize != sizeof(*info)) &&1276 (info->cbSize != sizeof(*info)-sizeof(info->nTrackPos))) return 0;1277 1278 /* Set the page size */1279 if (info->fMask & SIF_PAGE)1280 {1281 if( infoPtr->Page != info->nPage )1282 {1283 infoPtr->Page = info->nPage;1284 dprintf(("SetScrollInfo: Set pagesize to %d", info->nPage));1285 OSLibWinSetScrollPageSize(OS2HwndFrame, hwndScroll, info->nPage, infoPtr->MaxVal, fRedraw);1286 }1287 }1288 1289 /* Set the scroll pos */1290 if (info->fMask & SIF_POS)1291 {1292 if( infoPtr->CurVal != info->nPos )1293 {1294 infoPtr->CurVal = info->nPos;1295 dprintf(("SetScrollInfo: Set scroll position to %d", info->nPos));1296 OSLibWinSetScrollPos(OS2HwndFrame, hwndScroll, info->nPos, fRedraw);1297 }1298 }1299 1300 /* Set the scroll range */1301 if (info->fMask & SIF_RANGE)1302 {1303 /* Invalid range -> range is set to (0,0) */1304 if ((info->nMin > info->nMax) ||1305 ((UINT)(info->nMax - info->nMin) >= 0x80000000))1306 {1307 infoPtr->MinVal = 0;1308 infoPtr->MaxVal = 0;1309 }1310 else1311 {1312 if( infoPtr->MinVal != info->nMin ||1313 infoPtr->MaxVal != info->nMax )1314 {1315 infoPtr->MinVal = info->nMin;1316 infoPtr->MaxVal = info->nMax;1317 1318 dprintf(("SetScrollInfo: Set scroll range to (%d,%d)", info->nMin, info->nMax));1319 OSLibWinSetScrollRange(OS2HwndFrame, hwndScroll, info->nMin, info->nMax, fRedraw);1320 }1321 }1322 }1323 1324 /* Make sure the page size is valid */1325 if (infoPtr->Page < 0) infoPtr->Page = 0;1326 else if (infoPtr->Page > infoPtr->MaxVal - infoPtr->MinVal + 1 )1327 infoPtr->Page = infoPtr->MaxVal - infoPtr->MinVal + 1;1328 1329 /* Make sure the pos is inside the range */1330 if (infoPtr->CurVal < infoPtr->MinVal)1331 infoPtr->CurVal = infoPtr->MinVal;1332 else if (infoPtr->CurVal > infoPtr->MaxVal - MAX( infoPtr->Page-1, 0 ))1333 infoPtr->CurVal = infoPtr->MaxVal - MAX( infoPtr->Page-1, 0 );1334 1335 /* Check if the scrollbar should be hidden or disabled */1336 if (info->fMask & (SIF_RANGE | SIF_PAGE | SIF_DISABLENOSCROLL))1337 {1338 new_flags = infoPtr->flags;1339 if (infoPtr->MinVal >= infoPtr->MaxVal - MAX( infoPtr->Page-1, 0 ))1340 {1341 /* Hide or disable scroll-bar */1342 if (info->fMask & SIF_DISABLENOSCROLL)1343 {1344 new_flags = ESB_DISABLE_BOTH;1345 // *action |= SA_SSI_REFRESH;1346 }1347 else if (nBar != SB_CTL)1348 {1349 // *action = SA_SSI_HIDE;1350 goto done;1351 }1352 }1353 else /* Show and enable scroll-bar */1354 {1355 new_flags = 0;1356 // if (nBar != SB_CTL)1357 // *action |= SA_SSI_SHOW;1358 }1359 1360 if (infoPtr->flags != new_flags) /* check arrow flags */1361 {1362 infoPtr->flags = new_flags;1363 }1364 }1365 1366 done:1367 /* Return current position */1368 1369 return infoPtr->CurVal;1370 }1371 1240 /***********************************************************************/ 1372 1241 /***********************************************************************/ … … 2011 1880 2012 1881 dprintf(("ShowWindow %x %x", getWindowHandle(), nCmdShow)); 1882 #if 1 1883 if (flags & WIN_NEED_SIZE) 1884 { 1885 /* should happen only in CreateWindowEx() */ 1886 int wParam = SIZE_RESTORED; 1887 1888 flags &= ~WIN_NEED_SIZE; 1889 if (dwStyle & WS_MAXIMIZE) 1890 wParam = SIZE_MAXIMIZED; 1891 else 1892 if (dwStyle & WS_MINIMIZE) 1893 wParam = SIZE_MINIMIZED; 1894 1895 SendMessageA(WM_SIZE, wParam, 1896 MAKELONG(rectClient.right-rectClient.left, 1897 rectClient.bottom-rectClient.top)); 1898 SendMessageA(WM_MOVE, 0, MAKELONG( rectClient.left, rectClient.top ) ); 1899 } 1900 #else 2013 1901 if(fFirstShow) { 2014 1902 if(isFrameWindow() && IS_OVERLAPPED(getStyle()) && !isChild()) { … … 2021 1909 fFirstShow = FALSE; 2022 1910 } 1911 #endif 2023 1912 switch(nCmdShow) 2024 1913 { … … 2344 2233 } 2345 2234 //****************************************************************************** 2346 //TODO: not complete nor correct (distinction be tween top-level, top-most & child windows)2347 2235 //****************************************************************************** 2348 2236 HWND Win32BaseWindow::GetWindow(UINT uCmd) 2349 2237 { 2350 Win32BaseWindow *win32wnd; 2351 ULONG magic; 2352 ULONG getcmd = 0; 2353 HWND hwndRelated, hwnd; 2354 2355 dprintf(("GetWindow %x %d NOT COMPLETE", getWindowHandle(), uCmd)); 2356 hwnd = OS2Hwnd; 2238 HWND hwndRelated = 0; 2239 Win32BaseWindow *window; 2240 2357 2241 switch(uCmd) 2358 2242 { 2359 case GW_CHILD: 2360 getcmd = QWOS_TOP; 2361 break; 2362 case GW_HWNDFIRST: 2363 if(getParent()) { 2364 hwnd = getParent()->getOS2WindowHandle(); 2365 getcmd = QWOS_TOP; //top of child windows 2243 case GW_HWNDFIRST: 2244 if(getParent()) { 2245 window = (Win32BaseWindow *)getParent()->getFirstChild(); 2246 hwndRelated = window->getWindowHandle(); 2247 } 2248 break; 2249 2250 case GW_HWNDLAST: 2251 if(getParent()) 2252 { 2253 goto end; 2254 } 2255 2256 window = this; 2257 while(window) 2258 { 2259 window = (Win32BaseWindow *)window->getNextChild(); 2260 } 2261 hwndRelated = window->getWindowHandle(); 2262 break; 2263 2264 case GW_HWNDNEXT: 2265 window = (Win32BaseWindow *)getNextChild(); 2266 if(window) { 2267 hwndRelated = window->getWindowHandle(); 2268 } 2269 break; 2270 2271 case GW_HWNDPREV: 2272 if(!getParent()) 2273 { 2274 goto end; 2275 } 2276 window = (Win32BaseWindow *)(getParent()->getFirstChild()); /* First sibling */ 2277 if(window == this) 2278 { 2279 hwndRelated = 0; /* First in list */ 2280 goto end; 2281 } 2282 while(window->getNextChild()) 2283 { 2284 if (window->getNextChild() == this) 2285 { 2286 hwndRelated = window->getWindowHandle(); 2287 goto end; 2366 2288 } 2367 else getcmd = QWOS_TOP; //TODO 2368 break; 2369 case GW_HWNDLAST: 2370 if(getParent()) { 2371 hwnd = getParent()->getOS2WindowHandle(); 2372 getcmd = QWOS_BOTTOM; //bottom of child windows 2373 } 2374 else getcmd = QWOS_BOTTOM; //TODO 2375 break; 2376 case GW_HWNDNEXT: 2377 getcmd = QWOS_NEXT; 2378 break; 2379 case GW_HWNDPREV: 2380 getcmd = QWOS_PREV; 2381 break; 2382 case GW_OWNER: 2383 if(owner) { 2384 return owner->getWindowHandle(); 2385 } 2386 else return 0; 2387 } 2388 hwndRelated = OSLibWinQueryWindow(hwnd, getcmd); 2389 if(hwndRelated) 2390 { 2391 win32wnd = (Win32BaseWindow *)OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32WNDPTR); 2392 magic = OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32PM_MAGIC); 2393 if(CheckMagicDword(magic) && win32wnd) 2394 { 2395 return win32wnd->getWindowHandle(); 2396 } 2397 2398 hwndRelated = OSLibWinWindowFromID(hwndRelated, OSLIB_FID_CLIENT); 2399 win32wnd = (Win32BaseWindow *)OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32WNDPTR); 2400 magic = OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32PM_MAGIC); 2401 if(CheckMagicDword(magic) && win32wnd) 2402 { 2403 return win32wnd->getWindowHandle(); 2404 } 2405 } 2406 return 0; 2289 window = (Win32BaseWindow *)window->getNextChild(); 2290 } 2291 break; 2292 2293 case GW_OWNER: 2294 if(getOwner()) { 2295 hwndRelated = getOwner()->getWindowHandle(); 2296 } 2297 break; 2298 2299 case GW_CHILD: 2300 if(getFirstChild()) { 2301 hwndRelated = ((Win32BaseWindow *)getFirstChild())->getWindowHandle(); 2302 } 2303 break; 2304 } 2305 end: 2306 dprintf(("GetWindow %x %d returned %x", getWindowHandle(), uCmd, hwndRelated)); 2307 return hwndRelated; 2407 2308 } 2408 2309 //****************************************************************************** … … 2545 2446 ss.styleOld = dwExStyle; 2546 2447 ss.styleNew = value; 2448 dprintf(("SetWindowLong GWL_EXSTYLE %x new style %x", getWindowHandle(), value)); 2547 2449 SendMessageA(WM_STYLECHANGING,GWL_EXSTYLE,(LPARAM)&ss); 2548 2450 setExStyle(ss.styleNew); … … 2556 2458 ss.styleOld = dwStyle; 2557 2459 ss.styleNew = value; 2460 dprintf(("SetWindowLong GWL_STYLE %x new style %x", getWindowHandle(), value)); 2558 2461 SendMessageA(WM_STYLECHANGING,GWL_STYLE,(LPARAM)&ss); 2559 2462 setStyle(ss.styleNew);
Note:
See TracChangeset
for help on using the changeset viewer.