void SPluginCategories::Construct( const FArguments& Args, const TSharedRef< SPluginsEditor > Owner ) { OwnerWeak = Owner; RebuildAndFilterCategoryTree(); PluginCategoryTreeView = SNew( SPluginCategoryTreeView ) // For now we only support selecting a single folder in the tree .SelectionMode( ESelectionMode::Single ) .ClearSelectionOnClick( false ) // Don't allow user to select nothing. We always expect a category to be selected! .TreeItemsSource( &RootPluginCategories ) .OnGenerateRow( this, &SPluginCategories::PluginCategoryTreeView_OnGenerateRow ) .OnGetChildren( this, &SPluginCategories::PluginCategoryTreeView_OnGetChildren ) .OnSelectionChanged( this, &SPluginCategories::PluginCategoryTreeView_OnSelectionChanged ) ; // Expand the root categories by default for( auto RootCategoryIt( RootPluginCategories.CreateConstIterator() ); RootCategoryIt; ++RootCategoryIt ) { const auto& Category = *RootCategoryIt; PluginCategoryTreeView->SetItemExpansion( Category, true ); } // Select the first item by default if( RootPluginCategories.Num() > 0 ) { PluginCategoryTreeView->SetSelection( RootPluginCategories[ 0 ] ); } ChildSlot.AttachWidget( PluginCategoryTreeView.ToSharedRef() ); }
void SPluginCategories::Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime ) { // Call parent implementation SCompoundWidget::Tick( AllottedGeometry, InCurrentTime, InDeltaTime ); if( bNeedsRefresh ) { RebuildAndFilterCategoryTree(); } }