BOOL CXTPTabManager::DeleteItem(int nItem) { if (nItem < 0 || nItem >= GetItemCount()) return FALSE; CXTPTabManagerItem* pItem = m_arrItems[nItem]; BOOL bSelected = (m_pSelected == pItem); if (m_pHighlighted == pItem) m_pHighlighted = NULL; m_arrItems.RemoveAt(nItem); pItem->OnRemoved(); pItem->InternalRelease(); if (bSelected) { SetCurSel(nItem); } OnItemsChanged(); return TRUE; }
void CXTPTabManager::DeleteAllItems() { for (int i = 0; i < m_arrItems.GetSize(); i++) { CXTPTabManagerItem* pItem = m_arrItems[i]; pItem->OnRemoved(); pItem->InternalRelease(); } m_arrItems.RemoveAll(); m_pHighlighted = m_pSelected = m_pPressed = NULL; OnItemsChanged(); }
CXTPTabManager::~CXTPTabManager() { for (int i = 0; i < m_arrItems.GetSize(); i++) { CXTPTabManagerItem* pItem = m_arrItems[i]; pItem->OnRemoved(); pItem->InternalRelease(); } m_arrNavigateButtons.RemoveAll(); delete m_pRowIndexer; XTPMarkupReleaseContext(m_pMarkupContext); }