Files
UnrealEngineUWP/Engine/Source/Editor/PropertyEditor/Private/SDetailRowIndent.cpp
sebastian nordgren 366b191494 Details view style refresh:
- rows are now 26 pixels high
- right column is narrower unless the Sequencer is invoked
- padding has been removed to make more rows fit on the screen at once
- Advanced dropdown is now styled like a normal group and thus the bottom node is gone

#review-17520182 @editor-ux
#preflight 6140652a9dc6c8000144500a

[CL 17537602 by sebastian nordgren in ue5-main branch]
2021-09-16 08:33:49 -04:00

74 lines
2.1 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "SDetailRowIndent.h"
#include "SConstrainedBox.h"
#include "SDetailTableRowBase.h"
#include "PropertyEditorConstants.h"
#include "Widgets/Layout/SBox.h"
void SDetailRowIndent::Construct(const FArguments& InArgs, TSharedRef<SDetailTableRowBase> DetailsRow)
{
Row = DetailsRow;
ChildSlot
[
SNew(SBox)
.WidthOverride(this, &SDetailRowIndent::GetIndentWidth)
];
}
int32 SDetailRowIndent::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const
{
TSharedPtr<SDetailTableRowBase> RowPtr = Row.Pin();
if (!RowPtr.IsValid())
{
return LayerId;
}
const FSlateBrush* BackgroundBrush = FAppStyle::Get().GetBrush("DetailsView.CategoryMiddle");
const FSlateBrush* DropShadowBrush = FAppStyle::Get().GetBrush("DetailsView.ArrayDropShadow");
int32 IndentLevel = RowPtr->GetIndentLevelForBackgroundColor();
for (int32 i = 0; i < IndentLevel; ++i)
{
FSlateColor BackgroundColor = GetRowBackgroundColor(i);
FSlateDrawElement::MakeBox(
OutDrawElements,
LayerId,
AllottedGeometry.ToPaintGeometry(FVector2D(16 * i, 0), FVector2D(16, AllottedGeometry.GetLocalSize().Y)),
BackgroundBrush,
ESlateDrawEffect::None,
BackgroundColor.GetColor(InWidgetStyle)
);
FSlateDrawElement::MakeBox(
OutDrawElements,
LayerId + 1,
AllottedGeometry.ToPaintGeometry(FVector2D(16 * i, 0), FVector2D(16, AllottedGeometry.GetLocalSize().Y)),
DropShadowBrush
);
}
return LayerId + 1;
}
FOptionalSize SDetailRowIndent::GetIndentWidth() const
{
int32 IndentLevel = 0;
TSharedPtr<SDetailTableRowBase> RowPtr = Row.Pin();
if (RowPtr.IsValid())
{
IndentLevel = RowPtr->GetIndentLevelForBackgroundColor();
}
return IndentLevel * 16.0f;
}
FSlateColor SDetailRowIndent::GetRowBackgroundColor(int32 IndentLevel) const
{
TSharedPtr<SDetailTableRowBase> RowPtr = Row.Pin();
return PropertyEditorConstants::GetRowBackgroundColor(IndentLevel, RowPtr.IsValid() && RowPtr->IsHovered());
}