35template<
typename NumericType>
212 check(InArgs._EditableTextBoxStyle);
214 OnValueChanged = InArgs._OnValueChanged;
215 OnValueCommitted = InArgs._OnValueCommitted;
216 OnUndeterminedValueChanged = InArgs._OnUndeterminedValueChanged;
217 OnUndeterminedValueCommitted = InArgs._OnUndeterminedValueCommitted;
218 ValueAttribute = InArgs._Value;
219 UndeterminedString = InArgs._UndeterminedString;
220 MinDesiredValueWidth = InArgs._MinDesiredValueWidth;
221 BorderImageNormal = &InArgs._EditableTextBoxStyle->BackgroundImageNormal;
222 BorderImageHovered = &InArgs._EditableTextBoxStyle->BackgroundImageHovered;
223 BorderImageFocused = &InArgs._EditableTextBoxStyle->BackgroundImageFocused;
226 if (InArgs._TypeInterface.IsValid() && Interface->GetOnSettingChanged())
228 Interface->GetOnSettingChanged()->AddSP(
this, &SNumericEntryBox::ResetCachedValueString);
231 MinFractionalDigits = (InArgs._MinFractionalDigits.Get().IsSet()) ? InArgs._MinFractionalDigits : DefaultMinFractionalDigits;
232 MaxFractionalDigits = (InArgs._MaxFractionalDigits.Get().IsSet()) ? InArgs._MaxFractionalDigits : DefaultMaxFractionalDigits;
236 ToolTipTextFormat = InArgs._ToolTipTextFormat;
238 CachedExternalValue = ValueAttribute.
Get();
239 if (CachedExternalValue.
IsSet())
241 CachedValueString = Interface->ToString(CachedExternalValue.
GetValue());
243 bCachedValueStringDirty =
false;
249 .Padding(
FMargin(0.f, 0.f, 2.f, 0.f))
250 .IsChecked(InArgs._ToggleChecked)
251 .OnCheckStateChanged(
this, &SNumericEntryBox::HandleToggleCheckBoxChanged, InArgs._OnToggleChanged);
254 const bool bAllowSpin = InArgs._AllowSpin;
260 .Style(InArgs._SpinBoxStyle)
261 .Font(InArgs._Font.IsSet() ? InArgs._Font : InArgs._EditableTextBoxStyle->TextStyle.Font)
263 .Delta(InArgs._Delta)
264 .ShiftMultiplier(InArgs._ShiftMultiplier)
265 .CtrlMultiplier(InArgs._CtrlMultiplier)
266 .LinearDeltaSensitivity(InArgs._LinearDeltaSensitivity)
267 .SupportDynamicSliderMaxValue(InArgs._SupportDynamicSliderMaxValue)
268 .SupportDynamicSliderMinValue(InArgs._SupportDynamicSliderMinValue)
269 .OnDynamicSliderMaxValueChanged(InArgs._OnDynamicSliderMaxValueChanged)
270 .OnDynamicSliderMinValueChanged(InArgs._OnDynamicSliderMinValueChanged)
271 .OnValueChanged(OnValueChanged)
272 .OnValueCommitted(OnValueCommitted)
273 .MinFractionalDigits(MinFractionalDigits)
274 .MaxFractionalDigits(MaxFractionalDigits)
275 .MinSliderValue(InArgs._MinSliderValue)
276 .MaxSliderValue(InArgs._MaxSliderValue)
277 .MaxValue(InArgs._MaxValue)
278 .MinValue(InArgs._MinValue)
279 .ContextMenuExtender(InArgs._ContextMenuExtender)
280 .SliderExponent(InArgs._SliderExponent)
281 .SliderExponentNeutralValue(InArgs._SliderExponentNeutralValue)
282 .EnableWheel(InArgs._AllowWheel)
283 .PreventThrottling(InArgs._PreventThrottling)
284 .BroadcastValueChangesPerKey(InArgs._BroadcastValueChangesPerKey)
285 .WheelStep(InArgs._WheelStep)
286 .OnBeginSliderMovement(InArgs._OnBeginSliderMovement)
287 .OnEndSliderMovement(InArgs._OnEndSliderMovement)
288 .MinDesiredWidth(InArgs._MinDesiredValueWidth)
289 .TypeInterface(Interface)
297 .ColorAndOpacity(InArgs._EditableTextBoxStyle->ForegroundColor)
299 .
Font(InArgs._Font.IsSet() ? InArgs._Font : InArgs._EditableTextBoxStyle->TextStyle.Font)
300 .SelectAllTextWhenFocused(
true)
301 .ClearKeyboardFocusOnCommit(
false)
304 .SelectAllTextOnCommit(
true)
305 .ContextMenuExtender(InArgs._ContextMenuExtender)
306 .Justification(InArgs._Justification)
307 .MinDesiredWidth(InArgs._MinDesiredValueWidth);
323 TAttribute<FMargin> TextMargin = InArgs._OverrideTextMargin.
IsSet() ? InArgs._OverrideTextMargin : InArgs._EditableTextBoxStyle->Padding;
344 .VAlign(InArgs._LabelVAlign)
345 .Padding(InArgs._LabelPadding)
361 .BorderBackgroundColor(InArgs._BorderBackgroundColor)
362 .ForegroundColor(InArgs._BorderForegroundColor)
380 .Padding(InArgs._TogglePadding)
402 HorizontalBox->AddSlot()
405 .VAlign(InArgs._LabelVAlign)
406 .Padding(InArgs._LabelPadding)
413 HorizontalBox->AddSlot()
417 .Padding(InArgs._TogglePadding)
423 HorizontalBox->AddSlot()
445 .BorderImage(
FCoreStyle::Get().GetBrush(
"NumericEntrySpinBox.Decorator"))
446 .BorderBackgroundColor(BackgroundColor)
447 .ForegroundColor(ForegroundColor)
450 .Padding(
FMargin(1.f, 0.f, 6.f, 0.f))
463 .BorderImage(
FAppStyle::Get().GetBrush(
"NumericEntrySpinBox.NarrowDecorator"))
464 .BorderBackgroundColor(LabelColor)
466 .Padding(
FMargin(2.0f, 0.0f, 0.0f, 0.0f));
478 bCachedValueStringDirty =
true;
486 bCachedValueStringDirty =
true;
493 virtual bool SupportsKeyboardFocus()
const override
539 FString GetLabel()
const
548 NumericType OnGetValueForSpinBox()
const
550 const auto&
Value = ValueAttribute.
Get();
553 if(
Value.IsSet() ==
true )
561 void SetCachedString(
const NumericType CurrentValue)
563 if (!CachedExternalValue.
IsSet() || CachedExternalValue.
GetValue() != CurrentValue || bCachedValueStringDirty)
565 CachedExternalValue = CurrentValue;
566 CachedValueString = Interface->ToString(CurrentValue);
567 bCachedValueStringDirty =
false;
571 FString GetCachedString(
const NumericType CurrentValue)
const
574 return bUseCachedString ? CachedValueString : Interface->ToString(CurrentValue);
577 FText GetToolTipText()
const
582 if constexpr (std::is_floating_point_v<NumericType>)
584 if (
Value.IsSet() && CachedValueString.Contains(
TEXT(
"...")))
600 if (
Value.IsSet() ==
true)
602 NumericType CurrentValue =
Value.GetValue();
606 if (ToolTipTextFormat.
Get().
IsSet())
620 FText OnGetValueForTextBox()
const
625 if (
Value.IsSet() ==
true)
631 return UndeterminedString;
643 void OnTextChanged(
const FText& NewValue )
645 const auto&
Value = ValueAttribute.
Get();
647 if (
Value.IsSet() || !OnUndeterminedValueChanged.IsBound())
653 OnUndeterminedValueChanged.Execute(NewValue);
662 const auto&
Value = ValueAttribute.
Get();
664 if (
Value.IsSet() || !OnUndeterminedValueCommitted.IsBound())
666 SendChangesFromText( NewValue,
true, CommitInfo );
670 OnUndeterminedValueCommitted.Execute(NewValue, CommitInfo);
692 return BorderImageFocused;
697 return BorderImageHovered;
700 return BorderImageNormal;
725 OnValueCommitted.ExecuteIfBound(
NumericValue.GetValue(), CommitInfo);
741 if constexpr (std::is_floating_point_v<NumericType>)
745 Interface->SetIndicateNearlyInteger(
true);
746 bCachedValueStringDirty =
true;
750 SpinBox->ResetCachedValueString();
757 if (
Value.IsSet() ==
true)
759 SetCachedString(
Value.GetValue());
765 if (
Value.IsSet() ==
true)
784 bool IsToggleEnabled()
const
809 void ResetCachedValueString()
813 bCachedValueStringDirty =
true;
820 static const int32 DefaultMinFractionalDigits;
823 static const int32 DefaultMaxFractionalDigits;
844 FText UndeterminedString;
858 FString CachedValueString;
860 bool bCachedValueStringDirty;
867template <
typename NumericType>
870template <
typename NumericType>
873template <
typename NumericType>
876template <
typename NumericType>
879template <
typename NumericType>
882template<
typename NumericType>
885template<
typename NumericType>
#define check(expr)
Definition AssertionMacros.h:314
SharedPointerInternals::TRawPtrProxy< ObjectType > MakeShareable(ObjectType *InObject)
Definition SharedPointer.h:1947
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define SLATE_NAMED_SLOT(DeclarationType, SlotName)
Definition DeclarativeSyntaxSupport.h:437
#define SLATE_STYLE_ARGUMENT(ArgType, ArgName)
Definition DeclarativeSyntaxSupport.h:280
#define SAssignNew(ExposeAs, WidgetType,...)
Definition DeclarativeSyntaxSupport.h:41
#define SNew(WidgetType,...)
Definition DeclarativeSyntaxSupport.h:37
#define SLATE_ATTRIBUTE(AttrType, AttrName)
Definition DeclarativeSyntaxSupport.h:192
#define SLATE_ATTRIBUTE_DEPRECATED(AttrType, AttrName, DeprecationVersion, DeprecationMessage)
Definition DeclarativeSyntaxSupport.h:199
#define SLATE_EVENT(DelegateName, EventName)
Definition DeclarativeSyntaxSupport.h:458
#define SLATE_END_ARGS()
Definition DeclarativeSyntaxSupport.h:116
#define SLATE_ARGUMENT(ArgType, ArgName)
Definition DeclarativeSyntaxSupport.h:208
return true
Definition ExternalRpcRegistry.cpp:601
#define NSLOCTEXT(InNamespace, InKey, InTextLiteral)
Definition Internationalization.h:300
EVerticalAlignment
Definition SlateEnums.h:194
ECheckBoxState
Definition SlateTypes.h:65
static SLATECORE_API const ISlateStyle & Get()
Definition AppStyle.cpp:10
static const ISlateStyle & Get()
Definition CoreStyle.h:33
static FReply Unhandled()
Definition Reply.h:241
SLATECORE_API FReply & SetUserFocus(TSharedRef< SWidget > GiveMeFocus, EFocusCause ReasonFocusIsChanging=EFocusCause::SetDirectly, bool bInAllUsers=false)
Definition Reply.cpp:40
static FReply Handled()
Definition Reply.h:233
CORE_API bool IsEmpty() const
Definition Text.cpp:320
static CORE_API FText FromString(const ANSICHAR *String)
Definition Text.cpp:1081
static CORE_API const FText & GetEmpty()
Definition Text.cpp:252
static CORE_API FText Format(FTextFormat Fmt, const FFormatNamedArguments &InArguments)
Definition Text.cpp:469
CORE_API const FString & ToString() const
Definition Text.cpp:1263
Definition SCheckBox.h:30
bool IsChecked() const
Definition SCheckBox.h:191
Definition SEditableText.h:38
Definition SBoxPanel.h:171
static FSlot::FSlotArguments Slot()
Definition SBoxPanel.h:272
Definition SNumericEntryBox.h:37
DECLARE_DELEGATE_TwoParams(FOnUndeterminedValueCommitted, FText, ETextCommit::Type)
DECLARE_DELEGATE_OneParam(FOnValueChanged, NumericType)
static TSharedRef< SWidget > BuildLabel(TAttribute< FText > LabelText, const FSlateColor &ForegroundColor, const FSlateColor &BackgroundColor)
Definition SNumericEntryBox.h:440
SLATE_BEGIN_ARGS(SNumericEntryBox< NumericType >)
Definition SNumericEntryBox.h:71
static const FLinearColor BlueLabelBackgroundColor
Definition SNumericEntryBox.h:42
int32 GetMinFractionalDigits() const
Definition SNumericEntryBox.h:474
void SetMinFractionalDigits(const TAttribute< TOptional< int32 > > &InMinFractionalDigits)
Definition SNumericEntryBox.h:475
static const FLinearColor LilacLabelBackgroundColor
Definition SNumericEntryBox.h:43
DECLARE_DELEGATE_OneParam(FOnUndeterminedValueChanged, FText)
static TSharedRef< SWidget > BuildNarrowColorLabel(FLinearColor LabelColor)
Definition SNumericEntryBox.h:458
ELabelLocation
Definition SNumericEntryBox.h:62
static const FText DefaultUndeterminedString
Definition SNumericEntryBox.h:44
int32 GetMaxFractionalDigits() const
Definition SNumericEntryBox.h:482
DECLARE_DELEGATE_TwoParams(FOnValueCommitted, NumericType, ETextCommit::Type)
static const FLinearColor RedLabelBackgroundColor
Definition SNumericEntryBox.h:40
void SetMaxFractionalDigits(const TAttribute< TOptional< int32 > > &InMaxFractionalDigits)
Definition SNumericEntryBox.h:483
void Construct(const FArguments &InArgs)
Definition SNumericEntryBox.h:210
static const FLinearColor GreenLabelBackgroundColor
Definition SNumericEntryBox.h:41
DECLARE_DELEGATE_FourParams(FOnDynamicSliderMinMaxValueChanged, NumericType, TWeakPtr< SWidget >, bool, bool)
TSharedPtr< SWidget > GetSpinBox() const
Definition SNumericEntryBox.h:471
Definition STextBlock.h:45
Definition Attribute.h:17
const ObjectType & Get() const
Definition Attribute.h:241
bool IsSet() const
Definition Attribute.h:230
static UE_FORCEINLINE_HINT TSharedRef< OtherType, Mode > SharedThis(OtherType *ThisPtr)
Definition SharedPointer.h:1780
Definition SharedPointer.h:692
TSharedRef< ObjectType, Mode > ToSharedRef() const &
Definition SharedPointer.h:1028
UE_FORCEINLINE_HINT const bool IsValid() const
Definition SharedPointer.h:1085
Definition SharedPointer.h:153
Definition SharedPointer.h:1295
Type
Definition SlateEnums.h:291
@ Default
Definition SlateEnums.h:293
Definition TextLayout.h:26
Type
Definition TextLayout.h:28
@ false
Definition radaudio_common.h:23
static INPUTCORE_API const FKey Escape
Definition InputCoreTypes.h:312
static SLATECORE_API const EVisibility HitTestInvisible
Definition Visibility.h:23
static SLATECORE_API const EVisibility Visible
Definition Visibility.h:14
static SLATECORE_API const EVisibility Collapsed
Definition Visibility.h:17
Definition SlateTypes.h:1019
Definition InputCoreTypes.h:50
Definition SlateBrush.h:239
Definition SlateColor.h:42
Definition SlateFontInfo.h:147
Definition SlateTypes.h:1489
Definition NumericTypeInterface.h:21
Definition NumericTypeInterface.h:50
Definition NumericLimits.h:41
Definition Optional.h:131
constexpr OptionalType & GetValue()
Definition Optional.h:443
constexpr bool IsSet() const
Definition Optional.h:69