You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#preflight 6272a74d2f6d177be3c6fdda #rb Matt.Kuhlenschmidt #ROBOMERGE-OWNER: Lauren.Barnes #ROBOMERGE-AUTHOR: lauren.barnes #ROBOMERGE-SOURCE: CL 20057269 via CL 20070159 via CL 20072035 via CL 20072203 #ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v943-19904690) #ROBOMERGE-CONFLICT from-shelf [CL 20105363 by Lauren Barnes in ue5-main branch]
59 lines
2.1 KiB
C++
59 lines
2.1 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "Customizations/TextJustifyCustomization.h"
|
|
#include "Widgets/Images/SImage.h"
|
|
#include "Widgets/Input/SCheckBox.h"
|
|
#include "DetailWidgetRow.h"
|
|
#include "Framework/Application/SlateApplication.h"
|
|
#include "Widgets/Input/SSegmentedControl.h"
|
|
|
|
|
|
#define LOCTEXT_NAMESPACE "UMG"
|
|
|
|
void FTextJustifyCustomization::CustomizeHeader(TSharedRef<IPropertyHandle> PropertyHandle, FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& CustomizationUtils)
|
|
{
|
|
HeaderRow
|
|
.IsEnabled(TAttribute<bool>(PropertyHandle, &IPropertyHandle::IsEditable))
|
|
.NameContent()
|
|
[
|
|
PropertyHandle->CreatePropertyNameWidget()
|
|
]
|
|
.ValueContent()
|
|
[
|
|
SNew(SSegmentedControl<ETextJustify::Type>)
|
|
.Value(this, &FTextJustifyCustomization::GetCurrentJustification, PropertyHandle)
|
|
.OnValueChanged(this, &FTextJustifyCustomization::OnJustificationChanged, PropertyHandle)
|
|
+ SSegmentedControl<ETextJustify::Type>::Slot(ETextJustify::Left)
|
|
.Icon(FAppStyle::GetBrush("HorizontalAlignment_Left"))
|
|
.ToolTip(LOCTEXT("AlignTextLeft", "Align Text Left"))
|
|
+ SSegmentedControl<ETextJustify::Type>::Slot(ETextJustify::Center)
|
|
.Icon(FAppStyle::GetBrush("HorizontalAlignment_Center"))
|
|
.ToolTip(LOCTEXT("AlignTextCenter", "Align Text Center"))
|
|
+ SSegmentedControl<ETextJustify::Type>::Slot(ETextJustify::Right)
|
|
.Icon(FAppStyle::GetBrush("HorizontalAlignment_Right"))
|
|
.ToolTip(LOCTEXT("AlignTextRight", "Align Text Right"))
|
|
];
|
|
}
|
|
|
|
void FTextJustifyCustomization::CustomizeChildren(TSharedRef<IPropertyHandle> PropertyHandle, IDetailChildrenBuilder& ChildBuilder, IPropertyTypeCustomizationUtils& CustomizationUtils)
|
|
{
|
|
}
|
|
|
|
void FTextJustifyCustomization::OnJustificationChanged(ETextJustify::Type NewState, TSharedRef<IPropertyHandle> PropertyHandle)
|
|
{
|
|
PropertyHandle->SetValue((uint8)NewState);
|
|
}
|
|
|
|
ETextJustify::Type FTextJustifyCustomization::GetCurrentJustification(TSharedRef<IPropertyHandle> PropertyHandle) const
|
|
{
|
|
uint8 Value;
|
|
if ( PropertyHandle->GetValue(Value) == FPropertyAccess::Result::Success)
|
|
{
|
|
return ETextJustify::Type(Value);
|
|
}
|
|
|
|
return ETextJustify::Left;
|
|
}
|
|
|
|
#undef LOCTEXT_NAMESPACE
|