Files
UnrealEngineUWP/Engine/Source/Editor/PropertyEditor/Public/SResetToDefaultPropertyEditor.h
sebastian nordgren 09b15cf70d Exposed SResetToDefaultPropertyEditor publicly to allow it to be used for material slots.
#rb lauren.barnes

[CL 14444449 by sebastian nordgren in ue5-main branch]
2020-10-08 03:21:16 -04:00

50 lines
1.3 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Layout/Visibility.h"
#include "Input/Reply.h"
#include "Widgets/DeclarativeSyntaxSupport.h"
#include "Widgets/SCompoundWidget.h"
#include "IDetailPropertyRow.h"
// Forward decl
class FResetToDefaultOverride;
/** Widget showing the reset to default value button */
class PROPERTYEDITOR_API SResetToDefaultPropertyEditor : public SCompoundWidget
{
public:
SLATE_BEGIN_ARGS( SResetToDefaultPropertyEditor )
: _NonVisibleState( EVisibility::Hidden )
{}
SLATE_ARGUMENT( EVisibility, NonVisibleState )
SLATE_ARGUMENT( TOptional<FResetToDefaultOverride>, CustomResetToDefault )
SLATE_END_ARGS()
~SResetToDefaultPropertyEditor();
void Construct( const FArguments& InArgs, const TSharedPtr< class IPropertyHandle>& InPropertyHandle );
private:
FText GetResetToolTip() const;
EVisibility GetDiffersFromDefaultAsVisibility() const;
void Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime );
FReply OnResetClicked();
void UpdateDiffersFromDefaultState();
private:
TOptional<FResetToDefaultOverride> OptionalCustomResetToDefault;
TSharedPtr< class IPropertyHandle > PropertyHandle;
EVisibility NonVisibleState;
bool bValueDiffersFromDefault;
};