internal static void EndContainerGUI(Event evt, Rect layoutSize) { bool flag = Event.current.type == EventType.Layout && UIElementsUtility.s_ContainerStack.Count > 0; if (flag) { GUILayoutUtility.LayoutFromContainer(layoutSize.width, layoutSize.height); } GUILayoutUtility.SelectIDList(GUIUtility.s_OriginalID, false); GUIContent.ClearStaticCache(); bool flag2 = UIElementsUtility.s_ContainerStack.Count > 0; if (flag2) { IMGUIContainer obj = UIElementsUtility.s_ContainerStack.Peek(); bool flag3 = UIElementsUtility.s_EndContainerCallback != null; if (flag3) { UIElementsUtility.s_EndContainerCallback(obj); } } evt.CopyFrom(Event.current); bool flag4 = UIElementsUtility.s_ContainerStack.Count > 0; if (flag4) { GUIUtility.EndContainer(); UIElementsUtility.s_ContainerStack.Pop(); } }
// End the 2D GUI. internal static void EndContainerGUI(Event evt, Rect layoutSize) { if (Event.current.type == EventType.Layout && s_ContainerStack.Count > 0) { GUILayoutUtility.LayoutFromContainer(layoutSize.width, layoutSize.height); } // restore cache GUILayoutUtility.SelectIDList(GUIUtility.s_OriginalID, false); GUIContent.ClearStaticCache(); if (s_ContainerStack.Count > 0) { IMGUIContainer container = s_ContainerStack.Peek(); if (s_EndContainerCallback != null) { s_EndContainerCallback(container); } } evt.CopyFrom(Event.current); if (s_ContainerStack.Count > 0) { GUIUtility.EndContainer(); s_ContainerStack.Pop(); } }
private static bool SendEventToIMGUIContainer(EventBase evt, BaseVisualElementPanel panel) { bool flag = evt.imguiEvent == null; bool result; if (flag) { result = false; } else { IMGUIContainer rootIMGUIContainer = panel.rootIMGUIContainer; bool flag2 = rootIMGUIContainer == null; if (flag2) { result = false; } else { bool flag3 = evt.propagateToIMGUI || evt.eventTypeId == EventBase <MouseEnterWindowEvent> .TypeId() || evt.eventTypeId == EventBase <MouseLeaveWindowEvent> .TypeId(); if (flag3) { evt.skipElements.Add(evt.target); EventDispatchUtilities.PropagateToIMGUIContainer(panel.visualTree, evt); } result = MouseEventDispatchingStrategy.IsDone(evt); } } return(result); }
private static void GetCurrentTransformAndClip(IMGUIContainer container, Event evt, out Matrix4x4 transform, out Rect clipRect) { clipRect = container.GetCurrentClipRect(); transform = container.worldTransform; bool flag = evt.rawType == EventType.Repaint && container.elementPanel != null; if (flag) { transform = container.elementPanel.repaintData.currentOffset * container.worldTransform; } }
private static void GetCurrentTransformAndClip(IMGUIContainer container, Event evt, out Matrix4x4 transform, out Rect clipRect) { clipRect = container.GetCurrentClipRect(); transform = container.worldTransform; if (evt?.rawType == EventType.Repaint && container.elementPanel != null) { // during repaint, we must use in case the current transform is not relative to Panel // this is to account for the pixel caching feature transform = container.elementPanel.repaintData.currentOffset * container.worldTransform; } }
public void DispatchEvent(EventBase evt, IPanel panel) { bool flag = panel != null; if (flag) { Focusable leafFocusedElement = panel.focusController.GetLeafFocusedElement(); bool flag2 = leafFocusedElement != null; if (flag2) { bool isIMGUIContainer = leafFocusedElement.isIMGUIContainer; if (isIMGUIContainer) { IMGUIContainer iMGUIContainer = (IMGUIContainer)leafFocusedElement; bool flag3 = !evt.Skip(iMGUIContainer) && iMGUIContainer.SendEventToIMGUI(evt, true, true); if (flag3) { evt.StopPropagation(); evt.PreventDefault(); } bool flag4 = !evt.isPropagationStopped && evt.propagateToIMGUI; if (flag4) { evt.skipElements.Add(iMGUIContainer); EventDispatchUtilities.PropagateToIMGUIContainer(panel.visualTree, evt); } } else { evt.target = panel.focusController.GetLeafFocusedElement(); EventDispatchUtilities.PropagateEvent(evt); bool flag5 = !evt.isPropagationStopped && evt.propagateToIMGUI; if (flag5) { EventDispatchUtilities.PropagateToIMGUIContainer(panel.visualTree, evt); } } } else { EventDispatchUtilities.PropagateToIMGUIContainer(panel.visualTree, evt); } } evt.propagateToIMGUI = false; evt.stopDispatch = true; }
internal static void PropagateToIMGUIContainer(VisualElement root, EventBase evt) { bool flag = evt.imguiEvent == null || root.elementPanel.contextType == ContextType.Player; if (!flag) { bool isIMGUIContainer = root.isIMGUIContainer; if (isIMGUIContainer) { IMGUIContainer iMGUIContainer = root as IMGUIContainer; bool flag2 = evt.Skip(iMGUIContainer); if (flag2) { return; } Focusable expr_54 = evt.target as Focusable; bool flag3 = expr_54 != null && expr_54.focusable; bool flag4 = iMGUIContainer.SendEventToIMGUI(evt, !flag3, true); if (flag4) { evt.StopPropagation(); evt.PreventDefault(); } bool flag5 = evt.imguiEvent.rawType == EventType.Used; if (flag5) { Debug.Assert(evt.isPropagationStopped); } } bool flag6 = root.imguiContainerDescendantCount > 0; if (flag6) { int childCount = root.hierarchy.childCount; for (int i = 0; i < childCount; i++) { EventDispatchUtilities.PropagateToIMGUIContainer(root.hierarchy[i], evt); bool isPropagationStopped = evt.isPropagationStopped; if (isPropagationStopped) { break; } } } } }
private static void GetCurrentTransformAndClip(IMGUIContainer container, Event evt, out Matrix4x4 transform, out Rect clipRect) { clipRect = container.lastWorldClip; if (clipRect.width == 0.0f || clipRect.height == 0.0f) { // lastWorldClip will be empty until the first repaint occurred, // we fall back on the worldBound in this case. clipRect = container.worldBound; } transform = container.worldTransform; if (evt.type == EventType.Repaint && container.elementPanel != null) { // during repaint, we must use in case the current transform is not relative to Panel // this is to account for the pixel caching feature transform = container.elementPanel.repaintData.currentOffset * container.worldTransform; } }
bool IUIElementsUtility.TakeCapture() { bool flag = UIElementsUtility.s_ContainerStack.Count > 0; bool result; if (flag) { IMGUIContainer iMGUIContainer = UIElementsUtility.s_ContainerStack.Peek(); IEventHandler capturingElement = iMGUIContainer.panel.GetCapturingElement(PointerId.mousePointerId); bool flag2 = capturingElement != null && capturingElement != iMGUIContainer; if (flag2) { Debug.Log("Should not grab hot control with an active capture"); } iMGUIContainer.CaptureMouse(); result = true; } else { result = false; } return(result); }
internal static void BeginContainerGUI(GUILayoutUtility.LayoutCache cache, Event evt, IMGUIContainer container) { if (container.useOwnerObjectGUIState) { GUIUtility.BeginContainerFromOwner(container.elementPanel.ownerObject); } else { GUIUtility.BeginContainer(container.guiState); } s_ContainerStack.Push(container); GUIUtility.s_SkinMode = (int)container.contextType; GUIUtility.s_OriginalID = container.elementPanel.ownerObject.GetInstanceID(); if (Event.current == null) { Event.current = evt; } else { Event.current.CopyFrom(evt); } // call AFTER setting current event if (s_BeginContainerCallback != null) { s_BeginContainerCallback(container); } GUI.enabled = container.enabledInHierarchy; GUILayoutUtility.BeginContainer(cache); GUIUtility.ResetGlobalState(); }
internal static void BeginContainerGUI(GUILayoutUtility.LayoutCache cache, Event evt, IMGUIContainer container) { bool useOwnerObjectGUIState = container.useOwnerObjectGUIState; if (useOwnerObjectGUIState) { GUIUtility.BeginContainerFromOwner(container.elementPanel.ownerObject); } else { GUIUtility.BeginContainer(container.guiState); } UIElementsUtility.s_ContainerStack.Push(container); GUIUtility.s_SkinMode = (int)container.contextType; GUIUtility.s_OriginalID = container.elementPanel.ownerObject.GetInstanceID(); bool flag = Event.current == null; if (flag) { Event.current = evt; } else { Event.current.CopyFrom(evt); } bool flag2 = UIElementsUtility.s_BeginContainerCallback != null; if (flag2) { UIElementsUtility.s_BeginContainerCallback(container); } GUI.enabled = container.enabledInHierarchy; GUILayoutUtility.BeginContainer(cache); GUIUtility.ResetGlobalState(); }
internal bool HandleIMGUIEvent(Event e, Action onGUIHandler, bool canAffectFocus) { IMGUIContainer.GetCurrentTransformAndClip(this, e, out this.m_CachedTransform, out this.m_CachedClippingRect); return(this.HandleIMGUIEvent(e, this.m_CachedTransform, this.m_CachedClippingRect, onGUIHandler, canAffectFocus)); }