-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
EditorStyles.cs
606 lines (476 loc) · 28.8 KB
/
EditorStyles.cs
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using UnityEditor.Experimental;
using UnityEditor.StyleSheets;
using UnityEngine;
using UnityEngine.Internal;
// See Style Guide in wiki for more information on editor styles.
namespace UnityEditor
{
// Common GUIStyles used for EditorGUI controls.
public sealed class EditorStyles
{
internal const int kInspectorPaddingLeft = 8 + 10;
internal const int kInspectorPaddingRight = 4;
internal const int kInspectorPaddingTop = 4;
// Style used for the labeled on all EditorGUI overloads that take a prefix label
public static GUIStyle label { get { return s_Current.m_Label; } }
internal GUIStyle m_Label;
// Style for label with small font.
public static GUIStyle miniLabel { get { return s_Current.m_MiniLabel; } }
private GUIStyle m_MiniLabel;
// Style for label with large font.
public static GUIStyle largeLabel { get { return s_Current.m_LargeLabel; } }
private GUIStyle m_LargeLabel;
// Style for bold label.
public static GUIStyle boldLabel { get { return s_Current.m_BoldLabel; } }
private GUIStyle m_BoldLabel;
// Style for mini bold label.
public static GUIStyle miniBoldLabel { get { return s_Current.m_MiniBoldLabel; } }
private GUIStyle m_MiniBoldLabel;
// Style for centered grey mini label.
public static GUIStyle centeredGreyMiniLabel { get { return s_Current.m_CenteredGreyMiniLabel; } }
private GUIStyle m_CenteredGreyMiniLabel;
// Style for word wrapped mini label.
public static GUIStyle wordWrappedMiniLabel { get { return s_Current.m_WordWrappedMiniLabel; } }
private GUIStyle m_WordWrappedMiniLabel;
// Style for word wrapped label.
public static GUIStyle wordWrappedLabel { get { return s_Current.m_WordWrappedLabel; } }
private GUIStyle m_WordWrappedLabel;
// Style for link label.
public static GUIStyle linkLabel { get { return s_Current.m_LinkLabel; } }
private GUIStyle m_LinkLabel;
// Style for white label.
public static GUIStyle whiteLabel { get { return s_Current.m_WhiteLabel; } }
private GUIStyle m_WhiteLabel;
// Style for white mini label.
public static GUIStyle whiteMiniLabel { get { return s_Current.m_WhiteMiniLabel; } }
private GUIStyle m_WhiteMiniLabel;
// Style for white large label.
public static GUIStyle whiteLargeLabel { get { return s_Current.m_WhiteLargeLabel; } }
private GUIStyle m_WhiteLargeLabel;
// Style for white bold label.
public static GUIStyle whiteBoldLabel { get { return s_Current.m_WhiteBoldLabel; } }
private GUIStyle m_WhiteBoldLabel;
// Style used for a radio button
public static GUIStyle radioButton { get { return s_Current.m_RadioButton; } }
private GUIStyle m_RadioButton;
// Style used for a standalone small button.
public static GUIStyle miniButton { get { return s_Current.m_MiniButton; } }
private GUIStyle m_MiniButton;
// Style used for the leftmost button in a horizontal button group.
public static GUIStyle miniButtonLeft { get { return s_Current.m_MiniButtonLeft; } }
private GUIStyle m_MiniButtonLeft;
// Style used for the middle buttons in a horizontal group.
public static GUIStyle miniButtonMid { get { return s_Current.m_MiniButtonMid; } }
private GUIStyle m_MiniButtonMid;
// Style used for the rightmost button in a horizontal group.
public static GUIStyle miniButtonRight { get { return s_Current.m_MiniButtonRight; } }
private GUIStyle m_MiniButtonRight;
public static GUIStyle miniPullDown { get { return s_Current.m_MiniPullDown; } }
private GUIStyle m_MiniPullDown;
// Style used for EditorGUI::ref::TextField
public static GUIStyle textField { get { return s_Current.m_TextField; } }
internal GUIStyle m_TextField;
// Style used for bold text field
internal static GUIStyle boldTextField { get { return s_Current.m_BoldTextField; } }
private GUIStyle m_BoldTextField;
// Style used for EditorGUI::ref::TextArea
public static GUIStyle textArea { get { return s_Current.m_TextArea; } }
internal GUIStyle m_TextArea;
// Smaller text field
public static GUIStyle miniTextField { get { return s_Current.m_MiniTextField; } }
private GUIStyle m_MiniTextField;
// Style used for field editors for numbers
public static GUIStyle numberField { get { return s_Current.m_NumberField; } }
private GUIStyle m_NumberField;
// Style used for EditorGUI::ref::Popup, EditorGUI::ref::EnumPopup,
public static GUIStyle popup { get { return s_Current.m_Popup; } }
private GUIStyle m_Popup;
// Style used for headings for structures (Vector3, Rect, etc)
[System.Obsolete("structHeadingLabel is deprecated, use EditorStyles.label instead.")]
public static GUIStyle structHeadingLabel { get { return s_Current.m_Label; } }
// Style used for headings for object fields.
public static GUIStyle objectField { get { return s_Current.m_ObjectField; } }
private GUIStyle m_ObjectField;
internal static GUIStyle objectFieldButton { get { return s_Current.m_ObjectFieldButton; } }
private GUIStyle m_ObjectFieldButton;
// Style used for headings for the Select button in object fields.
public static GUIStyle objectFieldThumb { get { return s_Current.m_ObjectFieldThumb; } }
private GUIStyle m_ObjectFieldThumb;
// Style used for texture object field with minimal height (useful for single line texture objectfields)
public static GUIStyle objectFieldMiniThumb { get { return s_Current.m_ObjectFieldMiniThumb; } }
private GUIStyle m_ObjectFieldMiniThumb;
// Style used for headings for Color fields.
public static GUIStyle colorField { get { return s_Current.m_ColorField; } }
private GUIStyle m_ColorField;
// Style used for headings for Layer masks.
public static GUIStyle layerMaskField { get { return s_Current.m_LayerMaskField; } }
private GUIStyle m_LayerMaskField;
// Style used for headings for EditorGUI::ref::Toggle.
public static GUIStyle toggle {get { return s_Current.m_Toggle; } }
private GUIStyle m_Toggle;
internal static GUIStyle toggleMixed { get { return s_Current.m_ToggleMixed; } }
private GUIStyle m_ToggleMixed;
// Style used for headings for EditorGUI::ref::Foldout.
public static GUIStyle foldout { get { return s_Current.m_Foldout; } }
private GUIStyle m_Foldout;
internal static GUIStyle titlebarFoldout { get { return s_Current.m_TitlebarFoldout; } }
private GUIStyle m_TitlebarFoldout;
// Style used for headings for EditorGUI::ref::Foldout.
public static GUIStyle foldoutPreDrop { get { return s_Current.m_FoldoutPreDrop; } }
private GUIStyle m_FoldoutPreDrop;
public static GUIStyle foldoutHeader { get { return s_Current.m_FoldoutHeader;} }
GUIStyle m_FoldoutHeader;
public static GUIStyle foldoutHeaderIcon { get { return s_Current.m_FoldoutHeaderIcon; } }
GUIStyle m_FoldoutHeaderIcon;
internal static GUIStyle optionsButtonStyle { get { return s_Current.m_OptionsButtonStyle; } }
GUIStyle m_OptionsButtonStyle;
// Style used for headings for EditorGUILayout::ref::BeginToggleGroup.
public static GUIStyle toggleGroup { get { return s_Current.m_ToggleGroup; } }
private GUIStyle m_ToggleGroup;
internal static GUIStyle textFieldDropDown { get { return s_Current.m_TextFieldDropDown; } }
private GUIStyle m_TextFieldDropDown;
internal static GUIStyle textFieldDropDownText { get { return s_Current.m_TextFieldDropDownText; } }
private GUIStyle m_TextFieldDropDownText;
internal static GUIStyle overrideMargin { get { return s_Current.m_OverrideMargin; } }
private GUIStyle m_OverrideMargin;
// Standard font.
public static Font standardFont => EditorResources.GetFont(FontDef.Style.Normal);
// Bold font.
public static Font boldFont => EditorResources.GetFont(FontDef.Style.Bold);
// Mini font.
public static Font miniFont => EditorResources.GetFont(FontDef.Style.Small);
// Mini Bold font.
public static Font miniBoldFont => EditorResources.GetFont(FontDef.Style.Bold);
// Toolbar background from top of windows.
public static GUIStyle toolbar { get { return s_Current.m_Toolbar; } }
private GUIStyle m_Toolbar;
internal static GUIStyle contentToolbar { get { return s_Current.m_ContentToolbar; } }
private GUIStyle m_ContentToolbar;
// Style for Button and Toggles in toolbars.
public static GUIStyle toolbarButton { get { return s_Current.m_ToolbarButton; } }
private GUIStyle m_ToolbarButton;
internal static GUIStyle toolbarButtonLeft { get { return s_Current.m_ToolbarButtonLeft; } }
private GUIStyle m_ToolbarButtonLeft;
internal static GUIStyle toolbarButtonRight { get { return s_Current.m_ToolbarButtonRight; } }
private GUIStyle m_ToolbarButtonRight;
// Toolbar Popup
public static GUIStyle toolbarPopup { get { return s_Current.m_ToolbarPopup; } }
private GUIStyle m_ToolbarPopup;
internal static GUIStyle toolbarPopupLeft { get { return s_Current.m_ToolbarPopupLeft; } }
private GUIStyle m_ToolbarPopupLeft;
internal static GUIStyle toolbarPopupRight { get { return s_Current.m_ToolbarPopupRight; } }
private GUIStyle m_ToolbarPopupRight;
internal static GUIStyle toolbarDropDownLeft { get { return s_Current.m_ToolbarDropDownLeft; } }
private GUIStyle m_ToolbarDropDownLeft;
public static GUIStyle toolbarDropDown { get { return s_Current.m_ToolbarDropDown; } }
private GUIStyle m_ToolbarDropDown;
// Toolbar Dropdown Right
internal static GUIStyle toolbarDropDownRight { get { return s_Current.m_ToolbarDropDownRight; } }
private GUIStyle m_ToolbarDropDownRight;
// Toolbar Dropdown Toggle
internal static GUIStyle toolbarDropDownToggle { get { return s_Current.m_ToolbarDropDownToggle; } }
private GUIStyle m_ToolbarDropDownToggle;
// Toolbar Dropdown Toggle Button
internal static GUIStyle toolbarDropDownToggleButton { get { return s_Current.m_ToolbarDropDownToggleButton; } }
private GUIStyle m_ToolbarDropDownToggleButton;
// Toolbar Dropdown Toggle Right
internal static GUIStyle toolbarDropDownToggleRight { get { return s_Current.m_ToolbarDropDownToggleRight; } }
private GUIStyle m_ToolbarDropDownToggleRight;
// Toolbar Dropdown
internal static GUIStyle toolbarCreateAddNewDropDown { get { return s_Current.m_ToolbarCreateAddNewDropDown; } }
private GUIStyle m_ToolbarCreateAddNewDropDown;
// Toolbar text field
public static GUIStyle toolbarTextField { get { return s_Current.m_ToolbarTextField; } }
private GUIStyle m_ToolbarTextField;
internal static GUIStyle toolbarLabel { get { return s_Current.m_ToolbarLabel; } }
private GUIStyle m_ToolbarLabel;
public static GUIStyle inspectorDefaultMargins { get { return s_Current.m_InspectorDefaultMargins; } }
private GUIStyle m_InspectorDefaultMargins;
public static GUIStyle inspectorFullWidthMargins { get { return s_Current.m_InspectorFullWidthMargins; } }
private GUIStyle m_InspectorFullWidthMargins;
internal static GUIStyle defaultContentMargins { get { return s_Current.m_DefaultContentMargins; } }
private GUIStyle m_DefaultContentMargins;
internal static GUIStyle frameBox => s_Current.m_FrameBox;
private GUIStyle m_FrameBox;
public static GUIStyle helpBox { get { return s_Current.m_HelpBox; } }
private GUIStyle m_HelpBox;
internal static GUIStyle helpBoxLabel {
get {
s_Current.m_HelpBoxLabel.Assign(s_Current.m_HelpBox);
s_Current.m_HelpBoxLabel.name = "HelpBoxLabel";
s_Current.m_HelpBoxLabel.normal.background = null;
s_Current.m_HelpBoxLabel.hover.background = null;
s_Current.m_HelpBoxLabel.active.background = null;
s_Current.m_HelpBoxLabel.focused.background = null;
s_Current.m_HelpBoxLabel.onNormal.background = null;
s_Current.m_HelpBoxLabel.onHover.background = null;
s_Current.m_HelpBoxLabel.onActive.background = null;
s_Current.m_HelpBoxLabel.onFocused.background = null;
return s_Current.m_HelpBoxLabel;
}
}
private GUIStyle m_HelpBoxLabel;
public static GUIStyle toolbarSearchField { get { return s_Current.m_ToolbarSearchField; } }
private GUIStyle m_ToolbarSearchField;
internal static GUIStyle toolbarSearchFieldPopup { get { return s_Current.m_ToolbarSearchFieldPopup; } }
private GUIStyle m_ToolbarSearchFieldPopup;
internal static GUIStyle toolbarSearchFieldWithJumpSynced { get { return s_Current.m_ToolbarSearchFieldWithJumpSynced; } }
private GUIStyle m_ToolbarSearchFieldWithJumpSynced;
internal static GUIStyle toolbarSearchFieldWithJumpPopupSynced { get { return s_Current.m_ToolbarSearchFieldWithJumpPopupSynced; } }
private GUIStyle m_ToolbarSearchFieldWithJumpPopupSynced;
internal static GUIStyle toolbarSearchFieldWithJump { get { return s_Current.m_ToolbarSearchFieldWithJump; } }
private GUIStyle m_ToolbarSearchFieldWithJump;
internal static GUIStyle toolbarSearchFieldWithJumpPopup { get { return s_Current.m_ToolbarSearchFieldWithJumpPopup; } }
private GUIStyle m_ToolbarSearchFieldWithJumpPopup;
internal static GUIStyle toolbarSearchFieldJumpButton { get { return s_Current.m_ToolbarSearchFieldJumpButton; } }
private GUIStyle m_ToolbarSearchFieldJumpButton;
internal static GUIStyle toolbarSearchFieldCancelButton { get { return s_Current.m_ToolbarSearchFieldCancelButton; } }
private GUIStyle m_ToolbarSearchFieldCancelButton;
internal static GUIStyle toolbarSearchFieldCancelButtonEmpty { get { return s_Current.m_ToolbarSearchFieldCancelButtonEmpty; } }
private GUIStyle m_ToolbarSearchFieldCancelButtonEmpty;
internal static GUIStyle toolbarSearchFieldCancelButtonWithJump { get { return s_Current.m_ToolbarSearchFieldCancelButtonWithJump; } }
private GUIStyle m_ToolbarSearchFieldCancelButtonWithJump;
internal static GUIStyle toolbarSearchFieldCancelButtonWithJumpEmpty { get { return s_Current.m_ToolbarSearchFieldCancelButtonWithJumpEmpty; } }
private GUIStyle m_ToolbarSearchFieldCancelButtonWithJumpEmpty;
internal static GUIStyle colorPickerBox { get { return s_Current.m_ColorPickerBox; } }
private GUIStyle m_ColorPickerBox;
internal static GUIStyle viewBackground { get { return s_Current.m_ViewBg; } }
private GUIStyle m_ViewBg;
internal static GUIStyle inspectorBig { get { return s_Current.m_InspectorBig; } }
private GUIStyle m_InspectorBig;
internal static GUIStyle inspectorTitlebar { get { return s_Current.m_InspectorTitlebar; } }
private GUIStyle m_InspectorTitlebar;
internal static GUIStyle inspectorTitlebarFlat { get { return s_Current.m_InspectorTitlebarFlat; } }
private GUIStyle m_InspectorTitlebarFlat;
internal static GUIStyle inspectorTitlebarText { get { return s_Current.m_InspectorTitlebarText; } }
private GUIStyle m_InspectorTitlebarText;
internal static GUIStyle foldoutSelected { get { return s_Current.m_FoldoutSelected; } }
private GUIStyle m_FoldoutSelected;
// Style used for a standalone icon button
public static GUIStyle iconButton { get { return s_Current.m_IconButton; } }
private GUIStyle m_IconButton;
// Style for tooltips
internal static GUIStyle tooltip { get { return s_Current.m_Tooltip; } }
private GUIStyle m_Tooltip;
// Style for notification text.
internal static GUIStyle notificationText { get { return s_Current.m_NotificationText; } }
private GUIStyle m_NotificationText;
// Style for notification background area.
internal static GUIStyle notificationBackground { get { return s_Current.m_NotificationBackground; } }
private GUIStyle m_NotificationBackground;
internal static GUIStyle assetLabel { get { return s_Current.m_AssetLabel; } }
private GUIStyle m_AssetLabel;
internal static GUIStyle assetLabelPartial { get { return s_Current.m_AssetLabelPartial; } }
private GUIStyle m_AssetLabelPartial;
internal static GUIStyle assetLabelIcon { get { return s_Current.m_AssetLabelIcon; } }
private GUIStyle m_AssetLabelIcon;
internal static GUIStyle searchField { get { return s_Current.m_SearchField; } }
private GUIStyle m_SearchField;
internal static GUIStyle searchFieldCancelButton { get { return s_Current.m_SearchFieldCancelButton; } }
private GUIStyle m_SearchFieldCancelButton;
internal static GUIStyle searchFieldCancelButtonEmpty { get { return s_Current.m_SearchFieldCancelButtonEmpty; } }
private GUIStyle m_SearchFieldCancelButtonEmpty;
public static GUIStyle selectionRect { get { return s_Current.m_SelectionRect; } }
private GUIStyle m_SelectionRect;
internal static GUIStyle toolbarSlider { get { return s_Current.m_ToolbarSlider; } }
private GUIStyle m_ToolbarSlider;
internal static GUIStyle minMaxHorizontalSliderThumb { get { return s_Current.m_MinMaxHorizontalSliderThumb; } }
private GUIStyle m_MinMaxHorizontalSliderThumb;
internal static GUIStyle dropDownList { get { return s_Current.m_DropDownList; } }
private GUIStyle m_DropDownList;
internal static GUIStyle dropDownToggleButton { get { return s_Current.m_DropDownToggleButton; } }
private GUIStyle m_DropDownToggleButton;
internal static GUIStyle minMaxStateDropdown { get { return s_Current.m_MinMaxStateDropdown; } }
private GUIStyle m_MinMaxStateDropdown;
internal static GUIStyle progressBarBack { get { return s_Current.m_ProgressBarBack; } }
internal static GUIStyle progressBarBar { get { return s_Current.m_ProgressBarBar; } }
internal static GUIStyle progressBarText { get { return s_Current.m_ProgressBarText; } }
private GUIStyle m_ProgressBarBar, m_ProgressBarText, m_ProgressBarBack;
internal static GUIStyle scrollViewAlt { get { return s_Current.m_ScrollViewAlt; } }
private GUIStyle m_ScrollViewAlt;
internal static Vector2 knobSize {get {return s_Current.m_KnobSize; }}
internal static Vector2 miniKnobSize {get {return s_Current.m_MiniKnobSize; }}
private Vector2 m_KnobSize = new Vector2(40, 40);
private Vector2 m_MiniKnobSize = new Vector2(29, 29);
// the editor styles currently in use
internal static EditorStyles s_Current;
// the list of editor styles to use
private static EditorStyles[] s_CachedStyles = { null, null };
[ExcludeFromDocs]
public static GUIStyle FromUSS(string ussStyleRuleName, string ussInPlaceStyleOverride = null)
{
return GUIStyleExtensions.FromUSS(ussStyleRuleName, ussInPlaceStyleOverride);
}
[ExcludeFromDocs]
public static GUIStyle FromUSS(GUIStyle baseStyle, string ussStyleRuleName, string ussInPlaceStyleOverride = null)
{
return GUIStyleExtensions.FromUSS(baseStyle, ussStyleRuleName, ussInPlaceStyleOverride);
}
[ExcludeFromDocs]
public static GUIStyle ApplyUSS(GUIStyle style, string ussStyleRuleName, string ussInPlaceStyleOverride = null)
{
return GUIStyleExtensions.ApplyUSS(style, ussStyleRuleName, ussInPlaceStyleOverride);
}
internal static void UpdateSkinCache()
{
UpdateSkinCache(EditorGUIUtility.skinIndex);
}
internal static void UpdateSkinCache(int skinIndex)
{
// Don't cache the Game GUISkin styles
if (GUIUtility.s_SkinMode == 0)
return;
if (s_CachedStyles[skinIndex] == null)
{
EditorResources.RefreshSkin();
s_CachedStyles[skinIndex] = new EditorStyles();
s_CachedStyles[skinIndex].InitSharedStyles();
}
s_Current = s_CachedStyles[skinIndex];
EditorGUIUtility.s_FontIsBold = -1;
EditorGUIUtility.SetBoldDefaultFont(false);
}
private void InitSharedStyles()
{
m_ColorPickerBox = GetStyle("ColorPickerBox");
m_ViewBg = GetStyle("TabWindowBackground");
m_InspectorBig = GetStyle("In BigTitle");
m_MiniLabel = GetStyle("MiniLabel");
m_LargeLabel = GetStyle("LargeLabel");
m_BoldLabel = GetStyle("BoldLabel");
m_MiniBoldLabel = GetStyle("MiniBoldLabel");
m_WordWrappedLabel = GetStyle("WordWrappedLabel");
m_WordWrappedMiniLabel = GetStyle("WordWrappedMiniLabel");
m_WhiteLabel = GetStyle("WhiteLabel");
m_WhiteMiniLabel = GetStyle("WhiteMiniLabel");
m_WhiteLargeLabel = GetStyle("WhiteLargeLabel");
m_WhiteBoldLabel = GetStyle("WhiteBoldLabel");
m_MiniTextField = GetStyle("MiniTextField");
m_RadioButton = GetStyle("Radio");
m_MiniButton = GetStyle("miniButton");
m_MiniButtonLeft = GetStyle("miniButtonLeft");
m_MiniButtonMid = GetStyle("miniButtonMid");
m_MiniButtonRight = GetStyle("miniButtonRight");
m_MiniPullDown = GetStyle("MiniPullDown");
m_Toolbar = GetStyle("toolbar");
m_ContentToolbar = GetStyle("contentToolbar");
m_ToolbarButton = GetStyle("toolbarbutton");
m_ToolbarButtonLeft = GetStyle("toolbarbuttonLeft");
m_ToolbarButtonRight = GetStyle("toolbarbuttonRight");
m_ToolbarPopup = GetStyle("toolbarPopup");
m_ToolbarPopupLeft = GetStyle("toolbarPopupLeft");
m_ToolbarPopupRight = GetStyle("toolbarPopupRight");
m_ToolbarDropDown = GetStyle("toolbarDropDown");
m_ToolbarDropDownLeft = GetStyle("toolbarDropDownLeft");
m_ToolbarDropDownRight = GetStyle("toolbarDropDownRight");
m_ToolbarDropDownToggle = GetStyle("toolbarDropDownToggle");
m_ToolbarDropDownToggleButton = GetStyle("ToolbarDropDownToggleButton");
m_ToolbarDropDownToggleRight = GetStyle("toolbarDropDownToggleRight");
m_ToolbarCreateAddNewDropDown = GetStyle("ToolbarCreateAddNewDropDown");
m_ToolbarTextField = GetStyle("toolbarTextField");
m_ToolbarLabel = GetStyle("ToolbarLabel");
m_ToolbarSearchField = GetStyle("ToolbarSearchTextField");
m_ToolbarSearchFieldPopup = GetStyle("ToolbarSearchTextFieldPopup");
m_ToolbarSearchFieldWithJump = GetStyle("ToolbarSearchTextFieldWithJump");
m_ToolbarSearchFieldWithJumpPopup = GetStyle("ToolbarSearchTextFieldWithJumpPopup");
m_ToolbarSearchFieldJumpButton = GetStyle("ToolbarSearchTextFieldJumpButton");
m_ToolbarSearchFieldCancelButton = GetStyle("ToolbarSearchCancelButton");
m_ToolbarSearchFieldCancelButtonEmpty = GetStyle("ToolbarSearchCancelButtonEmpty");
m_ToolbarSearchFieldCancelButtonWithJump = GetStyle("ToolbarSearchCancelButtonWithJump");
m_ToolbarSearchFieldCancelButtonWithJumpEmpty = GetStyle("ToolbarSearchCancelButtonWithJumpEmpty");
m_ToolbarSearchFieldWithJumpSynced = GetStyle("ToolbarSearchTextFieldWithJumpSynced");
m_ToolbarSearchFieldWithJumpPopupSynced = GetStyle("ToolbarSearchTextFieldWithJumpPopupSynced");
m_SearchField = GetStyle("SearchTextField");
m_SearchFieldCancelButton = GetStyle("SearchCancelButton");
m_SearchFieldCancelButtonEmpty = GetStyle("SearchCancelButtonEmpty");
m_HelpBox = GetStyle("HelpBox");
m_FrameBox = GetStyle("FrameBox");
m_AssetLabel = GetStyle("AssetLabel");
m_AssetLabelPartial = GetStyle("AssetLabel Partial");
m_AssetLabelIcon = GetStyle("AssetLabel Icon");
m_SelectionRect = GetStyle("selectionRect");
m_ToolbarSlider = GetStyle("ToolbarSlider");
m_MinMaxHorizontalSliderThumb = GetStyle("MinMaxHorizontalSliderThumb");
m_DropDownList = GetStyle("DropDownButton");
m_DropDownToggleButton = GetStyle("DropDownToggleButton");
m_MinMaxStateDropdown = GetStyle("IN MinMaxStateDropdown");
m_ProgressBarBack = GetStyle("ProgressBarBack");
m_ProgressBarBar = GetStyle("ProgressBarBar");
m_ProgressBarText = GetStyle("ProgressBarText");
m_FoldoutPreDrop = GetStyle("FoldoutPreDrop");
m_FoldoutHeader = GetStyle("FoldoutHeader");
m_FoldoutHeaderIcon = GetStyle("FoldoutHeaderIcon");
m_OptionsButtonStyle = GetStyle("PaneOptions");
m_InspectorTitlebar = GetStyle("IN Title");
m_InspectorTitlebarFlat = GetStyle("IN Title Flat");
m_InspectorTitlebarText = GetStyle("IN TitleText");
m_ToggleGroup = GetStyle("BoldToggle");
m_Tooltip = GetStyle("Tooltip");
m_NotificationText = GetStyle("NotificationText");
m_NotificationBackground = GetStyle("NotificationBackground");
m_ScrollViewAlt = GetStyle("ScrollViewAlt");
// Former LookLikeControls styles
m_Popup = m_LayerMaskField = GetStyle("MiniPopup");
m_TextField = m_NumberField = GetStyle("TextField");
m_BoldTextField = GetStyle("BoldTextFIeld");
m_Label = GetStyle("ControlLabel");
m_ObjectField = GetStyle("ObjectField");
m_ObjectFieldThumb = GetStyle("ObjectFieldThumb");
m_ObjectFieldButton = GetStyle("ObjectFieldButton");
m_ObjectFieldMiniThumb = GetStyle("ObjectFieldMiniThumb");
m_Toggle = GetStyle("Toggle");
m_ToggleMixed = GetStyle("ToggleMixed");
m_ColorField = GetStyle("ColorField");
m_Foldout = GetStyle("Foldout");
m_TitlebarFoldout = GetStyle("Titlebar Foldout");
m_FoldoutSelected = GUIStyle.none;
m_IconButton = GetStyle("IconButton");
m_TextFieldDropDown = GetStyle("TextFieldDropDown");
m_TextFieldDropDownText = GetStyle("TextFieldDropDownText");
m_OverrideMargin = GetStyle("OverrideMargin");
m_LinkLabel = GetStyle("LinkLabel");
// Match selection color which works nicely for both light and dark skins
m_TextArea = new GUIStyle(m_TextField) {wordWrap = true};
m_InspectorDefaultMargins = new GUIStyle
{
padding = new RectOffset(kInspectorPaddingLeft, kInspectorPaddingRight, kInspectorPaddingTop, 0)
};
// For the full width margins, use padding from right side in both sides,
// though adjust for overdraw by adding one in left side to get even margins.
m_InspectorFullWidthMargins = new GUIStyle
{
padding = new RectOffset(kInspectorPaddingRight + 1, kInspectorPaddingRight, 0, 0)
};
m_DefaultContentMargins = new GUIStyle
{
padding = new RectOffset(4, 4, 4, 4)
};
// Derive centered grey mini label from base minilabel
m_CenteredGreyMiniLabel = new GUIStyle(m_MiniLabel)
{
alignment = TextAnchor.MiddleCenter,
normal = {textColor = Color.grey},
hover = { textColor = Color.grey },
active = { textColor = Color.grey},
focused = { textColor = Color.grey }
};
m_HelpBoxLabel = new GUIStyle(m_HelpBox)
{
name = "HelpBoxLabel"
};
}
internal GUIStyle GetStyle(string styleName)
{
GUIStyle s = GUI.skin.FindStyle(styleName) ?? EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector).FindStyle(styleName);
if (s == null)
{
Debug.LogError("Missing built-in guistyle " + styleName);
s = GUISkin.error;
}
return s;
}
}
}