Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public static string CreateUid(DisplayListMember component)
        {
            if (null == component)
                return null;

            Type type = component.GetType();
            int count = 0; // default

            if (UidDict.ContainsKey(type))
            {
                count = UidDict[type];
            }

            count++;
            UidDict[type] = count;

            var name = type.Name;

            // If the class name ends with a digit (which some autogenerated
            // classes do), then append an underscore before appending
            // the counter.
            int charCode = name[name.Length - 1];
            if (charCode >= 48 && charCode <= 57)
                name += "_";

            return string.Format("{0}{1}", name, count);
        }
Ejemplo n.º 3
0
        public DisplayListMember QRemoveChild(DisplayListMember child)
        {
            bool removed = false;

            //RemovingChild(child);

            if (_children.Contains(child)) // 20120428, radi popupa koji se zatvara na "X" i options modela
            {
                removed = _children.Remove(child);
            }

            //_drawingList.Remove(child); // 20130507
            if (AutoUpdateDrawingList)
            {
                InvalidateDrawingList();
            }

            if (removed)
            {
                child.Parent = null;
            }

            //ChildRemoved(child);

            InvalidateDrawingList();

            return(removed ? child : null);
        }
Ejemplo n.º 4
0
        public DisplayListMember QRemoveChildAt(int index) // TODO: Do delayed version
        {
            DisplayListMember child = QGetChildAt(index);

            InvalidateDrawingList();
            return(QRemoveChild(child));
        }
