forked from Unity-Technologies/UnityCsReference
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEditorGUIInternal.cs
More file actions
78 lines (66 loc) · 3.33 KB
/
Copy pathEditorGUIInternal.cs
File metadata and controls
78 lines (66 loc) · 3.33 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using UnityEngine;
using Object = UnityEngine.Object;
namespace UnityEditor
{
//@todo This should be handled through friend assemblies instead
internal sealed class EditorGUIInternal : GUI
{
// Choose how toggles appear when showing mixed values
static internal GUIStyle mixedToggleStyle
{
get { return s_MixedToggleStyle; }
set { s_MixedToggleStyle = value; }
}
private static GUIStyle s_MixedToggleStyle = EditorStyles.toggleMixed;
static internal Rect GetTooltipRect() { return tooltipRect; }
static internal string GetMouseTooltip() { return mouseTooltip; }
internal static bool DoToggleForward(Rect position, int id, bool value, GUIContent content, GUIStyle style)
{
Event evt = Event.current;
if (EditorGUI.showMixedValue)
style = mixedToggleStyle;
// Ignore mouse clicks that are not with the primary (left) mouse button so those can be grabbed by other things later.
EventType origType = evt.type;
bool nonLeftClick = (evt.type == EventType.MouseDown && evt.button != 0);
if (nonLeftClick)
evt.type = EventType.Ignore;
bool returnValue = DoToggle(position, id, EditorGUI.showMixedValue ? false : value, content, style);
if (nonLeftClick)
evt.type = origType;
else if (evt.type != origType)
EditorGUIUtility.keyboardControl = id; // If control used event, give it keyboard focus.
return returnValue;
}
internal static Vector2 DoBeginScrollViewForward(Rect position, Vector2 scrollPosition, Rect viewRect, bool alwaysShowHorizontal, bool alwaysShowVertical, GUIStyle horizontalScrollbar, GUIStyle verticalScrollbar, GUIStyle background)
{
return DoBeginScrollView(position, scrollPosition, viewRect, alwaysShowHorizontal, alwaysShowVertical, horizontalScrollbar, verticalScrollbar, background);
}
internal static void BeginWindowsForward(int skinMode, int editorWindowInstanceID)
{
BeginWindows(skinMode, editorWindowInstanceID);
}
internal static void AssetPopup<T>(SerializedProperty serializedProperty, GUIContent content, string fileExtension) where T : Object, new()
{
AssetPopup<T>(serializedProperty, content, fileExtension, "Default");
}
internal static void AssetPopup<T>(SerializedProperty serializedProperty, GUIContent content, string fileExtension, string defaultFieldName) where T : Object, new()
{
AssetPopupBackend.AssetPopup<T>(serializedProperty, content, fileExtension, defaultFieldName);
}
}
//@todo This should be handled through friend assemblies instead
internal sealed class EditorGUILayoutUtilityInternal : GUILayoutUtility
{
internal new static GUILayoutGroup BeginLayoutArea(GUIStyle style, System.Type LayoutType)
{
return GUILayoutUtility.DoBeginLayoutArea(style, LayoutType);
}
internal new static GUILayoutGroup topLevel
{
get { return GUILayoutUtility.topLevel; }
}
}
}