October3d55/M/LGUI/Source/LGUIEditor/Private/DetailCustomization/UIItemCustomization.h

85 lines
4.0 KiB
C++

// Copyright 2019-Present LexLiu. All Rights Reserved.
#include "CoreMinimal.h"
#include "IDetailCustomization.h"
#include "Layout/ILGUILayoutInterface.h"
#include "Widget/AnchorPreviewWidget.h"
#pragma once
/**
*
*/
class FUIItemCustomization : public IDetailCustomization
{
public:
FUIItemCustomization();
~FUIItemCustomization();
static TSharedRef<IDetailCustomization> MakeInstance();
/** IDetailCustomization interface */
virtual void CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) override;
private:
TArray<TWeakObjectPtr<class UUIItem>> TargetScriptArray;
static TArray<float> ValueRangeArray;
void AddSlotProperty(IDetailLayoutBuilder& DetailBuilder);
bool GetIsAnchorsEnabled()const;
FText GetAnchorsTooltipText()const;
void ForceRefreshEditor(IDetailLayoutBuilder* DetailBuilder);
void ForceUpdateUI();
bool OnCanCopyAnchor()const;
bool OnCanPasteAnchor()const;
void OnCopyAnchor();
void OnPasteAnchor(IDetailLayoutBuilder* DetailBuilder);
void OnCopyHierarchyIndex();
void OnPasteHierarchyIndex(TSharedRef<IPropertyHandle> PropertyHandle);
void OnSelectAnchor(LGUIAnchorPreviewWidget::UIAnchorHorizontalAlign HorizontalAlign, LGUIAnchorPreviewWidget::UIAnchorVerticalAlign VerticalAlign, IDetailLayoutBuilder* DetailBuilder);
LGUIAnchorPreviewWidget::UIAnchorHorizontalAlign GetAnchorHAlign(TSharedRef<IPropertyHandle> AnchorMinHandle, TSharedRef<IPropertyHandle> AnchorMaxHandle)const;
LGUIAnchorPreviewWidget::UIAnchorVerticalAlign GetAnchorVAlign(TSharedRef<IPropertyHandle> AnchorMinHandle, TSharedRef<IPropertyHandle> AnchorMaxHandle)const;
FText GetHAlignText(TSharedRef<IPropertyHandle> AnchorMinHandle, TSharedRef<IPropertyHandle> AnchorMaxHandle)const;
FText GetVAlignText(TSharedRef<IPropertyHandle> AnchorMinHandle, TSharedRef<IPropertyHandle> AnchorMaxHandle)const;
FText GetAnchorLabelText(TSharedRef<IPropertyHandle> AnchorMinHandle, TSharedRef<IPropertyHandle> AnchorMaxHandle, int LabelIndex)const;
FText GetAnchorLabelTooltipText(TSharedRef<IPropertyHandle> AnchorMinHandle, TSharedRef<IPropertyHandle> AnchorMaxHandle, int LabelTooltipIndex)const;
TOptional<float> GetAnchorValue(TSharedRef<IPropertyHandle> AnchorHandle, int AnchorValueIndex)const;
TOptional<float> GetMinMaxSliderValue(TSharedRef<IPropertyHandle> AnchorHandle, int AnchorValueIndex, bool MinOrMax)const;
void ApplyValueChanged(float Value, TSharedRef<IPropertyHandle> AnchorHandle, int AnchorValueIndex);
void OnAnchorValueChanged(float Value, TSharedRef<IPropertyHandle> AnchorHandle, int AnchorValueIndex);
void OnAnchorValueCommitted(float Value, ETextCommit::Type commitType, TSharedRef<IPropertyHandle> AnchorHandle, int AnchorValueIndex);
void OnAnchorValueSliderMovementBegin();
void OnAnchorValueSliderMovementEnd(float Value, TSharedRef<IPropertyHandle> AnchorHandle, int AnchorValueIndex);
EVisibility GetAnchorPresetButtonVisibility()const;
bool IsAnchorValueEnable(TSharedRef<IPropertyHandle> AnchorHandle, int AnchorValueIndex)const;
bool IsAnchorEditable()const;
FReply OnClickIncreaseOrDecreaseHierarchyIndex(bool IncreaseOrDecrease, TSharedRef<IPropertyHandle> HierarchyIndexHandle);
EVisibility GetDisplayNameWarningVisibility()const;
FReply OnClickFixDisplayNameButton(bool singleOrAll, TSharedRef<IPropertyHandle> DisplayNameHandle);
TArray<FMargin> AnchorAsMarginArray;
void OnPrePivotChange();
void OnPivotChanged();
FLGUICanLayoutControlAnchor GetLayoutControlAnchorValue()const;
enum class EAnchorControlledByLayoutType
{
HorizontalAnchor,
HorizontalAnchoredPosition,
HorizontalSizeDelta,
VerticalAnchor,
VerticalAnchoredPosition,
VerticalSizeDelta,
};
bool IsAnchorControlledByMultipleLayout(TMap<EAnchorControlledByLayoutType, TArray<UObject*>>& Result)const;
bool GetLayoutControlHorizontalAnchor()const;
bool GetLayoutControlVerticalAnchor()const;
bool GetLayoutControlHorizontalAnchoredPosition()const;
bool GetLayoutControlVerticalAnchoredPosition()const;
bool GetLayoutControlHorizontalSizeDelta()const;
bool GetLayoutControlVerticalSizeDelta()const;
};