SBasicFilterBar

A Basic Filter Bar widget, which can be used to filter items of type [FilterType] given a list of custom filters

Unreal Engine C++ API Reference > Developer > ToolWidgets > Filters

Inheritance Hierarchy

References

   
Module ToolWidgets
Header /Engine/Source/Developer/ToolWidgets/Public/Filters/SBasicFilterBar.h
Include #include "Filters/SBasicFilterBar.h"

Syntax

template<typename FilterType>  
class SBasicFilterBar : public [SCompoundWidget](API\Runtime\SlateCore\Widgets\SCompoundWidget)  

Remarks

A Basic Filter Bar widget, which can be used to filter items of type [FilterType] given a list of custom filters Use the GetAllActiveFilters() function to get the FilterCollection of Active Filters in this FilterBar, that can be used to filter your items Use MakeAddFilterButton() to make the button that summons the dropdown showing all the filters

Variables

Type Name Description
TSharedPtr< TFi... ActiveFilters Currently active filter objects
TArray< TShared... AllFilterCategories All filter categories (for menu construction)
TArray< TShared... AllFrontendFilters All possible filter objects
bool bCanChangeOrientation Whether the orientation can be changed after initailization
bool bUseSectionsForCategories Whether to use submenus or sections for categories in the filter menu
FCreateTextFilt... CreateTextFilter A delegate used to create a TTextFilter for FilterType
TArray< TShared... CustomTextFilters Custom text filters that a user can create
TWeakPtr< SWind... CustomTextFilterWindow The window containing the custom text filter dialog
EFilterBarLayou... FilterBarLayout The current Filter Layout being used
TSharedPtr< SWi... FilterBox The widget switcher containing the horizontal and vertical filter widgets
EFilterPillStyl... FilterPillStyle Determines how each individual pill looks like
TArray< TShared... Filters All SFilters in the list
TSharedPtr< SWr... HorizontalFilterBox The horizontal wrap box which contains all the filters (used in the horizontal layout)
FOnExtendAddFil... OnExtendAddFilterMenu Delegate to extend the AddFilter Menu
FOnFilterChange... OnFilterChanged Delegate for when filters have changed
TSharedPtr< SSc... VerticalFilterBox The vertical scroll box which contains all the filters (used in the vertical layout)

Functions

