void VaultSearchPanel::PopulateCollectionsChoice() { u32 numAdded = 0; std::vector< tstring > tableData; for ( M_AssetCollections::const_iterator itr = m_CollectionManager->GetCollections().begin(), end = m_CollectionManager->GetCollections().end(); itr != end; ++itr ) { AssetCollection* collection = itr->second; if ( collection && !collection->GetAssetPaths().empty() ) { tableData.push_back( collection->GetName() ); ++numAdded; } } if ( numAdded > 0 ) { tableData.push_back( TXT( "" ) ); PopulateChoiceControl( (wxControlWithItems*) m_CollectionChoice, tableData ); m_SearchCollectionRadio->Enable( true ); m_CollectionChoice->Enable( true ); } else { m_SearchVaultRadio->SetValue( true ); m_SearchCollectionRadio->SetValue( false ); m_SearchCollectionRadio->Enable( false ); m_CollectionChoice->Enable( false ); } }
void CollectionsPanel::OnMyCollectionsBeginLabelEdit( wxTreeEvent& event ) { // this just makes the code below more generic in case we want to abstract it later SortTreeCtrl* treeCtrl = m_MyCollectionsTreeCtrl; wxTreeItemId item = event.GetItem(); if ( !item ) { event.Veto(); return; } AssetCollectionItemData* baseData = GetItemData( m_MyCollectionsTreeCtrl, item ); if ( !baseData ) { event.Veto(); return; } AssetCollection* collection = baseData->GetCollection<AssetCollection>(); if ( !collection || !collection->CanRename() ) { event.Veto(); return; } treeCtrl->SetItemText( item, collection->GetName() ); //treeCtrl->EditLabel( item ); event.Skip(); }
void CollectionsPanel::OnCloseCollection( wxCommandEvent& event ) { SortTreeCtrl* treeCtrl = m_MyCollectionsTreeCtrl; wxTreeItemId rootID = treeCtrl->GetRootItem(); wxTreeItemId item = treeCtrl->GetSelection(); if( !item || item == rootID ) { return; } AssetCollectionItemData* baseData = GetItemData( treeCtrl, item ); if ( !baseData ) { return; } AssetCollection* collection = baseData->GetCollection<AssetCollection>(); if ( collection && !collection->IsTemporary() ) { if ( event.GetId() == ID_DeleteCollection ) { tstring warning = TXT( "Are you sure you'd like permenantly delete your collection \"" ); warning += collection->GetName() + TXT( "\"?" ); if ( wxYES == wxMessageBox( warning, TXT( "Delete Colleciton?" ), wxCENTER | wxYES_NO | wxICON_WARNING, this ) ) { m_CollectionManager->DeleteCollection( collection ); } } else { m_CollectionManager->CloseCollection( collection ); } } }