WwiseBoolPropertyDragDropOp.h 2.9 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 "CoreMinimal.h"
  17. #include "Input/DragAndDrop.h"
  18. #include "Widgets/DeclarativeSyntaxSupport.h"
  19. #include "Widgets/SBoxPanel.h"
  20. #include "Widgets/Layout/SBorder.h"
  21. #include "Widgets/Images/SImage.h"
  22. #include "Widgets/Text/STextBlock.h"
  23. #include "WaapiPicker/WwiseTreeItem.h"
  24. #include "AkAudioStyle.h"
  25. class AKAUDIO_API FWwiseBoolPropertyDragDropOp : public FDragDropOperation
  26. {
  27. public:
  28. DRAG_DROP_OPERATOR_TYPE(FWwiseBoolPropertyDragDropOp, FDragDropOperation)
  29. static TSharedRef<FWwiseBoolPropertyDragDropOp> New(const TArray<TSharedPtr<FString>>& in_Wwiseproperties)
  30. {
  31. TSharedRef<FWwiseBoolPropertyDragDropOp> Operation = MakeShareable(new FWwiseBoolPropertyDragDropOp);
  32. Operation->MouseCursor = EMouseCursor::GrabHandClosed;
  33. Operation->Wwiseproperties = in_Wwiseproperties;
  34. Operation->Construct();
  35. return Operation;
  36. }
  37. const TArray< TSharedPtr<FString> >& GetWiseProperties() const
  38. {
  39. return Wwiseproperties;
  40. }
  41. public:
  42. FText GetDecoratorText() const
  43. {
  44. FString Text = Wwiseproperties.Num() == 1 ? *Wwiseproperties[0].Get() : TEXT("");
  45. if (Wwiseproperties.Num() > 1 )
  46. {
  47. Text = FString::Printf(TEXT("Can't handle more than one Property"));
  48. }
  49. return FText::FromString(Text);
  50. }
  51. virtual TSharedPtr<SWidget> GetDefaultDecorator() const override
  52. {
  53. return
  54. SNew(SBorder)
  55. .BorderImage(FAkAudioStyle::GetBrush("AudiokineticTools.AssetDragDropTooltipBackground"))
  56. .Content()
  57. [
  58. SNew(SHorizontalBox)
  59. // slot for the item name.
  60. + SHorizontalBox::Slot()
  61. .AutoWidth()
  62. .VAlign(VAlign_Center)
  63. [
  64. SNew(SHorizontalBox)
  65. +SHorizontalBox::Slot()
  66. .AutoWidth()
  67. .Padding(3,0,3,0)
  68. .VAlign(VAlign_Center)
  69. [
  70. SNew(STextBlock)
  71. .Text(this, &FWwiseBoolPropertyDragDropOp::GetDecoratorText)
  72. ]
  73. ]
  74. ];
  75. }
  76. private:
  77. /** Data for the asset this item represents */
  78. TArray<TSharedPtr<FString>> Wwiseproperties;
  79. };