Type Name Description
void AddFilter ( TSharedRef< FFilterBase< FilterType... ) Add a custom filter to the FilterBar.
void AddFilterToBar ( const TSharedRef< SFilter >& Filte... ) 'Activate' A filter by adding it to the filter bar, does not turn it on
TSharedRef< ... AddFilterToBar ( const TSharedRef< FFilterBase< Filt... ) 'Activate' A filter by adding it to the filter bar, does not turn it on
void AddWidgetToLayout ( const TSharedRef< SWidget > WidgetT... ) Add a widget to the current filter layout
void AttachFilterSearchBox ( TSharedPtr< SFilterSearchBox > InFi... ) Attach an SFilterSearchBox to this filter bar, overriding the SFilterSearchBox:: OnSaveSearchClicked event to save a search as a filter
void Construct ( const FArguments& InArgs )  
void CreateAddCustomTextFilterWindow () Creates a dialog box to Add a custom text filter
void CreateCustomTextFilterFromSearch ( const FText& InSearchText ) Creates a dialog to add a custom text filter from the given search text
void CreateCustomTextFilterWindow ( const FCustomTextFilterData& Custo..., TSharedPtr< ICustomTextFilter< Filt... ) Creates a dialog box with the SCustomTextFilterDialog Widget
void CreateEditCustomTextFilterWindow ( TSharedPtr< ICustomTextFilter< Filt... ) Creates a dialog box to Edit an existing custom text filter
void CreateOtherFiltersMenuCategory ( FToolMenuSection& Section, TSharedPtr< FFilterCategory > MenuC... ) Handler for when the add filter menu is populated by a non-category
void CreateOtherFiltersMenuCategory ( UToolMenu* InMenu, TSharedPtr< FFilterCategory > MenuC... ) Handler for when the add filter menu is populated by a non-category
void CreateTextFiltersMenu ( UToolMenu* InMenu ) Populate the Custom Filters submenu in the Add Filter dropdown
void CustomTextFilterClicked ( ECheckBoxState CheckBoxState, TSharedRef< ICustomTextFilter< Filt... ) Handler for when a checkbox next to a custom text filter is clicked
void DisableAllFilters () Disable all the filters that are currently visible on the filter bar
void EnableAllFilters () Enable all the filters that are currently visible on the filter bar
void EnableOnlyThisFilter ( const TSharedRef< SFilter >& Filte... ) Handler for when the enable only this button was clicked on a single filter
void FrontendFilterCategoryClicked ( TSharedPtr< FFilterCategory > MenuC... ) Handler for when a filter category is clicked
void FrontendFilterChanged ( TSharedRef< FFilterBase< FilterType... ) Handler for when a frontend filter state has changed
void FrontendFilterClicked ( TSharedRef< FFilterBase< FilterType... ) Handler for a frontend filter is clicked
TSharedPtr< ... GetAllActiveFilters () Use this function to get all currently active filters (to filter your items) Not const on purpose: Subclasses might need to update the filter collection before getting it
void GetAllCustomTextFilterLabels ( TArray< FText >& OutFilterLabels )  
TSharedPtr< ... GetFilter ( const FString& InName ) Retrieve a specific filter
const FSlate... GetFilterBadgeIcon () Overlay for filter icon, badge if there are any active filters
ECheckBoxSta... GetFilterCheckState ( const TSharedPtr< FFilterBase< Filt... ) Returns the check box state of the specified filter (in the filter drop down).
EFilterBarLa... GetFilterLayout ()  
bool HasAnyFilters () Returns true if any filters are applied
bool IsFilterActive ( const TSharedPtr< FFilterBase< Filt... ) Returns true if the specified filter is both checked (pinned on the filter bar) and active (contributing to filter the result).
ECheckBoxSta... IsFrontendFilterCategoryChecked ( TSharedPtr< FFilterCategory > MenuC... ) Handler to determine the "checked" state of a frontend filter category in the filter dropdown
bool IsFrontendFilterCategoryInUse ( TSharedPtr< FFilterCategory > MenuC... ) Handler to check if a filter category is in use
bool IsFrontendFilterInUse ( TSharedRef< FFilterBase< FilterType... ) Handler to check if a frontend filter is in use
TSharedRef< ... MakeAddFilterButton ( TSharedRef< SBasicFilterBar< Filter... ) Makes the button that summons the Add Filter dropdown on click
void OnCancelCustomTextFilterDialog () Handler to close the custom text filter dialog
void OnCreateCustomTextFilter ( const FCustomTextFilterData& InFil..., bool bApplyFilter ) Handler for when a custom text filter is created
void OnDeleteCustomTextFilter ( const TSharedPtr< ICustomTextFilter... ) Handler for when a custom text filter is deleted
void OnModifyCustomTextFilter ( const FCustomTextFilterData& InFil..., TSharedPtr< ICustomTextFilter< Filt... ) Handler for when a custom text filter is modified
void OnResetFilters () Called when reset filters option is pressed
void OnSetFilterActive ( bool bInActive, TWeakPtr< FFilterBase< FilterType >... ) Called to set a filter active externally
void PopulateCommonFilterSections ( UToolMenu* Menu ) Helper function to add common sections to the Add Filter Menu
void PopulateCustomFilters ( UToolMenu* Menu ) Helper function to add all custom filters to the Add Filter Menu
void RemoveAllButThis ( const TSharedRef< SFilter >& Filte... ) Remove all filters except the specified one
void RemoveAllFilters () Remove all filters from the filter bar, while disabling any active ones
void RemoveFilter ( const TSharedRef< SFilter >& Filte... ) Remove a filter from the filter bar
void RemoveFilter ( const TSharedRef< FFilterBase< Filt..., bool ExecuteOnFilterChanged ) Remove a filter from the filter bar
void RemoveFilterAndUpdate ( const TSharedRef< SFilter >& Filte... ) Remove a filter from the filter bar
void RemoveWidgetFromLayout ( const TSharedRef< SWidget > WidgetT... ) Remove a widget from the current filter layout
void SetFilterCheckState ( const TSharedPtr< FFilterBase< Filt..., ECheckBoxState InCheckState ) Set the check box state of the specified filter (in the filter drop down) and pin/unpin a filter widget on/from the filter bar.
void SetFilterLayout ( EFilterBarLayout InFilterBarLayout )  
void SetFrontendFilterActive ( const TSharedRef< FFilterBase< Filt..., bool bActive ) Sets the active state of a frontend filter.

Classes

Type Name Description
Public struct FArguments  
Protected class SFilter A single filter in the filter list. Can be removed by clicking the remove button on it.

Typedefs

Name Description
FCreateTextFilter Delegate to create a TTextFilter used to compare FilterType with text queries
FOnExtendAddFilterMenu Delegate for when filters have changed
FOnFilterChanged Delegate for when filters have changed

See Also

SFilterBar in EditorWidgets if you want a FilterBar that includes Asset Type Filters NOTE: The filter functions create copies

so you want to use a reference or pointer as the template type when possible Sample Usage: SAssignNew(MyFilterBar

SBasicFilterBar) .OnFilterChanged() // A delegate for when the list of filters changes .CustomFilters() // An array of filters available to this FilterBar (

FGenericFilter to create simple delegate based filters)


Ask questions and help your peers Developer Forums

Write your own tutorials or read those from others Learning Library