/******************************************************************************* The content of this file includes portions of the proprietary AUDIOKINETIC Wwise Technology released in source code form as part of the game integration package. The content of this file may not be used without valid licenses to the AUDIOKINETIC Wwise Technology. Note that the use of the game engine is subject to the Unreal(R) Engine End User License Agreement at https://www.unrealengine.com/en-US/eula/unreal License Usage Licensees holding valid licenses to the AUDIOKINETIC Wwise Technology may use this file in accordance with the end user license agreement provided with the software or, alternatively, in accordance with the terms contained in a written agreement between you and Audiokinetic Inc. Copyright (c) 2023 Audiokinetic Inc. *******************************************************************************/ /*------------------------------------------------------------------------------------ AkWaapiFieldNames.h ------------------------------------------------------------------------------------*/ #pragma once /*------------------------------------------------------------------------------------ SAkWaapiFieldNames ------------------------------------------------------------------------------------*/ #include "Misc/TextFilter.h" #include "Widgets/Views/STableRow.h" #include "Widgets/Views/STreeView.h" #include "Kismet/BlueprintFunctionLibrary.h" #include "Widgets/Input/SSearchBox.h" #include "AkWaapiFieldNames.generated.h" /** * Structure for Field Names */ USTRUCT(BlueprintType) struct AKAUDIO_API FAkWaapiFieldNames { GENERATED_BODY() /** * The Field Name */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = FieldName, meta = (DisplayName = "Field Name")) FString FieldName; }; /*------------------------------------------------------------------------------------ USAkWaapiFieldNamesConv ------------------------------------------------------------------------------------*/ UCLASS() class AKAUDIO_API USAkWaapiFieldNamesConv : public UBlueprintFunctionLibrary { GENERATED_BODY() public: USAkWaapiFieldNamesConv(const class FObjectInitializer& ObjectInitializer); /** Converts an AkWaapiFieldName value to a string */ UFUNCTION(BlueprintPure, meta = (DisplayName = "ToString (FAkWaapiFieldNames)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Utilities|String") static FString Conv_FAkWaapiFieldNamesToString(const FAkWaapiFieldNames& INAkWaapiFieldNames); /** Converts an AkWaapiFieldName value to a localizable text */ UFUNCTION(BlueprintPure, meta = (DisplayName = "ToText (FAkWaapiFieldNames)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Utilities|Text") static FText Conv_FAkWaapiFieldNamesToText(const FAkWaapiFieldNames& INAkWaapiFieldNames); }; typedef TTextFilter< const FString& > StringFilter; /*------------------------------------------------------------------------------------ SAkWaapiFieldNames ------------------------------------------------------------------------------------*/ class AKAUDIO_API SAkWaapiFieldNames : public SCompoundWidget { public: typedef TSlateDelegates< TSharedPtr< FString > >::FOnSelectionChanged FOnSelectionChanged; public: SLATE_BEGIN_ARGS(SAkWaapiFieldNames) : _FocusSearchBoxWhenOpened(true) , _SelectionMode(ESelectionMode::Multi) {} /** Content displayed to the left of the search bar */ SLATE_NAMED_SLOT(FArguments, SearchContent) /** If true, the search box will be focus the frame after construction */ SLATE_ARGUMENT(bool, FocusSearchBoxWhenOpened) /** The selection mode for the list view */ SLATE_ARGUMENT(ESelectionMode::Type, SelectionMode) /** Handles the drag and drop operations */ SLATE_EVENT(FOnDragDetected, OnDragDetected) /** Handles the selection operation */ SLATE_EVENT(FOnSelectionChanged, OnSelectionChanged) SLATE_END_ARGS() void Construct(const FArguments& InArgs); SAkWaapiFieldNames(void); ~SAkWaapiFieldNames(); /** Returns all the FieldNames currently selected in the Waapi Picker view */ const TArray> GetSelectedFieldNames() const; private: /** The tree view widget */ TSharedPtr< SListView< TSharedPtr> > ListViewPtr; /** The FieldNames list search box */ TSharedPtr< SSearchBox > SearchBoxPtr; /** Filter for the search box */ TSharedPtr SearchBoxFilter; /** Field Names list */ TArray< TSharedPtr > FieldNamesList; /** Delegate to invoke when drag drop detected. */ FOnDragDetected OnDragDetected; /** Delegate to invoke when a Field Name is selected. */ FOnSelectionChanged OnSelectionChanged; private: /** One-off active timer to focus the widget post-construct */ EActiveTimerReturnType SetFocusPostConstruct(double InCurrentTime, float InDeltaTime); /** Generate a row in the tree view */ TSharedRef GenerateRow(TSharedPtr in_FieldName, const TSharedRef& OwnerTable); /** Used by the search filter */ void PopulateSearchStrings(const FString& in_FieldName, OUT TArray< FString >& OutSearchStrings) const; void FilterUpdated(); /** Handler for list view selection changes */ void ListSelectionChanged(TSharedPtr< FString > in_FieldName, ESelectInfo::Type SelectInfo); };