private void HandleSplitView() { SplitView sp = parent as SplitView; if (Event.current.type == EventType.Repaint && sp) { View view = this; while (sp) { int id = sp.controlID; if (id == GUIUtility.hotControl || GUIUtility.hotControl == 0) { int idx = sp.IndexOfChild(view); if (sp.vertical) { if (idx != 0) { EditorGUIUtility.AddCursorRect(new Rect(0, 0, position.width, SplitView.kGrabDist), MouseCursor.SplitResizeUpDown, id); } else if (idx != sp.children.Length - 1) { EditorGUIUtility.AddCursorRect(new Rect(0, position.height - SplitView.kGrabDist, position.width, SplitView.kGrabDist), MouseCursor.SplitResizeUpDown, id); } } else // horizontal { if (idx != 0) { EditorGUIUtility.AddCursorRect(new Rect(0, 0, SplitView.kGrabDist, position.height), MouseCursor.SplitResizeLeftRight, id); } else if (idx != sp.children.Length - 1) { EditorGUIUtility.AddCursorRect(new Rect(position.width - SplitView.kGrabDist, 0, SplitView.kGrabDist, position.height), MouseCursor.SplitResizeLeftRight, id); } } } view = sp; sp = sp.parent as SplitView; } sp = (SplitView)parent; } if (sp) { Event e = new Event(Event.current); e.mousePosition += new Vector2(position.x, position.y); sp.SplitGUI(e); if (e.type == EventType.Used) { Event.current.Use(); } } }
public void OnGUI() { base.ClearBackground(); EditorGUIUtility.ResetGUIState(); SplitView splitView = base.parent as SplitView; if (Event.current.type == EventType.Repaint && splitView) { View child = this; while (splitView) { int controlID = splitView.controlID; if (controlID == GUIUtility.hotControl || GUIUtility.hotControl == 0) { int num = splitView.IndexOfChild(child); if (splitView.vertical) { if (num != 0) { EditorGUIUtility.AddCursorRect(new Rect(0f, 0f, base.position.width, 5f), MouseCursor.SplitResizeUpDown, controlID); } if (num != splitView.children.Length - 1) { EditorGUIUtility.AddCursorRect(new Rect(0f, base.position.height - 5f, base.position.width, 5f), MouseCursor.SplitResizeUpDown, controlID); } } else { if (num != 0) { EditorGUIUtility.AddCursorRect(new Rect(0f, 0f, 5f, base.position.height), MouseCursor.SplitResizeLeftRight, controlID); } if (num != splitView.children.Length - 1) { EditorGUIUtility.AddCursorRect(new Rect(base.position.width - 5f, 0f, 5f, base.position.height), MouseCursor.SplitResizeLeftRight, controlID); } } } child = splitView; splitView = (splitView.parent as SplitView); } splitView = (base.parent as SplitView); } bool flag = false; if (base.window.mainView.GetType() != typeof(MainWindow)) { flag = true; if (base.windowPosition.y == 0f) { this.background = "dockareaStandalone"; } else { this.background = "dockarea"; } } else { this.background = "dockarea"; } if (splitView) { Event @event = new Event(Event.current); @event.mousePosition += new Vector2(base.position.x, base.position.y); splitView.SplitGUI(@event); if (@event.type == EventType.Used) { Event.current.Use(); } } GUIStyle style = "dockareaoverlay"; Rect position = this.background.margin.Remove(new Rect(0f, 0f, base.position.width, base.position.height)); position.x = (float)this.background.margin.left; position.y = (float)this.background.margin.top; Rect windowPosition = base.windowPosition; float num2 = 2f; if (windowPosition.x == 0f) { position.x -= num2; position.width += num2; } if (windowPosition.xMax == base.window.position.width) { position.width += num2; } if (windowPosition.yMax == base.window.position.height) { position.height += ((!flag) ? 2f : 2f); } GUI.Box(position, GUIContent.none, this.background); if (this.tabStyle == null) { this.tabStyle = "dragtab"; } this.DragTab(new Rect(position.x + 1f, position.y, position.width - 40f, 17f), this.tabStyle); this.tabStyle = "dragtab"; base.ShowGenericMenu(); base.DoWindowDecorationStart(); if (this.m_Panes.Count > 0) { if (this.m_Panes[this.selected] is GameView) { GUI.Box(position, GUIContent.none, style); } DockArea.BeginOffsetArea(new Rect(position.x + 2f, position.y + 17f, position.width - 4f, position.height - 17f - 2f), GUIContent.none, "TabWindowBackground"); Vector2 vector = GUIUtility.GUIToScreenPoint(Vector2.zero); Rect pos = base.borderSize.Remove(base.position); pos.x = vector.x; pos.y = vector.y; this.m_Panes[this.selected].m_Pos = pos; EditorGUIUtility.ResetGUIState(); try { base.Invoke("OnGUI"); } catch (TargetInvocationException ex) { throw ex.InnerException; } EditorGUIUtility.ResetGUIState(); if (base.actualView != null && base.actualView.m_FadeoutTime != 0f && Event.current != null && Event.current.type == EventType.Repaint) { base.actualView.DrawNotification(); } DockArea.EndOffsetArea(); } base.DoWindowDecorationEnd(); GUI.Box(position, GUIContent.none, style); EditorGUI.ShowRepaints(); Highlighter.ControlHighlightGUI(this); }
public void SplitGUI(Event evt) { if (splitState == null) { SetupSplitter(); } SplitView sp = parent as SplitView; if (sp) { Event e = new Event(evt); e.mousePosition += new Vector2(position.x, position.y); sp.SplitGUI(e); if (e.type == EventType.Used) { evt.Use(); } } float pos = vertical ? evt.mousePosition.y : evt.mousePosition.x; int id = GUIUtility.GetControlID(546739, FocusType.Passive); controlID = id; switch (evt.GetTypeForControl(id)) { case EventType.MouseDown: if (children.Length != 1) // is there a splitter { int cursor = vertical ? (int)children[0].position.y : (int)children[0].position.x; for (int i = 0; i < children.Length - 1; i++) { if (i >= splitState.realSizes.Length) { DockArea dock = GUIView.current as DockArea; string name = "Non-dock area " + GUIView.current.GetType(); if (dock && dock.m_Selected < dock.m_Panes.Count && dock.m_Panes[dock.m_Selected]) { name = dock.m_Panes[dock.m_Selected].GetType().ToString(); } if (Unsupported.IsDeveloperMode()) { Debug.LogError("Real sizes out of bounds for: " + name + " index: " + i + " RealSizes: " + splitState.realSizes.Length); } SetupSplitter(); } Rect splitterRect = vertical ? new Rect(children[0].position.x, cursor + splitState.realSizes[i] - splitState.splitSize / 2, children[0].position.width, splitState.splitSize) : new Rect(cursor + splitState.realSizes[i] - splitState.splitSize / 2, children[0].position.y, splitState.splitSize, children[0].position.height); if (splitterRect.Contains(evt.mousePosition)) { splitState.splitterInitialOffset = (int)pos; splitState.currentActiveSplitter = i; GUIUtility.hotControl = id; evt.Use(); break; } cursor += splitState.realSizes[i]; } } break; case EventType.MouseDrag: if (children.Length > 1 && (GUIUtility.hotControl == id) && (splitState.currentActiveSplitter >= 0)) { int diff = (int)pos - splitState.splitterInitialOffset; if (diff != 0) { splitState.splitterInitialOffset = (int)pos; splitState.DoSplitter(splitState.currentActiveSplitter, splitState.currentActiveSplitter + 1, diff); } SetupRectsFromSplitter(); evt.Use(); } break; case EventType.MouseUp: if (GUIUtility.hotControl == id) { GUIUtility.hotControl = 0; } break; } }
public void OnGUI() { this.ClearBackground(); EditorGUIUtility.ResetGUIState(); SplitView parent = this.parent as SplitView; if (Event.current.type == EventType.Repaint && (bool)((UnityEngine.Object)parent)) { View child = (View)this; for (; (bool)((UnityEngine.Object)parent); parent = parent.parent as SplitView) { int controlId = parent.controlID; if (controlId == GUIUtility.hotControl || GUIUtility.hotControl == 0) { int num = parent.IndexOfChild(child); if (parent.vertical) { if (num != 0) { EditorGUIUtility.AddCursorRect(new Rect(0.0f, 0.0f, this.position.width, 5f), MouseCursor.SplitResizeUpDown, controlId); } if (num != parent.children.Length - 1) { EditorGUIUtility.AddCursorRect(new Rect(0.0f, this.position.height - 5f, this.position.width, 5f), MouseCursor.SplitResizeUpDown, controlId); } } else { if (num != 0) { EditorGUIUtility.AddCursorRect(new Rect(0.0f, 0.0f, 5f, this.position.height), MouseCursor.SplitResizeLeftRight, controlId); } if (num != parent.children.Length - 1) { EditorGUIUtility.AddCursorRect(new Rect(this.position.width - 5f, 0.0f, 5f, this.position.height), MouseCursor.SplitResizeLeftRight, controlId); } } } child = (View)parent; } parent = this.parent as SplitView; } bool flag = false; if (this.window.mainView.GetType() != typeof(MainWindow)) { flag = true; if ((double)this.windowPosition.y == 0.0) { this.background = (GUIStyle)"dockareaStandalone"; } else { this.background = (GUIStyle)"dockarea"; } } else { this.background = (GUIStyle)"dockarea"; } if ((bool)((UnityEngine.Object)parent)) { Event evt = new Event(Event.current); evt.mousePosition += new Vector2(this.position.x, this.position.y); parent.SplitGUI(evt); if (evt.type == EventType.Used) { Event.current.Use(); } } GUIStyle style = (GUIStyle)"dockareaoverlay"; Rect position = this.background.margin.Remove(new Rect(0.0f, 0.0f, this.position.width, this.position.height)); position.x = (float)this.background.margin.left; position.y = (float)this.background.margin.top; Rect windowPosition = this.windowPosition; float num1 = 2f; if ((double)windowPosition.x == 0.0) { position.x -= num1; position.width += num1; } if ((double)windowPosition.xMax == (double)this.window.position.width) { position.width += num1; } if ((double)windowPosition.yMax == (double)this.window.position.height) { position.height += !flag ? 2f : 2f; } GUI.Box(position, GUIContent.none, this.background); if (this.tabStyle == null) { this.tabStyle = (GUIStyle)"dragtab"; } this.DragTab(new Rect(position.x + 1f, position.y, position.width - 40f, 17f), this.tabStyle); this.tabStyle = (GUIStyle)"dragtab"; this.ShowGenericMenu(); this.DoWindowDecorationStart(); if (this.m_Panes.Count > 0) { if (this.m_Panes[this.selected] is GameView) { GUI.Box(position, GUIContent.none, style); } DockArea.BeginOffsetArea(new Rect(position.x + 2f, position.y + 17f, position.width - 4f, (float)((double)position.height - 17.0 - 2.0)), GUIContent.none, (GUIStyle)"TabWindowBackground"); Vector2 screenPoint = GUIUtility.GUIToScreenPoint(Vector2.zero); Rect rect = this.borderSize.Remove(this.position); rect.x = screenPoint.x; rect.y = screenPoint.y; this.m_Panes[this.selected].m_Pos = rect; EditorGUIUtility.ResetGUIState(); try { this.Invoke("OnGUI"); } catch (TargetInvocationException ex) { throw ex.InnerException; } EditorGUIUtility.ResetGUIState(); if ((UnityEngine.Object) this.actualView != (UnityEngine.Object)null && (double)this.actualView.m_FadeoutTime != 0.0 && (Event.current != null && Event.current.type == EventType.Repaint)) { this.actualView.DrawNotification(); } DockArea.EndOffsetArea(); } this.DoWindowDecorationEnd(); GUI.Box(position, GUIContent.none, style); EditorGUI.ShowRepaints(); Highlighter.ControlHighlightGUI((GUIView)this); }
public void SplitGUI(Event evt) { if (this.splitState == null) { this.SetupSplitter(); } SplitView parent = this.parent as SplitView; if ((bool)((Object)parent)) { Event evt1 = new Event(evt); evt1.mousePosition += new Vector2(this.position.x, this.position.y); parent.SplitGUI(evt1); if (evt1.type == EventType.Used) { evt.Use(); } } float num1 = !this.vertical ? evt.mousePosition.x : evt.mousePosition.y; int controlId = GUIUtility.GetControlID(546739, FocusType.Passive); this.controlID = controlId; switch (evt.GetTypeForControl(controlId)) { case EventType.MouseDown: if (this.children.Length == 1) { break; } int num2 = !this.vertical ? (int)this.children[0].position.x : (int)this.children[0].position.y; for (int index = 0; index < this.children.Length - 1; ++index) { if (index >= this.splitState.realSizes.Length) { DockArea current = GUIView.current as DockArea; string str = "Non-dock area " + (object)GUIView.current.GetType(); if ((bool)((Object)current) && current.m_Selected < current.m_Panes.Count && (bool)((Object)current.m_Panes[current.m_Selected])) { str = current.m_Panes[current.m_Selected].GetType().ToString(); } if (Unsupported.IsDeveloperBuild()) { Debug.LogError((object)("Real sizes out of bounds for: " + str + " index: " + (object)index + " RealSizes: " + (object)this.splitState.realSizes.Length)); } this.SetupSplitter(); } if ((!this.vertical ? new Rect((float)(num2 + this.splitState.realSizes[index] - this.splitState.splitSize / 2), this.children[0].position.y, (float)this.splitState.splitSize, this.children[0].position.height) : new Rect(this.children[0].position.x, (float)(num2 + this.splitState.realSizes[index] - this.splitState.splitSize / 2), this.children[0].position.width, (float)this.splitState.splitSize)).Contains(evt.mousePosition)) { this.splitState.splitterInitialOffset = (int)num1; this.splitState.currentActiveSplitter = index; GUIUtility.hotControl = controlId; evt.Use(); break; } num2 += this.splitState.realSizes[index]; } break; case EventType.MouseUp: if (GUIUtility.hotControl != controlId) { break; } GUIUtility.hotControl = 0; break; case EventType.MouseDrag: if (this.children.Length <= 1 || GUIUtility.hotControl != controlId || this.splitState.currentActiveSplitter < 0) { break; } int diff = (int)num1 - this.splitState.splitterInitialOffset; if (diff != 0) { this.splitState.splitterInitialOffset = (int)num1; this.splitState.DoSplitter(this.splitState.currentActiveSplitter, this.splitState.currentActiveSplitter + 1, diff); } this.SetupRectsFromSplitter(); evt.Use(); break; } }
public void OldOnGUI() { base.ClearBackground(); EditorGUIUtility.ResetGUIState(); SplitView splitView = base.parent as SplitView; if (Event.current.type == EventType.Repaint && splitView) { View child = this; while (splitView) { int controlID = splitView.controlID; if (controlID == GUIUtility.hotControl || GUIUtility.hotControl == 0) { int num = splitView.IndexOfChild(child); if (splitView.vertical) { if (num != 0) { EditorGUIUtility.AddCursorRect(new Rect(0f, 0f, base.position.width, 5f), MouseCursor.SplitResizeUpDown, controlID); } if (num != splitView.children.Length - 1) { EditorGUIUtility.AddCursorRect(new Rect(0f, base.position.height - 5f, base.position.width, 5f), MouseCursor.SplitResizeUpDown, controlID); } } else { if (num != 0) { EditorGUIUtility.AddCursorRect(new Rect(0f, 0f, 5f, base.position.height), MouseCursor.SplitResizeLeftRight, controlID); } if (num != splitView.children.Length - 1) { EditorGUIUtility.AddCursorRect(new Rect(base.position.width - 5f, 0f, 5f, base.position.height), MouseCursor.SplitResizeLeftRight, controlID); } } } child = splitView; splitView = (splitView.parent as SplitView); } splitView = (base.parent as SplitView); } bool flag = false; if (base.window.rootView.GetType() != typeof(MainView)) { flag = true; if (base.windowPosition.y == 0f) { this.background = "dockareaStandalone"; } else { this.background = "dockarea"; } } else { this.background = "dockarea"; } if (splitView) { Event @event = new Event(Event.current); @event.mousePosition += new Vector2(base.position.x, base.position.y); splitView.SplitGUI(@event); if (@event.type == EventType.Used) { Event.current.Use(); } } Rect rect = this.background.margin.Remove(new Rect(0f, 0f, base.position.width, base.position.height)); rect.x = (float)this.background.margin.left; rect.y = (float)this.background.margin.top; Rect windowPosition = base.windowPosition; float num2 = 2f; if (windowPosition.x == 0f) { rect.x -= num2; rect.width += num2; } if (windowPosition.xMax == base.window.position.width) { rect.width += num2; } if (windowPosition.yMax == base.window.position.height) { rect.height += ((!flag) ? 2f : 2f); } if (Event.current.type == EventType.Repaint) { this.background.Draw(rect, GUIContent.none, 0); } if (this.tabStyle == null) { this.tabStyle = "dragtab"; } if (this.m_Panes.Count > 0) { HostView.BeginOffsetArea(new Rect(rect.x + 2f, rect.y + 17f, rect.width - 4f, rect.height - 17f - 2f), GUIContent.none, "TabWindowBackground"); Vector2 vector = GUIUtility.GUIToScreenPoint(Vector2.zero); Rect pos = base.borderSize.Remove(base.position); pos.x = vector.x; pos.y = vector.y; this.m_Panes[this.selected].m_Pos = pos; HostView.EndOffsetArea(); } this.DragTab(new Rect(rect.x + 1f, rect.y, rect.width - 40f, 17f), this.tabStyle); this.tabStyle = "dragtab"; base.ShowGenericMenu(); if (this.m_Panes.Count > 0) { base.InvokeOnGUI(rect); } EditorGUI.ShowRepaints(); Highlighter.ControlHighlightGUI(this); }
public void SplitGUI(Event evt) { if (this.splitState == null) { this.SetupSplitter(); } SplitView parent = base.parent as SplitView; if (parent != null) { Event event2 = new Event(evt); event2.mousePosition += new Vector2(base.position.x, base.position.y); parent.SplitGUI(event2); if (event2.type == EventType.Used) { evt.Use(); } } float num = !this.vertical ? evt.mousePosition.x : evt.mousePosition.y; int controlID = GUIUtility.GetControlID(0x857b3, FocusType.Passive); this.controlID = controlID; EventType typeForControl = evt.GetTypeForControl(controlID); if (typeForControl == EventType.MouseDown) { if (base.children.Length != 1) { int num3 = !this.vertical ? ((int)base.children[0].position.x) : ((int)base.children[0].position.y); for (int i = 0; i < (base.children.Length - 1); i++) { if (i >= this.splitState.realSizes.Length) { DockArea current = GUIView.current as DockArea; string str = "Non-dock area " + GUIView.current.GetType(); if (((current != null) && (current.m_Selected < current.m_Panes.Count)) && (current.m_Panes[current.m_Selected] != null)) { str = current.m_Panes[current.m_Selected].GetType().ToString(); } if (Unsupported.IsDeveloperBuild()) { Debug.LogError(string.Concat(new object[] { "Real sizes out of bounds for: ", str, " index: ", i, " RealSizes: ", this.splitState.realSizes.Length })); } this.SetupSplitter(); } Rect rect5 = !this.vertical ? new Rect((float)((num3 + this.splitState.realSizes[i]) - (this.splitState.splitSize / 2)), base.children[0].position.y, (float)this.splitState.splitSize, base.children[0].position.height) : new Rect(base.children[0].position.x, (float)((num3 + this.splitState.realSizes[i]) - (this.splitState.splitSize / 2)), base.children[0].position.width, (float)this.splitState.splitSize); if (rect5.Contains(evt.mousePosition)) { this.splitState.splitterInitialOffset = (int)num; this.splitState.currentActiveSplitter = i; GUIUtility.hotControl = controlID; evt.Use(); break; } num3 += this.splitState.realSizes[i]; } } } else if (typeForControl == EventType.MouseDrag) { if (((base.children.Length > 1) && (GUIUtility.hotControl == controlID)) && (this.splitState.currentActiveSplitter >= 0)) { int diff = ((int)num) - this.splitState.splitterInitialOffset; if (diff != 0) { this.splitState.splitterInitialOffset = (int)num; this.splitState.DoSplitter(this.splitState.currentActiveSplitter, this.splitState.currentActiveSplitter + 1, diff); } this.SetupRectsFromSplitter(); evt.Use(); } } else if ((typeForControl == EventType.MouseUp) && (GUIUtility.hotControl == controlID)) { GUIUtility.hotControl = 0; } }
public void SplitGUI(Event evt) { if (this.splitState == null) { this.SetupSplitter(); } SplitView splitView = base.parent as SplitView; if (splitView) { Event @event = new Event(evt); @event.mousePosition += new Vector2(base.position.x, base.position.y); splitView.SplitGUI(@event); if (@event.type == EventType.Used) { evt.Use(); } } float num = (!this.vertical) ? evt.mousePosition.x : evt.mousePosition.y; int num2 = GUIUtility.GetControlID(546739, FocusType.Passive); this.controlID = num2; EventType typeForControl = evt.GetTypeForControl(num2); if (typeForControl != EventType.MouseDown) { if (typeForControl != EventType.MouseDrag) { if (typeForControl == EventType.MouseUp) { if (GUIUtility.hotControl == num2) { GUIUtility.hotControl = 0; } } } else if (base.children.Length > 1 && GUIUtility.hotControl == num2 && this.splitState.currentActiveSplitter >= 0) { int num3 = (int)num - this.splitState.splitterInitialOffset; if (num3 != 0) { this.splitState.splitterInitialOffset = (int)num; this.splitState.DoSplitter(this.splitState.currentActiveSplitter, this.splitState.currentActiveSplitter + 1, num3); } this.SetupRectsFromSplitter(); evt.Use(); } } else if (base.children.Length != 1) { int num4 = (!this.vertical) ? ((int)base.children[0].position.x) : ((int)base.children[0].position.y); for (int i = 0; i < base.children.Length - 1; i++) { if (i >= this.splitState.realSizes.Length) { DockArea dockArea = GUIView.current as DockArea; string text = "Non-dock area " + GUIView.current.GetType(); if (dockArea && dockArea.m_Selected < dockArea.m_Panes.Count && dockArea.m_Panes[dockArea.m_Selected]) { text = dockArea.m_Panes[dockArea.m_Selected].GetType().ToString(); } if (Unsupported.IsDeveloperBuild()) { Debug.LogError(string.Concat(new object[] { "Real sizes out of bounds for: ", text, " index: ", i, " RealSizes: ", this.splitState.realSizes.Length })); } this.SetupSplitter(); } if (((!this.vertical) ? new Rect((float)(num4 + this.splitState.realSizes[i] - this.splitState.splitSize / 2), base.children[0].position.y, (float)this.splitState.splitSize, base.children[0].position.height) : new Rect(base.children[0].position.x, (float)(num4 + this.splitState.realSizes[i] - this.splitState.splitSize / 2), base.children[0].position.width, (float)this.splitState.splitSize)).Contains(evt.mousePosition)) { this.splitState.splitterInitialOffset = (int)num; this.splitState.currentActiveSplitter = i; GUIUtility.hotControl = num2; evt.Use(); break; } num4 += this.splitState.realSizes[i]; } } }
protected override void OldOnGUI() { ClearBackground(); // Call reset GUI state as first thing so GUI.color is correct when drawing window decoration. EditorGUIUtility.ResetGUIState(); // Exit if the window was destroyed after entering play mode or on domain-reload. if (window == null) { return; } // Add CursorRects SplitView sp = parent as SplitView; if (Event.current.type == EventType.Repaint && sp) { View view = this; while (sp) { int id = sp.controlID; if (id == GUIUtility.hotControl || GUIUtility.hotControl == 0) { int idx = sp.IndexOfChild(view); if (sp.vertical) { if (idx != 0) { EditorGUIUtility.AddCursorRect(new Rect(0, 0, position.width, SplitView.kGrabDist), MouseCursor.SplitResizeUpDown, id); } if (idx != sp.children.Length - 1) { EditorGUIUtility.AddCursorRect( new Rect(0, position.height - SplitView.kGrabDist, position.width, SplitView.kGrabDist), MouseCursor.SplitResizeUpDown, id); } } else // horizontal { if (idx != 0) { EditorGUIUtility.AddCursorRect(new Rect(0, 0, SplitView.kGrabDist, position.height), MouseCursor.SplitResizeLeftRight, id); } if (idx != sp.children.Length - 1) { EditorGUIUtility.AddCursorRect( new Rect(position.width - SplitView.kGrabDist, 0, SplitView.kGrabDist, position.height), MouseCursor.SplitResizeLeftRight, id); } } } view = sp; sp = sp.parent as SplitView; } // reset sp = parent as SplitView; } bool customBorder = false; if (window.rootView.GetType() != typeof(MainView)) { customBorder = true; if (windowPosition.y == 0) { background = "dockareaStandalone"; } else { background = "dockarea"; } } else { background = "dockarea"; } if (sp) { Event e = new Event(Event.current); e.mousePosition += new Vector2(position.x, position.y); sp.SplitGUI(e); if (e.type == EventType.Used) { Event.current.Use(); } } Rect r = background.margin.Remove(new Rect(0, 0, position.width, position.height)); r.x = background.margin.left; r.y = background.margin.top; Rect wPos = windowPosition; float sideBorder = kSideBorders; if (wPos.x == 0) { r.x -= sideBorder; r.width += sideBorder; } if (wPos.xMax == window.position.width) { r.width += sideBorder; } if (wPos.yMax == window.position.height) { r.height += customBorder ? 2f : kBottomBorders; } if (Event.current.type == EventType.Repaint) { background.Draw(r, GUIContent.none, 0); } if (tabStyle == null) { tabStyle = "dragtab"; } if (m_Panes.Count > 0) { // Set up the pane's position, so its GUI can use this // Contents: // scroll it by -1, -1 so we top & left 1px gets culled (they are drawn already by the us, so we want to // not have them here (thing that the default skin relies on) BeginOffsetArea(new Rect(r.x + 2, r.y + kTabHeight, r.width - 4, r.height - kTabHeight - 2), GUIContent.none, "TabWindowBackground"); Vector2 basePos = GUIUtility.GUIToScreenPoint(Vector2.zero); Rect p = borderSize.Remove(position); p.x = basePos.x; p.y = basePos.y; if (selected >= 0 && selected < m_Panes.Count) { m_Panes[selected].m_Pos = p; } EndOffsetArea(); } DragTab(new Rect(r.x + 1, r.y, r.width - kWindowButtonsWidth, kTabHeight), tabStyle); // TODO: Make this nice - right now this is meant to be overridden by Panes in Layout if they want something else. Inspector does this tabStyle = "dragtab"; ShowGenericMenu(); if (m_Panes.Count > 0) { InvokeOnGUI(r); } EditorGUI.ShowRepaints(); Highlighter.ControlHighlightGUI(this); }