UnityEditor.ExposablePopupMenu.OnGUI C# (CSharp) Method

OnGUI() public method

public OnGUI ( Rect rect ) : float
rect UnityEngine.Rect
return float
        public float OnGUI(Rect rect)
        {
            if ((rect.width >= this.m_WidthOfButtons) && (rect.width > this.m_MinWidthOfPopup))
            {
                Rect position = rect;
                foreach (ItemData data in this.m_Items)
                {
                    position.width = data.m_Width;
                    EditorGUI.BeginChangeCheck();
                    using (new EditorGUI.DisabledScope(!data.m_Enabled))
                    {
                        GUI.Toggle(position, data.m_On, data.m_GUIContent, data.m_Style);
                    }
                    if (EditorGUI.EndChangeCheck())
                    {
                        this.SelectionChanged(data);
                        GUIUtility.ExitGUI();
                    }
                    position.x += data.m_Width + this.m_ItemSpacing;
                }
                return this.m_WidthOfButtons;
            }
            if (this.m_WidthOfPopup < rect.width)
            {
                rect.width = this.m_WidthOfPopup;
            }
            if (EditorGUI.ButtonMouseDown(rect, this.m_PopupButtonData.m_GUIContent, FocusType.Passive, this.m_PopupButtonData.m_Style))
            {
                PopUpMenu.Show(rect, this.m_Items, this);
            }
            return this.m_WidthOfPopup;
        }