SEzAbleTreeViewWidget.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Fill out your copyright notice in the Description page of Project Settings.
  2. #pragma once
  3. #include "CoreMinimal.h"
  4. #include "Widgets/SCompoundWidget.h"
  5. #include "Widgets/Layout/SScrollBox.h"
  6. #include "EzAbilityState.h"
  7. #include "EzAbleTreeViewOperationMode.h"
  8. /**
  9. *
  10. */
  11. class EZABILITYEDITOR_API SEzAbleTreeViewWidget : public SCompoundWidget
  12. {
  13. public:
  14. SLATE_BEGIN_ARGS(SEzAbleTreeViewWidget)
  15. {}
  16. SLATE_END_ARGS()
  17. /** Constructs this widget with InArgs */
  18. void Construct(const FArguments& InArgs, TSharedPtr<FEzAbleTreeViewOperationMode> InAbleTreeViewOperationMode);
  19. FReply HandleAddStateButton();
  20. // Treeview handlers
  21. TSharedRef<ITableRow> HandleGenerateRow(TWeakObjectPtr<UEzAbilityState> InState, const TSharedRef<STableViewBase>& InOwnerTableView);
  22. void HandleGetChildren(TWeakObjectPtr<UEzAbilityState> InParent, TArray<TWeakObjectPtr<UEzAbilityState>>& OutChildren);
  23. void UpdateTree(bool bExpandPersistent = false);
  24. void HandleTreeSelectionChanged(TWeakObjectPtr<UEzAbilityState> InSelectedItem, ESelectInfo::Type SelectionType);
  25. void HandleTreeExpansionChanged(TWeakObjectPtr<UEzAbilityState> InSelectedItem, bool bExpanded);
  26. TSharedPtr<SWidget> HandleContextMenuOpening();
  27. void HandleModelStateAdded(UEzAbilityState* ParentState, UEzAbilityState* NewState);
  28. bool HasSelection() const;
  29. void BindCommands();
  30. //Action Handlers
  31. UEzAbilityState* GetFirstSelectedState() const;
  32. void HandleDeleteStates();
  33. void HandleAddChildState();
  34. void HandleAddSiblingState();
  35. private:
  36. virtual FReply OnKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent) override;
  37. public:
  38. TSharedPtr<FEzAbleTreeViewOperationMode> AbleTreeViewOperationMode;
  39. TSharedPtr<STreeView<TWeakObjectPtr<UEzAbilityState>>> TreeView;
  40. TSharedPtr<SScrollBox> ViewBox;
  41. TArray<TWeakObjectPtr<UEzAbilityState>> Subtrees;
  42. TSharedPtr<FUICommandList> CommandList;
  43. bool bUpdatingSelection;
  44. // TArray<TWeakObjectPtr<UEzAbilityState>> TestState;
  45. // TArray<TObjectPtr<UEzAbilityState>> TestStrongState;
  46. //
  47. // TObjectPtr<UEzAbilityState> TestAddState;
  48. };