You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#preflight 60ef54ef925f140001b2edfc #ROBOMERGE-SOURCE: CL 16856781 in //UE5/Main/... #ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v836-16769935) [CL 16856783 by zahra nikbakht in ue5-release-engine-test branch]
87 lines
3.6 KiB
C++
87 lines
3.6 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "Styling/WidgetReflectorStyle.h"
|
|
#include "Styling/SlateStyleRegistry.h"
|
|
#include "Styling/SlateTypes.h"
|
|
#include "Styling/CoreStyle.h"
|
|
#include "Styling/SlateStyleMacros.h"
|
|
#include "Styling/ToolBarStyle.h"
|
|
|
|
// This is to fix the issue that SlateStyleMacros like IMAGE_BRUSH look for RootToContentDir but StyleSet->RootToContentDir is how this style is set up
|
|
#define RootToContentDir StyleSet->RootToContentDir
|
|
#define RootToCoreContentDir StyleSet->RootToCoreContentDir
|
|
|
|
TSharedPtr< FSlateStyleSet > FWidgetReflectorStyle::StyleInstance = nullptr;
|
|
|
|
void FWidgetReflectorStyle::Initialize()
|
|
{
|
|
if (!StyleInstance.IsValid())
|
|
{
|
|
StyleInstance = Create();
|
|
FSlateStyleRegistry::RegisterSlateStyle(*StyleInstance);
|
|
}
|
|
}
|
|
|
|
void FWidgetReflectorStyle::Shutdown()
|
|
{
|
|
FSlateStyleRegistry::UnRegisterSlateStyle(*StyleInstance);
|
|
ensure(StyleInstance.IsUnique());
|
|
StyleInstance.Reset();
|
|
}
|
|
|
|
FName FWidgetReflectorStyle::GetStyleSetName()
|
|
{
|
|
static FName StyleSetName(TEXT("WidgetReflectorStyleStyle"));
|
|
return StyleSetName;
|
|
}
|
|
|
|
TSharedRef< FSlateStyleSet > FWidgetReflectorStyle::Create()
|
|
{
|
|
const FVector2D Icon8x8(8.0f, 8.0f);
|
|
const FVector2D Icon16x16(16.0f, 16.0f);
|
|
const FVector2D Icon24x24(24.0f, 24.0f);
|
|
|
|
TSharedRef<FSlateStyleSet> StyleSet = MakeShareable(new FSlateStyleSet(FWidgetReflectorStyle::GetStyleSetName()));
|
|
StyleSet->SetContentRoot(FPaths::EngineContentDir() / TEXT("Editor/Slate"));
|
|
StyleSet->SetCoreContentRoot(FPaths::EngineContentDir() / TEXT("Slate"));
|
|
|
|
{
|
|
StyleSet->Set("Icon.FocusPicking", new FSlateImageBrush(RootToContentDir("Icons/SlateReflector/FocusPicking_24x.png"), Icon24x24));
|
|
StyleSet->Set("Icon.HitTestPicking", new FSlateImageBrush(RootToContentDir("Icons/GeneralTools/Select_40x.png"), Icon24x24));
|
|
StyleSet->Set("Icon.VisualPicking", new FSlateImageBrush(RootToContentDir("Icons/GeneralTools/Paint_40x.png"), Icon24x24));
|
|
StyleSet->Set("Icon.LoadSnapshot", new FSlateImageBrush(RootToContentDir("Icons/GeneralTools/Import_40x.png"), Icon24x24));
|
|
StyleSet->Set("Icon.Filter", new CORE_IMAGE_BRUSH_SVG("Starship/Common/filter", Icon24x24));
|
|
StyleSet->Set("Icon.TakeSnapshot", new IMAGE_BRUSH_SVG("Starship/Common/SaveThumbnail", Icon24x24));
|
|
|
|
StyleSet->Set("Symbols.LeftArrow", new CORE_IMAGE_BRUSH_SVG("Starship/Common/arrow-left", Icon24x24));
|
|
StyleSet->Set("Symbols.RightArrow", new CORE_IMAGE_BRUSH_SVG("Starship/Common/arrow-right", Icon24x24));
|
|
StyleSet->Set("Symbols.UpArrow", new CORE_IMAGE_BRUSH_SVG("Starship/Common/arrow-up", Icon24x24));
|
|
StyleSet->Set("Symbols.DownArrow", new CORE_IMAGE_BRUSH_SVG("Starship/Common/arrow-down", Icon24x24));
|
|
|
|
StyleSet->Set("WidgetReflector.TabIcon", new IMAGE_BRUSH_SVG("Starship/Common/Widget", Icon16x16));
|
|
StyleSet->Set("Icon.Ellipsis", new CORE_IMAGE_BRUSH_SVG("Starship/Common/ellipsis-vertical-narrow", FVector2D(6, 24)));
|
|
}
|
|
|
|
{
|
|
FToolBarStyle SlimToolbarStyle = FAppStyle::Get().GetWidgetStyle<FToolBarStyle>("SlimToolBar");
|
|
const FTextBlockStyle& ButtonText = FAppStyle::Get().GetWidgetStyle<FTextBlockStyle>("ButtonText");
|
|
SlimToolbarStyle.SetLabelStyle(FTextBlockStyle(ButtonText));
|
|
StyleSet->Set("BoldSlimToolbar", SlimToolbarStyle);
|
|
}
|
|
|
|
{
|
|
FToolBarStyle SlimToolbarStyle = FAppStyle::Get().GetWidgetStyle<FToolBarStyle>("SlimToolBar");
|
|
StyleSet->Set("Menu.Label", SlimToolbarStyle.LabelStyle);
|
|
StyleSet->Set("Menu.Button", FButtonStyle(SlimToolbarStyle.ButtonStyle).SetNormalPadding(0.0f).SetPressedPadding(0.0f));
|
|
}
|
|
|
|
return StyleSet;
|
|
}
|
|
|
|
const ISlateStyle& FWidgetReflectorStyle::Get()
|
|
{
|
|
return *StyleInstance;
|
|
}
|
|
|
|
#undef RootToCoreContentDir
|
|
#undef RootToContentDir |