2019-12-26 15:33:43 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
2022-05-09 13:12:28 -04:00
|
|
|
#include "Brushes/SlateDynamicImageBrush.h"
|
2022-08-24 22:45:13 -04:00
|
|
|
#include "Containers/Array.h"
|
|
|
|
|
#include "Containers/UnrealString.h"
|
|
|
|
|
#include "Fonts/SlateFontInfo.h"
|
|
|
|
|
#include "HAL/Platform.h"
|
|
|
|
|
#include "HAL/PlatformMath.h"
|
|
|
|
|
#include "Layout/Margin.h"
|
|
|
|
|
#include "Math/Color.h"
|
|
|
|
|
#include "Math/Vector2D.h"
|
2022-05-09 13:12:28 -04:00
|
|
|
#include "Sound/SlateSound.h"
|
2022-08-24 22:45:13 -04:00
|
|
|
#include "Styling/AppStyle.h"
|
|
|
|
|
#include "Styling/ISlateStyle.h"
|
|
|
|
|
#include "Styling/SlateBrush.h"
|
|
|
|
|
#include "Styling/SlateColor.h"
|
|
|
|
|
#include "Styling/SlateColor.h"
|
|
|
|
|
#include "Styling/StyleDefaults.h"
|
2022-05-09 13:12:28 -04:00
|
|
|
#include "Templates/SharedPointer.h"
|
2022-08-24 22:45:13 -04:00
|
|
|
#include "UObject/NameTypes.h"
|
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
|
|
|
|
2022-08-24 22:45:13 -04:00
|
|
|
struct FLinearColor;
|
|
|
|
|
struct FMargin;
|
|
|
|
|
struct FSlateBrush;
|
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
|
|
|
struct FSlateDynamicImageBrush;
|
2022-08-24 22:45:13 -04:00
|
|
|
struct FSlateSound;
|
2016-07-07 13:53:30 -04:00
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
/**
|
|
|
|
|
* A collection of named properties that guide the appearance of Slate.
|
|
|
|
|
*/
|
|
|
|
|
class EDITORSTYLE_API FEditorStyle
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
2021-06-03 18:23:24 +00:00
|
|
|
/**
|
|
|
|
|
* @return the Application Style
|
|
|
|
|
*
|
|
|
|
|
* NOTE: Until the Editor can be fully updated, calling FEditorStyle::Get() or any of its
|
|
|
|
|
* static convenience functions will will return the AppStyle instead of the style definied in this class.
|
|
|
|
|
*
|
|
|
|
|
* Using the AppStyle is preferred in most cases as it allows the style to be changed
|
|
|
|
|
* on an application level.
|
|
|
|
|
*
|
|
|
|
|
* In cases requiring explicit use of the EditorStyle where a Slate Widget should not take on
|
|
|
|
|
* the appearance of the rest of the application, use FEditorStyle::GetEditorStyle().
|
|
|
|
|
*
|
|
|
|
|
*/
|
2022-05-11 16:36:44 -04:00
|
|
|
UE_DEPRECATED(5.1, "FEditorStyle::Get() is deprecated, use FAppStyle::Get() instead.")
|
2021-06-03 18:23:24 +00:00
|
|
|
static const ISlateStyle& Get( )
|
|
|
|
|
{
|
|
|
|
|
return FAppStyle::Get();
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-11 16:36:44 -04:00
|
|
|
template< class T >
|
|
|
|
|
UE_DEPRECATED(5.1, "FEditorStyle::GetWidgetStyle() is deprecated, use FAppStyle::GetWidgetStyle() instead.")
|
2014-03-14 14:13:41 -04:00
|
|
|
static const T& GetWidgetStyle( FName PropertyName, const ANSICHAR* Specifier = NULL )
|
|
|
|
|
{
|
2021-06-03 18:23:24 +00:00
|
|
|
return FAppStyle::Get().GetWidgetStyle< T >( PropertyName, Specifier );
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 16:36:44 -04:00
|
|
|
UE_DEPRECATED(5.1, "FEditorStyle::GetFloat() is deprecated, use FAppStyle::GetFloat() instead.")
|
2014-03-14 14:13:41 -04:00
|
|
|
static float GetFloat( FName PropertyName, const ANSICHAR* Specifier = NULL )
|
|
|
|
|
{
|
2021-06-03 18:23:24 +00:00
|
|
|
return FAppStyle::Get().GetFloat( PropertyName, Specifier );
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 16:36:44 -04:00
|
|
|
UE_DEPRECATED(5.1, "FEditorStyle::GetVector() is deprecated, use FAppStyle::GetVector() instead.")
|
2014-03-14 14:13:41 -04:00
|
|
|
static FVector2D GetVector( FName PropertyName, const ANSICHAR* Specifier = NULL )
|
|
|
|
|
{
|
2021-06-03 18:23:24 +00:00
|
|
|
return FAppStyle::Get().GetVector( PropertyName, Specifier );
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 16:36:44 -04:00
|
|
|
UE_DEPRECATED(5.1, "FEditorStyle::GetColor() is deprecated, use FAppStyle::GetColor() instead.")
|
2014-03-14 14:13:41 -04:00
|
|
|
static const FLinearColor& GetColor( FName PropertyName, const ANSICHAR* Specifier = NULL )
|
|
|
|
|
{
|
2021-06-03 18:23:24 +00:00
|
|
|
return FAppStyle::Get().GetColor( PropertyName, Specifier );
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 16:36:44 -04:00
|
|
|
UE_DEPRECATED(5.1, "FEditorStyle::GetSlateColor() is deprecated, use FAppStyle::GetSlateColor() instead.")
|
2014-03-14 14:13:41 -04:00
|
|
|
static const FSlateColor GetSlateColor( FName PropertyName, const ANSICHAR* Specifier = NULL )
|
|
|
|
|
{
|
2021-06-03 18:23:24 +00:00
|
|
|
return FAppStyle::Get().GetSlateColor( PropertyName, Specifier );
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 16:36:44 -04:00
|
|
|
UE_DEPRECATED(5.1, "FEditorStyle::GetMargin() is deprecated, use FAppStyle::GetMargin() instead.")
|
2014-03-14 14:13:41 -04:00
|
|
|
static const FMargin& GetMargin( FName PropertyName, const ANSICHAR* Specifier = NULL )
|
|
|
|
|
{
|
2021-06-03 18:23:24 +00:00
|
|
|
return FAppStyle::Get().GetMargin( PropertyName, Specifier );
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 16:36:44 -04:00
|
|
|
UE_DEPRECATED(5.1, "FEditorStyle::GetBrush() is deprecated, use FAppStyle::GetBrush() instead.")
|
2014-03-14 14:13:41 -04:00
|
|
|
static const FSlateBrush* GetBrush( FName PropertyName, const ANSICHAR* Specifier = NULL )
|
|
|
|
|
{
|
2021-06-03 18:23:24 +00:00
|
|
|
return FAppStyle::Get().GetBrush( PropertyName, Specifier );
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 16:36:44 -04:00
|
|
|
UE_DEPRECATED(5.1, "FEditorStyle::GetDynamicImageBrush() is deprecated, use FAppStyle::GetDynamicImageBrush() instead.")
|
2014-03-14 14:13:41 -04:00
|
|
|
static const TSharedPtr< FSlateDynamicImageBrush > GetDynamicImageBrush( FName BrushTemplate, FName TextureName, const ANSICHAR* Specifier = NULL )
|
|
|
|
|
{
|
2021-06-03 18:23:24 +00:00
|
|
|
return FAppStyle::Get().GetDynamicImageBrush( BrushTemplate, TextureName, Specifier );
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 16:36:44 -04:00
|
|
|
UE_DEPRECATED(5.1, "FEditorStyle::GetDynamicImageBrush() is deprecated, use FAppStyle::GetDynamicImageBrush() instead.")
|
2014-03-14 14:13:41 -04:00
|
|
|
static const TSharedPtr< FSlateDynamicImageBrush > GetDynamicImageBrush( FName BrushTemplate, const ANSICHAR* Specifier, class UTexture2D* TextureResource, FName TextureName )
|
|
|
|
|
{
|
2021-06-03 18:23:24 +00:00
|
|
|
return FAppStyle::Get().GetDynamicImageBrush( BrushTemplate, Specifier, TextureResource, TextureName );
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 16:36:44 -04:00
|
|
|
UE_DEPRECATED(5.1, "FEditorStyle::GetDynamicImageBrush() is deprecated, use FAppStyle::GetDynamicImageBrush() instead.")
|
2014-03-14 14:13:41 -04:00
|
|
|
static const TSharedPtr< FSlateDynamicImageBrush > GetDynamicImageBrush( FName BrushTemplate, class UTexture2D* TextureResource, FName TextureName )
|
|
|
|
|
{
|
2021-06-03 18:23:24 +00:00
|
|
|
return FAppStyle::Get().GetDynamicImageBrush( BrushTemplate, TextureResource, TextureName );
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 16:36:44 -04:00
|
|
|
UE_DEPRECATED(5.1, "FEditorStyle::GetSound() is deprecated, use FAppStyle::GetSound() instead.")
|
2014-03-14 14:13:41 -04:00
|
|
|
static const FSlateSound& GetSound( FName PropertyName, const ANSICHAR* Specifier = NULL )
|
|
|
|
|
{
|
2021-06-03 18:23:24 +00:00
|
|
|
return FAppStyle::Get().GetSound( PropertyName, Specifier );
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 16:36:44 -04:00
|
|
|
UE_DEPRECATED(5.1, "FEditorStyle::GetFontStyle() is deprecated, use FAppStyle::GetFontStyle() instead.")
|
2014-03-14 14:13:41 -04:00
|
|
|
static FSlateFontInfo GetFontStyle( FName PropertyName, const ANSICHAR* Specifier = NULL )
|
|
|
|
|
{
|
2021-06-03 18:23:24 +00:00
|
|
|
return FAppStyle::Get().GetFontStyle( PropertyName, Specifier );
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 16:36:44 -04:00
|
|
|
UE_DEPRECATED(5.1, "FEditorStyle::GetDefaultBrush() is deprecated, use FAppStyle::GetDefaultBrush() instead.")
|
2014-03-14 14:13:41 -04:00
|
|
|
static const FSlateBrush* GetDefaultBrush()
|
|
|
|
|
{
|
2021-06-03 18:23:24 +00:00
|
|
|
return FAppStyle::Get().GetDefaultBrush();
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 16:36:44 -04:00
|
|
|
UE_DEPRECATED(5.1, "FEditorStyle::GetNoBrush() is deprecated, use FAppStyle::GetNoBrush() instead.")
|
2014-03-14 14:13:41 -04:00
|
|
|
static const FSlateBrush* GetNoBrush()
|
|
|
|
|
{
|
|
|
|
|
return FStyleDefaults::GetNoBrush();
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-11 16:36:44 -04:00
|
|
|
UE_DEPRECATED(5.1, "FEditorStyle::GetOptionalBrush() is deprecated, use FAppStyle::GetOptionalBrush() instead.")
|
2014-04-02 18:09:23 -04:00
|
|
|
static const FSlateBrush* GetOptionalBrush( FName PropertyName, const ANSICHAR* Specifier = NULL, const FSlateBrush* const DefaultBrush = FStyleDefaults::GetNoBrush() )
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2021-06-03 18:23:24 +00:00
|
|
|
return FAppStyle::Get().GetOptionalBrush( PropertyName, Specifier, DefaultBrush );
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 16:36:44 -04:00
|
|
|
UE_DEPRECATED(5.1, "FEditorStyle::GetResources() is deprecated, use FAppStyle::GetResources() instead.")
|
2014-03-14 14:13:41 -04:00
|
|
|
static void GetResources( TArray< const FSlateBrush* >& OutResources )
|
|
|
|
|
{
|
2021-06-03 18:23:24 +00:00
|
|
|
return FAppStyle::Get().GetResources( OutResources );
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 16:36:44 -04:00
|
|
|
UE_DEPRECATED(5.1, "FEditorStyle::GetStyleSetName() is deprecated, use FAppStyle::GetAppStyleSetName() instead.")
|
2014-03-14 14:13:41 -04:00
|
|
|
static const FName& GetStyleSetName()
|
|
|
|
|
{
|
|
|
|
|
return Instance->GetStyleSetName();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Concatenates two FNames.e If A and B are "Path.To" and ".Something"
|
|
|
|
|
* the result "Path.To.Something".
|
|
|
|
|
*
|
|
|
|
|
* @param A First FName
|
|
|
|
|
* @param B Second name
|
|
|
|
|
*
|
|
|
|
|
* @return New FName that is A concatenated with B.
|
|
|
|
|
*/
|
2022-05-11 16:36:44 -04:00
|
|
|
UE_DEPRECATED(5.1, "FEditorStyle::Join() is deprecated, use FAppStyle::Join() instead.")
|
2014-03-14 14:13:41 -04:00
|
|
|
static FName Join( FName A, const ANSICHAR* B )
|
|
|
|
|
{
|
|
|
|
|
if( B == NULL )
|
|
|
|
|
{
|
|
|
|
|
return A;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return FName( *( A.ToString() + B ) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void ResetToDefault();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
static void SetStyle( const TSharedRef< class ISlateStyle >& NewStyle );
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
/** Singleton instance of the slate style */
|
|
|
|
|
static TSharedPtr< class ISlateStyle > Instance;
|
|
|
|
|
};
|