static public void Toggle(ValueWrapper <bool> firstBoolProperty, ValueWrapper <bool> secondBoolProperty, string toggleFirst = "First", string toggleSecond = "Second", string toggleFalse = "OFF") { using (new GUIHorizontal()) { GUIContent buttonText = new GUIContent(toggleFirst); Rect headerRect = GUILayoutUtility.GetRect(buttonText, UITools.LeftToggleButton); if (GUI.Toggle(headerRect, firstBoolProperty, buttonText, UITools.LeftToggleButton)) { firstBoolProperty.Value = true; secondBoolProperty.Value = false; } buttonText = new GUIContent(toggleSecond); headerRect = GUILayoutUtility.GetRect(buttonText, UITools.MiddleToggleButton); if (GUI.Toggle(headerRect, secondBoolProperty, buttonText, UITools.MiddleToggleButton)) { firstBoolProperty.Value = false; secondBoolProperty.Value = true; } buttonText = new GUIContent(toggleFalse); headerRect = GUILayoutUtility.GetRect(buttonText, UITools.RightToggleButton); if (GUI.Toggle(headerRect, !firstBoolProperty && !secondBoolProperty, buttonText, UITools.RightToggleButton)) { firstBoolProperty.Value = false; secondBoolProperty.Value = false; } } }
static public void ToggleHeader(ValueWrapper <bool> firstBoolProperty, ValueWrapper <bool> secondBoolProperty, GUIContent headerText, string toggleFirst = "First", string toggleSecond = "Second", string toggleFalse = "OFF") { using (new GUIHorizontal()) { UITools.Header(headerText); UITools.Toggle(firstBoolProperty, secondBoolProperty, toggleFirst, toggleSecond, toggleFalse); } }
static public void ToggleWithLabel(ValueWrapper <bool> boolProperty, GUIContent label, string toggleTrue = "ON", string toggleFalse = "OFF") { using (new GUIHorizontal()) { EditorGUILayout.LabelField(label); UITools.Toggle(boolProperty, toggleTrue, toggleFalse); } }
static public void ToggleHeader(ValueWrapper <bool> boolProperty, GUIContent headerText, string toggleTrue = "ON", string toggleFalse = "OFF") { using (new GUIHorizontal()) { UITools.Header(headerText); UITools.Toggle(boolProperty, toggleTrue, toggleFalse); } }
static public void Toggle(ValueWrapper <bool> boolProperty, string toggleTrue = "ON", string toggleFalse = "OFF") { using (new GUIHorizontal()) { GUIContent buttonText = new GUIContent(toggleTrue); Rect headerRect = GUILayoutUtility.GetRect(buttonText, UITools.LeftToggleButton); if (GUI.Toggle(headerRect, boolProperty, buttonText, UITools.LeftToggleButton)) { boolProperty.Value = true; } buttonText = new GUIContent(toggleFalse); headerRect = GUILayoutUtility.GetRect(buttonText, UITools.RightToggleButton); if (GUI.Toggle(headerRect, !boolProperty, buttonText, UITools.RightToggleButton)) { boolProperty.Value = false; } } }