SAkItemBoolProperties.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. /*------------------------------------------------------------------------------------
  16. AkItemProperties.h
  17. ------------------------------------------------------------------------------------*/
  18. #pragma once
  19. /*------------------------------------------------------------------------------------
  20. SAkItemBoolProperties
  21. ------------------------------------------------------------------------------------*/
  22. #include "Widgets/Views/STableRow.h"
  23. #include "Widgets/Input/SSearchBox.h"
  24. #include "Misc/TextFilter.h"
  25. typedef TTextFilter< const FString& > StringFilter;
  26. class AKAUDIO_API SAkItemBoolProperties : public SCompoundWidget
  27. {
  28. public:
  29. typedef TSlateDelegates< TSharedPtr< FString > >::FOnSelectionChanged FOnSelectionChanged;
  30. public:
  31. SLATE_BEGIN_ARGS(SAkItemBoolProperties)
  32. : _FocusSearchBoxWhenOpened(false)
  33. , _SelectionMode( ESelectionMode::Multi )
  34. {}
  35. /** Content displayed to the left of the search bar */
  36. SLATE_NAMED_SLOT( FArguments, SearchContent )
  37. /** If true, the search box will be focus the frame after construction */
  38. SLATE_ARGUMENT( bool, FocusSearchBoxWhenOpened )
  39. /** The selection mode for the list view */
  40. SLATE_ARGUMENT( ESelectionMode::Type, SelectionMode )
  41. /** Handles the drag and drop operations */
  42. SLATE_EVENT(FOnDragDetected, OnDragDetected)
  43. /** Handles the selection operation */
  44. SLATE_EVENT(FOnSelectionChanged, OnSelectionChanged)
  45. SLATE_END_ARGS( )
  46. void Construct(const FArguments& InArgs);
  47. SAkItemBoolProperties(void);
  48. ~SAkItemBoolProperties();
  49. /** Returns all properties currently selected in the Wwise properties list */
  50. const TArray<TSharedPtr<FString>> GetSelectedProperties() const;
  51. const FString GetSearchText() const;
  52. const void SetSearchText(const FString& newText);
  53. private:
  54. /** The tree view widget */
  55. TSharedPtr< SListView< TSharedPtr<FString>> > ListViewPtr;
  56. /** The property list search box */
  57. TSharedPtr< SSearchBox > SearchBoxPtr;
  58. /** Filter for the search box */
  59. TSharedPtr<StringFilter> SearchBoxFilter;
  60. /** Property list */
  61. TArray< TSharedPtr<FString> > PropertiesList;
  62. /** Delegate to invoke when drag drop detected. */
  63. FOnDragDetected OnDragDetected;
  64. /** Delegate to invoke when a property is selected. */
  65. FOnSelectionChanged OnSelectionChanged;
  66. private:
  67. /** One-off active timer to focus the widget post-construct */
  68. EActiveTimerReturnType SetFocusPostConstruct(double InCurrentTime, float InDeltaTime);
  69. /** Generate a row in the tree view */
  70. TSharedRef<ITableRow> GenerateRow( TSharedPtr<FString> ItemProperty, const TSharedRef<STableViewBase>& OwnerTable );
  71. /** Handle Drag & Drop */
  72. FReply HandleOnDragDetected(const FGeometry& Geometry, const FPointerEvent& MouseEvent);
  73. /** Used by the search filter */
  74. void PopulateSearchStrings( const FString& PropertyName, OUT TArray< FString >& OutSearchStrings ) const;
  75. void FilterUpdated();
  76. /** Handler for list view selection changes */
  77. void ListSelectionChanged( TSharedPtr< FString > ItemProperty, ESelectInfo::Type SelectInfo );
  78. };