UnityEditor.IconSelector.DoButton C# (CSharp) Method

DoButton() private method

private DoButton ( GUIContent content, Texture2D selectedIcon, bool labelIcon ) : void
content UnityEngine.GUIContent
selectedIcon UnityEngine.Texture2D
labelIcon bool
return void
        private void DoButton(GUIContent content, Texture2D selectedIcon, bool labelIcon)
        {
            int controlID = GUIUtility.GetControlID(s_HashIconSelector, FocusType.Keyboard);
            if (content.image == selectedIcon)
            {
                Rect position = GUILayoutUtility.topLevel.PeekNext();
                float num2 = 2f;
                position.x -= num2;
                position.y -= num2;
                position.width = selectedIcon.width + (2f * num2);
                position.height = selectedIcon.height + (2f * num2);
                GUI.Label(position, GUIContent.none, !labelIcon ? m_Styles.selection : m_Styles.selectionLabel);
            }
            if (EditorGUILayout.IconButton(controlID, content, GUIStyle.none, new GUILayoutOption[0]))
            {
                Texture2D icon = this.ConvertSmallIconToLargeIcon((Texture2D) content.image, labelIcon);
                EditorGUIUtility.SetIconForObject(this.m_TargetObject, icon);
                EditorUtility.ForceReloadInspectors();
                AnnotationWindow.IconChanged();
                if (Event.current.clickCount == 2)
                {
                    this.CloseWindow();
                }
            }
        }