Files
UnrealEngineUWP/Engine/Source/Editor/PropertyEditor/Private/DetailAdvancedDropdownNode.cpp
Ben Marsh 4ba423868f Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none

==========================
MAJOR FEATURES + CHANGES
==========================

Change 3209340 on 2016/11/23 by Ben.Marsh

	Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.

	Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.

	  * Every header now includes everything it needs to compile.
	        * There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
	        * There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
	  * Every .cpp file includes its matching .h file first.
	        * This helps validate that each header is including everything it needs to compile.
	  * No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
	        * You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
	        * There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
	  * No engine code explicitly includes a precompiled header any more.
	        * We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
	        * PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.

	Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.

[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00

201 lines
5.9 KiB
C++

// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
#include "DetailAdvancedDropdownNode.h"
#include "Widgets/Images/SImage.h"
#include "Widgets/Input/SButton.h"
#include "SDetailTableRowBase.h"
class SAdvancedDropdownRow : public SDetailTableRowBase
{
public:
SLATE_BEGIN_ARGS( SAdvancedDropdownRow )
: _IsExpanded( false )
, _IsButtonEnabled( true )
, _ShouldShowAdvancedButton( false )
{}
SLATE_ATTRIBUTE( bool, IsExpanded )
SLATE_ATTRIBUTE( bool, IsButtonEnabled )
SLATE_ARGUMENT( bool, ShouldShowAdvancedButton )
SLATE_ARGUMENT( FDetailColumnSizeData, ColumnSizeData )
SLATE_EVENT( FOnClicked, OnClicked )
SLATE_END_ARGS()
/**
* Construct the widget
*
* @param InArgs A declaration from which to construct the widget
*/
void Construct( const FArguments& InArgs, const TSharedRef<STableViewBase>& InOwnerTableView, bool bIsTopNode, bool bInDisplayShowAdvancedMessage, bool bShowSplitter )
{
IsExpanded = InArgs._IsExpanded;
bDisplayShowAdvancedMessage = bInDisplayShowAdvancedMessage;
TSharedPtr<SWidget> ContentWidget;
if( bIsTopNode )
{
ContentWidget =
SNew( SBorder )
.BorderImage( FEditorStyle::GetBrush("DetailsView.CategoryMiddle") )
.Padding( FMargin( 0.0f, 3.0f, SDetailTableRowBase::ScrollbarPaddingSize, 0.0f ) )
[
SNew( SImage )
.Image( FEditorStyle::GetBrush("DetailsView.AdvancedDropdownBorder.Open") )
];
}
else if( InArgs._ShouldShowAdvancedButton )
{
ContentWidget =
SNew( SBorder )
.BorderImage( FEditorStyle::GetBrush("DetailsView.AdvancedDropdownBorder") )
.Padding( FMargin( 0.0f, 3.0f, SDetailTableRowBase::ScrollbarPaddingSize, 0.0f ) )
[
SNew( SVerticalBox )
+SVerticalBox::Slot()
.HAlign( HAlign_Center )
.AutoHeight()
[
SNew( STextBlock )
.Text( NSLOCTEXT("DetailsView", "NoSimpleProperties", "Click the arrow to display advanced properties") )
.Font( IDetailLayoutBuilder::GetDetailFont() )
.Visibility( this, &SAdvancedDropdownRow::OnGetHelpTextVisibility )
.ColorAndOpacity(FLinearColor(1,1,1,.5))
]
+ SVerticalBox::Slot()
.AutoHeight()
[
SAssignNew(ExpanderButton, SButton)
.ButtonStyle(FEditorStyle::Get(), "NoBorder")
.HAlign(HAlign_Center)
.ContentPadding(2)
.OnClicked(InArgs._OnClicked)
.IsEnabled(InArgs._IsButtonEnabled)
.ToolTipText(this, &SAdvancedDropdownRow::GetAdvancedPulldownToolTipText )
[
SNew(SImage)
.Image(this, &SAdvancedDropdownRow::GetAdvancedPulldownImage)
]
]
];
}
else
{
TSharedPtr<SWidget> SplitterArea;
if( bShowSplitter )
{
SplitterArea =
SNew( SSplitter )
.PhysicalSplitterHandleSize( 1.0f )
.HitDetectionSplitterHandleSize( 5.0f )
.Style( FEditorStyle::Get(), "DetailsView.Splitter" )
+ SSplitter::Slot()
.Value( InArgs._ColumnSizeData.LeftColumnWidth )
.OnSlotResized( SSplitter::FOnSlotResized::CreateSP( this, &SAdvancedDropdownRow::OnLeftColumnResized ) )
[
SNew( SHorizontalBox )
+ SHorizontalBox::Slot()
.Padding( 3.0f, 0.0f )
.HAlign( HAlign_Left )
.VAlign( VAlign_Center )
.AutoWidth()
[
SNew( SExpanderArrow, SharedThis(this) )
]
+ SHorizontalBox::Slot()
.HAlign( HAlign_Left )
.Padding( FMargin( 0.0f, 2.5f, 2.0f, 2.5f ) )
[
SNew( SSpacer )
]
]
+ SSplitter::Slot()
.Value( InArgs._ColumnSizeData.RightColumnWidth )
.OnSlotResized( InArgs._ColumnSizeData.OnWidthChanged )
[
SNew( SSpacer )
];
}
else
{
SplitterArea = SNew(SSpacer);
}
SplitterArea = SNew(SSpacer);
ContentWidget =
SNew( SBorder )
.BorderImage( FEditorStyle::GetBrush("DetailsView.CategoryBottom") )
.Padding( FMargin( 0.0f, 0.0f, SDetailTableRowBase::ScrollbarPaddingSize, 2.0f ) )
[
SplitterArea.ToSharedRef()
];
}
ChildSlot
[
ContentWidget.ToSharedRef()
];
STableRow< TSharedPtr< IDetailTreeNode > >::ConstructInternal(
STableRow::FArguments()
.Style(FEditorStyle::Get(), "DetailsView.TreeView.TableRow")
.ShowSelection(false),
InOwnerTableView
);
}
private:
void OnLeftColumnResized( float InNewWidth )
{
// This has to be bound or the splitter will take it upon itself to determine the size
// We do nothing here because it is handled by the column size data
}
EVisibility OnGetHelpTextVisibility() const
{
return bDisplayShowAdvancedMessage && !IsExpanded.Get() ? EVisibility::Visible : EVisibility::Collapsed;
}
FText GetAdvancedPulldownToolTipText() const
{
return IsExpanded.Get() ? NSLOCTEXT("DetailsView", "HideAdvanced", "Hide Advanced") : NSLOCTEXT("DetailsView", "ShowAdvanced", "Show Advanced");
}
const FSlateBrush* GetAdvancedPulldownImage() const
{
if( ExpanderButton->IsHovered() )
{
return IsExpanded.Get() ? FEditorStyle::GetBrush("DetailsView.PulldownArrow.Up.Hovered") : FEditorStyle::GetBrush("DetailsView.PulldownArrow.Down.Hovered");
}
else
{
return IsExpanded.Get() ? FEditorStyle::GetBrush("DetailsView.PulldownArrow.Up") : FEditorStyle::GetBrush("DetailsView.PulldownArrow.Down");
}
}
private:
TAttribute<bool> IsExpanded;
TSharedPtr<SButton> ExpanderButton;
bool bDisplayShowAdvancedMessage;
};
TSharedRef< ITableRow > FAdvancedDropdownNode::GenerateNodeWidget( const TSharedRef<STableViewBase>& OwnerTable, const FDetailColumnSizeData& ColumnSizeData, const TSharedRef<IPropertyUtilities>& PropertyUtilities, bool bAllowFavoriteSystem)
{
return
SNew( SAdvancedDropdownRow, OwnerTable, bIsTopNode, bDisplayShowAdvancedMessage, bShowSplitter )
.OnClicked( this, &FAdvancedDropdownNode::OnAdvancedDropDownClicked )
.IsButtonEnabled( IsEnabled )
.IsExpanded( IsExpanded )
.ShouldShowAdvancedButton( bShouldShowAdvancedButton )
.ColumnSizeData( ColumnSizeData );
}
FReply FAdvancedDropdownNode::OnAdvancedDropDownClicked()
{
ParentCategory.OnAdvancedDropdownClicked();
return FReply::Handled();
}