From cb8a830d544003476a9aa6394dfedd2181f47ff7 Mon Sep 17 00:00:00 2001 From: Steve Streeting Date: Mon, 9 Jan 2023 12:45:18 +0000 Subject: [PATCH] 5.0 compat --- .../Private/StevesUI/FocusableCheckBox.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Source/StevesUEHelpers/Private/StevesUI/FocusableCheckBox.cpp b/Source/StevesUEHelpers/Private/StevesUI/FocusableCheckBox.cpp index c78d8a3..7d45ccd 100644 --- a/Source/StevesUEHelpers/Private/StevesUI/FocusableCheckBox.cpp +++ b/Source/StevesUEHelpers/Private/StevesUI/FocusableCheckBox.cpp @@ -6,11 +6,18 @@ TSharedRef UFocusableCheckBox::RebuildWidget() { MyCheckbox = SNew(SFocusableCheckBox) .OnCheckStateChanged( BIND_UOBJECT_DELEGATE(FOnCheckStateChanged, SlateOnCheckStateChangedCallback) ) +#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION > 0 .Style(&GetWidgetStyle()) - .HAlign( HorizontalAlignment ) .ClickMethod(GetClickMethod()) .TouchMethod(GetTouchMethod()) .PressMethod(GetPressMethod()) +#else + .Style(&WidgetStyle) + .ClickMethod(ClickMethod) + .TouchMethod(TouchMethod) + .PressMethod(PressMethod) +#endif + .HAlign( HorizontalAlignment ) .IsFocusable(IsFocusable) // Our new events .OnHovered(BIND_UOBJECT_DELEGATE(FSimpleDelegate, SlateHandleHovered)) @@ -34,7 +41,11 @@ TSharedRef UFocusableCheckBox::RebuildWidget() void UFocusableCheckBox::RefreshFocussedStyle_Implementation() { // Copy Widget style but make normal same as hovered +#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION > 0 FocussedStyle = GetWidgetStyle(); +#else + FocussedStyle = WidgetStyle; +#endif FocussedStyle.UncheckedImage = FocussedStyle.UncheckedHoveredImage; FocussedStyle.CheckedImage = FocussedStyle.CheckedHoveredImage; FocussedStyle.UndeterminedImage = FocussedStyle.UndeterminedHoveredImage; @@ -65,7 +76,11 @@ void UFocusableCheckBox::UndoFocusStyle() { if (MyCheckbox.IsValid()) { +#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION > 0 MyCheckbox->SetStyle(&GetWidgetStyle()); +#else + MyCheckbox->SetStyle(&WidgetStyle); +#endif } }