void OnGUI() { Rect rect = new Rect(0, 0, position.width, position.height); int keyboardControl = GUIUtility.GetControlID(FocusType.Keyboard, rect); // Header Rect headerRect = new Rect(0, 0, position.width, kHeaderHeight); GUI.Label(headerRect, string.Empty, Styles.styles.headerStyle); GUI.Label(new Rect(10, 2, position.width, kHeaderHeight), Styles.styles.nodesLabel); Rect bottomRect = new Rect(rect.x, rect.yMax - kBottomHeight, rect.width, kBottomHeight); // Footer GUILayout.BeginArea(bottomRect); GUILayout.BeginHorizontal(Styles.styles.footerStyle); GUILayout.FlexibleSpace(); bool closeWindow = false; if (isModal) { if (GUILayout.Button(Styles.styles.okButton)) { closeWindow = true; } } else { if (GUILayout.Button(Styles.styles.cancelButton)) { closeWindow = true; } else if (GUILayout.Button(Styles.styles.okButton)) { closeWindow = true; if (m_ModelEditor.IsAlive) { SketchUpImporterModelEditor modelEditor = m_ModelEditor.Target as SketchUpImporterModelEditor; modelEditor.SetSelectedNodes(m_DataSource.FetchEnableNodes()); } } } GUILayout.Space(10); GUILayout.EndHorizontal(); GUILayout.EndArea(); // TreeView rect.y = kHeaderHeight; rect.height -= headerRect.height + bottomRect.height; m_TreeView.OnEvent(); m_TreeView.OnGUI(rect, keyboardControl); HandleKeyboardEvents(); if (closeWindow) { Close(); } }
private void OnGUI() { Rect rect = new Rect(0f, 0f, base.position.width, base.position.height); int controlID = GUIUtility.GetControlID(FocusType.Keyboard, rect); Rect position = new Rect(0f, 0f, base.position.width, 25f); GUI.Label(position, string.Empty, SketchUpImportDlg.Styles.styles.headerStyle); GUI.Label(new Rect(10f, 2f, base.position.width, 25f), SketchUpImportDlg.Styles.styles.nodesLabel); Rect screenRect = new Rect(rect.x, rect.yMax - 30f, rect.width, 30f); GUILayout.BeginArea(screenRect); GUILayout.Box(string.Empty, SketchUpImportDlg.Styles.styles.boxBackground, new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(1f) }); GUILayout.Space(2f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); bool flag = false; if (this.isModal) { if (GUILayout.Button(SketchUpImportDlg.Styles.styles.okButton, new GUILayoutOption[0])) { flag = true; } } else if (GUILayout.Button(SketchUpImportDlg.Styles.styles.cancelButton, new GUILayoutOption[0])) { flag = true; } else if (GUILayout.Button(SketchUpImportDlg.Styles.styles.okButton, new GUILayoutOption[0])) { flag = true; if (this.m_ModelEditor.IsAlive) { SketchUpImporterModelEditor sketchUpImporterModelEditor = this.m_ModelEditor.Target as SketchUpImporterModelEditor; sketchUpImporterModelEditor.SetSelectedNodes(this.m_DataSource.FetchEnableNodes()); } } GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.EndArea(); rect.y = 18f; rect.height -= position.height + screenRect.height - 7f; this.m_TreeView.OnEvent(); this.m_TreeView.OnGUI(rect, controlID); this.HandleKeyboardEvents(); if (flag) { base.Close(); } }