public void OnGUI() { using (gui.Horizontal(EditorStyles.toolbar)) { for (int i = 0; i < tabs.Length; i++) { var tab = tabs[i]; using (gui.ColorBlock(tab == currentTab ? TabColor : (Color?)null)) { if (gui.Button(tab.title, EditorStyles.toolbarButton)) { currentTab = tab; currentTab.Refresh(); lastTabIndex = i; } } } gui.FlexibleSpace(); } gui.Space(3f); //GUI.SetNextControlName("SearchBox"); search = gui.ToolbarSearch(search); //if (Event.current != null && Event.current.isKey && Event.current.keyCode == KeyCode.Tab) //{ // Debug.Log(GUI.GetNameOfFocusedControl()); // GUI.FocusControl("SearchBox"); // Debug.Log(GUI.GetNameOfFocusedControl()); //} gui.Splitter(); using (gui.ScrollView.Begin(ref scroll, BackgroundStyle)) currentTab.OnGUI(search, maxSize.x - minSize.x); }
private void Initialize(Tab[] tabs, Action onClose) { // TODO: Use RabbitGUI when we implement BeginScrollView gui = new TurtleGUI(); this.onClose = onClose; this.tabs = tabs; for (int i = 0; i < tabs.Length; i++) { var t = tabs[i]; t.gui = gui; t.selectionStyle = GUIHelper.SelectionRect; } currentTab = lastTabIndex >= tabs.Length ? tabs[0] : tabs[lastTabIndex]; search = string.Empty; }