Mercurial > dwindows
comparison os2/dw.c @ 847:2663f23c88a5
Basics of scrolling working on OS/2.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 31 Mar 2011 01:17:09 +0000 |
parents | a75e798ee6ed |
children | 543e591c69a3 |
comparison
equal
deleted
inserted
replaced
846:a75e798ee6ed | 847:2663f23c88a5 |
---|---|
1379 hpos = usedx; | 1379 hpos = usedx; |
1380 WinSendMsg(hscroll, SBM_SETPOS, (MPARAM)hpos, 0); | 1380 WinSendMsg(hscroll, SBM_SETPOS, (MPARAM)hpos, 0); |
1381 } | 1381 } |
1382 | 1382 |
1383 /* Position the scrolled box */ | 1383 /* Position the scrolled box */ |
1384 WinSetWindowPos(box, HWND_TOP, 0, -(cy - origy), cx, cy, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | 1384 WinSetWindowPos(box, HWND_TOP, 0, -(cy - origy), cx, cy, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
1385 | |
1386 dw_window_set_data(handle, "_dw_cy", (void *)(cy - origy)); | |
1385 | 1387 |
1386 /* Layout the content of the scrollbox */ | 1388 /* Layout the content of the scrollbox */ |
1387 _do_resize(thisbox, cx, cy); | 1389 _do_resize(thisbox, cx, cy); |
1388 } | 1390 } |
1389 else if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) | 1391 else if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) |
1613 { | 1615 { |
1614 switch(msg) | 1616 switch(msg) |
1615 { | 1617 { |
1616 case WM_HSCROLL: | 1618 case WM_HSCROLL: |
1617 case WM_VSCROLL: | 1619 case WM_VSCROLL: |
1618 break; | 1620 { |
1621 MPARAM res; | |
1622 int *pos, min, max, page, which = SHORT2FROMMP(mp2); | |
1623 HWND handle, client = WinWindowFromID(hWnd, FID_CLIENT); | |
1624 HWND box = (HWND)dw_window_get_data(hWnd, "_dw_resizebox"); | |
1625 HWND hscroll = WinWindowFromID(hWnd, FID_HORZSCROLL); | |
1626 HWND vscroll = WinWindowFromID(hWnd, FID_VERTSCROLL); | |
1627 int hpos = dw_scrollbar_get_pos(hscroll); | |
1628 int vpos = dw_scrollbar_get_pos(vscroll); | |
1629 int cy = (int)dw_window_get_data(hWnd, "_dw_cy"); | |
1630 RECTL rect; | |
1631 | |
1632 WinQueryWindowRect(client, &rect); | |
1633 | |
1634 if(msg == WM_VSCROLL) | |
1635 { | |
1636 page = rect.yTop - rect.yBottom; | |
1637 handle = vscroll; | |
1638 pos = &vpos; | |
1639 } | |
1640 else | |
1641 { | |
1642 page = rect.xRight - rect.xLeft; | |
1643 handle = hscroll; | |
1644 pos = &hpos; | |
1645 } | |
1646 | |
1647 if(msg == SB_SLIDERTRACK) | |
1648 return pos; | |
1649 | |
1650 res = WinSendMsg(handle, SBM_QUERYRANGE, 0, 0); | |
1651 | |
1652 min = SHORT1FROMMP(res); | |
1653 max = SHORT2FROMMP(res); | |
1654 | |
1655 switch(which) | |
1656 { | |
1657 case SB_SLIDERTRACK: | |
1658 *pos = SHORT1FROMMP(mp2); | |
1659 break; | |
1660 case SB_LINEUP: | |
1661 *pos--; | |
1662 if(*pos < min) | |
1663 *pos = min; | |
1664 break; | |
1665 case SB_LINEDOWN: | |
1666 *pos++; | |
1667 if(*pos > max) | |
1668 *pos = max; | |
1669 break; | |
1670 case SB_PAGEUP: | |
1671 *pos -= page; | |
1672 if(*pos < min) | |
1673 *pos = min; | |
1674 break; | |
1675 case SB_PAGEDOWN: | |
1676 *pos += page; | |
1677 if(*pos > max) | |
1678 *pos = max; | |
1679 break; | |
1680 } | |
1681 WinSendMsg(handle, SBM_SETPOS, (MPARAM)*pos, 0); | |
1682 /* Position the scrolled box */ | |
1683 WinSetWindowPos(box, HWND_TOP, -hpos, -(cy - vpos), 0, 0, SWP_MOVE); | |
1684 break; | |
1685 } | |
1619 } | 1686 } |
1620 return WinDefWindowProc(hWnd, msg, mp1, mp2); | 1687 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
1621 } | 1688 } |
1622 | 1689 |
1623 void _click_default(HWND handle) | 1690 void _click_default(HWND handle) |