| 630 | } |
| 631 | |
| 632 | void CListUI::EnsureVisible(int iIndex) |
| 633 | { |
| 634 | if( m_iCurSel < 0 ) return; |
| 635 | RECT rcItem = m_pList->GetItemAt(iIndex)->GetPos(); |
| 636 | RECT rcList = m_pList->GetPos(); |
| 637 | RECT rcListInset = m_pList->GetInset(); |
| 638 | |
| 639 | rcList.left += rcListInset.left; |
| 640 | rcList.top += rcListInset.top; |
| 641 | rcList.right -= rcListInset.right; |
| 642 | rcList.bottom -= rcListInset.bottom; |
| 643 | |
| 644 | CScrollBarUI* pHorizontalScrollBar = m_pList->GetHorizontalScrollBar(); |
| 645 | if( pHorizontalScrollBar && pHorizontalScrollBar->IsVisible() ) rcList.bottom -= pHorizontalScrollBar->GetFixedHeight(); |
| 646 | |
| 647 | int iPos = m_pList->GetScrollPos().cy; |
| 648 | if( rcItem.top >= rcList.top && rcItem.bottom < rcList.bottom ) return; |
| 649 | int dx = 0; |
| 650 | if( rcItem.top < rcList.top ) dx = rcItem.top - rcList.top; |
| 651 | if( rcItem.bottom > rcList.bottom ) dx = rcItem.bottom - rcList.bottom; |
| 652 | Scroll(0, dx); |
| 653 | } |
| 654 | |
| 655 | void CListUI::Scroll(int dx, int dy) |
| 656 | { |
nothing calls this directly
no test coverage detected