Files
UnrealEngineUWP/Engine/Source/Editor/GameProjectGeneration/Private/SNewClassDialog.h
Jamie Dale c010db2fb4 #ttp 322244 - LIVE: Feature Request: During "Add Code to Project", allow user to select path where files go
#proj UE4
#branch UE4
#summary You can now choose where to place a class added via the New Class Wizard
#extra This tries to be smart about your placement if you have Public and Private folders for your project.
- By default the header would go into Public, and the source file would go into Private.
- If you select the Public/Classes folder for the path, the source file will still go into Private.
- If you have a sub-path, eg) /Public/MyStuff/MyClass.h, this will be mirrored in the placement of the source file, eg) /Private/MyStuff/MyClass.cpp
#extra If you're not using Public or Private folders it will just place the source at whatever path you specified.
#extra It will verify that your source code is going to a valid module folder for your game, and also allows matching of modules that start with your game name, eg) MyGame, MyGameEditor.
#reviewedby Thomas.Sarkanen, Max.Preussner

[CL 2046528 by Jamie Dale in Main branch]
2014-04-23 18:50:08 -04:00

177 lines
5.9 KiB
C++

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#pragma once
struct FParentClassItem;
/**
* A dialog to choose a new class parent and name
*/
class SNewClassDialog : public SCompoundWidget
{
public:
SLATE_BEGIN_ARGS( SNewClassDialog )
: _Class(NULL)
{}
/** The class we want to build our new class from. If this is not specified then the wizard will display classes to the user. */
SLATE_ARGUMENT(UClass*, Class)
SLATE_END_ARGS()
/** Constructs this widget with InArgs */
void Construct( const FArguments& InArgs );
virtual void Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime ) OVERRIDE;
private:
/** Creates a row in the parent class list */
TSharedRef<ITableRow> MakeParentClassListViewWidget(TSharedPtr<FParentClassItem> ParentClassItem, const TSharedRef<STableViewBase>& OwnerTable);
/** Gets the currently selected parent class name */
FString GetSelectedParentClassName() const;
/** Handler for when a parent class item is double clicked */
void OnParentClassItemDoubleClicked( TSharedPtr<FParentClassItem> TemplateItem );
/** Handler for when a class is selected in the parent class list */
void OnClassSelected(TSharedPtr<FParentClassItem> Item, ESelectInfo::Type SelectInfo);
/** Handler for when a class was picked in the full class tree */
void OnAdvancedClassSelected(UClass* Class);
/** Gets the check box state for the full class list */
ESlateCheckBoxState::Type IsFullClassTreeChecked() const;
/** Gets the check box state for the full class list */
void OnFullClassTreeChanged(ESlateCheckBoxState::Type NewCheckedState);
/** Gets the visibility of the basic class list */
EVisibility GetBasicParentClassVisibility() const;
/** Gets the visibility of the full class list */
EVisibility GetAdvancedParentClassVisibility() const;
/** Gets the visibility of the name error label */
EVisibility GetNameErrorLabelVisibility() const;
/** Gets the text to display in the name error label */
FString GetNameErrorLabelText() const;
/** Gets the visibility of the global error label */
EVisibility GetGlobalErrorLabelVisibility() const;
/** Gets the visibility of the global error label IDE Link */
EVisibility GetGlobalErrorLabelIDELinkVisibility() const;
/** Gets the text to display in the global error label */
FString GetGlobalErrorLabelText() const;
/** Handler for when the user enters the "name class" page */
void OnNamePageEntered();
/** Returns the title text for the "name class" page */
FString GetNameClassTitle() const;
/** Returns the text in the class name edit box */
FText OnGetClassNameText() const;
/** Handler for when the text in the class name edit box has changed */
void OnClassNameTextChanged(const FText& NewText);
/** Returns the text in the class path edit box */
FText OnGetClassPathText() const;
/** Handler for when the text in the class path edit box has changed */
void OnClassPathTextChanged(const FText& NewText);
/** Returns the text for the calculated header file name */
FText OnGetClassHeaderFileText() const;
/** Returns the text for the calculated source file name */
FText OnGetClassSourceFileText() const;
/** Handler for when cancel is clicked */
void CancelClicked();
/** Returns true if Finish is allowed */
bool CanFinish() const;
/** Handler for when finish is clicked */
void FinishClicked();
/** Handler for when the error label IDE hyperlink was clicked */
void OnDownloadIDEClicked(FString URL);
/** Handler for when the "Choose Folder" button is clicked */
FReply HandleChooseFolderButtonClicked( );
private:
/** Checks the current class name/path for validity and updates cached values accordingly */
void UpdateInputValidity();
/** Gets the currently selected parent class */
const UClass* GetSelectedParentClass() const;
/** Adds parent classes to the ParentClassListView source */
void SetupParentClassItems();
/** Closes the window that contains this widget */
void CloseContainingWindow();
private:
/** The wizard widget */
TSharedPtr<SWizard> MainWizard;
/** ParentClass items */
TSharedPtr< SListView< TSharedPtr<FParentClassItem> > > ParentClassListView;
TArray< TSharedPtr<FParentClassItem> > ParentClassItemsSource;
/** A pointer to a class viewer **/
TSharedPtr<class SClassViewer> ClassViewer;
/** The editable text box to enter the current name */
TSharedPtr<SEditableTextBox> ClassNameEditBox;
/** The name of the class being created */
FString NewClassName;
/** The path to place the files for the class being generated */
FString NewClassPath;
/** The calculated name of the generated header file for this class */
FString CalculatedClassHeaderName;
/** The calculated name of the generated source file for this class */
FString CalculatedClassSourceName;
/** The name of the last class that was auto-generated by this wizard */
FString LastAutoGeneratedClassName;
/** The selected parent class */
TWeakObjectPtr<UClass> ParentClass;
/** The fixed width of the dialog */
int32 DialogFixedWidth;
/** If true, the full class tree will be shown in the parent class selection */
bool bShowFullClassTree;
/** The last time that the class name/path was checked for validity. This is used to throttle I/O requests to a reasonable frequency */
double LastPeriodicValidityCheckTime;
/** The frequency in seconds for validity checks while the dialog is idle. Changes to the name/path immediately update the validity. */
double PeriodicValidityCheckFrequency;
/** Periodic checks for validity will not occur while this flag is true. Used to prevent a frame of "this project already exists" while exiting after a successful creation. */
bool bPreventPeriodicValidityChecksUntilNextChange;
/** The error text from the last validity check */
FText LastInputValidityErrorText;
/** True if the last validity check returned that the class name/path is valid for creation */
bool bLastInputValidityCheckSuccessful;
};