Files
UnrealEngineUWP/Engine/Source/Editor/DetailCustomizations/Private/TemplateStringStructCustomization.h
George Rolfe 04df2dac7c TemplateString + customization
#jira none
#rb sebastian.nordgren
#preflight 6295f14f926be5fb68b3e29a

[CL 20435453 by George Rolfe in ue5-main branch]
2022-05-31 07:40:18 -04:00

55 lines
1.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "IPropertyTypeCustomization.h"
#include "Core/Private/Internationalization/TextCache.h"
class IPropertyHandle;
/**
* Implements a details view customization for the FTemplateString structure.
*/
class FTemplateStringStructCustomization
: public IPropertyTypeCustomization
{
public:
/**
* Creates an instance of this class.
*
* @return The new instance.
*/
static TSharedRef<IPropertyTypeCustomization> MakeInstance( )
{
return MakeShareable(new FTemplateStringStructCustomization());
}
public:
virtual void CustomizeChildren( TSharedRef<class IPropertyHandle> StructPropertyHandle, class IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils ) override;
virtual void CustomizeHeader( TSharedRef<class IPropertyHandle> StructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils ) override;
private:
/** Get the property string value (as FText). */
FText GetText() const;
/** Set the property string value (from FText). */
void SetText(const FText& InNewText) const;
/** Get/Create tooltip, with list of valid arguments. */
FText GetToolTip() const;
/** Get the list of valid arguments. */
const TArray<FString>& GetValidArguments() const;
private:
/** Pointer to the string that will be set when changing the path */
TSharedPtr<IPropertyHandle> TemplateStringProperty;
/** Cached tooltip, created by GetToolTip(). */
mutable FText CachedTooltip;
/** Store the valid arguments for this property. */
mutable TArray<FString> ValidArguments;
};