bool CNavigatorPanelUI::Add(CControlUI* pControl) { IListItemUI* pListItem = static_cast<IListItemUI*>(pControl->GetInterface(_T("ListItem"))); if (pListItem != NULL) { pListItem->SetOwner(this); pListItem->SetIndex(m_items.GetSize()); } return CContainerUI::Add(pControl); }
bool NavigatorPanelUI::Add(ControlUI* ctrl) { IListItemUI* listItem = static_cast<IListItemUI*>(ctrl->GetInterface("ListItem")); if (listItem != NULL) { listItem->SetOwner(this); listItem->SetIndex(m_items.Count()); } return ContainerUI::Add(ctrl); }
bool CUIComboBox::Add(CUIControl* pControl) { if (m_pWindow) { return false; } IListItemUI* pListItem = static_cast<IListItemUI*>(pControl->GetInterface(_T("ListItem"))); if( pListItem != NULL ) { pListItem->SetOwner(this); pListItem->SetIndex(m_items.GetSize()); } return CUIContainer::Add(pControl); }
bool CListUI::Add(CControlUI* pControl) { // Override the Add() method so we can add items specifically to // the intended widgets. Headers and footers are assumed to be // answer the correct interface so we can add multiple list headers/footers. if( pControl->GetInterface(_T("ListHeader")) != NULL ) return CVerticalLayoutUI::Add(pControl); if( pControl->GetInterface(_T("ListFooter")) != NULL ) return CVerticalLayoutUI::Add(pControl); // We also need to recognize header sub-items if( _tcsstr(pControl->GetClass(), _T("Header")) != NULL ) return m_pHeader->Add(pControl); if( _tcsstr(pControl->GetClass(), _T("Footer")) != NULL ) return m_pFooter->Add(pControl); // The list items should know about us IListItemUI* pListItem = static_cast<IListItemUI*>(pControl->GetInterface(_T("ListItem"))); if( pListItem != NULL ) { pListItem->SetOwner(this); pListItem->SetIndex(GetCount()); } return m_pList->Add(pControl); }
bool CComboUI::AddAt(CControlUI* pControl, int iIndex) { if (!CContainerUI::AddAt(pControl, iIndex)) return false; // The list items should know about us IListItemUI* pListItem = static_cast<IListItemUI*>(pControl->GetInterface(_T("ListItem"))); if( pListItem != NULL ) { pListItem->SetOwner(this); pListItem->SetIndex(iIndex); } for(int i = iIndex + 1; i < GetCount(); ++i) { CControlUI* p = GetItemAt(i); pListItem = static_cast<IListItemUI*>(p->GetInterface(_T("ListItem"))); if( pListItem != NULL ) { pListItem->SetIndex(i); } } if( m_iCurSel >= iIndex ) m_iCurSel += 1; return true; }