AkWwiseTree.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*******************************************************************************
  2. The content of this file includes portions of the proprietary AUDIOKINETIC Wwise
  3. Technology released in source code form as part of the game integration package.
  4. The content of this file may not be used without valid licenses to the
  5. AUDIOKINETIC Wwise Technology.
  6. Note that the use of the game engine is subject to the Unreal(R) Engine End User
  7. License Agreement at https://www.unrealengine.com/en-US/eula/unreal
  8. License Usage
  9. Licensees holding valid licenses to the AUDIOKINETIC Wwise Technology may use
  10. this file in accordance with the end user license agreement provided with the
  11. software or, alternatively, in accordance with the terms contained
  12. in a written agreement between you and Audiokinetic Inc.
  13. Copyright (c) 2023 Audiokinetic Inc.
  14. *******************************************************************************/
  15. #pragma once
  16. #include "Components/Widget.h"
  17. #include "WaapiPicker/SWaapiPicker.h"
  18. #include "AkSlider.h"
  19. #include "AkWwiseTree.generated.h"
  20. class IMenu;
  21. class SButton;
  22. /** A delegate type invoked when a selection changes somewhere. */
  23. DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnItemSelectionChanged, FGuid, ItemSelectedID);
  24. /** A delegate type invoked when an item is being dragged. */
  25. DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnItemDragDetected, FGuid, ItemDraggedID, FString, ItemDraggedName);
  26. /*------------------------------------------------------------------------------------
  27. UAkSlider
  28. ------------------------------------------------------------------------------------*/
  29. /**
  30. * A widget that shows the Wwise tree items.
  31. */
  32. UCLASS(config = Editor, defaultconfig)
  33. class AKAUDIO_API UAkWwiseTree : public UWidget
  34. {
  35. GENERATED_BODY()
  36. public:
  37. UAkWwiseTree(const FObjectInitializer& ObjectInitializer);
  38. typedef TSlateDelegates< TSharedPtr< FWwiseTreeItem > >::FOnSelectionChanged FOnSelectionChanged;
  39. /** Called when the item selection changes. */
  40. UPROPERTY(BlueprintAssignable, Category = "Widget Event")
  41. FOnItemSelectionChanged OnSelectionChanged;
  42. /** Called when an item is dragged from the wwise tree. */
  43. UPROPERTY(BlueprintAssignable, Category = "Widget Event")
  44. FOnItemDragDetected OnItemDragged;
  45. /** Returns all properties currently selected in the Wwise properties list */
  46. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Audiokinetic")
  47. FAkWwiseObjectDetails GetSelectedItem() const;
  48. /** returns the current text of the searchBox */
  49. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Audiokinetic")
  50. FString GetSearchText() const;
  51. /** sets the current text of the searchBox */
  52. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Audiokinetic")
  53. void SetSearchText(const FString& newText);
  54. // UWidget interface
  55. virtual void SynchronizeProperties() override;
  56. // End of UWidget interface
  57. // UVisual interface
  58. virtual void ReleaseSlateResources(bool bReleaseChildren) override;
  59. // End of UVisual interface
  60. #if WITH_EDITOR
  61. virtual const FText GetPaletteCategory() override;
  62. #endif
  63. protected:
  64. // UWidget interface
  65. virtual TSharedRef<SWidget> RebuildWidget() override;
  66. // End of UWidget interface
  67. private:
  68. /** Delegate used to handle the value of the item to be controlled */
  69. void TreeSelectionChanged(TSharedPtr< FWwiseTreeItem > TreeItem, ESelectInfo::Type SelectInfo);
  70. /** Delegate used to handle the drag detected action on the Wwise items. */
  71. FReply HandleOnDragDetected(const FGeometry& Geometry, const FPointerEvent& MouseEvent);
  72. private:
  73. /** The widget to display the item name */
  74. TSharedPtr<STextBlock> ItemTextBlock;
  75. /** The Wwise tree used to pick an item */
  76. TSharedPtr<SWaapiPicker> WaapiPicker;
  77. };