You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
[REVIEW] [at]lauren.barnes #jira UE-108254 #ROBOMERGE-SOURCE: CL 15377566 in //UE5/Release-5.0-EarlyAccess/... #ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668) [CL 15378776 by sebastian nordgren in ue5-main branch]
78 lines
2.2 KiB
C++
78 lines
2.2 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();
|
|
if (RowPtr.IsValid() && RowPtr->IsHovered())
|
|
{
|
|
return FAppStyle::Get().GetSlateColor("Colors.Header");
|
|
}
|
|
|
|
return PropertyEditorConstants::GetRowBackgroundColor(IndentLevel);
|
|
}
|