forked from MattRix/UnityDecompiled
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTreeViewColumnHeader.cs
More file actions
63 lines (57 loc) · 1.16 KB
/
Copy pathTreeViewColumnHeader.cs
File metadata and controls
63 lines (57 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using UnityEngine;
namespace UnityEditor.TreeViewExamples
{
internal class TreeViewColumnHeader
{
public float[] columnWidths
{
get;
set;
}
public float minColumnWidth
{
get;
set;
}
public float dragWidth
{
get;
set;
}
public Action<int, Rect> columnRenderer
{
get;
set;
}
public TreeViewColumnHeader()
{
this.minColumnWidth = 10f;
this.dragWidth = 6f;
}
public void OnGUI(Rect rect)
{
float num = rect.x;
for (int i = 0; i < this.columnWidths.Length; i++)
{
Rect arg = new Rect(num, rect.y, this.columnWidths[i], rect.height);
num += this.columnWidths[i];
Rect position = new Rect(num - this.dragWidth / 2f, rect.y, 3f, rect.height);
float x = EditorGUI.MouseDeltaReader(position, true).x;
if (x != 0f)
{
this.columnWidths[i] += x;
this.columnWidths[i] = Mathf.Max(this.columnWidths[i], this.minColumnWidth);
}
if (this.columnRenderer != null)
{
this.columnRenderer(i, arg);
}
if (Event.current.type == EventType.Repaint)
{
EditorGUIUtility.AddCursorRect(position, MouseCursor.SplitResizeLeftRight);
}
}
}
}
}