Beispiel #1
0
        protected override void ChildAdded(DisplayListMember child)
        {
            //Debug.Log("GroupBase - ChildAdded: " + child);
            if (HasEventListener("childrenChanged"))
            {
                DispatchEvent(new Event("childrenChanged"));
            }

            if (HasEventListener(ChildExistenceChangedEvent.CHILD_ADD))
            {
                var cece = new ChildExistenceChangedEvent(ChildExistenceChangedEvent.CHILD_ADD)
                {
                    RelatedObject = child
                };
                DispatchEvent(cece);
            }

            /*if (child is ModalOverlay)
             *  Debug.Log("Added: " + child);*/

            if (child.HasEventListener(FrameworkEvent.ADD))
            {
                child.DispatchEvent(new FrameworkEvent(FrameworkEvent.ADD));
            }

            base.ChildAdded(child);
        }
        internal static void BuildAndDispatchMouseEvent(EventDispatcher dispatcher, DisplayListMember targetComponent, string type, Point position, Event unityEvent)
        {
            //Debug.Log("BuildAndDispatchMouseEvent");

            if (null == dispatcher)
                throw new Exception("dispatcher cannot be null");

            if (null == targetComponent)
                throw new Exception("targetComponent cannot be null");

            if (!dispatcher.HasEventListener(type) && !targetComponent.HasBubblingEventListener(type)) // optimization
                return; // don't bother to build an event

            //Debug.Log("unityEvent: " + unityEvent);
            //var ue = unityEvent ?? Event.current;
            //Debug.Log("ue: " + ue);
            //Debug.Log("ue.button: " + ue.button);

            /**
             * 1) InvalidateDrawingList the event
             * */
            MouseEvent me = new MouseEvent(type)
                                {
                                    Target = targetComponent,
                                    CurrentEvent = unityEvent,
                                    GlobalPosition = position,
                                    LocalPosition = targetComponent.GlobalToLocal(position)
                                };

            if (null != MouseProcessor.MouseDownEvent)
            {
                // this is not a mouse move event, but rather a mouse drag, because MouseProcessor holds the reference to a mousedown event
                me.ButtonDown = MouseProcessor.MouseDownEvent.button == 0;
                me.RightButtonDown = MouseProcessor.MouseDownEvent.button == 1;
                me.MiddleButtonDown = MouseProcessor.MouseDownEvent.button == 2;
            }

            /**
             * 2) Dispatch from manager
             * */
            dispatcher.DispatchEvent(me);

            /**
             * 3) If not canceled, dispatch from component
             * */
            if (!me.Canceled)
            {
                me.Bubbles = true; // added 28.1.2012.
                targetComponent.DispatchEvent(me);
            }
        }
Beispiel #3
0
        protected override void RemovingChild(DisplayListMember child)
        {
            base.RemovingChild(child);

            if (child.HasEventListener(FrameworkEvent.REMOVE))
            {
                child.DispatchEvent(new FrameworkEvent(FrameworkEvent.REMOVE));
            }

            if (HasEventListener(ChildExistenceChangedEvent.CHILD_REMOVE))
            {
                var cece = new ChildExistenceChangedEvent(ChildExistenceChangedEvent.CHILD_REMOVE)
                {
                    RelatedObject = child
                };
                DispatchEvent(cece);
            }
        }
Beispiel #4
0
        protected override void ChildAdded(DisplayListMember child)
        {
            //Debug.Log("GroupBase - ChildAdded: " + child);
            if (HasEventListener("childrenChanged"))
                DispatchEvent(new Event("childrenChanged"));

            if (HasEventListener(ChildExistenceChangedEvent.CHILD_ADD))
            {
                var cece = new ChildExistenceChangedEvent(ChildExistenceChangedEvent.CHILD_ADD) {RelatedObject = child};
                DispatchEvent(cece);
            }
            
            /*if (child is ModalOverlay)
                Debug.Log("Added: " + child);*/

            if (child.HasEventListener(FrameworkEvent.ADD))
                child.DispatchEvent(new FrameworkEvent(FrameworkEvent.ADD));

 	        base.ChildAdded(child);
        }
Beispiel #5
0
        protected override void RemovingChild(DisplayListMember child)
        {
            base.RemovingChild(child);

            if (child.HasEventListener(FrameworkEvent.REMOVE))
                child.DispatchEvent(new FrameworkEvent(FrameworkEvent.REMOVE));

            if (HasEventListener(ChildExistenceChangedEvent.CHILD_REMOVE))
            {
                var cece = new ChildExistenceChangedEvent(ChildExistenceChangedEvent.CHILD_REMOVE) {RelatedObject = child};
                DispatchEvent(cece);
            }
        }