internal void ProcessEvent(EventBase evt) { if (evt.imguiEvent != null && SendEventToIMGUI(evt) || // Prevent navigation events since IMGUI already uses KeyDown events evt.eventTypeId == NavigationMoveEvent.TypeId() || evt.eventTypeId == NavigationSubmitEvent.TypeId() || evt.eventTypeId == NavigationCancelEvent.TypeId()) { evt.StopPropagation(); evt.PreventDefault(); } }
void OnMouseUpDownEvent(IMouseEvent evt) { if (CanStartManipulation(evt)) { if (target.elementPanel != null && target.elementPanel.contextualMenuManager != null) { EventBase e = evt as EventBase; target.elementPanel.contextualMenuManager.DisplayMenu(e, target); e.StopPropagation(); e.PreventDefault(); } } }
private void ProcessEvent(EventBase evt) { if (evt.imguiEvent == null) { return; } if (SendEventToIMGUI(evt)) { evt.StopPropagation(); evt.PreventDefault(); } }
protected override void ExecuteDefaultActionAtTarget(EventBase evt) { base.ExecuteDefaultActionAtTarget(evt); if (evt.imguiEvent == null) { return; } if (SendEventToIMGUI(evt)) { evt.StopPropagation(); evt.PreventDefault(); } }
private void OnMouseUpDownEvent(IMouseEvent evt) { bool flag = base.CanStartManipulation(evt); if (flag) { bool flag2 = base.target.elementPanel != null && base.target.elementPanel.contextualMenuManager != null; if (flag2) { EventBase eventBase = evt as EventBase; base.target.elementPanel.contextualMenuManager.DisplayMenu(eventBase, base.target); eventBase.StopPropagation(); eventBase.PreventDefault(); } } }
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; } } } } }
protected override void ProcessMoveEvent(EventBase evt, Vector2 localPosition) { // Let base class Clickable handle the mouse event first // (although nothing much happens in the base class on pointer drag) base.ProcessMoveEvent(evt, localPosition); // Take control if we can if (dragDirection == DragDirection.None) { dragDirection = DragDirection.Free; } // If and when we have control, set value from drag element if (dragDirection == DragDirection.Free) { if (evt.eventTypeId == PointerMoveEvent.TypeId()) { evt.PreventDefault(); } dragging?.Invoke(); } }
protected override void ExecuteDefaultActionAtTarget(EventBase evt) { base.ExecuteDefaultActionAtTarget(evt); bool flag = evt == null; if (!flag) { bool flag2 = evt.eventTypeId == EventBase <KeyDownEvent> .TypeId(); if (flag2) { KeyDownEvent keyDownEvent = evt as KeyDownEvent; bool flag3 = !this.parentTextField.isDelayed || (!this.multiline && ((keyDownEvent != null && keyDownEvent.keyCode == KeyCode.KeypadEnter) || (keyDownEvent != null && keyDownEvent.keyCode == KeyCode.Return))); if (flag3) { this.parentTextField.value = base.text; } bool multiline = this.multiline; if (multiline) { char?c = (keyDownEvent != null) ? new char?(keyDownEvent.character) : null; int? num = c.HasValue ? new int?((int)c.GetValueOrDefault()) : null; int num2 = 9; bool flag4 = (num.GetValueOrDefault() == num2 & num.HasValue) && keyDownEvent.modifiers == EventModifiers.None; if (flag4) { if (keyDownEvent != null) { keyDownEvent.StopPropagation(); } if (keyDownEvent != null) { keyDownEvent.PreventDefault(); } } else { c = ((keyDownEvent != null) ? new char?(keyDownEvent.character) : null); num = (c.HasValue ? new int?((int)c.GetValueOrDefault()) : null); num2 = 3; bool arg_1EE_0; if (!(num.GetValueOrDefault() == num2 & num.HasValue) || keyDownEvent == null || !keyDownEvent.shiftKey) { c = ((keyDownEvent != null) ? new char?(keyDownEvent.character) : null); num = (c.HasValue ? new int?((int)c.GetValueOrDefault()) : null); num2 = 10; arg_1EE_0 = ((num.GetValueOrDefault() == num2 & num.HasValue) && keyDownEvent != null && keyDownEvent.shiftKey); } else { arg_1EE_0 = true; } bool flag5 = arg_1EE_0; if (flag5) { base.parent.Focus(); } } } else { char?c = (keyDownEvent != null) ? new char?(keyDownEvent.character) : null; int? num = c.HasValue ? new int?((int)c.GetValueOrDefault()) : null; int num2 = 3; bool arg_2B8_0; if (!(num.GetValueOrDefault() == num2 & num.HasValue)) { c = ((keyDownEvent != null) ? new char?(keyDownEvent.character) : null); num = (c.HasValue ? new int?((int)c.GetValueOrDefault()) : null); num2 = 10; arg_2B8_0 = (num.GetValueOrDefault() == num2 & num.HasValue); } else { arg_2B8_0 = true; } bool flag6 = arg_2B8_0; if (flag6) { base.parent.Focus(); } } } else { bool flag7 = evt.eventTypeId == EventBase <ExecuteCommandEvent> .TypeId(); if (flag7) { ExecuteCommandEvent executeCommandEvent = evt as ExecuteCommandEvent; string commandName = executeCommandEvent.commandName; bool flag8 = !this.parentTextField.isDelayed && (commandName == "Paste" || commandName == "Cut"); if (flag8) { this.parentTextField.value = base.text; } } else { NavigationDirection navigationDirection; bool flag9 = base.eventInterpreter.IsActivationEvent(evt) || base.eventInterpreter.IsCancellationEvent(evt) || (base.eventInterpreter.IsNavigationEvent(evt, out navigationDirection) && navigationDirection != NavigationDirection.Previous && navigationDirection != NavigationDirection.Next); if (flag9) { evt.StopPropagation(); evt.PreventDefault(); } } } } }