summaryrefslogtreecommitdiff
path: root/Runtime/Export/GUIContentBindings.txt
blob: c53201b68b15f3a6bbcc4b6461c1089481b476ab (plain)
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
CSRAW
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Collections;

namespace UnityEngine
{



// The contents of a GUI element.
CSRAW [StructLayout (LayoutKind.Sequential)]
CSRAW [System.Serializable]
CLASS GUIContent 

	// MUST MATCH MEMORY LAYOUT IN GUICONTENT.CPP
	CSRAW
	[SerializeField]
	string m_Text = "";
	[SerializeField]
	Texture m_Image;
	[SerializeField]
	string m_Tooltip = "";
	


	// The text contained.
	CSRAW public string text { get { return m_Text; } set { m_Text = value; } }

	// The icon image contained.
	CSRAW public Texture image { get { return m_Image; } set { m_Image = value; } }

	// The tooltip of this element.
	CSRAW public string tooltip { get { return m_Tooltip; } set { m_Tooltip = value; } }


	// Constructor for GUIContent in all shapes and sizes
	CSRAW public GUIContent () {}
	// Build a GUIContent object containing only text.
	CSRAW public GUIContent (string text) {
		m_Text = text;
	}

	// Build a GUIContent object containing only an image.
	CSRAW public GUIContent (Texture image) {
		m_Image = image;
	}
	
	// Build a GUIContent object containing both /text/ and an image.
	CSRAW public GUIContent (string text, Texture image) {
		m_Text = text;
		m_Image = image;
	}
	
	// Build a GUIContent containing some /text/. When the user hovers the mouse over it, the global GUI::ref::tooltip is set to the /tooltip/.
	CSRAW public GUIContent (string text, string tooltip) {
		m_Text = text;
		m_Tooltip = tooltip;
	}

	// Build a GUIContent containing an image. When the user hovers the mouse over it, the global GUI::ref::tooltip is set to the /tooltip/.
	CSRAW public GUIContent (Texture image, string tooltip) {
		m_Image = image;
		m_Tooltip = tooltip;
	}
	
	// Build a GUIContent that contains both /text/, an /image/ and has a /tooltip/ defined. When the user hovers the mouse over it, the global GUI::ref::tooltip is set to the /tooltip/.
	CSRAW public GUIContent (string text, Texture image, string tooltip) {
		m_Text = text;
		m_Image = image;
		m_Tooltip = tooltip;
	}
	
	// Build a GUIContent as a copy of another GUIContent.
	CSRAW public GUIContent (GUIContent src) {
		m_Text = src.m_Text;	
		m_Image = src.m_Image;
		m_Tooltip = src.m_Tooltip;
	}

	// Shorthand for empty content.
	CSRAW public static GUIContent none = new GUIContent ("");

	// *undocumented*
	CSRAW 
	internal int hash {get {
		int h = 0;
		if (m_Text != null && m_Text != "")
			h = m_Text.GetHashCode () * 37;
		return h;
	}}
	static GUIContent s_Text = new GUIContent(), s_Image = new GUIContent(), s_TextImage = new GUIContent();
	internal static GUIContent Temp (string t) {
		s_Text.m_Text = t;
		return s_Text;
	}
	internal static GUIContent Temp (Texture i) {
		s_Image.m_Image = i;
		return s_Image;
	}
	internal static GUIContent Temp (string t, Texture i) {
		s_TextImage.m_Text = t;
		s_TextImage.m_Image = i;
		return s_TextImage;
	}
	internal static void ClearStaticCache()
	{
		s_Text.m_Text = null;
		s_Image.m_Image = null;
		s_TextImage.m_Text = null;
		s_TextImage.m_Image = null;
	}

	internal static GUIContent[] Temp (string[] texts) {
		GUIContent[] retval = new GUIContent[texts.Length];
		for (int i = 0; i < texts.Length; i++) {
			retval[i] = new GUIContent (texts[i]);
		}
		return retval;
	}
	internal static GUIContent[] Temp (Texture[] images) {
		GUIContent[] retval = new GUIContent[images.Length];
		for (int i = 0; i < images.Length; i++) {
			retval[i] = new GUIContent (images[i]);
		}
		return retval;
	}
END

CSRAW
}