Beispiel #1
0
        private float CalcPopupWidth(string[] options, GUIStyle style)
        {
            float width = 0;

            for (int i = 0; i < options.Length; ++i)
            {
                width = Mathf.Max(width, SharedStyles.MeasureWidth(style, options[i]));
            }

            return(width);
        }
Beispiel #2
0
        public override void OnGUI()
        {
            if (m_title != null)
            {
                EditorGUILayout.BeginHorizontal();
                {
                    GUIStyle style = EditorStyles.miniLabel;

                    if (m_titleWith == 0)
                    {
                        m_titleWith = SharedStyles.MeasureWidth(style, m_title);
                    }

                    GUILayout.Label(m_title, style, GUILayout.Width(m_titleWith));
                    DrawPopup();
                }
                EditorGUILayout.EndHorizontal();
            }
            else
            {
                DrawPopup();
            }
        }
Beispiel #3
0
 public ToolBarCheckbox(string title, ToggleButtonDelegate buttonDelegate)
     : base(title, buttonDelegate)
 {
     Width = SharedStyles.MeasureWidth(GUI.skin.toggle, title);
 }
Beispiel #4
0
 public ToolBarToggle(string title, ToggleButtonDelegate buttonDelegate)
     : base(title, buttonDelegate)
 {
     Width = SharedStyles.MeasureWidth(SharedStyles.toolbarButton, title);
 }