Files
UnrealEngineUWP/Engine/Source/Editor/MaterialEditor/Private/SMaterialEditorTitleBar.cpp
Jamie Dale a569f6b356 Fixed code relying on SLATE_TEXT_ATTRIBUTE for STextBlock.
UETOOL-213 - Minimize Slate FString -> FText conversion (remove SLATE_TEXT_ATTRIBUTE)

This fixes any editor/engine specific code that was passing text to Slate as FString rather than FText.

[CL 2399803 by Jamie Dale in Main branch]
2015-01-07 09:52:40 -05:00

82 lines
2.0 KiB
C++

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "MaterialEditorModule.h"
#include "MaterialEditor.h"
#include "SMaterialEditorTitleBar.h"
void SMaterialEditorTitleBar::Construct(const FArguments& InArgs)
{
Visibility = EVisibility::HitTestInvisible;
this->ChildSlot
[
SNew(SBorder)
.BorderImage( FEditorStyle::GetBrush( TEXT("Graph.TitleBackground") ) )
.HAlign(HAlign_Fill)
[
SNew(SVerticalBox)
// Title text/icon
+SVerticalBox::Slot()
.HAlign(HAlign_Center)
.Padding(10)
.AutoHeight()
[
SNew(STextBlock)
.TextStyle( FEditorStyle::Get(), TEXT("GraphBreadcrumbButtonText") )
.Text( InArgs._TitleText )
]
+SVerticalBox::Slot()
.VAlign(VAlign_Top)
.AutoHeight()
[
SNew(SHorizontalBox)
+SHorizontalBox::Slot()
.HAlign(HAlign_Left)
.FillWidth(1.f)
.Padding(5,0)
[
SAssignNew(MaterialInfoList, SListView<TSharedPtr<FMaterialInfo>>)
.ListItemsSource(InArgs._MaterialInfoList)
.OnGenerateRow(this, &SMaterialEditorTitleBar::MakeMaterialInfoWidget)
.SelectionMode( ESelectionMode::None )
.Visibility((InArgs._MaterialInfoList != NULL) ? EVisibility::Visible : EVisibility::Collapsed)
]
]
]
];
}
TSharedRef<ITableRow> SMaterialEditorTitleBar::MakeMaterialInfoWidget(TSharedPtr<FMaterialInfo> Item, const TSharedRef<STableViewBase>& OwnerTable)
{
const int32 FontSize = 9;
FMaterialInfo Info = *Item.Get();
FLinearColor TextColor = Info.Color;
FString Text = Info.Text;
if( Text.IsEmpty() )
{
return
SNew(STableRow< TSharedPtr<FMaterialInfo> >, OwnerTable)
[
SNew(SSpacer)
];
}
else
{
return
SNew(STableRow< TSharedPtr<FMaterialInfo> >, OwnerTable)
[
SNew(STextBlock)
.ColorAndOpacity(TextColor)
.Font(FSlateFontInfo( FPaths::EngineContentDir() / TEXT("Slate/Fonts/Roboto-Regular.ttf"), FontSize ))
.Text(FText::FromString(Text))
];
}
}
void SMaterialEditorTitleBar::RequestRefresh()
{
MaterialInfoList->RequestListRefresh();
}