@@ -28,6 +28,7 @@ public abstract class Tree<TNode, TData>: TreeBase<TNode, TData>
28
28
[ NonSerialized ] private TNode rightClickNextRenderNode ;
29
29
30
30
[ NonSerialized ] private int controlId ;
31
+ [ NonSerialized ] private bool isBusy ;
31
32
32
33
public bool IsInitialized { get { return Nodes != null && Nodes . Count > 0 && ! String . IsNullOrEmpty ( Nodes [ 0 ] . Path ) ; } }
33
34
public bool RequiresRepaint { get ; private set ; }
@@ -75,7 +76,7 @@ public Rect Render(Rect treeDisplayRect, Vector2 scroll, Action<TNode> singleCli
75
76
if ( titleDisplay )
76
77
{
77
78
var isSelected = SelectedNode != null && SelectedNode . Path == titleNode . Path ;
78
- renderResult = titleNode . Render ( rect , Styles . TreeIndentation , isSelected , FolderStyle , treeNodeStyle , activeTreeNodeStyle ) ;
79
+ renderResult = titleNode . Render ( rect , Styles . TreeIndentation , isSelected , IsBusy , FolderStyle , treeNodeStyle , activeTreeNodeStyle ) ;
79
80
}
80
81
81
82
if ( renderResult == TreeNodeRenderResult . VisibilityChange )
@@ -109,7 +110,7 @@ public Rect Render(Rect treeDisplayRect, Vector2 scroll, Action<TNode> singleCli
109
110
if ( display )
110
111
{
111
112
var isSelected = SelectedNode != null && SelectedNode . Path == node . Path ;
112
- renderResult = node . Render ( rect , Styles . TreeIndentation , isSelected , FolderStyle , treeNodeStyle , activeTreeNodeStyle ) ;
113
+ renderResult = node . Render ( rect , Styles . TreeIndentation , isSelected , IsBusy , FolderStyle , treeNodeStyle , activeTreeNodeStyle ) ;
113
114
}
114
115
115
116
if ( renderResult == TreeNodeRenderResult . VisibilityChange )
@@ -153,6 +154,12 @@ protected bool TreeHasFocus
153
154
154
155
public abstract bool ViewHasFocus { get ; set ; }
155
156
157
+ public bool IsBusy
158
+ {
159
+ get { return isBusy ; }
160
+ set { isBusy = value ; }
161
+ }
162
+
156
163
public void Focus ( )
157
164
{
158
165
bool selectionChanged = false ;
@@ -406,10 +413,15 @@ public void Load()
406
413
content = new GUIContent ( Label , Icon ) ;
407
414
}
408
415
409
- public TreeNodeRenderResult Render ( Rect rect , float indentation , bool isSelected , GUIStyle toggleStyle , GUIStyle nodeStyle , GUIStyle activeNodeStyle )
416
+ public TreeNodeRenderResult Render ( Rect rect , float indentation , bool isSelected , bool treeIsBusy , GUIStyle toggleStyle , GUIStyle nodeStyle , GUIStyle activeNodeStyle )
410
417
{
411
418
var renderResult = TreeNodeRenderResult . None ;
412
419
420
+ if ( treeIsBusy )
421
+ {
422
+ GUI . enabled = false ;
423
+ }
424
+
413
425
if ( IsHidden )
414
426
return renderResult ;
415
427
@@ -500,6 +512,11 @@ public TreeNodeRenderResult Render(Rect rect, float indentation, bool isSelected
500
512
GUI . DrawTexture ( statusRect , IconBadge ) ;
501
513
}
502
514
515
+ if ( treeIsBusy )
516
+ {
517
+ GUI . enabled = true ;
518
+ }
519
+
503
520
return renderResult ;
504
521
}
505
522
0 commit comments