A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
DlgTreeViewHelper.h
Go to the documentation of this file.
1// Copyright Csaba Molnar, Daniel Butum. All Rights Reserved.
2#pragma once
3
4#include "CoreMinimal.h"
5#include "Widgets/Views/STreeView.h"
6
7#include "DlgHelper.h"
8
9class DLGSYSTEM_API FDlgTreeViewHelper
10{
11public:
13 const TWeakObjectPtr<const UDlgDialogue>& First,
14 const TWeakObjectPtr<const UDlgDialogue>& Second
15 )
16 {
17 if (!First.IsValid())
18 {
19 return false;
20 }
21 if (!Second.IsValid())
22 {
23 return true;
24 }
25
27 }
28
30 template<typename ItemType, typename ComparisonType>
32 const TSharedPtr<STreeView<ItemType>>& InTree,
33 const TArray<ItemType>& ItemSource,
34 const TSet<ItemType>& OldExpansionState, ComparisonType ComparisonFunction
35 )
36 {
37 check(InTree.IsValid());
38
39 // Iterate over new tree items
40 for (int32 ItemIdx = 0; ItemIdx < ItemSource.Num(); ItemIdx++)
41 {
42 ItemType NewItem = ItemSource[ItemIdx];
43
44 // Look through old expansion state
45 for (const ItemType OldItem : OldExpansionState)
46 {
47 // See if this matches this new item
48 if (ComparisonFunction(OldItem, NewItem))
49 {
50 // It does, so expand it
51 InTree->SetItemExpansion(NewItem, true);
52 }
53 }
54 }
55 }
56};
static bool PredicateSortFNameAlphabeticallyAscending(FName A, FName B)
Definition DlgHelper.h:446
static bool PredicateSortDialogueWeakPtrAlphabeticallyAscending(const TWeakObjectPtr< const UDlgDialogue > &First, const TWeakObjectPtr< const UDlgDialogue > &Second)
static void RestoreTreeExpansionState(const TSharedPtr< STreeView< ItemType > > &InTree, const TArray< ItemType > &ItemSource, const TSet< ItemType > &OldExpansionState, ComparisonType ComparisonFunction)