// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "InputCoreTypes.h" #include "IPropertyTypeCustomization.h" #include "PropertyHandle.h" /** * Implements a details panel customization for FKey structures. * As "Key" */ class DETAILCUSTOMIZATIONS_API FKeyStructCustomization : public IPropertyTypeCustomization { public: // IPropertyTypeCustomization interface virtual void CustomizeHeader(TSharedRef StructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override; virtual void CustomizeChildren(TSharedRef StructPropertyHandle, class IDetailChildrenBuilder& ChildBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override { }; virtual bool ShouldInlineKey() const override { return true; } // Helper variant that generates the key struct in the header and appends a single button at the end // TODO: Is there a better way? void CustomizeHeaderOnlyWithButton(TSharedRef StructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils, TSharedRef Button); public: /** * Creates a new instance. * * @return A new struct customization for Keys. */ static TSharedRef MakeInstance( ); protected: /** Gets the current Key being edited. */ TOptional GetCurrentKey() const; /** Updates the property when a new key is selected. */ void OnKeyChanged(TSharedPtr SelectedKey); /** Holds a handle to the property being edited. */ TSharedPtr PropertyHandle; };