BView* TabManager::RemoveTab(int32 index) { // It's important to remove the view first, since // removing the tab will preliminary mess with the selected tab // and then item count of card layout and tab container will not // match yet. BLayoutItem* item = fCardLayout->RemoveItem(index); if (item == NULL) return NULL; TabView* tab = fTabContainerView->RemoveTab(index); delete tab; BView* view = item->View(); delete item; return view; }
bool BLayout::RemoveView(BView* child) { bool removed = false; // a view can have any number of layout items - we need to remove them all for (int32 i = fItems.CountItems(); i-- > 0;) { BLayoutItem* item = ItemAt(i); if (item->View() != child) continue; RemoveItem(i); removed = true; delete item; } return removed; }
BLayoutItem* BLayout::RemoveItem(int32 index) { if (index < 0 || index >= fItems.CountItems()) return NULL; BLayoutItem* item = (BLayoutItem*)fItems.RemoveItem(index); // if the item refers to a BView, we make sure, it is removed from the // parent view BView* view = item->View(); if (view && view->fParent == fView) view->_RemoveSelf(); item->SetLayout(NULL); ItemRemoved(item); InvalidateLayout(); return item; }