AkWwiseTreeSelector.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 "AkWwiseTree.h"
  19. #include "AkWwiseTreeSelector.generated.h"
  20. class IMenu;
  21. class SButton;
  22. /*------------------------------------------------------------------------------------
  23. UAkSlider
  24. ------------------------------------------------------------------------------------*/
  25. /**
  26. * A widget that shows the Wwise tree items.
  27. */
  28. UCLASS(config = Editor, defaultconfig)
  29. class AKAUDIO_API UAkWwiseTreeSelector : public UWidget
  30. {
  31. GENERATED_BODY()
  32. public:
  33. UAkWwiseTreeSelector(const FObjectInitializer& ObjectInitializer);
  34. typedef TSlateDelegates< TSharedPtr< FWwiseTreeItem > >::FOnSelectionChanged FOnSelectionChanged;
  35. /** Called when the item selection changes. */
  36. UPROPERTY(BlueprintAssignable, Category = "Widget Event")
  37. FOnItemSelectionChanged OnSelectionChanged;
  38. /** Called when an item is dragged from the wwise tree. */
  39. UPROPERTY(BlueprintAssignable, Category = "Widget Event")
  40. FOnItemDragDetected OnItemDragged;
  41. // UWidget interface
  42. virtual void SynchronizeProperties() override;
  43. // End of UWidget interface
  44. // UVisual interface
  45. virtual void ReleaseSlateResources(bool bReleaseChildren) override;
  46. // End of UVisual interface
  47. #if WITH_EDITOR
  48. virtual const FText GetPaletteCategory() override;
  49. #endif
  50. protected:
  51. // UWidget interface
  52. virtual TSharedRef<SWidget> RebuildWidget() override;
  53. // End of UWidget interface
  54. private:
  55. /** Delegate used to handle the value of the item to be controlled */
  56. void TreeSelectionChanged(TSharedPtr< FWwiseTreeItem > TreeItem, ESelectInfo::Type SelectInfo);
  57. /** Delegate used to handle the drag detected action on the Wwise items. */
  58. FReply HandleOnDragDetected(const FGeometry& Geometry, const FPointerEvent& MouseEvent);
  59. /** Delegate used to display the Waapi Picker */
  60. FReply HandleButtonClicked();
  61. private:
  62. /** The widget to display the item name */
  63. TSharedPtr<STextBlock> ItemTextBlock;
  64. /** The Wwise tree used to pick an item */
  65. TSharedPtr<SWaapiPicker> WaapiPicker;
  66. /** The pick button widget */
  67. TSharedPtr<SButton> PickerButton;
  68. /** The pick button popup menu*/
  69. TSharedPtr<IMenu> PickerMenu;
  70. };