Mercurial > dwindows
comparison os2/dw.c @ 848:543e591c69a3
Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
Also fixed an issue with the line scrolling (up/down/left/right arrows) on OS/2.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 31 Mar 2011 01:37:18 +0000 |
parents | 2663f23c88a5 |
children | 39a74ebfdd0d |
comparison
equal
deleted
inserted
replaced
847:2663f23c88a5 | 848:543e591c69a3 |
---|---|
1642 page = rect.xRight - rect.xLeft; | 1642 page = rect.xRight - rect.xLeft; |
1643 handle = hscroll; | 1643 handle = hscroll; |
1644 pos = &hpos; | 1644 pos = &hpos; |
1645 } | 1645 } |
1646 | 1646 |
1647 if(msg == SB_SLIDERTRACK) | 1647 res = WinSendMsg(handle, SBM_QUERYRANGE, 0, 0); |
1648 return pos; | |
1649 | |
1650 res = WinSendMsg(handle, SBM_QUERYRANGE, 0, 0); | |
1651 | |
1652 min = SHORT1FROMMP(res); | 1648 min = SHORT1FROMMP(res); |
1653 max = SHORT2FROMMP(res); | 1649 max = SHORT2FROMMP(res); |
1654 | 1650 |
1655 switch(which) | 1651 switch(which) |
1656 { | 1652 { |
1657 case SB_SLIDERTRACK: | 1653 case SB_SLIDERTRACK: |
1658 *pos = SHORT1FROMMP(mp2); | 1654 *pos = SHORT1FROMMP(mp2); |
1659 break; | 1655 break; |
1660 case SB_LINEUP: | 1656 case SB_LINEUP: |
1661 *pos--; | 1657 (*pos)--; |
1662 if(*pos < min) | 1658 if(*pos < min) |
1663 *pos = min; | 1659 *pos = min; |
1664 break; | 1660 break; |
1665 case SB_LINEDOWN: | 1661 case SB_LINEDOWN: |
1666 *pos++; | 1662 (*pos)++; |
1667 if(*pos > max) | 1663 if(*pos > max) |
1668 *pos = max; | 1664 *pos = max; |
1669 break; | 1665 break; |
1670 case SB_PAGEUP: | 1666 case SB_PAGEUP: |
1671 *pos -= page; | 1667 (*pos) -= page; |
1672 if(*pos < min) | 1668 if(*pos < min) |
1673 *pos = min; | 1669 *pos = min; |
1674 break; | 1670 break; |
1675 case SB_PAGEDOWN: | 1671 case SB_PAGEDOWN: |
1676 *pos += page; | 1672 (*pos) += page; |
1677 if(*pos > max) | 1673 if(*pos > max) |
1678 *pos = max; | 1674 *pos = max; |
1679 break; | 1675 break; |
1680 } | 1676 } |
1681 WinSendMsg(handle, SBM_SETPOS, (MPARAM)*pos, 0); | 1677 WinSendMsg(handle, SBM_SETPOS, (MPARAM)*pos, 0); |
4248 dw_window_set_color(newbox->hwnd, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | 4244 dw_window_set_color(newbox->hwnd, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); |
4249 return newbox->hwnd; | 4245 return newbox->hwnd; |
4250 } | 4246 } |
4251 | 4247 |
4252 /* | 4248 /* |
4253 * INCOMPLETE | |
4254 * Create a new scroll Box to be packed. | 4249 * Create a new scroll Box to be packed. |
4255 * Parameters: | 4250 * Parameters: |
4256 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). | 4251 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
4257 * pad: Number of pixels to pad around the box. | 4252 * pad: Number of pixels to pad around the box. |
4258 */ | 4253 */ |
4277 dw_window_set_color(hwndframe, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | 4272 dw_window_set_color(hwndframe, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); |
4278 dw_window_set_color(client, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | 4273 dw_window_set_color(client, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); |
4279 return hwndframe; | 4274 return hwndframe; |
4280 } | 4275 } |
4281 | 4276 |
4277 /* | |
4278 * Returns the position of the scrollbar in the scrollbox | |
4279 * Parameters: | |
4280 * handle: Handle to the scrollbox to be queried. | |
4281 * orient: The vertical or horizontal scrollbar. | |
4282 */ | |
4282 int API dw_scrollbox_get_pos( HWND handle, int orient ) | 4283 int API dw_scrollbox_get_pos( HWND handle, int orient ) |
4283 { | 4284 { |
4284 return 0; | 4285 HWND scroll; |
4285 } | 4286 |
4286 | 4287 if(orient == DW_VERT) |
4288 { | |
4289 scroll = WinWindowFromID(handle, FID_VERTSCROLL); | |
4290 } | |
4291 else | |
4292 { | |
4293 scroll = WinWindowFromID(handle, FID_HORZSCROLL); | |
4294 } | |
4295 return (int)WinSendMsg(scroll, SBM_QUERYPOS, 0, 0); | |
4296 } | |
4297 | |
4298 /* | |
4299 * Gets the range for the scrollbar in the scrollbox. | |
4300 * Parameters: | |
4301 * handle: Handle to the scrollbox to be queried. | |
4302 * orient: The vertical or horizontal scrollbar. | |
4303 */ | |
4287 int API dw_scrollbox_get_range( HWND handle, int orient ) | 4304 int API dw_scrollbox_get_range( HWND handle, int orient ) |
4288 { | 4305 { |
4289 return 0; | 4306 HWND scroll; |
4290 } | 4307 |
4308 if(orient == DW_VERT) | |
4309 { | |
4310 scroll = WinWindowFromID(handle, FID_VERTSCROLL); | |
4311 } | |
4312 else | |
4313 { | |
4314 scroll = WinWindowFromID(handle, FID_HORZSCROLL); | |
4315 } | |
4316 return SHORT2FROMMP(WinSendMsg(scroll, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), 0)); | |
4317 } | |
4318 | |
4291 /* | 4319 /* |
4292 * Create a new Group Box to be packed. | 4320 * Create a new Group Box to be packed. |
4293 * Parameters: | 4321 * Parameters: |
4294 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). | 4322 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
4295 * pad: Number of pixels to pad around the box. | 4323 * pad: Number of pixels to pad around the box. |