2020-11-17 12:45:35 -04:00
// Copyright Epic Games, Inc. All Rights Reserved.
# include "SPerPlatformPropertiesWidget.h"
# include "Layout/Margin.h"
# include "Fonts/SlateFontInfo.h"
# include "Styling/CoreStyle.h"
# include "Framework/MultiBox/MultiBoxBuilder.h"
# include "Widgets/Input/SButton.h"
# include "Widgets/Input/SComboButton.h"
# include "PlatformInfo.h"
# include "Widgets/Layout/SWrapBox.h"
2022-05-09 13:12:28 -04:00
# include "Styling/AppStyle.h"
2020-11-17 12:45:35 -04:00
# include "Widgets/Layout/SBox.h"
# include "DetailLayoutBuilder.h"
# include "Widgets/Images/SImage.h"
2021-05-27 13:40:37 -04:00
# include "PerQualityLevelProperties.h"
2020-11-17 12:45:35 -04:00
void SPerPlatformPropertiesRow : : Construct ( const FArguments & InArgs , FName PlatformName )
{
this - > OnGenerateWidget = InArgs . _OnGenerateWidget ;
this - > OnRemovePlatform = InArgs . _OnRemovePlatform ;
ChildSlot
[
MakePerPlatformWidget ( PlatformName )
] ;
}
FReply SPerPlatformPropertiesRow : : RemovePlatform ( FName PlatformName )
{
if ( OnRemovePlatform . IsBound ( ) )
{
OnRemovePlatform . Execute ( PlatformName ) ;
}
return FReply : : Handled ( ) ;
}
TSharedRef < SWidget > SPerPlatformPropertiesRow : : MakePerPlatformWidget ( FName InName )
{
TSharedPtr < SHorizontalBox > HorizontalBox ;
TSharedRef < SWidget > Widget =
SNew ( SBox )
. Padding ( FMargin ( 0.0f , 2.0f , 4.0f , 2.0f ) )
. MinDesiredWidth ( 50.0f )
[
SAssignNew ( HorizontalBox , SHorizontalBox )
2021-04-28 01:58:36 -04:00
. ToolTipText ( ( InName ! = NAME_None )
2020-11-17 12:45:35 -04:00
? FText : : Format ( NSLOCTEXT ( " SPerPlatformPropertiesWidget " , " PerPlatformDesc " , " Override for {0} " ) , FText : : AsCultureInvariant ( InName . ToString ( ) ) )
: NSLOCTEXT ( " SPerPlatformPropertiesWidget " , " DefaultDesc " , " Default value for properties without an override " ) )
+ SHorizontalBox : : Slot ( )
. Padding ( 0.0f , 0.0f , 2.0f , 0.0f )
. VAlign ( VAlign_Center )
[
OnGenerateWidget . Execute ( InName )
]
] ;
if ( InName ! = NAME_None )
{
HorizontalBox - > AddSlot ( )
. AutoWidth ( )
. Padding ( 2.0f , 0.0f , 0.0f , 0.0f )
. VAlign ( VAlign_Center )
[
SNew ( SButton )
2022-05-09 13:12:28 -04:00
. ButtonStyle ( FAppStyle : : Get ( ) , " SimpleButton " )
2020-11-17 12:45:35 -04:00
. OnClicked ( this , & SPerPlatformPropertiesRow : : RemovePlatform , InName )
. ToolTipText ( FText : : Format ( NSLOCTEXT ( " SPerPlatformPropertiesWidget " , " RemoveOverrideFor " , " Remove Override for {0} " ) , FText : : AsCultureInvariant ( InName . ToString ( ) ) ) )
. Content ( )
[
SNew ( SImage )
2022-05-09 13:12:28 -04:00
. Image ( FAppStyle : : GetBrush ( " Icons.Delete " ) )
2020-11-17 12:45:35 -04:00
. ColorAndOpacity ( FSlateColor : : UseForeground ( ) )
]
] ;
}
return Widget ;
}