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

Method SelectItem

DuiLib/Control/UIList.cpp:354–390  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

352}
353
354bool CListUI::SelectItem(int iIndex, bool bTakeFocus)
355{
356 if( iIndex == m_iCurSel ) return true;
357
358 int iOldSel = m_iCurSel;
359 // We should first unselect the currently selected item
360 if( m_iCurSel >= 0 ) {
361 CControlUI* pControl = GetItemAt(m_iCurSel);
362 if( pControl != NULL) {
363 IListItemUI* pListItem = static_cast<IListItemUI*>(pControl->GetInterface(_T("ListItem")));
364 if( pListItem != NULL ) pListItem->Select(false);
365 }
366
367 m_iCurSel = -1;
368 }
369 if( iIndex < 0 ) return false;
370
371 CControlUI* pControl = GetItemAt(iIndex);
372 if( pControl == NULL ) return false;
373 if( !pControl->IsVisible() ) return false;
374 if( !pControl->IsEnabled() ) return false;
375
376 IListItemUI* pListItem = static_cast<IListItemUI*>(pControl->GetInterface(_T("ListItem")));
377 if( pListItem == NULL ) return false;
378 m_iCurSel = iIndex;
379 if( !pListItem->Select(true) ) {
380 m_iCurSel = -1;
381 return false;
382 }
383 EnsureVisible(m_iCurSel);
384 if( bTakeFocus ) pControl->SetFocus();
385 if( m_pManager != NULL ) {
386 m_pManager->SendNotify(this, DUI_MSGTYPE_ITEMSELECT, m_iCurSel, iOldSel);
387 }
388
389 return true;
390}
391
392TListInfoUI* CListUI::GetListInfo()
393{

Callers 6

SortItemsMethod · 0.45
SetVisibleMethod · 0.45
SelectMethod · 0.45
OnSelectChangedMethod · 0.45
DoFillDataMethod · 0.45
DoEventMethod · 0.45

Calls 6

IsVisibleMethod · 0.80
IsEnabledMethod · 0.80
SendNotifyMethod · 0.80
GetInterfaceMethod · 0.45
SelectMethod · 0.45
SetFocusMethod · 0.45

Tested by

no test coverage detected