Files
UnrealEngineUWP/Engine/Source/Editor/PropertyEditor/Private/SDetailExpanderArrow.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

108 lines
2.5 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "SDetailExpanderArrow.h"
#include "SDetailTableRowBase.h"
#include "SConstrainedBox.h"
#include "Widgets/Images/SImage.h"
#include "Widgets/Input/SButton.h"
void SDetailExpanderArrow::Construct(const FArguments& InArgs, TSharedRef<SDetailTableRowBase> DetailsRow)
{
Row = DetailsRow;
ChildSlot
[
SNew(SConstrainedBox)
.MinWidth(12)
.Visibility(this, &SDetailExpanderArrow::GetExpanderVisibility)
[
SAssignNew(ExpanderArrow, SButton)
.ButtonStyle(FCoreStyle::Get(), "NoBorder")
.VAlign(VAlign_Center)
.HAlign(HAlign_Center)
.ClickMethod(EButtonClickMethod::MouseDown)
.OnClicked(this, &SDetailExpanderArrow::OnExpanderClicked)
.ContentPadding(0)
.IsFocusable(false)
[
SNew(SImage)
.Image(this, &SDetailExpanderArrow::GetExpanderImage)
.ColorAndOpacity(FSlateColor::UseSubduedForeground())
]
]
];
}
EVisibility SDetailExpanderArrow::GetExpanderVisibility() const
{
TSharedPtr<SDetailTableRowBase> RowPtr = Row.Pin();
if (!RowPtr.IsValid())
{
return EVisibility::Collapsed;
}
return RowPtr->DoesItemHaveChildren() ? EVisibility::Visible : EVisibility::Hidden;
}
const FSlateBrush* SDetailExpanderArrow::GetExpanderImage() const
{
TSharedPtr<SDetailTableRowBase> RowPtr = Row.Pin();
if (!RowPtr.IsValid())
{
return FAppStyle::Get().GetBrush("NoBrush");
}
const bool bIsItemExpanded = RowPtr->IsItemExpanded();
FName ResourceName;
if (bIsItemExpanded)
{
if (ExpanderArrow->IsHovered())
{
static const FName ExpandedHoveredName = "TreeArrow_Expanded_Hovered";
ResourceName = ExpandedHoveredName;
}
else
{
static const FName ExpandedName = "TreeArrow_Expanded";
ResourceName = ExpandedName;
}
}
else
{
if (ExpanderArrow->IsHovered())
{
static const FName CollapsedHoveredName = "TreeArrow_Collapsed_Hovered";
ResourceName = CollapsedHoveredName;
}
else
{
static const FName CollapsedName = "TreeArrow_Collapsed";
ResourceName = CollapsedName;
}
}
return FAppStyle::Get().GetBrush(ResourceName);
}
FReply SDetailExpanderArrow::OnExpanderClicked()
{
TSharedPtr<SDetailTableRowBase> RowPtr = Row.Pin();
if (!RowPtr.IsValid())
{
return FReply::Unhandled();
}
// Recurse the expansion if "shift" is being pressed
const FModifierKeysState ModKeyState = FSlateApplication::Get().GetModifierKeys();
if (ModKeyState.IsShiftDown())
{
RowPtr->Private_OnExpanderArrowShiftClicked();
}
else
{
RowPtr->ToggleExpansion();
}
return FReply::Handled();
}