internal void OnGUI() { if (Event.current.type == EventType.KeyDown) { if (Event.current.keyCode == KeyCode.Escape) { Event.current.Use(); Close(); m_ElementSelectedHandler(-1); } else if (Event.current.keyCode == KeyCode.DownArrow && GUI.GetNameOfFocusedControl() == k_SearchField) { m_ListView.SetFocusAndEnsureSelectedItem(); Event.current.Use(); } else if (Event.current.keyCode == KeyCode.UpArrow && m_ListView.HasFocus() && m_ListView.IsFirstItemSelected()) { EditorGUI.FocusTextInControl(k_SearchField); Event.current.Use(); } } if (m_Config.showSearchField) { EditorGUI.BeginChangeCheck(); if (m_Config.drawSearchField != null) { m_SearchValue = m_Config.drawSearchField(k_SearchField, m_SearchValue); } else { GUI.SetNextControlName(k_SearchField); m_SearchValue = SearchField(m_SearchValue); } if (EditorGUI.EndChangeCheck()) { m_ListView.searchString = m_SearchValue; } if (m_NeedFocus) { m_NeedFocus = false; GUI.FocusControl(k_SearchField); } } else if (m_NeedFocus) { m_NeedFocus = false; m_ListView.SetFocusAndEnsureSelectedItem(); } var rect = EditorGUILayout.GetControlRect(false, GUILayout.ExpandHeight(true)); m_ListView.OnGUI(rect); }
internal void OnGUI() { if (Event.current.type == EventType.KeyDown) { if (Event.current.keyCode == KeyCode.Escape) { Event.current.Use(); Close(); m_ElementSelectedHandler(-1); } } var rect = EditorGUILayout.GetControlRect(false, GUILayout.ExpandHeight(true)); m_ListView.OnGUI(rect); if (m_NeedFocus && Event.current.type == EventType.Repaint) { m_NeedFocus = false; m_ListView.SetFocusAndEnsureSelectedItem(); } }