// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.

#include "FAssetEditorToolbarComboActionGraph.h"

#include "ComboInputEditor.h"
#include "Ed/AssetEditor_ComboActionGraph.h"
#include "Ed/FComboActionGraphEditorCommands.h"

#define LOCTEXT_NAMESPACE "AssetEditorToolbarComboActionGraph"


void FAssetEditorToolbarComboActionGraph::AddComboActionGraphToolbar(TSharedPtr<FExtender> Extender)
{
	check(this->ComboActionGraphEditor.IsValid());
	TSharedPtr<FAssetEditor_ComboActionGraph> ComboActionGraphEditorPtr = this->ComboActionGraphEditor.Pin();

	TSharedPtr<FExtender> ToolbarExtender = MakeShareable(new FExtender);
	ToolbarExtender->AddToolBarExtension("Asset", EExtensionHook::After, ComboActionGraphEditorPtr->GetToolkitCommands(), FToolBarExtensionDelegate::CreateSP( this, &FAssetEditorToolbarComboActionGraph::FillComboActionGraphToolbar ));
	ComboActionGraphEditorPtr->AddToolbarExtender(ToolbarExtender);
}

void FAssetEditorToolbarComboActionGraph::FillComboActionGraphToolbar(FToolBarBuilder &ToolbarBuilder)
{
	check(this->ComboActionGraphEditor.IsValid());
	TSharedPtr<FAssetEditor_ComboActionGraph> MounteaDialogueGraphEditorPtr = this->ComboActionGraphEditor.Pin();

	ToolbarBuilder.BeginSection("Util");
	{
		ToolbarBuilder.AddToolBarButton(FComboActionGraphEditorCommands::Get().AutoArrange,
			NAME_None,
			LOCTEXT("AutoArrange_Label", "Auto Arrange"),
			LOCTEXT("AutoArrange_ToolTip", "ALPHA version!\n\nTries its best to arrange Graph Nodes. Don't judge too harshly please."),
			FSlateIcon(FComboInputSlateStyle::GetAppStyleSetName(), "MDSStyleSet.AutoArrange"));

		ToolbarBuilder.AddToolBarButton(FComboActionGraphEditorCommands::Get().ValidateGraph,
			NAME_None,
			LOCTEXT("ValidateGraph_Label", "Validate Graph"),
			LOCTEXT("ValidateGraph_ToolTip", "Validates Graph if there are any invalid connections or broken data."),
			FSlateIcon(FComboInputSlateStyle::GetAppStyleSetName(), "MDSStyleSet.ValidateGraph"));
	}
	ToolbarBuilder.EndSection();
}

#undef LOCTEXT_NAMESPACE
