// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "Components/ListView.h" #include "PoseSearchDebuggerDatabaseColumns.h" #include "PoseSearchDebuggerDatabaseView.h" #include "Widgets/Views/STableRow.h" namespace UE::PoseSearch { /** * Widget representing a single row of the database view */ class SDebuggerDatabaseRow : public SMultiColumnTableRow> { SLATE_BEGIN_ARGS(SDebuggerDatabaseRow) {} SLATE_ATTRIBUTE(const SDebuggerDatabaseView::FColumnMap*, ColumnMap) SLATE_END_ARGS() void Construct( const FArguments& InArgs, const TSharedRef& InOwnerTable, TSharedRef InRow, const FTableRowStyle& InRowStyle, const FSlateBrush* InRowBrush, FMargin InPaddingMargin ) { ColumnMap = InArgs._ColumnMap; check(ColumnMap.IsBound()); Row = InRow; RowBrush = InRowBrush; check(RowBrush); SMultiColumnTableRow>::Construct( FSuperRowType::FArguments() .Padding(InPaddingMargin) .Style(&InRowStyle), InOwnerTable ); } virtual TSharedRef GenerateWidgetForColumn(const FName& InColumnName) override { // Get column const TSharedRef& Column = (*ColumnMap.Get())[InColumnName]; const TSharedRef Widget = Column->GenerateWidget(Row.ToSharedRef()); return SNew(SBorder) .HAlign(HAlign_Fill) .VAlign(VAlign_Fill) .BorderImage(RowBrush) [ SNew(SHorizontalBox) + SHorizontalBox::Slot() .VAlign(VAlign_Center) .HAlign(HAlign_Center) .Padding(0.0f, 3.0f) [ Widget ] ]; } /** Row data associated with this widget */ TSharedPtr Row; /** Used for cell styles (active vs database row) */ const FSlateBrush* RowBrush = nullptr; /** Used to grab the column struct given a column name */ TAttribute ColumnMap; }; } // namespace UE::PoseSearch