// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "IDetailCustomization.h" #include "Input/Reply.h" #include "IPropertyTypeCustomization.h" #include "Layout/Visibility.h" class UNamingTokens; class SWidget; class FNamingTokensCustomization final : public IDetailCustomization { public: static TSharedRef MakeInstance() { return MakeShareable(new FNamingTokensCustomization); } virtual void CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) override; private: /** Handle to namespace property. */ TSharedPtr NamespacePropertyHandle; /** Stores error text. */ TSharedPtr TokenKeyErrorMessage; }; class FNamingTokensDataCustomization final : public IPropertyTypeCustomization { public: static TSharedRef MakeInstance() { return MakeShareable(new FNamingTokensDataCustomization()); } virtual void CustomizeHeader(TSharedRef PropertyHandle, FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& CustomizationUtils) override; virtual void CustomizeChildren(TSharedRef PropertyHandle, IDetailChildrenBuilder& ChildBuilder, IPropertyTypeCustomizationUtils& CustomizationUtils) override; /** The naming tokens owning this customization. */ UNamingTokens* GetOwningNamingTokens() const; private: /** Available functions which can be assigned to naming tokens. */ TArray GetAvailableFunctions() const; /** Make the combo box for selecting functions. */ TSharedRef MakeComboBoxWidget(TSharedPtr InItem); /** When the user selects a function. */ void OnFunctionSelected( TSharedPtr NewValue, ESelectInfo::Type SelectInfo, TSharedPtr InFunctionNameHandle); /** The text of the currently selected function. */ FText GetSelectedFunctionText() const; /** User clicked the button to add a new function. */ FReply OnAddFunctionClicked(); /** If a new function can be added. */ bool CanAddFunction() const; private: /** Customization pointer. */ IPropertyTypeCustomizationUtils* CustomizationUtilsPtr = nullptr; /** Blueprint of the naming tokens. */ TWeakObjectPtr OwningBlueprint; /** All available function names. */ TArray> FunctionNames; /** The selected function name. */ TSharedPtr SelectedFunctionName; /** Property handle to the function name. */ TSharedPtr FunctionNameHandle; /** Property handle to the token key. */ TSharedPtr TokenKeyHandle; /** Stores error text. */ TSharedPtr NamespaceErrorMessage; };