Files
UnrealEngineUWP/Engine/Source/Developer/ProjectLauncher/Private/Widgets/Cook/SProjectLauncherCookedPlatforms.h
Ben Marsh 149375b14b Update copyright notices to 2015.
[CL 2379638 by Ben Marsh in Main branch]
2014-12-07 19:09:38 -05:00

123 lines
2.9 KiB
C++

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
/**
* Implements the cooked platforms panel.
*/
class SProjectLauncherCookedPlatforms
: public SCompoundWidget
{
public:
SLATE_BEGIN_ARGS(SProjectLauncherCookedPlatforms) { }
SLATE_END_ARGS()
public:
/**
* Constructs the widget.
*
* @param InArgs The Slate argument list.
* @param InModel The data model.
*/
void Construct( const FArguments& InArgs, const FProjectLauncherModelRef& InModel );
protected:
/**
* Builds the platform menu.
*
* @return Platform menu widget.
*/
void MakePlatformMenu( )
{
TArray<ITargetPlatform*> Platforms = GetTargetPlatformManager()->GetTargetPlatforms();
if (Platforms.Num() > 0)
{
PlatformList.Reset();
for (int32 PlatformIndex = 0; PlatformIndex < Platforms.Num(); ++PlatformIndex)
{
FString PlatformName = Platforms[PlatformIndex]->PlatformName();
PlatformList.Add(MakeShareable(new FString(PlatformName)));
}
}
}
private:
// Callback for clicking the 'Select All Platforms' button.
void HandleAllPlatformsHyperlinkNavigate( bool AllPlatforms )
{
ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile();
if (SelectedProfile.IsValid())
{
if (AllPlatforms)
{
TArray<ITargetPlatform*> Platforms = GetTargetPlatformManager()->GetTargetPlatforms();
for (int32 PlatformIndex = 0; PlatformIndex < Platforms.Num(); ++PlatformIndex)
{
SelectedProfile->AddCookedPlatform(Platforms[PlatformIndex]->PlatformName());
}
}
else
{
SelectedProfile->ClearCookedPlatforms();
}
}
}
// Callback for determining the visibility of the 'Select All Platforms' button.
EVisibility HandleAllPlatformsHyperlinkVisibility( ) const
{
if (GetTargetPlatformManager()->GetTargetPlatforms().Num() > 1)
{
return EVisibility::Visible;
}
return EVisibility::Collapsed;
}
// Callback for getting the color of a platform menu check box.
FSlateColor HandlePlatformMenuEntryColorAndOpacity( FString PlatformName ) const
{
ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile();
if (SelectedProfile.IsValid())
{
ITargetPlatform* TargetPlatform = GetTargetPlatformManager()->FindTargetPlatform(PlatformName);
if (TargetPlatform != NULL)
{
// if (TargetPlatform->HasValidBuild(SelectedProfile->GetProjectPath(), SelectedProfile->GetBuildConfiguration()))
{
return FEditorStyle::GetColor("Foreground");
}
}
}
return FLinearColor::Yellow;
}
// Handles generating a row widget in the map list view.
TSharedRef<ITableRow> HandlePlatformListViewGenerateRow( TSharedPtr<FString> InItem, const TSharedRef<STableViewBase>& OwnerTable );
private:
// Holds a pointer to the data model.
FProjectLauncherModelPtr Model;
// Holds the platform list.
TArray<TSharedPtr<FString> > PlatformList;
// Holds the platform list view.
TSharedPtr<SListView<TSharedPtr<FString> > > PlatformListView;
};