You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#jira UE-152623 #rb Josh.Adams, Patrick.Boutot, Patrick.Laflamme, Louise.Rasmussen #preflight 628d6c5faf7a2e956b8de990 #ROBOMERGE-OWNER: lauren.barnes #ROBOMERGE-AUTHOR: lauren.barnes #ROBOMERGE-SOURCE: CL 20366551 via CL 20368551 via CL 20369147 via CL 20369164 #ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v949-20362246) [CL 20370889 by lauren barnes in ue5-main branch]
106 lines
2.8 KiB
C++
106 lines
2.8 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Widgets/DeclarativeSyntaxSupport.h"
|
|
#include "Layout/Margin.h"
|
|
#include "Widgets/SCompoundWidget.h"
|
|
#include "ITargetDeviceProxy.h"
|
|
#include "Styling/CoreStyle.h"
|
|
#include "Widgets/Text/STextBlock.h"
|
|
#include "Widgets/Input/SComboButton.h"
|
|
#include "Textures/SlateIcon.h"
|
|
#include "Framework/Commands/UIAction.h"
|
|
#include "Framework/MultiBox/MultiBoxBuilder.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "SProjectLauncherVariantSelector"
|
|
|
|
|
|
/**
|
|
* Delegate type for build configuration selections.
|
|
*
|
|
* The first parameter is the selected build configuration.
|
|
*/
|
|
DECLARE_DELEGATE_OneParam(FOnSProjectLauncherVariantSelected, FName)
|
|
|
|
|
|
/**
|
|
* Implements a build configuration selector widget.
|
|
*/
|
|
class SProjectLauncherVariantSelector
|
|
: public SCompoundWidget
|
|
{
|
|
public:
|
|
|
|
SLATE_BEGIN_ARGS(SProjectLauncherVariantSelector) { }
|
|
SLATE_EVENT(FOnSProjectLauncherVariantSelected, OnVariantSelected)
|
|
SLATE_ATTRIBUTE(FText, Text)
|
|
SLATE_END_ARGS()
|
|
|
|
public:
|
|
|
|
/**
|
|
* Constructs the widget.
|
|
*
|
|
* @param InArgs The Slate argument list.
|
|
* @param InModel The data model.
|
|
*/
|
|
void Construct(const FArguments& InArgs, TSharedPtr<ITargetDeviceProxy> DeviceProxy)
|
|
{
|
|
OnVariantSelected = InArgs._OnVariantSelected;
|
|
|
|
// create instance types menu
|
|
FMenuBuilder MenuBuilder(true, NULL);
|
|
|
|
TArray<FName> Variants;
|
|
DeviceProxy->GetVariants(Variants);
|
|
|
|
for (TArray<FName>::TIterator It(Variants); It; ++It)
|
|
{
|
|
FName Variant = (*It);
|
|
FUIAction Action(FExecuteAction::CreateSP(this, &SProjectLauncherVariantSelector::HandleMenuEntryClicked, Variant));
|
|
MenuBuilder.AddMenuEntry(FText::FromString(Variant.ToString()), FText::GetEmpty(), FSlateIcon(), Action);
|
|
}
|
|
|
|
FName DefaultVariant = NAME_None;
|
|
FUIAction Action(FExecuteAction::CreateSP(this, &SProjectLauncherVariantSelector::HandleMenuEntryClicked, DefaultVariant));
|
|
MenuBuilder.AddMenuEntry(LOCTEXT("DefaultVariant", "Default"), FText::GetEmpty(), FSlateIcon(), Action);
|
|
|
|
ChildSlot
|
|
[
|
|
// build configuration menu
|
|
SNew(SComboButton)
|
|
.VAlign(VAlign_Center)
|
|
.ComboButtonStyle(FAppStyle::Get(), "ComboButton")
|
|
.ButtonContent()
|
|
[
|
|
SNew(STextBlock)
|
|
.Font(FCoreStyle::Get().GetFontStyle(TEXT("SmallFont")))
|
|
.Text(InArgs._Text)
|
|
]
|
|
.ContentPadding(FMargin(6.0f, 0.0f))
|
|
.MenuContent()
|
|
[
|
|
MenuBuilder.MakeWidget()
|
|
]
|
|
];
|
|
}
|
|
|
|
private:
|
|
|
|
// Callback for clicking a menu entry.
|
|
void HandleMenuEntryClicked(FName Variant)
|
|
{
|
|
OnVariantSelected.ExecuteIfBound(Variant);
|
|
}
|
|
|
|
private:
|
|
|
|
// Holds a delegate to be invoked when a build configuration has been selected.
|
|
FOnSProjectLauncherVariantSelected OnVariantSelected;
|
|
};
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE
|