Files
UnrealEngineUWP/Engine/Source/Editor/UnrealEd/Public/SCSVImportOptions.h
Jamie Dale 5f5d0206a9 Fixed some new code that was providing text to Slate as FString rather than FText
UETOOL-213 - Minimize Slate FString -> FText conversion (remove SLATE_TEXT_ATTRIBUTE)

[CL 2422115 by Jamie Dale in Main branch]
2015-01-28 09:33:56 -05:00

113 lines
2.9 KiB
C++

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
/**
* UI to pick options when importing a data table
*/
#pragma once
class UNREALED_API SCSVImportOptions : public SCompoundWidget
{
private:
/** Typedef for curve enum pointers */
typedef TSharedPtr<ERichCurveInterpMode> CurveInterpModePtr;
public:
SLATE_BEGIN_ARGS(SCSVImportOptions)
: _WidgetWindow()
{}
SLATE_ARGUMENT(TSharedPtr<SWindow>, WidgetWindow)
SLATE_END_ARGS()
SCSVImportOptions()
: bImport(false)
, SelectedImportType(ECSVImportType::ECSV_DataTable)
, SelectedStruct(NULL)
{}
void Construct(const FArguments& InArgs);
/** If we should import */
bool ShouldImport();
/** Get the row struct we selected */
UScriptStruct* GetSelectedRowStruct();
/** Get the import type we selected */
ECSVImportType GetSelectedImportType();
/** Get the interpolation mode we selected */
ERichCurveInterpMode GetSelectedCurveIterpMode();
/** Whether to show table row options */
EVisibility GetTableRowOptionVis() const;
/** Whether to show table row options */
EVisibility GetCurveTypeVis() const;
FString GetImportTypeText(TSharedPtr<ECSVImportType> Type) const;
/** Called to create a widget for each struct */
TSharedRef<SWidget> MakeImportTypeItemWidget(TSharedPtr<ECSVImportType> Type);
/** Called to create a widget for each struct */
TSharedRef<SWidget> MakeRowStructItemWidget(UScriptStruct* Struct);
FString GetCurveTypeText(CurveInterpModePtr InterpMode) const;
/** Called to create a widget for each curve interpolation enum */
TSharedRef<SWidget> MakeCurveTypeWidget(CurveInterpModePtr InterpMode);
/** Called when 'OK' button is pressed */
FReply OnImport();
/** Called when 'Cancel' button is pressed */
FReply OnCancel();
FText GetSelectedItemText() const;
FText GetSelectedRowOptionText() const;
FText GetSelectedCurveTypeText() const;
private:
/** Whether we should go ahead with import */
bool bImport;
/** Window that owns us */
TWeakPtr< SWindow > WidgetWindow;
// Import type
/** List of import types to pick from, drives combo box */
TArray< TSharedPtr<ECSVImportType> > ImportTypes;
/** The combo box */
TSharedPtr< SComboBox< TSharedPtr<ECSVImportType> > > ImportTypeCombo;
/** Indicates what kind of asset we want to make from the CSV file */
ECSVImportType SelectedImportType;
// Row type
/** Array of row struct options */
TArray< UScriptStruct* > RowStructs;
/** The row struct combo box */
TSharedPtr< SComboBox<UScriptStruct*> > RowStructCombo;
/** The selected row struct */
UScriptStruct* SelectedStruct;
/** The curve interpolation combo box */
TSharedPtr< SComboBox<CurveInterpModePtr> > CurveInterpCombo;
/** All available curve interpolation modes */
TArray< CurveInterpModePtr > CurveInterpModes;
/** The selected curve interpolation type */
ERichCurveInterpMode SelectedCurveInterpMode;
};