Files
UnrealEngine/Engine/Plugins/Mutable/Source/CustomizableObjectEditor/Private/MuCOE/SMutableStringViewer.cpp
2025-05-18 13:04:45 +08:00

54 lines
976 B
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "MuCOE/SMutableStringViewer.h"
#include "Widgets/SBoxPanel.h"
#include "Widgets/Text/STextBlock.h"
#define LOCTEXT_NAMESPACE "CustomizableObjectEditor"
void SMutableStringViewer::Construct(const FArguments& InArgs)
{
// Set a default value for the displayed text
if (InArgs._DefaultText.IsSet())
{
StringValue = InArgs._DefaultText.Get();
}
const FText StringValueTitle = LOCTEXT("StringValueTitle", "String Value : ");
ChildSlot
[
SNew(SHorizontalBox)
// Title
+ SHorizontalBox::Slot()
.AutoWidth()
[
SNew(STextBlock).
Text(StringValueTitle)
]
// Value
+ SHorizontalBox::Slot()
.AutoWidth()
[
SNew(STextBlock).
Text(this, &SMutableStringViewer::GetValue)
]
];
}
void SMutableStringViewer::SetString(const FText& InString)
{
this->StringValue = InString;
}
FText SMutableStringViewer::GetValue() const
{
return this->StringValue;
}
#undef LOCTEXT_NAMESPACE