A game about forced loneliness, made by TACStudios
1using UnityEditor;
2using UnityEngine;
3
4namespace Unity.PlasticSCM.Editor.UI
5{
6 internal static class DrawActionButton
7 {
8 internal static GUIStyle ButtonStyle { get { return mButtonStyle; } }
9
10 internal static bool For(string buttonText)
11 {
12 GUIContent buttonContent = new GUIContent(buttonText);
13
14 return ForRegularButton(buttonContent);
15 }
16
17 internal static bool For(string buttonText, string buttonTooltip)
18 {
19 GUIContent buttonContent = new GUIContent(buttonText, buttonTooltip);
20
21 return ForRegularButton(buttonContent);
22 }
23
24 internal static bool ForCommentSection(string buttonText, float width)
25 {
26 GUIContent buttonContent = new GUIContent(buttonText);
27
28 Rect rt = GUILayoutUtility.GetRect(
29 buttonContent,
30 mButtonStyle,
31 GUILayout.MinWidth(width),
32 GUILayout.MaxWidth(width));
33
34 return GUI.Button(rt, buttonContent, mButtonStyle);
35 }
36
37 static bool ForRegularButton(GUIContent buttonContent)
38 {
39 Rect rt = GUILayoutUtility.GetRect(
40 buttonContent,
41 mButtonStyle,
42 GUILayout.MinWidth(UnityConstants.REGULAR_BUTTON_WIDTH));
43
44 return GUI.Button(rt, buttonContent, mButtonStyle);
45 }
46
47 static readonly GUIStyle mButtonStyle =
48 new GUIStyle(EditorStyles.miniButton)
49 {
50 stretchWidth = false
51 };
52 }
53}