void FMacGraphicsSwitchingStyle::Initialize() { const FVector2D Icon8x8(8.0f, 8.0f); const FLinearColor DisabledColor(FColor(0xaaaaaa)); // Only register once if (StyleSet.IsValid()) { return; } StyleSet = MakeShareable(new FSlateStyleSet("MacGraphicsSwitchingStyle")); StyleSet->SetContentRoot(FPaths::EngineContentDir() / TEXT("Editor/Slate")); StyleSet->SetCoreContentRoot(FPaths::EngineContentDir() / TEXT("Slate")); { const FButtonStyle ComboBoxButton = FButtonStyle() .SetNormal(BOX_BRUSH("Tutorials/FlatColorSquare", FVector2D(1.0f, 1.0f), FMargin(1), FLinearColor(0.05f,0.05f,0.05f))) .SetHovered(BOX_BRUSH("Tutorials/FlatColorSquare", FVector2D(1.0f, 1.0f), FMargin(1), FLinearColor(0.05f,0.05f,0.05f))) .SetPressed(BOX_BRUSH("Tutorials/FlatColorSquare", FVector2D(1.0f, 1.0f), FMargin(1), FLinearColor(0.05f,0.05f,0.05f))) .SetDisabled(BOX_BRUSH("Tutorials/FlatColorSquare", FVector2D(1.0f, 1.0f), FMargin(1), DisabledColor)) .SetNormalPadding(FMargin(2, 2, 2, 2)) .SetPressedPadding(FMargin(2, 3, 2, 1)); const FComboButtonStyle ComboButton = FComboButtonStyle() .SetButtonStyle(FEditorStyle::Get().GetWidgetStyle<FButtonStyle>("Button")) .SetDownArrowImage(IMAGE_BRUSH("Common/ComboArrow", Icon8x8)) .SetMenuBorderBrush(BOX_BRUSH("Tutorials/FlatColorSquare", FVector2D(1.0f, 1.0f), FMargin(1), FLinearColor(0.05f,0.05f,0.05f))) .SetMenuBorderPadding(FMargin(0.0f)); const FComboButtonStyle ComboBoxComboButton = FComboButtonStyle(ComboButton) .SetButtonStyle(ComboBoxButton) .SetMenuBorderPadding(FMargin(1.0)); StyleSet->Set("MacGraphicsSwitcher.ComboBox", FComboBoxStyle() .SetComboButtonStyle(ComboBoxComboButton) ); } FSlateStyleRegistry::RegisterSlateStyle(*StyleSet.Get()); };
TSharedRef< FSlateStyleSet > FAllarBuilderClientStyle::Create() { const FVector2D Icon16x16(16.0f, 16.0f); const FVector2D Icon32x32(32.0f, 32.0f); const FVector2D Icon48x48(48.0f, 48.0f); const FVector2D Icon64x64(64.0f, 64.0f); TSharedRef<FSlateStyleSet> StyleRef = MakeShareable(new FSlateStyleSet("FAllarBuilderClientStyle")); FSlateStyleSet& Style = StyleRef.Get(); const FTextBlockStyle DefaultText = FTextBlockStyle() .SetFont(TTF_FONT("Fonts/Roboto-Regular", 10)) .SetColorAndOpacity(FSlateColor::UseForeground()) .SetShadowOffset(FVector2D::ZeroVector) .SetShadowColorAndOpacity(FLinearColor::Black); // Set the client app styles Style.Set(TEXT("Background"), new IMAGE_BRUSH("Common/NoiseBackground", Icon64x64, FLinearColor(1,1,1,1), ESlateBrushTileType::Both)); Style.Set(TEXT("ProjectPicker.Text"), FTextBlockStyle(DefaultText) .SetFont(TTF_FONT("Fonts/Roboto-Regular", 24)) ); Style.Set(TEXT("ProjectPicker.ErrorImage"), new IMAGE_BRUSH("Icons/icon_error_16x", Icon32x32)); Style.Set(TEXT("Section.Label"), FTextBlockStyle(DefaultText) .SetFont(TTF_FONT("Fonts/Roboto-Bold", 18)) ); Style.Set(TEXT("Section.Border"), new BOX_BRUSH("Common/GroupBorder", FMargin(4.0f / 16.0f))); Style.Set(TEXT("Section.Text"), FTextBlockStyle(DefaultText) .SetFont(TTF_FONT("Fonts/Roboto-Regular", 10)) ); Style.Set(TEXT("Code"), FTextBlockStyle(DefaultText) .SetFont(TTF_FONT("Fonts/Roboto-Regular", 8)) .SetColorAndOpacity(FSlateColor(FLinearColor::White * 0.8f)) ); Style.Set(TEXT("Title"), FTextBlockStyle(DefaultText) .SetFont(TTF_FONT("Fonts/Roboto-Bold", 12)) ); Style.Set(TEXT("Status"), FTextBlockStyle(DefaultText) .SetColorAndOpacity(FSlateColor::UseSubduedForeground()) ); FSlateBrush* GenericWhiteBox = new IMAGE_BRUSH("Old/White", Icon16x16); // Scrollbar const FScrollBarStyle ScrollBar = FScrollBarStyle() .SetVerticalTopSlotImage(IMAGE_BRUSH("Common/Scrollbar_Background_Vertical", FVector2D(8, 8))) .SetVerticalBottomSlotImage(IMAGE_BRUSH("Common/Scrollbar_Background_Vertical", FVector2D(8, 8))) .SetHorizontalTopSlotImage(IMAGE_BRUSH("Common/Scrollbar_Background_Horizontal", FVector2D(8, 8))) .SetHorizontalBottomSlotImage(IMAGE_BRUSH("Common/Scrollbar_Background_Horizontal", FVector2D(8, 8))) .SetNormalThumbImage(BOX_BRUSH("Common/Scrollbar_Thumb", FMargin(4.f / 16.f))) .SetDraggedThumbImage(BOX_BRUSH("Common/Scrollbar_Thumb", FMargin(4.f / 16.f))) .SetHoveredThumbImage(BOX_BRUSH("Common/Scrollbar_Thumb", FMargin(4.f / 16.f))); // SEditableTextBox defaults... const FEditableTextBoxStyle NormalEditableTextBoxStyle = FEditableTextBoxStyle() .SetBackgroundImageNormal(*GenericWhiteBox) .SetBackgroundImageHovered(*GenericWhiteBox) .SetBackgroundImageFocused(*GenericWhiteBox) .SetBackgroundImageReadOnly(*GenericWhiteBox) .SetScrollBarStyle(ScrollBar); { Style.Set("NormalEditableTextBox", NormalEditableTextBoxStyle); } // RichText const FTextBlockStyle AllarBuilderDataStyle = FTextBlockStyle() .SetFont(TTF_FONT("Testing/Fonts/Roboto-Italic", 9)) .SetColorAndOpacity(FSlateColor(FLinearColor::White * 0.5f)) .SetShadowOffset(FVector2D::ZeroVector) .SetShadowColorAndOpacity(FLinearColor::Black); Style.Set("AllarBuilderDataStyle", AllarBuilderDataStyle); FButtonStyle DarkHyperlinkButton = FButtonStyle() .SetNormal(BORDER_BRUSH("Old/HyperlinkDotted", FMargin(0, 0, 0, 3 / 16.0f), FSlateColor(FLinearColor::White * 0.5f))) .SetPressed(FSlateNoResource()) .SetHovered(BORDER_BRUSH("Old/HyperlinkUnderline", FMargin(0, 0, 0, 3 / 16.0f), FSlateColor(FLinearColor::White * 0.5f))); const FHyperlinkStyle DarkHyperlink = FHyperlinkStyle() .SetUnderlineStyle(DarkHyperlinkButton) .SetTextStyle(AllarBuilderDataStyle) .SetPadding(FMargin(0.0f)); Style.Set("RichText.Hyperlink", DarkHyperlink); return StyleRef; }
TSharedRef< FSlateStyleSet > FCrashReportClientStyle::Create() { TSharedRef<FSlateStyleSet> StyleRef = MakeShareable(new FSlateStyleSet("CrashReportClientStyle")); FSlateStyleSet& Style = StyleRef.Get(); const FTextBlockStyle DefaultText = FTextBlockStyle() .SetFont(TTF_FONT("Fonts/Roboto-Bold", 10)) .SetColorAndOpacity(FSlateColor::UseForeground()) .SetShadowOffset(FVector2D::ZeroVector) .SetShadowColorAndOpacity(FLinearColor::Black); // Set the client app styles Style.Set(TEXT("Code"), FTextBlockStyle(DefaultText) .SetFont(TTF_FONT("Fonts/Roboto-Regular", 8)) .SetColorAndOpacity(FSlateColor(FLinearColor::White * 0.8f)) ); Style.Set(TEXT("Title"), FTextBlockStyle(DefaultText) .SetFont(TTF_FONT("Fonts/Roboto-Bold", 12)) ); Style.Set(TEXT("Status"), FTextBlockStyle(DefaultText) .SetColorAndOpacity(FSlateColor::UseSubduedForeground()) ); const FVector2D Icon16x16( 16.0f, 16.0f ); FSlateBrush* GenericWhiteBox = new IMAGE_BRUSH( "Old/White", Icon16x16 ); // Scrollbar const FScrollBarStyle ScrollBar = FScrollBarStyle() .SetVerticalTopSlotImage(IMAGE_BRUSH("Common/Scrollbar_Background_Vertical", FVector2D(8, 8))) .SetVerticalBottomSlotImage(IMAGE_BRUSH("Common/Scrollbar_Background_Vertical", FVector2D(8, 8))) .SetHorizontalTopSlotImage(IMAGE_BRUSH("Common/Scrollbar_Background_Horizontal", FVector2D(8, 8))) .SetHorizontalBottomSlotImage(IMAGE_BRUSH("Common/Scrollbar_Background_Horizontal", FVector2D(8, 8))) .SetNormalThumbImage(BOX_BRUSH("Common/Scrollbar_Thumb", FMargin(4.f / 16.f))) .SetDraggedThumbImage(BOX_BRUSH("Common/Scrollbar_Thumb", FMargin(4.f / 16.f))) .SetHoveredThumbImage(BOX_BRUSH("Common/Scrollbar_Thumb", FMargin(4.f / 16.f))); // SEditableTextBox defaults... const FEditableTextBoxStyle NormalEditableTextBoxStyle = FEditableTextBoxStyle() .SetBackgroundImageNormal(*GenericWhiteBox) .SetBackgroundImageHovered(*GenericWhiteBox) .SetBackgroundImageFocused(*GenericWhiteBox) .SetBackgroundImageReadOnly(*GenericWhiteBox) .SetScrollBarStyle(ScrollBar); { Style.Set( "NormalEditableTextBox", NormalEditableTextBoxStyle ); } // RichText const FTextBlockStyle CrashReportDataStyle = FTextBlockStyle() .SetFont( TTF_FONT( "Testing/Fonts/Roboto-Italic", 9 ) ) .SetColorAndOpacity( FSlateColor( FLinearColor::White * 0.5f ) ) .SetShadowOffset( FVector2D::ZeroVector ) .SetShadowColorAndOpacity( FLinearColor::Black ); Style.Set( "CrashReportDataStyle", CrashReportDataStyle ); FButtonStyle DarkHyperlinkButton = FButtonStyle() .SetNormal( BORDER_BRUSH( "Old/HyperlinkDotted", FMargin( 0, 0, 0, 3 / 16.0f ), FSlateColor( FLinearColor::White * 0.5f ) ) ) .SetPressed( FSlateNoResource() ) .SetHovered( BORDER_BRUSH( "Old/HyperlinkUnderline", FMargin( 0, 0, 0, 3 / 16.0f ), FSlateColor( FLinearColor::White * 0.5f ) ) ); const FHyperlinkStyle DarkHyperlink = FHyperlinkStyle() .SetUnderlineStyle( DarkHyperlinkButton ) .SetTextStyle( CrashReportDataStyle ) .SetPadding( FMargin( 0.0f ) ); Style.Set( "RichText.Hyperlink", DarkHyperlink ); return StyleRef; }