Files
UnrealEngine/Engine/Plugins/Chooser/Source/ChooserEditor/Private/SNestedChooserTree.h
2025-05-18 13:04:45 +08:00

49 lines
1.3 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Widgets/SCompoundWidget.h"
#include "Widgets/Views/STreeView.h"
class UChooserTable;
namespace UE::ChooserEditor
{
class FChooserTableEditor;
struct FNestedChooserTreeEntry
{
UChooserTable* Chooser = nullptr;
bool bExpanded = true;
};
class SNestedChooserTree : public SCompoundWidget
{
public:
SLATE_BEGIN_ARGS(SNestedChooserTree)
{}
SLATE_ARGUMENT(FChooserTableEditor*, ChooserEditor)
SLATE_END_ARGS()
void Construct(const FArguments& InArgs);
virtual ~SNestedChooserTree() override;
void RefreshAll();
private:
TSharedPtr<SWidget> TreeViewContextMenuOpening();
TSharedRef<ITableRow> TreeViewGenerateRow(TSharedPtr<FNestedChooserTreeEntry> InItem, const TSharedRef<STableViewBase>& OwnerTable);
void TreeViewGetChildren(TSharedPtr<FNestedChooserTreeEntry> InItem, TArray<TSharedPtr<FNestedChooserTreeEntry>>& OutChildren);
void TreeViewDoubleClicked(TSharedPtr<FNestedChooserTreeEntry> SelectedObject);
void DeleteNestedChooser();
void RenameNestedChooser();
FChooserTableEditor* ChooserEditor = nullptr;
UChooserTable* RootChooser = nullptr;
TSharedPtr<STreeView<TSharedPtr<FNestedChooserTreeEntry>>> TreeView;
TArray<TSharedPtr<FNestedChooserTreeEntry>> TreeEntries;
TArray<TSharedPtr<FNestedChooserTreeEntry>> AllChoosers;
};
}