forked from Unity-Technologies/UnityCsReference
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDrawStates.cs
More file actions
57 lines (50 loc) · 2.08 KB
/
DrawStates.cs
File metadata and controls
57 lines (50 loc) · 2.08 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
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
namespace UnityEngine
{
internal delegate bool DrawHandler(GUIStyle style, Rect rect, GUIContent content, DrawStates states);
internal struct DrawStates
{
public DrawStates(bool isHover, bool isActive, bool on, bool hasKeyboardFocus) : this(-1, isHover, isActive, on, hasKeyboardFocus)
{
}
public DrawStates(int controlId, bool isHover, bool isActive, bool on, bool hasKeyboardFocus)
{
this.controlId = controlId;
this.isHover = isHover;
this.isActive = isActive;
this.on = on;
this.hasKeyboardFocus = hasKeyboardFocus;
hasTextInput = false;
drawSelectionAsComposition = false;
cursorFirst = -1;
cursorLast = -1;
cursorColor = Color.red;
selectionColor = Color.red;
}
public DrawStates(int controlId, bool isHover, bool isActive, bool on, bool hasKeyboardFocus,
bool drawSelectionAsComposition, int cursorFirst, int cursorLast,
Color cursorColor, Color selectionColor)
: this(controlId, isHover, isActive, on, hasKeyboardFocus)
{
hasTextInput = true;
this.drawSelectionAsComposition = drawSelectionAsComposition;
this.cursorFirst = cursorFirst;
this.cursorLast = cursorLast;
this.cursorColor = cursorColor;
this.selectionColor = selectionColor;
}
public readonly int controlId;
public readonly bool isHover;
public readonly bool isActive;
public readonly bool on;
public readonly bool hasKeyboardFocus;
public readonly bool hasTextInput;
public readonly bool drawSelectionAsComposition;
public readonly int cursorFirst;
public readonly int cursorLast;
public readonly Color cursorColor;
public readonly Color selectionColor;
}
}