Files
UnrealEngine/Engine/Source/Editor/DetailCustomizations/Public/Customizations/SlateBrushCustomization.h
2025-05-18 13:04:45 +08:00

74 lines
2.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "IPropertyTypeCustomization.h"
#include "Layout/Visibility.h"
#include "Math/Vector2D.h"
#include "PropertyHandle.h"
#include "Templates/SharedPointer.h"
class IPropertyHandle;
class SErrorText;
class DETAILCUSTOMIZATIONS_API FSlateBrushStructCustomization : public IPropertyTypeCustomization
{
public:
static TSharedRef<IPropertyTypeCustomization> MakeInstance(bool bIncludePreview);
FSlateBrushStructCustomization(bool bIncludePreview);
/** IPropertyTypeCustomization interface */
virtual void CustomizeHeader( TSharedRef<IPropertyHandle> StructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils ) override;
virtual void CustomizeChildren( TSharedRef<IPropertyHandle> StructPropertyHandle, class IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils ) override;
private:
/**
* Get the Slate Brush outline settings property row visibility
*/
EVisibility GetOutlineSettingsPropertyVisibility() const;
/**
* Get the Slate Brush tiling property row visibility
*/
EVisibility GetTilingPropertyVisibility() const;
/**
* Get the Slate Brush margin property row visibility
*/
EVisibility GetMarginPropertyVisibility() const;
/** Callback for determining image size reset button visibility */
bool IsImageSizeResetToDefaultVisible(TSharedPtr<IPropertyHandle> PropertyHandle) const;
/** Callback for clicking the image size reset button */
void OnImageSizeResetToDefault(TSharedPtr<IPropertyHandle> PropertyHandle) const;
/** Gets the current default image size based on the current texture resource */
FVector2f GetDefaultImageSize() const;
/** Slate Brush DrawAs property */
TSharedPtr<IPropertyHandle> DrawAsProperty;
/** Slate Brush Image Size property */
TSharedPtr<IPropertyHandle> ImageSizeProperty;
/** Slate Brush Resource Object property */
TSharedPtr<IPropertyHandle> ResourceObjectProperty;
/** Slate Brush Resource Name property */
TSharedPtr<IPropertyHandle> ResourceNameProperty;
/** Slate Brush Image Type property */
TSharedPtr<IPropertyHandle> ImageTypeProperty;
/** Error text to display if the resource object is not valid*/
TSharedPtr<SErrorText> ResourceErrorText;
/** Should we show the preview portion of the customization? */
bool bIncludePreview;
};