Ejemplo n.º 5
0
        public DisplayListMember QAddChild(DisplayListMember child)
        {
            DisplayListMember m = QAddChildAt(child, _children.Count);

            InvalidateDrawingList();
            return(m);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Returns true if child is the descendant of the component or the component itself
        /// </summary>
        /// <param name="child"></param>
        /// <param name="includeThisCheck">Should the container (me) be included in the search</param>
        /// <returns></returns>
        /// <remarks>Walks up the hierarchy -> Recursive!!!</remarks>
        public bool QContains(DisplayListMember child, bool includeThisCheck)
        {
            if (null == child)
            {
                return(false);
            }

            // contains returns true for myself
            if (this == child)
            {
                return(includeThisCheck);
            }

            var p = child.Parent;

            if (null != p)
            {
                if (this == p)
                {
                    return(true);
                }

                return(Contains(p));
            }

            return(false);
        }
Ejemplo n.º 7
0
 protected virtual void ChildRemoved(DisplayListMember child)
 {
     if (child is Component)
     {
         ((Component)child).ParentChanged(null);
     }
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Gets content group child index
 /// </summary>
 /// <param name="child">A child</param>
 /// <returns>The position</returns>
 public int GetContentChildIndex(DisplayListMember child)
 {
     if (null != child && Viewport != child)
     {
         return(0);
     }
     throw new Exception("Child not found in scroller");
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Sets child index
 /// </summary>
 /// <param name="child">A child</param>
 /// <param name="index">New index</param>
 /// <returns>The position</returns>
 public void QSetChildIndex(DisplayListMember child, int index)
 {
     if (index > -1)
     {
         QRemoveChildAt(index);
         QAddChildAt(child, index);
     }
 }
Ejemplo n.º 10
0
        override public DisplayListMember RemoveChild(DisplayListMember child)
        {
            RemovingChild(child);

            QRemoveChild(child);

            ChildRemoved(child);

            return(child);
        }
Ejemplo n.º 11
0
        ///<summary>
        ///</summary>
        ///<param name="firstChild"></param>
        ///<param name="secondChild"></param>
        public void QSwapChildren(DisplayListMember firstChild, DisplayListMember secondChild) // TODO: Do delayed version
        {
            int index = QGetChildIndex(firstChild);

            if (index > -1)
            {
                QRemoveChildAt(index);
                QAddChildAt(secondChild, index);
            }
        }
Ejemplo n.º 12
0
        public virtual DisplayListMember RemoveChildAt(int index) // TODO: Do delayed version
        {
            //DisplayListMember child = QGetChildAt(index);
            //return QRemoveChild(child);

            DisplayListMember child = GetChildAt(index);

            QRemoveChild(child);

            return(child);
        }
Ejemplo n.º 13
0
        //public override DisplayListMember RemoveChild(DisplayListMember child)
        //{
        //    return null != _contentPane ? _contentPane.QRemoveChild(child) : QRemoveChild(child);
        //}

        //public override DisplayListMember RemoveChildAt(int index)
        //{
        //    return null != _contentPane ? _contentPane.QRemoveChildAt(index) : QRemoveChildAt(index);
        //}

        //public override void RemoveAllChildren()
        //{
        //    if (null != _contentPane)
        //        _contentPane.QRemoveAllChildren();
        //    else
        //        QRemoveAllChildren();
        //}

        ///<summary>
        /// Swaps two children
        ///</summary>
        ///<param name="firstElement">First child</param>
        ///<param name="secondElement">Second child</param>
        public override void SwapChildren(DisplayListMember firstElement, DisplayListMember secondElement)
        {
            //Debug.Log("SwapChildren");
            if (null != _contentPane)
            {
                _contentPane.QSwapChildren(firstElement, secondElement);
            }
            else
            {
                QSwapChildren(firstElement, secondElement);
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Checks if this is a Owner of a component
        /// </summary>
        /// <param name="child"></param>
        /// <returns></returns>
        public bool QHasChild(DisplayListMember child)
        {
            if (null != child.Parent)
            {
                if (this == child.Parent)
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 15
0
        override public DisplayListMember RemoveChild(DisplayListMember child)
        {
            RemovingChild(child);

            var retVal = null != _contentPane?_contentPane.QRemoveChild(child) : QRemoveChild(child);

            ChildRemoved(child);

            InvalidateDrawingList();

            return(retVal);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Pushes the child to back in a depth list
        /// </summary>
        /// <param name="depthList"></param>
        /// <param name="child"></param>
        public static void PushToBack(List<DisplayListMember> depthList, DisplayListMember child)
        {
            var min = GetMinDepth(depthList);
            //Debug.Log("min: " + min);

            if (child.Depth < min)
                return;

            if (child.Depth == min && IsOnlyChildWithDepth(depthList, child, min))
                return;

            SetDepth(depthList, child, GetMinDepth(depthList) - 1, true);
        }
Ejemplo n.º 17
0
        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);
            }
        }
Ejemplo n.º 18
0
        public virtual DisplayListMember AddChildAt(DisplayListMember child, int index) // TODO: Do delayed version
        {
            //return QAddChildAt(index, child);
            DisplayObjectContainer formerParent = child.Parent;

            if (null != formerParent)
            {
                formerParent.RemoveChild(child);
            }

            QAddChildAt(child, index);

            return(child);
        }
Ejemplo n.º 19
0
        public virtual DisplayListMember AddChild(DisplayListMember child)
        {
            //Debug.Log("Parent: " + child.Parent);
            DisplayObjectContainer formerParent = child.Parent;

            if (null != formerParent)
            {
                formerParent.RemoveChild(child);
            }

            QAddChild(child);

            return(child);
        }
Ejemplo n.º 20
0
        override public DisplayListMember RemoveChildAt(int index) // TODO: Do delayed version
        {
            //DisplayListMember child = QGetChildAt(index);
            //return QRemoveChild(child);

            DisplayListMember child = GetChildAt(index);

            RemovingChild(child);

            QRemoveChild(child);

            ChildRemoved(child);

            return(child);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Shows the mask
        /// </summary>
        /// <param name="component"></param>
        public void Mask(DisplayListMember component)
        {
            _component = component;

#if DEBUG
            if (DebugMode)
            {
                Debug.Log("Masking component: " + component);
            }
#endif
            if (null != _maskGraphics)
            {
                return; // already masking this component
            }
            _parent = _component.Parent ?? (_component is Stage ? _component as Stage : null);

            if (null == _parent)
            {
                return; // we are not on the display list, so we have nothing to mask indeed
            }
            var imc = _component as InvalidationManagerClient;

            _maskGraphics = new T
            {
                IncludeInLayout = false,
                X     = _component.X,
                Y     = _component.Y,
                Width = null != imc?imc.GetExplicitOrMeasuredWidth() : _component.Width,
                            Height = null != imc?imc.GetExplicitOrMeasuredHeight() : _component.Height
                                         //Bounds = (Rectangle)_component.Bounds.Clone() // NOTE: BEWARE! This was the reference bug (without Clone())!!!!!!!!!
            };

            _parent.AddChild(_maskGraphics);
            //_maskGraphics.ValidateNow(); // commented out 20130331 and moved to LoadingMaskAnimator

            // critical!
            //_maskGraphics.Transform.Apply(); // TODO: remove
            //_maskGraphics.Parent.Transform.ValidateChild(_maskGraphics);
            _maskGraphics.InvalidateTransform();

            // subscribe to MOVE and RESIZE events of the component
            // we shall be levitating just over the component
            _component.AddEventListener(MoveEvent.MOVE, MoveHandler, EventPhase.Target);
            _component.AddEventListener(ResizeEvent.RESIZE, ResizeHandler, EventPhase.Target);

            _maskGraphics.Play();
        }
Ejemplo n.º 22
0
        public override DisplayListMember AddChildAt(DisplayListMember child, int index)
        {
            DisplayObjectContainer formerParent = child.Parent;

            if (null != formerParent)
            {
                formerParent.RemoveChild(child);
            }

            AddingChild(child);

            QAddChildAt(child, index);

            ChildAdded(child);

            return(child);
        }
Ejemplo n.º 23
0
        override public DisplayListMember RemoveChildAt(int index) // TODO: Do delayed version
        {
            //DisplayListMember child = QGetChildAt(index);
            //return QRemoveChild(child);

            DisplayListMember child = GetChildAt(index);

            RemovingChild(child);

            var retVal = null != _contentPane?_contentPane.QRemoveChild(child) : QRemoveChild(child);

            ChildRemoved(child);

            InvalidateDrawingList();

            return(retVal);
        }
Ejemplo n.º 24
0
        /**
         * Važno:
         * Ove overrideove sam ja dodao 20131105
         * Razlog je bio problem oko dinamičkog dodavanja itema u List kontrolu
         * Naime, iako su se liste inicijalno normalno inicijalizirale, prilikom dodavanja novog childa u kolekciju (dinamički)
         * događao se Exception u DataGroup metodi AddItemRendererToDisplayList ("ArgumentOutOfRangeException: Argument is out of range.")
         * Greška je bila ta da je linija base.AddChildAt(child, childIndex) naravno zvala base.AddChildAt od klase Component
         * a ta implementacija interno zove QAddChildAt (tj. ne radi razliku između toga da li postoji contentPane ili ne)
         * Tako da je child uvijek bio dodavan direktno na GroupBase, a ne na contentPane ukoliko je postojao
         * (GroupBase "laže" vanjskom svijetu i skriva činjenicu da postoji contentPane)
         * Zbog toga je bilo potrebno overridati ove 4 metode i ispraviti tu funkcionalnost
         * */

        public override DisplayListMember AddChild(DisplayListMember child)
        {
            DisplayObjectContainer formerParent = child.Parent;

            if (null != formerParent)
            {
                formerParent.RemoveChild(child);
            }

            // Do anything that needs to be done before the child is added.
            // When adding a child to Component, this will set the child's
            // virtual parent, its nestLevel, its document, etc.
            // When adding a child to a Container, the override will also
            // invalidate the container, adjust its content/chrome partitions,
            // etc.
            //base.AddingChild(child);

            if (null != _contentPane)
            {
                ContentPaneAddingChild(child);
            }
            else
            {
                base.AddingChild(child);
            }

            // Call a low-level player method in DisplayObjectContainer which
            // actually attaches the child to this component.
            // The player dispatches an "added" event from the child just after
            // it is attached, so all "added" handlers execute during this call.
            // Component registers an addedHandler() in its constructor,
            // which makes it runs before any other "added" handlers except
            // capture-phase ones; it sets up the child's styles.
            var retVal = null != _contentPane?_contentPane.QAddChild(child) : QAddChild(child);

            // Do anything that needs to be done after the child is added
            // and after all "added" handlers have executed.
            // This is where
            /*base.*/ ChildAdded(child);

            InvalidateDrawingList();
            //if (null != _contentPane)
            //    DepthUtil.UpdateDrawingList(_contentPane); // because AutoUpdateDrawingList is turned of on contentPane

            return(retVal);
        }
Ejemplo n.º 25
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);
            }
        }
Ejemplo n.º 26
0
 private void UninstallViewport()
 {
     if (null != HorizontalScrollBar)
     {
         HorizontalScrollBar.Viewport = null;
     }
     if (null != VerticalScrollBar)
     {
         VerticalScrollBar.Viewport = null;
     }
     if (null != Skin && null != Viewport)
     {
         Viewport.ClipAndEnableScrolling = false;
         DisplayListMember dlm = (DisplayListMember)Viewport;
         ((Group)Skin).RemoveContentChild(dlm);
         dlm.RemoveEventListener(PropertyChangeEvent.PROPERTY_CHANGE, ViewportPropertyChangeHandler);
     }
 }
Ejemplo n.º 27
0
        protected virtual void ChildAdded(DisplayListMember child)
        {
            InvalidationManagerClient imc = child as InvalidationManagerClient;

            if (null == imc)
            {
                return;
            }

            if (!imc.Initialized)
            {
                child.Initialize();
            }
            else // already created, but changed parent
            {
                child.PropagateStage();
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Checks if the component has the listener or any of component's ancestors 
        /// have listeners for the supplied event type
        /// </summary>
        /// <param name="eventType"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        internal static bool HasBubblingEventListener(string eventType, DisplayListMember target)
        {
            /**
             * 0) Get parent chain
             * */
            List<DisplayListMember> parentChain = ComponentUtil.GetParentChain(target, true);
            parentChain.Add(target); // add myself

            /**
             * 1) Look for at least one subscribed component
             * */
            foreach (DisplayListMember component in parentChain)
            {
                if (component.HasEventListener(eventType))
                    return true;
            }

            return false; // no subscribed components
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Helper
        /// </summary>
        /// <param name="child"></param>
        private void ContentPaneAddingChild(DisplayListMember child)
        {
            //Debug.Log("ContentPaneAddingChild: " + child);
            var component = child as Component;

            if (component != null)
            {
                component.ParentChanged(_contentPane); // fix the parent (currently it is "this")
            }
            var client = child as IInvalidationManagerClient;

            if (client != null)
            {
                client.NestLevel = /*NestLevel == -1 ? -1 : */ NestLevel + 1;
            }

            var styleClient = child as IStyleClient;

            if (styleClient != null)
            {
                styleClient.RegenerateStyleCache(true);
            }

            var simpleStyleClient = child as ISimpleStyleClient;

            if (simpleStyleClient != null)
            {
                simpleStyleClient.StyleChanged(null);
            }

            if (styleClient != null)
            {
                styleClient.NotifyStyleChangeInChildren(null, null, true);
            }

            // Inform the component that it's style properties
            // have been fully initialized. Most components won't care,
            // but some need to react to even this early change.
            if (component != null)
            {
                component.StylesInitialized();
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Brings the child to front in a depth list
        /// </summary>
        /// <param name="depthList"></param>
        /// <param name="child"></param>
        public static void BringToFront(List<DisplayListMember> depthList, DisplayListMember child)
        {
            //Debug.Log("BringToFront");

            var max = GetMaxDepth(depthList);
            //Debug.Log(string.Format(@"depthList.Count: {0}; max: {1}; child.Depth: {2}; child: {3}", depthList.Count, max, child.Depth, child));

            if (child.Depth > max)
                return;

            //Debug.Log(1);

            if (child.Depth == max && IsOnlyChildWithDepth(depthList, child, max))
                return;

            //Debug.Log(2);

            SetDepth(depthList, child, GetMaxDepth(depthList) + 1, true);
        }
Ejemplo n.º 31
0
        public override DisplayListMember AddChildAt(DisplayListMember child, int index)
        {
            if (null != _contentPane)
            {
                ContentPaneAddingChild(child);
            }
            else
            {
                base.AddingChild(child);
            }

            var retVal = null != _contentPane?_contentPane.QAddChildAt(child, index) : QAddChildAt(child, index);

            /*base.*/ ChildAdded(child);

            InvalidateDrawingList();
            //if (null != _contentPane)
            //    DepthUtil.UpdateDrawingList(_contentPane); // because AutoUpdateDrawingList is turned of on contentPane

            return(retVal);
        }
Ejemplo n.º 32
0
        /// <summary>
        /// Gets a parent chain
        /// Example: If out component is in a chain Stage-A-B-C-Component, this method returns the list of: Stage, A, B, C.
        /// </summary>
        /// <param name="component">Compo</param>
        /// <param name="reverse">Reverse the chain</param>
        /// <returns></returns>
        public static List<DisplayListMember> GetParentChain(DisplayListMember component, bool reverse)
        {
            if (null == component)
                throw new Exception("Component not defined");

            List<DisplayListMember> list = new List<DisplayListMember>();
            DisplayListMember current = component;

            //list.Add(current); // removed on 2011-09-18

            while (!(current is Stage) && null != current.Parent)
            {
                current = current.Parent;
                list.Add(current);
            }

            if (reverse)
                list.Reverse();

            return list;
        }
Ejemplo n.º 33
0
        /// <summary>
        /// The main add child method
        /// </summary>
        /// <param name="index"></param>
        /// <param name="child"></param>
        /// <returns></returns>
        public DisplayListMember QAddChildAt(DisplayListMember child, int index) // TODO: Do delayed version
        {
            if (_children.Contains(child))
            {
                if (child.Parent == this && _children.IndexOf(child) == index)
                {
                    return(child); // do nothing
                }
                if (_children.Count > 0 && index == _children.Count && index != 0)
                {
                    index--;
                }
                _children.Remove(child);
            }

//            Debug.Log(string.Format(@"QAddChildAt [{0}]
//Adding {1} to {2}", index, child, this));

            //AddingChild(child);

//            Debug.Log(string.Format(@"QAddChildAt: {0} [child count: {1}]
//Adding {2} to: {3}", index, _children.Count, child, this));
            _children.Insert(index, child);
            //Debug.Log("   OK");

            //Debug.Log(1);
            //_drawingList.Insert(index, child); // 20130507

            //Debug.Log(2);

            child.Parent = this;

            InvalidateDrawingList();

            //ChildAdded(child);

            //Debug.Log("   -> added. Count: " + _children.Count + " [" + this + ", " + child + "]");

            return(child);
        }
Ejemplo n.º 34
0
        protected virtual void AddingChild(DisplayListMember child)
        {
            if (child is Component)
            {
                ((Component)child).ParentChanged(this);
            }

            if (child is IInvalidationManagerClient)
            {
                ((IInvalidationManagerClient)child).NestLevel = /*NestLevel == -1 ? -1 : */ NestLevel + 1;
            }

            if (child is IStyleClient) // TEMP: TURNED OFF BECAUSE OF THE FREEZING BUG! TODO
            {
                ((IStyleClient)child).RegenerateStyleCache(true);
            }

            if (child is ISimpleStyleClient)
            {
                ((ISimpleStyleClient)child).StyleChanged(null);
            }

            if (child is IStyleClient)
            {
                ((IStyleClient)child).NotifyStyleChangeInChildren(null, null, true);
            }

            if (child is Component)
            {
                ((Component)child).InitializeEffects();
            }

            // Inform the component that it's style properties
            // have been fully initialized. Most components won't care,
            // but some need to react to even this early change.
            if (child is Component)
            {
                ((Component)child).StylesInitialized();
            }
        }
Ejemplo n.º 35
0
        private void InstallViewport()
        {
            //Debug.Log("InstallViewport: " + this);
            if (null != Skin && null != Viewport)
            {
                Viewport.ClipAndEnableScrolling = true;
                DisplayListMember dlm = (DisplayListMember)Viewport;
                ((Group)Skin).AddContentChildAt(dlm, 0);
                dlm.AddEventListener(PropertyChangeEvent.PROPERTY_CHANGE, ViewportPropertyChangeHandler);
                InteractiveComponent ic = (InteractiveComponent)Viewport;
                ic.MouseEnabled = true; // because of mouse-wheeling!
            }

            if (null != VerticalScrollBar)
            {
                VerticalScrollBar.Viewport = Viewport;
            }
            if (null != HorizontalScrollBar)
            {
                HorizontalScrollBar.Viewport = Viewport;
            }
        }
Ejemplo n.º 36
0
        public override DisplayListMember AddChild(DisplayListMember child)
        {
            DisplayObjectContainer formerParent = child.Parent;

            if (null != formerParent)
            {
                formerParent.RemoveChild(child);
            }

            // If there is an overlay, place the child underneath it.
            int index = base.NumberOfChildren;

            // Do anything that needs to be done before the child is added.
            // When adding a child to Component, this will set the child's
            // virtual parent, its nestLevel, its document, etc.
            // When adding a child to a Container, the override will also
            // invalidate the container, adjust its content/chrome partitions,
            // etc.
            AddingChild(child);

            // Call a low-level player method in DisplayObjectContainer which
            // actually attaches the child to this component.
            // The player dispatches an "added" event from the child just after
            // it is attached, so all "added" handlers execute during this call.
            // Component registers an addedHandler() in its constructor,
            // which makes it runs before any other "added" handlers except
            // capture-phase ones; it sets up the child's styles.
            QAddChildAt(child, index);

            // Do anything that needs to be done after the child is added
            // and after all "added" handlers have executed.
            // This is where
            ChildAdded(child);

            return(child);
        }
Ejemplo n.º 37
0
 ///<summary>
 /// Swaps two children of the stage
 ///</summary>
 ///<param name="firstChild">First child</param>
 ///<param name="secondChild">Second child</param>
 public void SwapChildren(DisplayListMember firstChild, DisplayListMember secondChild)
 {
     Stage.SwapContentChildren(firstChild, secondChild);
 }
Ejemplo n.º 38
0
 /// <summary>
 /// Removes a chold from the stage
 /// </summary>
 /// <param name="child"></param>
 /// <returns></returns>
 public DisplayListMember RemoveChild(DisplayListMember child)
 {
     return Stage.RemoveContentChild(child);
 }
Ejemplo n.º 39
0
 /// <summary>
 /// Adds a child to the container to the specified index
 /// </summary>
 /// <param name="child">A child</param>
 /// <param name="index">Index</param>
 public DisplayListMember AddChildAt(DisplayListMember child, int index)
 {
     return Stage.AddContentChildAt(child, index);
 }
Ejemplo n.º 40
0
 /// <summary>
 /// Adds the child to a stage
 /// </summary>
 /// <param name="child"></param>
 /// <returns></returns>
 public DisplayListMember AddChild(DisplayListMember child)
 {
     return Stage.AddContentChild(child);
 }
Ejemplo n.º 41
0
 public virtual bool ContentContains(DisplayListMember child)
 {
     return Contains(child);
 }
Ejemplo n.º 42
0
        /// <summary>
        /// Adds a popup to popup stage
        /// </summary>
        /// <param name="popup">A popup to add</param>
        /// <param name="parent">Parent component (for position calculations)</param>
        /// <param name="modal">Is this a modal popup</param>
        /// <param name="centered">Should popup be centered</param>
        /// <param name="keepCenter">Should popup stay centered after the screen resize</param>
        public void AddPopup(DisplayListMember popup, DisplayObjectContainer parent, bool modal, bool centered, bool keepCenter)
        {
#if TRIAL
            /* HACK CHECK */
            Acme acme = (Acme) Framework.GetComponent<Acme>(true);
            if (null == acme || !acme.gameObject.activeInHierarchy/*active*/ || !acme.enabled)
                return;
#endif

            if (_popups.Contains(popup))
                return;
#if DEBUG
            if (DebugMode)
            {
                Debug.Log("AddPopup");
            }
#endif
            List<PopupOption> options = new List<PopupOption>
                                            {
                                                new PopupOption(PopupOptionType.Parent, parent),
                                                new PopupOption(PopupOptionType.Modal, modal),
                                                new PopupOption(PopupOptionType.Centered, centered),
                                                new PopupOption(PopupOptionType.KeepCenter, keepCenter)
                                            };

            AddPopup(popup, options.ToArray());
        }
Ejemplo n.º 43
0
        private static bool Contains(IInvalidationManagerClient parent, DisplayListMember child)
        {
            var doc = parent as DisplayObjectContainer;
            if (null != doc)
            {
                // include me in the search!
                return doc.Contains(child, true); // BUG BUG - this was a bug - it was parent.Children.Contains(), which doesn't go deep, only the direct children!!!
            }

            return parent == child;
        }
Ejemplo n.º 44
0
 override public int GetContentChildIndex(DisplayListMember child)
 {
     //return GetContentChildIndex(child);
     return GetChildIndex(child);
 }
Ejemplo n.º 45
0
 public virtual void SwapContentChildren(DisplayListMember firstElement, DisplayListMember secondElement)
 {
     SwapChildren(firstElement, secondElement);
 }
Ejemplo n.º 46
0
 public virtual DisplayListMember RemoveContentChild(DisplayListMember child)
 {
     return RemoveChild(child);
 }
Ejemplo n.º 47
0
 public virtual DisplayListMember AddContentChildAt(DisplayListMember child, int index)
 {
     return AddChildAt(child, index);
 }
Ejemplo n.º 48
0
 public virtual DisplayListMember AddContentChild(DisplayListMember child)
 {
     return AddChild(child);
 }
Ejemplo n.º 49
0
 // ReSharper disable UnusedMember.Global
 public virtual bool ContentContains(DisplayListMember child, bool includeThisCheck)
 // ReSharper restore UnusedMember.Global
 {
     return Contains(child, includeThisCheck);
 }
Ejemplo n.º 50
0
 /// <summary>
 /// Gets stage child index
 /// </summary>
 /// <param name="child">A child</param>
 /// <returns>The position</returns>
 public int GetChildIndex(DisplayListMember child)
 {
     return Stage.GetContentChildIndex(child);
 }
Ejemplo n.º 51
0
 ///<summary>
 /// Sets stage child index
 ///</summary>
 ///<param name="child"></param>
 ///<param name="index"></param>
 public void SetChildIndex(DisplayListMember child, int index)
 {
     Stage.SetChildIndex(child, index);
 }
Ejemplo n.º 52
0
 /// <summary>
 /// Adds a popup to popup stage
 /// </summary>
 /// <param name="popup">A popup to add</param>
 /// <param name="parent">Parent component (for position calculations)</param>
 /// <param name="modal">Is this a modal popup</param>
 /// <param name="centered">Should popup be centered</param>
 public void AddPopup(DisplayListMember popup, DisplayObjectContainer parent, bool modal, bool centered)
 {
     AddPopup(popup, parent ?? _stage, modal, centered, false);
 }
Ejemplo n.º 53
0
        /// <summary>
        /// Returns the string presentation of the component
        /// </summary>
        /// <param name="displayObject"></param>
        /// <returns></returns>
        public static string DisplayListMemberToString(DisplayListMember displayObject)
        {
            //Debug.Log("######## DisplayListMemberToString: " + displayObject.GetType() + "/" + displayObject.Name);

            #region Commented on 20130313 because wiring up ID from the Adapter

            string result = null;

            for (DisplayListMember control = displayObject;
                 control != null;
                 control = control.Parent)
            {
                // If this object is in the display tree,
                // stop after we've prepended the topmost Application instance.
                //if (null != control.Owner 
                //    && null != control.Stage 
                //    && control.Owner == control.Stage)
                //    break;

                // Prefer id over name if specified.
                //string s = "id" in o && o["id"] ? o["id"] : o.name;

                //string s = control.Uid ?? control.Name;

                string name = control.Name;
                if (!string.IsNullOrEmpty(control.Id))
                    name = string.Format("{0}[{1}]", name, control.Id);

                result = (null == result) ? name : name + "." + result;
            }

            return result;

            #endregion

            //string result = displayObject.ToString();

            //if (!string.IsNullOrEmpty(displayObject.Id))
            //    result += string.Format(@" [Id=""{0}""]", displayObject.Id);

            //return result;
        }
Ejemplo n.º 54
0
 /// <summary>
 /// Adds a popup to popup stage
 /// </summary>
 /// <param name="popup">A popup to add</param>
 public void AddPopup(DisplayListMember popup)
 {
     AddPopup(popup, true); // modal by default
 }
Ejemplo n.º 55
0
 /// <summary>
 /// Returns true if the stage contains the specified child
 /// </summary>
 /// <param name="child"></param>
 /// <returns></returns>
 public bool HasChild(DisplayListMember child)
 {
     return Stage.HasContentChild(child);
 }
Ejemplo n.º 56
0
 public virtual bool HasContentChild(DisplayListMember child)
 {
     return HasChild(child);
 }
Ejemplo n.º 57
0
 /// <summary>
 /// Returns true if the stage contains the specified child
 /// </summary>
 /// <param name="child"></param>
 /// <returns></returns>
 public bool Contains(DisplayListMember child)
 {
     return Stage.ContentContains(child);
 }
Ejemplo n.º 58
0
 /// <summary>
 /// Returns true if the stage contains the specified child
 /// </summary>
 /// <param name="child"></param>
 /// <param name="exclusive"></param>
 /// <returns></returns>
 public bool Contains(DisplayListMember child, bool exclusive)
 {
     return Stage.ContentContains(child, exclusive);
 }
Ejemplo n.º 59
0
 /// <summary>
 /// Adds a popup to popup stage
 /// </summary>
 /// <param name="popup">A popup to add</param>
 /// <param name="modal">Is this a modal popup</param>
 /// <param name="centered">Is the popup centered</param>
 public void AddPopup(DisplayListMember popup, bool modal, bool centered)
 {
     AddPopup(popup, _stage, modal, centered); // application by default
 }
Ejemplo n.º 60
0
 /// <summary>
 /// Adds a popup to popup stage
 /// </summary>
 /// <param name="popup">A popup to add</param>
 /// <param name="parent">Parent component (for position calculations)</param>
 /// <param name="modal">Is this a modal popup</param>
 public void AddPopup(DisplayListMember popup, DisplayObjectContainer parent, bool modal)
 {
     AddPopup(popup, parent ?? _stage, modal, true); // centered by default
 }