Changeset 1057 for trunk/src/user32/scroll.cpp
- Timestamp:
- Sep 26, 1999, 12:10:02 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/scroll.cpp
r949 r1057 1 /* $Id: scroll.cpp,v 1. 1 1999-09-15 23:18:55sandervl Exp $ */1 /* $Id: scroll.cpp,v 1.2 1999-09-26 10:10:00 sandervl Exp $ */ 2 2 /* 3 3 * Scrollbar control … … 17 17 18 18 #include <stdlib.h> 19 #include "winuser.h" 20 #include "winbase.h" 19 #include <os2win.h> 21 20 #include "controls.h" 22 21 #include "scroll.h" 22 #include "win32wbase.h" 23 #include "oslibwin.h" 23 24 24 25 static HBITMAP hUpArrow = 0; … … 98 99 const SCROLLINFO *info, INT *action ); 99 100 static void SCROLL_DrawInterior_9x( HWND hwnd, HDC hdc, INT nBar, 100 101 102 103 101 RECT *rect, INT arrowSize, 102 INT thumbSize, INT thumbPos, 103 UINT flags, BOOL vertical, 104 BOOL top_selected, BOOL bottom_selected ); 104 105 105 106 /*********************************************************************** … … 402 403 403 404 DrawFrameControl( hdc, &r, DFC_SCROLL, 404 405 406 405 (vertical ? DFCS_SCROLLUP : DFCS_SCROLLLEFT) 406 | (top_pressed ? (DFCS_PUSHED | DFCS_FLAT) : 0 ) 407 | (infoPtr->flags&ESB_DISABLE_LTUP ? DFCS_INACTIVE : 0 ) ); 407 408 408 409 r = *rect; … … 413 414 414 415 DrawFrameControl( hdc, &r, DFC_SCROLL, 415 (vertical ? DFCS_SCROLLDOWN : DFCS_SCROLLRIGHT) 416 | (bottom_pressed ? (DFCS_PUSHED | DFCS_FLAT) : 0 ) 417 | (infoPtr->flags&ESB_DISABLE_RTDN ? DFCS_INACTIVE : 0) ); 418 } 419 416 (vertical ? DFCS_SCROLLDOWN : DFCS_SCROLLRIGHT) 417 | (bottom_pressed ? (DFCS_PUSHED | DFCS_FLAT) : 0 ) 418 | (infoPtr->flags&ESB_DISABLE_RTDN ? DFCS_INACTIVE : 0) ); 419 } 420 //****************************************************************************** 421 //****************************************************************************** 420 422 static void SCROLL_DrawArrows( HDC hdc, SCROLLBAR_INFO *infoPtr, 421 422 423 RECT *rect, INT arrowSize, BOOL vertical, 424 BOOL top_pressed, BOOL bottom_pressed ) 423 425 { 424 426 SCROLL_DrawArrows_9x( hdc, infoPtr, rect, arrowSize, … … 433 435 */ 434 436 static void SCROLL_DrawMovingThumb_9x( HDC hdc, RECT *rect, BOOL vertical, 435 437 INT arrowSize, INT thumbSize ) 436 438 { 437 439 INT pos = SCROLL_TrackingPos; … … 451 453 452 454 SCROLL_DrawInterior_9x( SCROLL_TrackingWin, hdc, SCROLL_TrackingBar, 453 454 455 455 rect, arrowSize, thumbSize, pos, 456 0, vertical, FALSE, FALSE ); 457 456 458 SCROLL_MovingThumb = !SCROLL_MovingThumb; 457 459 } 458 460 //****************************************************************************** 461 //****************************************************************************** 459 462 static void SCROLL_DrawMovingThumb( HDC hdc, RECT *rect, BOOL vertical, 460 463 INT arrowSize, INT thumbSize ) 461 464 { 462 465 SCROLL_DrawMovingThumb_9x( hdc, rect, vertical, arrowSize, thumbSize ); 463 466 } 464 465 467 /*********************************************************************** 466 468 * SCROLL_DrawInterior … … 469 471 */ 470 472 static void SCROLL_DrawInterior_9x( HWND hwnd, HDC hdc, INT nBar, 471 472 473 474 473 RECT *rect, INT arrowSize, 474 INT thumbSize, INT thumbPos, 475 UINT flags, BOOL vertical, 476 BOOL top_selected, BOOL bottom_selected ) 475 477 { 476 478 RECT r; … … 485 487 { 486 488 hBrush = (HBRUSH)SendMessageA( GetParent(hwnd), WM_CTLCOLORSCROLLBAR, 487 489 (WPARAM)hdc,(LPARAM)hwnd); 488 490 } 489 491 else … … 556 558 SelectObject( hdc, hSaveBrush ); 557 559 } 558 559 560 //****************************************************************************** 561 //****************************************************************************** 560 562 static void SCROLL_DrawInterior( HWND hwnd, HDC hdc, INT nBar, 561 563 RECT *rect, INT arrowSize, … … 607 609 /* Draw the scroll bar frame */ 608 610 609 611 /* Only draw outline if Win 3.1. Mar 24, 1999 - Ronald B. Cemer */ 610 612 611 613 /* Draw the scroll rectangles and thumb */ … … 673 675 SelectObject( hdc, hSaveBrush ); 674 676 } 675 676 677 /*********************************************************************** 677 678 * SCROLL_DrawScrollBar … … 724 725 725 726 } 726 727 728 727 /*********************************************************************** 729 728 * SCROLL_RefreshScrollBar … … 742 741 ReleaseDC( hwnd, hdc ); 743 742 } 744 745 746 743 /*********************************************************************** 747 744 * SCROLL_HandleKbdEvent … … 769 766 msg, hwnd ); 770 767 } 771 772 773 768 /*********************************************************************** 774 769 * SCROLL_HandleScrollEvent … … 985 980 ReleaseDC( hwnd, hdc ); 986 981 } 987 988 989 982 /*********************************************************************** 990 983 * ScrollBarWndProc … … 1124 1117 * the text), and info->nPage=25. 1125 1118 */ 1126 /* CB:1127 1128 1119 INT WINAPI SetScrollInfo( 1129 HWND hwnd / * [I] Handle of window whose scrollbar will be affected */,1130 INT nBar / * [I] One of SB_HORZ, SB_VERT, or SB_CTL */,1131 const SCROLLINFO *info / * [I] Specifies what to change and new values */,1132 BOOL bRedraw / * [I] Should scrollbar be redrawn afterwards ? */)1120 HWND hwnd /* [I] Handle of window whose scrollbar will be affected */, 1121 INT nBar /* [I] One of SB_HORZ, SB_VERT, or SB_CTL */, 1122 const SCROLLINFO *info /* [I] Specifies what to change and new values */, 1123 BOOL bRedraw /* [I] Should scrollbar be redrawn afterwards ? */) 1133 1124 { 1134 1125 INT action; … … 1141 1132 if( action & SA_SSI_SHOW ) 1142 1133 if( SCROLL_ShowScrollBar( hwnd, nBar, TRUE, TRUE ) ) 1143 return retVal; / * SetWindowPos() already did the painting */1134 return retVal; /* SetWindowPos() already did the painting */ 1144 1135 1145 1136 if( bRedraw && (action & SA_SSI_REFRESH)) … … 1149 1140 } 1150 1141 return retVal; 1151 } */ 1152 1142 } 1143 //****************************************************************************** 1144 //****************************************************************************** 1153 1145 INT SCROLL_SetScrollInfo( HWND hwnd, INT nBar, 1154 1146 const SCROLLINFO *info, INT *action ) … … 1276 1268 return infoPtr->CurVal; 1277 1269 } 1278 1279 1280 1270 /************************************************************************* 1281 1271 * GetScrollInfo32 (USER32.284) … … 1285 1275 * RETURNS STD 1286 1276 */ 1287 /* CB:1288 1277 BOOL WINAPI GetScrollInfo( 1289 HWND hwnd / * [I] Handle of window */ ,1290 INT nBar / * [I] One of SB_HORZ, SB_VERT, or SB_CTL */,1291 LPSCROLLINFO info / * [IO] (info.fMask [I] specifies which values are to retrieve) */)1278 HWND hwnd /* [I] Handle of window */ , 1279 INT nBar /* [I] One of SB_HORZ, SB_VERT, or SB_CTL */, 1280 LPSCROLLINFO info /* [IO] (info.fMask [I] specifies which values are to retrieve) */) 1292 1281 { 1293 1282 SCROLLBAR_INFO *infoPtr; … … 1308 1297 } 1309 1298 return (info->fMask & SIF_ALL) != 0; 1310 } */ 1311 1312 1299 } 1313 1300 /************************************************************************* 1314 1301 * SetScrollPos32 (USER32.502) … … 1322 1309 * to make sure there was an error (and to know which one). 1323 1310 */ 1324 /* CB:1325 1311 INT WINAPI SetScrollPos( 1326 HWND hwnd / * [I] Handle of window whose scrollbar will be affected */,1327 INT nBar / * [I] One of SB_HORZ, SB_VERT, or SB_CTL */,1328 INT nPos / * [I] New value */,1329 BOOL bRedraw / * [I] Should scrollbar be redrawn afterwards ? */ )1312 HWND hwnd /* [I] Handle of window whose scrollbar will be affected */, 1313 INT nBar /* [I] One of SB_HORZ, SB_VERT, or SB_CTL */, 1314 INT nPos /* [I] New value */, 1315 BOOL bRedraw /* [I] Should scrollbar be redrawn afterwards ? */ ) 1330 1316 { 1331 1317 SCROLLINFO info; … … 1340 1326 SetScrollInfo( hwnd, nBar, &info, bRedraw ); 1341 1327 return oldPos; 1342 } */ 1343 1344 1328 } 1345 1329 /************************************************************************* 1346 1330 * GetScrollPos32 (USER32.285) … … 1354 1338 * to make sure there was an error (and to know which one). 1355 1339 */ 1356 /* CB:1357 1340 INT WINAPI GetScrollPos( 1358 HWND hwnd, / * [I] Handle of window */1359 INT nBar / * [I] One of SB_HORZ, SB_VERT, or SB_CTL */)1341 HWND hwnd, /* [I] Handle of window */ 1342 INT nBar /* [I] One of SB_HORZ, SB_VERT, or SB_CTL */) 1360 1343 { 1361 1344 SCROLLBAR_INFO *infoPtr; … … 1363 1346 if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ))) return 0; 1364 1347 return infoPtr->CurVal; 1365 } */ 1366 1367 1348 } 1368 1349 /************************************************************************* 1369 1350 * SetScrollRange32 (USER32.503) … … 1371 1352 * RETURNS STD 1372 1353 */ 1373 /* CB:1374 1354 BOOL WINAPI SetScrollRange( 1375 HWND hwnd, / * [I] Handle of window whose scrollbar will be affected */1376 INT nBar, / * [I] One of SB_HORZ, SB_VERT, or SB_CTL */1377 INT MinVal, / * [I] New minimum value */1378 INT MaxVal, / * [I] New maximum value */1379 BOOL bRedraw / * [I] Should scrollbar be redrawn afterwards ? */)1355 HWND hwnd, /* [I] Handle of window whose scrollbar will be affected */ 1356 INT nBar, /* [I] One of SB_HORZ, SB_VERT, or SB_CTL */ 1357 INT MinVal, /* [I] New minimum value */ 1358 INT MaxVal, /* [I] New maximum value */ 1359 BOOL bRedraw /* [I] Should scrollbar be redrawn afterwards ? */) 1380 1360 { 1381 1361 SCROLLINFO info; … … 1387 1367 SetScrollInfo( hwnd, nBar, &info, bRedraw ); 1388 1368 return TRUE; 1389 } */ 1390 1391 1369 } 1392 1370 /************************************************************************* 1393 1371 * SCROLL_SetNCSbState … … 1429 1407 * RETURNS STD 1430 1408 */ 1431 /* CB:1432 1409 BOOL WINAPI GetScrollRange( 1433 HWND hwnd, / * [I] Handle of window */1434 INT nBar, / * [I] One of SB_HORZ, SB_VERT, or SB_CTL */1435 LPINT lpMin, / * [O] Where to store minimum value */1436 LPINT lpMax / * [O] Where to store maximum value */)1410 HWND hwnd, /* [I] Handle of window */ 1411 INT nBar, /* [I] One of SB_HORZ, SB_VERT, or SB_CTL */ 1412 LPINT lpMin, /* [O] Where to store minimum value */ 1413 LPINT lpMax /* [O] Where to store maximum value */) 1437 1414 { 1438 1415 SCROLLBAR_INFO *infoPtr; … … 1447 1424 if (lpMax) *lpMax = infoPtr->MaxVal; 1448 1425 return TRUE; 1449 }*/ 1450 1451 1426 } 1452 1427 /************************************************************************* 1453 1428 * SCROLL_ShowScrollBar() … … 1456 1431 * NOTE: fShowV/fShowH must be zero when nBar is SB_HORZ/SB_VERT. 1457 1432 */ 1458 BOOL SCROLL_ShowScrollBar( 1459 1433 BOOL SCROLL_ShowScrollBar(HWND hwnd, INT nBar, 1434 BOOL fShowH, BOOL fShowV ) 1460 1435 { 1461 1436 BOOL retvalue = FALSE; … … 1531 1506 * RETURNS STD 1532 1507 */ 1533 /* CB:1534 1508 BOOL WINAPI ShowScrollBar( 1535 HWND hwnd, / * [I] Handle of window whose scrollbar(s) will be affected * / 1536 INT nBar, / * [I] One of SB_HORZ, SB_VERT, SB_BOTH or SB_CTL * / 1537 BOOL fShow / * [I] TRUE = show, FALSE = hide * /) 1538 { 1509 HWND hwnd, /* [I] Handle of window whose scrollbar(s) will be affected */ 1510 INT nBar, /* [I] One of SB_HORZ, SB_VERT, SB_BOTH or SB_CTL */ 1511 BOOL fShow /* [I] TRUE = show, FALSE = hide */) 1512 { 1513 Win32BaseWindow *window; 1514 1515 dprintf(("ShowScrollBar %04x %d %d\n", hwnd, nBar, fShow)); 1516 1517 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 1518 if(!window) { 1519 dprintf(("ShowScrollBar window not found!")); 1520 SetLastError(ERROR_INVALID_HANDLE); 1521 return 0; 1522 } 1523 if(nBar != SB_CTL || (window->getStyle() & (WM_HSCROLL|WM_VSCROLL) != 0)) 1524 { 1525 BOOL rc; 1526 1527 if(nBar == SB_HORZ || nBar == SB_BOTH) 1528 rc = OSLibWinShowScrollBar(window->getOS2FrameWindowHandle(), OSLIB_HSCROLL, fShow); 1529 1530 if(nBar == SB_VERT || ( rc == TRUE && nBar == SB_BOTH)) 1531 rc = OSLibWinShowScrollBar(window->getOS2FrameWindowHandle(), OSLIB_VSCROLL, fShow); 1532 1533 return rc; 1534 } 1535 1539 1536 SCROLL_ShowScrollBar( hwnd, nBar, (nBar == SB_VERT) ? 0 : fShow, 1540 1537 (nBar == SB_HORZ) ? 0 : fShow ); 1541 1538 return TRUE; 1542 }*/ 1543 1544 1539 } 1545 1540 /************************************************************************* 1546 1541 * EnableScrollBar32 (USER32.171) 1547 1542 */ 1548 /* CB_ 1549 BOOL WINAPI EnableScrollBar( HWND hwnd, INT nBar, UINT flags ) 1550 { 1551 BOOL bFineWithMe; 1552 SCROLLBAR_INFO *infoPtr; 1553 1554 //TRACE("%04x %d %d\n", hwnd, nBar, flags ); 1555 1543 BOOL WINAPI EnableScrollBar( HWND hwnd, INT nBar, UINT flags) 1544 { 1545 Win32BaseWindow *window; 1546 BOOL bFineWithMe; 1547 SCROLLBAR_INFO *infoPtr; 1548 1549 dprintf(("EnableScrollBar %04x %d %d\n", hwnd, nBar, flags)); 1550 1551 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 1552 if(!window) { 1553 dprintf(("EnableScrollBar window not found!")); 1554 SetLastError(ERROR_INVALID_HANDLE); 1555 return 0; 1556 } 1557 if(nBar != SB_CTL || (window->getStyle() & (WM_HSCROLL|WM_VSCROLL) != 0)) 1558 { 1559 BOOL fEnable, rc; 1560 1561 //hwnd = parent window with default scrollbar(s) 1562 switch(flags) { 1563 case ESB_ENABLE_BOTH: 1564 fEnable = TRUE; 1565 break; 1566 case ESB_DISABLE_BOTH: 1567 case ESB_DISABLE_RTDN: 1568 case ESB_DISABLE_LTUP: 1569 fEnable = FALSE; 1570 break; 1571 default: 1572 SetLastError(ERROR_INVALID_PARAMETER); 1573 return 0; 1574 } 1575 if(nBar == SB_HORZ || nBar == SB_BOTH) 1576 rc = OSLibWinEnableScrollBar(window->getOS2FrameWindowHandle(), OSLIB_HSCROLL, fEnable); 1577 1578 if(nBar == SB_VERT || ( rc == TRUE && nBar == SB_BOTH)) 1579 rc = OSLibWinEnableScrollBar(window->getOS2FrameWindowHandle(), OSLIB_VSCROLL, fEnable); 1580 1581 return rc; 1582 } 1556 1583 flags &= ESB_DISABLE_BOTH; 1557 1584 … … 1575 1602 SCROLL_RefreshScrollBar( hwnd, nBar, TRUE, TRUE ); 1576 1603 return TRUE; 1577 }*/ 1578 1604 } 1605 //****************************************************************************** 1606 //****************************************************************************** 1579 1607 BOOL SCROLLBAR_Register() 1580 1608 { … … 1594 1622 return RegisterClassA(&wndClass); 1595 1623 } 1596 1597 1624 //****************************************************************************** 1625 //****************************************************************************** 1598 1626 BOOL SCROLLBAR_Unregister() 1599 1627 { … … 1602 1630 else return FALSE; 1603 1631 } 1632 //****************************************************************************** 1633 //****************************************************************************** 1634
Note:
See TracChangeset
for help on using the changeset viewer.