|
@@ -0,0 +1,105 @@
|
|
|
|
+// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+#include "SEzAbleTreeViewWidget.h"
|
|
|
|
+#include "SlateOptMacros.h"
|
|
|
|
+#include "SPositiveActionButton.h"
|
|
|
|
+#include "Widgets/Layout/SScrollBox.h"
|
|
|
|
+#include "SEzAbleTreeViewRowWidget.h"
|
|
|
|
+
|
|
|
|
+#define LOCTEXT_NAMESPACE "AbleStateTreeEditor"
|
|
|
|
+
|
|
|
|
+BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
|
|
|
+void SEzAbleTreeViewWidget::Construct(const FArguments& InArgs)
|
|
|
|
+{
|
|
|
|
+ TSharedRef<SScrollBar> HorizontalScrollBar = SNew(SScrollBar)
|
|
|
|
+ .Orientation(Orient_Horizontal)
|
|
|
|
+ .Thickness(FVector2D(12.0f, 12.0f));
|
|
|
|
+
|
|
|
|
+ TSharedRef<SScrollBar> VerticalScrollBar = SNew(SScrollBar)
|
|
|
|
+ .Orientation(Orient_Vertical)
|
|
|
|
+ .Thickness(FVector2D(12.0f, 12.0f));
|
|
|
|
+
|
|
|
|
+ TreeView = SNew(STreeView<TWeakObjectPtr<UEzAbilityState>>)
|
|
|
|
+ .OnGenerateRow(this, &SEzAbleTreeViewWidget::HandleGenerateRow);
|
|
|
|
+
|
|
|
|
+ ChildSlot
|
|
|
|
+ [
|
|
|
|
+ SNew(SVerticalBox)
|
|
|
|
+
|
|
|
|
+ + SVerticalBox::Slot()
|
|
|
|
+ .VAlign(VAlign_Center)
|
|
|
|
+ .AutoHeight()
|
|
|
|
+ [
|
|
|
|
+ SNew(SBorder)
|
|
|
|
+ .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder"))
|
|
|
|
+ .Padding(2.0f)
|
|
|
|
+ [
|
|
|
|
+ SNew(SHorizontalBox)
|
|
|
|
+
|
|
|
|
+ // New State
|
|
|
|
+ + SHorizontalBox::Slot()
|
|
|
|
+ .VAlign(VAlign_Center)
|
|
|
|
+ .Padding(4.0f, 2.0f)
|
|
|
|
+ .AutoWidth()
|
|
|
|
+ [
|
|
|
|
+ SNew(SPositiveActionButton)
|
|
|
|
+ .ToolTipText(LOCTEXT("AddStateToolTip", "Add New State"))
|
|
|
|
+ .Icon(FAppStyle::Get().GetBrush("Icons.Plus"))
|
|
|
|
+ .Text(LOCTEXT("AddState", "Add State"))
|
|
|
|
+ .OnClicked(this, &SEzAbleTreeViewWidget::HandleAddStateButton)
|
|
|
|
+ ]
|
|
|
|
+ ]
|
|
|
|
+ ]
|
|
|
|
+
|
|
|
|
+ + SVerticalBox::Slot()
|
|
|
|
+ .Padding(0.0f, 6.0f, 0.0f, 0.0f)
|
|
|
|
+ [
|
|
|
|
+ SNew(SHorizontalBox)
|
|
|
|
+ + SHorizontalBox::Slot()
|
|
|
|
+ .FillWidth(1.0f)
|
|
|
|
+ .Padding(0.0f)
|
|
|
|
+ [
|
|
|
|
+ SAssignNew(ViewBox, SScrollBox)
|
|
|
|
+ .Orientation(Orient_Horizontal)
|
|
|
|
+ .ExternalScrollbar(HorizontalScrollBar)
|
|
|
|
+ + SScrollBox::Slot()
|
|
|
|
+ .FillSize(1.0f)
|
|
|
|
+ [
|
|
|
|
+ TreeView.ToSharedRef()
|
|
|
|
+ ]
|
|
|
|
+ ]
|
|
|
|
+
|
|
|
|
+ + SHorizontalBox::Slot()
|
|
|
|
+ .AutoWidth()
|
|
|
|
+ [
|
|
|
|
+ VerticalScrollBar
|
|
|
|
+ ]
|
|
|
|
+ ]
|
|
|
|
+ + SVerticalBox::Slot()
|
|
|
|
+ .AutoHeight()
|
|
|
|
+ [
|
|
|
|
+ HorizontalScrollBar
|
|
|
|
+ ]
|
|
|
|
+ ];
|
|
|
|
+ /*
|
|
|
|
+ ChildSlot
|
|
|
|
+ [
|
|
|
|
+ // Populate the widget
|
|
|
|
+ ];
|
|
|
|
+ */
|
|
|
|
+}
|
|
|
|
+END_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
|
|
|
+
|
|
|
|
+FReply SEzAbleTreeViewWidget::HandleAddStateButton()
|
|
|
|
+{
|
|
|
|
+ UE_LOG(LogTemp, Log, TEXT("SEzAbleTreeViewWidget::HandleAddStateButton"));
|
|
|
|
+ return FReply::Handled();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+TSharedRef<ITableRow> SEzAbleTreeViewWidget::HandleGenerateRow(TWeakObjectPtr<UEzAbilityState> InState, const TSharedRef<STableViewBase>& InOwnerTableView)
|
|
|
|
+{
|
|
|
|
+ return SNew(SEzAbleTreeViewRowWidget, InOwnerTableView, InState, ViewBox);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#undef LOCTEXT_NAMESPACE
|