MCPcopy Create free account
hub / github.com/cinience/RedisStudio / EnsureVisible

Method EnsureVisible

DuiLib/Control/UICombo.cpp:172–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172void CComboWnd::EnsureVisible(int iIndex)
173{
174 if( m_pOwner->GetCurSel() < 0 ) return;
175 m_pLayout->FindSelectable(m_pOwner->GetCurSel(), false);
176 RECT rcItem = m_pLayout->GetItemAt(iIndex)->GetPos();
177 RECT rcList = m_pLayout->GetPos();
178 CScrollBarUI* pHorizontalScrollBar = m_pLayout->GetHorizontalScrollBar();
179 if( pHorizontalScrollBar && pHorizontalScrollBar->IsVisible() ) rcList.bottom -= pHorizontalScrollBar->GetFixedHeight();
180 int iPos = m_pLayout->GetScrollPos().cy;
181 if( rcItem.top >= rcList.top && rcItem.bottom < rcList.bottom ) return;
182 int dx = 0;
183 if( rcItem.top < rcList.top ) dx = rcItem.top - rcList.top;
184 if( rcItem.bottom > rcList.bottom ) dx = rcItem.bottom - rcList.bottom;
185 Scroll(0, dx);
186}
187
188void CComboWnd::Scroll(int dx, int dy)
189{

Callers

nothing calls this directly

Calls 7

FindSelectableMethod · 0.80
IsVisibleMethod · 0.80
GetFixedHeightMethod · 0.80
GetCurSelMethod · 0.45
GetItemAtMethod · 0.45
GetScrollPosMethod · 0.45

Tested by

no test coverage detected