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

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

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

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

                    GUILayout.Label(m_title, style, GUILayout.Width(m_titleWith));
                    DrawPopup();
                }
                EditorGUILayout.EndHorizontal();
            }
            else
            {
                DrawPopup();
            }
        }
Exemple #3
0
 public float CalcHeight(string text, float width)
 {
     return(CSharedStyles.MeasureHeight(m_style, text, width));
 }
Exemple #4
0
 public Vector2 CalcSize(string text)
 {
     return(CSharedStyles.MeasureText(m_style, text));
 }
Exemple #5
0
 public CToolBarCheckbox(string title, CToggleButtonDelegate buttonDelegate)
     : base(title, buttonDelegate)
 {
     Width = CSharedStyles.MeasureWidth(GUI.skin.toggle, title);
 }
Exemple #6
0
 public CToolBarToggle(string title, CToggleButtonDelegate buttonDelegate)
     : base(title, buttonDelegate)
 {
     Width = CSharedStyles.MeasureWidth(CSharedStyles.toolbarButton, title);
 }