/******************************************************************************* 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. *******************************************************************************/ #pragma once #include "Components/Widget.h" #include "SAkItemProperties.h" #include "Kismet/BlueprintFunctionLibrary.h" #include "Widgets/Text/STextBlock.h" #include "AkItemProperties.generated.h" class IMenu; class SButton; /** A delegate type invoked when a selection changes somewhere. */ DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnItemPropertySelectionChanged, FString, PropertySelected); /** A delegate type invoked when a property is being dragged. */ DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnItemPropertyDragDetected, FString, PropertyDragged); /*------------------------------------------------------------------------------------ FAkPropertyToControl ------------------------------------------------------------------------------------*/ /** * Structure for property to be controlled by the UI. */ USTRUCT(BlueprintType) struct AKAUDIO_API FAkPropertyToControl { GENERATED_BODY() /** * The name of the item to control */ UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = ItemProperty, meta = (DisplayName = "Property")) FString ItemProperty; }; /*------------------------------------------------------------------------------------ UAkItemPropertiesConv ------------------------------------------------------------------------------------*/ UCLASS() class AKAUDIO_API UAkItemPropertiesConv : public UBlueprintFunctionLibrary { GENERATED_BODY() public: UAkItemPropertiesConv(const class FObjectInitializer& ObjectInitializer); /** Converts an AkPropertyToControl value to a string */ UFUNCTION(BlueprintPure, meta = (DisplayName = "ToString (FAkPropertyToControl)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Utilities|String") static FString Conv_FAkPropertyToControlToString(const FAkPropertyToControl& INAkPropertyToControl); /** Converts an AkPropertyToControl value to a localizable text */ UFUNCTION(BlueprintPure, meta = (DisplayName = "ToText (FAkPropertyToControl)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Utilities|Text") static FText Conv_FAkPropertyToControlToText(const FAkPropertyToControl& INAkPropertyToControl); }; /*------------------------------------------------------------------------------------ UAkItemProperties ------------------------------------------------------------------------------------*/ /** * A widget that shows the Wwise properties list. */ UCLASS(config = Editor, defaultconfig) class AKAUDIO_API UAkItemProperties : public UWidget { GENERATED_BODY() public: UAkItemProperties(const FObjectInitializer& ObjectInitializer); typedef TSlateDelegates< TSharedPtr< FString > >::FOnSelectionChanged FOnSelectionChanged; /** Called when the property selection changes. */ UPROPERTY(BlueprintAssignable, Category = "Widget Event") FOnItemPropertySelectionChanged OnSelectionChanged; /** Called when a property is dragged from the property list. */ UPROPERTY(BlueprintAssignable, Category = "Widget Event") FOnItemPropertyDragDetected OnPropertyDragged; /** Returns all properties currently selected in the Wwise properties list */ UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Audiokinetic") FString GetSelectedProperty() const; /** returns the current text of the searchBox */ UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Audiokinetic") FString GetSearchText() const; /** sets the current text of the searchBox */ UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Audiokinetic") void SetSearchText(const FString& newText); // UVisual interface virtual void ReleaseSlateResources(bool bReleaseChildren) override; // End of UVisual interface #if WITH_EDITOR virtual const FText GetPaletteCategory() override; #endif protected: // UWidget interface virtual TSharedRef RebuildWidget() override; // End of UWidget interface private: /** Delegate used to handle the value of the property to be controlled */ void PropertySelectionChanged(TSharedPtr< FString > PropertySelected, ESelectInfo::Type SelectInfo); /** Delegate used to handle the drag detected action on the items properties. */ FReply HandleOnDragDetected(const FGeometry& Geometry, const FPointerEvent& MouseEvent); private: /** The widget to display the property name */ TSharedPtr PropertyTextBlock; /** The Wwise list used to pick an item property */ TSharedPtr WwiseProperties; };