// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "Containers/Array.h" #include "GraphEditor.h" #include "HAL/PlatformCrt.h" #include "Math/Vector2D.h" #include "Misc/Attribute.h" #include "Templates/SharedPointer.h" #include "Types/SlateEnums.h" #include "Widgets/DeclarativeSyntaxSupport.h" #include "Widgets/Layout/SBorder.h" #include "Widgets/SCompoundWidget.h" class FText; class SGraphActionMenu; class SWidget; class UEdGraph; class UEdGraphPin; struct FEdGraphSchemaAction; struct FGraphActionListBuilderBase; struct FSlateFontInfo; /** Widget for displaying a single item */ class SSoundClassActionMenuItem : public SCompoundWidget { public: SLATE_BEGIN_ARGS( SSoundClassActionMenuItem ) {} SLATE_ATTRIBUTE( FText, HighlightText ) SLATE_END_ARGS() void Construct(const FArguments& InArgs, TSharedPtr InAction, TWeakPtr InOwner); private: /* Create the new sound class widget */ TSharedRef CreateNewSoundClassWidget( const FText& DisplayText, const FText& ToolTip, const FSlateFontInfo& NameFont, TSharedPtr& InAction ); /** Called when confirming name for new sound class */ void OnNewSoundClassNameEntered(const FText& NewText, ETextCommit::Type CommitInfo, TSharedPtr InAction ); /** Called when text is changed for a new sound class name */ void OnNewSoundClassNameChanged(const FText& NewText, TSharedPtr InAction ); TWeakPtr Owner; }; ///////////////////////////////////////////////////////////////////////////////////////////////// class SSoundClassActionMenu : public SBorder { public: SLATE_BEGIN_ARGS( SSoundClassActionMenu ) : _GraphObj( static_cast(NULL) ) , _NewNodePosition( FVector2D::ZeroVector ) , _AutoExpandActionMenu( true ) {} SLATE_ARGUMENT( UEdGraph*, GraphObj ) SLATE_ARGUMENT( FVector2D, NewNodePosition ) SLATE_ARGUMENT( TArray, DraggedFromPins ) SLATE_ARGUMENT( SGraphEditor::FActionMenuClosed, OnClosedCallback ) SLATE_ARGUMENT( bool, AutoExpandActionMenu ) SLATE_END_ARGS() void Construct( const FArguments& InArgs ); ~SSoundClassActionMenu(); protected: UEdGraph* GraphObj; TArray DraggedFromPins; FDeprecateSlateVector2D NewNodePosition; bool bAutoExpandActionMenu; SGraphEditor::FActionMenuClosed OnClosedCallback; TSharedPtr GraphActionMenu; void OnActionSelected( const TArray< TSharedPtr >& SelectedActions, ESelectInfo::Type InSelectionType ); TSharedRef OnCreateWidgetForAction(struct FCreateWidgetForActionData* const InCreateData); /** Callback used to populate all actions list in SGraphActionMenu */ void CollectAllActions(FGraphActionListBuilderBase& OutAllActions); friend class SSoundClassActionMenuItem; };