public void DispatchEvent(EventBase evt, IPanel panel)
        {
            if (panel != null)
            {
                IMGUIContainer imguiContainer = panel.focusController.GetLeafFocusedElement() as IMGUIContainer;

                if (imguiContainer != null)
                {
                    if (!evt.Skip(imguiContainer) && imguiContainer.SendEventToIMGUI(evt))
                    {
                        evt.StopPropagation();
                        evt.PreventDefault();
                    }

                    if (!evt.isPropagationStopped && evt.propagateToIMGUI)
                    {
                        evt.skipElements.Add(imguiContainer);
                        EventDispatchUtilities.PropagateToIMGUIContainer(panel.visualTree, evt);
                    }
                }
                else if (panel.focusController.GetLeafFocusedElement() != null)
                {
                    evt.target = panel.focusController.GetLeafFocusedElement();
                    EventDispatchUtilities.PropagateEvent(evt);
                }
                else
                {
                    EventDispatchUtilities.PropagateToIMGUIContainer(panel.visualTree, evt);
                }
            }

            evt.propagateToIMGUI = false;
            evt.stopDispatch     = true;
        }
        public void DispatchEvent(EventBase evt, IPanel panel)
        {
            if (panel != null)
            {
                // Note that here we always overwrite evt.target, even if it's already set. This might be required by
                // some pre-existing editor content, but it's not standard among the dispatching strategies and should
                // probably be changed in the future.

                var leafFocusElement = panel.focusController.GetLeafFocusedElement();

                if (leafFocusElement != null)
                {
                    evt.target = leafFocusElement;

                    if (leafFocusElement.isIMGUIContainer)
                    {
                        IMGUIContainer imguiContainer = (IMGUIContainer)leafFocusElement;
                        if (!evt.Skip(imguiContainer) && imguiContainer.SendEventToIMGUI(evt))
                        {
                            evt.StopPropagation();
                            evt.PreventDefault();
                        }
                    }
                    else
                    {
                        EventDispatchUtilities.PropagateEvent(evt);
                    }
                }
                else
                {
                    evt.target = panel.visualTree;
                    EventDispatchUtilities.PropagateEvent(evt);

                    if (!evt.isPropagationStopped)
                    {
                        EventDispatchUtilities.PropagateToIMGUIContainer(panel.visualTree, evt);
                    }
                }
            }

            evt.propagateToIMGUI = false;
            evt.stopDispatch     = true;
        }
        public void DispatchEvent(EventBase evt, IPanel panel)
        {
            if (panel != null)
            {
                if (panel.focusController.GetLeafFocusedElement() != null)
                {
                    IMGUIContainer imguiContainer = panel.focusController.GetLeafFocusedElement() as IMGUIContainer;

                    if (imguiContainer != null)
                    {
                        // THINK ABOUT THIS PF: shouldn't we allow for the trickleDown dispatch phase?
                        if (!evt.Skip(imguiContainer) && imguiContainer.SendEventToIMGUI(evt))
                        {
                            evt.StopPropagation();
                            evt.PreventDefault();
                        }
                    }
                    else
                    {
                        evt.target = panel.focusController.GetLeafFocusedElement();
                        EventDispatchUtilities.PropagateEvent(evt);
                    }
                }
                else
                {
                    evt.target = panel.visualTree;
                    EventDispatchUtilities.PropagateEvent(evt);

                    if (!evt.isPropagationStopped)
                    {
                        EventDispatchUtilities.PropagateToIMGUIContainer(panel.visualTree, evt);
                    }
                }
            }

            evt.propagateToIMGUI = false;
            evt.stopDispatch     = true;
        }
        public void DispatchEvent(EventBase evt, IPanel panel)
        {
            if (panel != null)
            {
                var leafFocusElement = panel.focusController.GetLeafFocusedElement();

                if (leafFocusElement != null)
                {
                    if (leafFocusElement.isIMGUIContainer)
                    {
                        IMGUIContainer imguiContainer = (IMGUIContainer)leafFocusElement;
                        if (!evt.Skip(imguiContainer) && imguiContainer.SendEventToIMGUI(evt))
                        {
                            evt.StopPropagation();
                            evt.PreventDefault();
                        }
                    }
                    else
                    {
                        evt.target = leafFocusElement;
                        EventDispatchUtilities.PropagateEvent(evt);
                    }
                }
                else
                {
                    evt.target = panel.visualTree;
                    EventDispatchUtilities.PropagateEvent(evt);

                    if (!evt.isPropagationStopped)
                    {
                        EventDispatchUtilities.PropagateToIMGUIContainer(panel.visualTree, evt);
                    }
                }
            }

            evt.propagateToIMGUI = false;
            evt.stopDispatch     = true;
        }