SAkItemProperties.h 4.0 KB

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