Files
UnrealEngineUWP/Engine/Source/Editor/UMGEditor/Private/Customizations/TextJustifyCustomization.cpp
Lauren Barnes 6248f8d412 Replacing legacy EditorStyle calls with AppStyle
#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]
2022-05-09 13:12:28 -04:00

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