Ejemplo n.º 1
0
 public virtual bool initWithDelegate(ICCTouchDelegate pDelegate, int nPriority)
 {
     this.m_pDelegate         = pDelegate;
     this.m_nPriority         = nPriority;
     this.m_nEnabledSelectors = 0;
     return(true);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// allocates a TouchHandler with a delegate and a priority
        /// </summary>
        public static CCTouchHandler Create(ICCTouchDelegate pDelegate, int nPriority)
        {
            var pHandler = new CCTouchHandler();

            pHandler.InitWithDelegate(pDelegate, nPriority);
            return(pHandler);
        }
Ejemplo n.º 3
0
        public CCTouchHandler findHandler(ICCTouchDelegate pDelegate)
        {
            CCTouchHandler cCTouchHandler;

            foreach (CCTouchHandler mPTargetedHandler in this.m_pTargetedHandlers)
            {
                if (mPTargetedHandler.Delegate != pDelegate)
                {
                    continue;
                }
                cCTouchHandler = mPTargetedHandler;
                return(cCTouchHandler);
            }
            List <CCTouchHandler> .Enumerator enumerator = this.m_pStandardHandlers.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    CCTouchHandler current = enumerator.Current;
                    if (current.Delegate != pDelegate)
                    {
                        continue;
                    }
                    cCTouchHandler = current;
                    return(cCTouchHandler);
                }
                return(null);
            }
            finally
            {
                ((IDisposable)enumerator).Dispose();
            }
            return(cCTouchHandler);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// initializes a TouchHandler with a delegate and a priority 
        /// </summary>
        public virtual bool initWithDelegate(ICCTouchDelegate pDelegate, int nPriority)
        {
            m_pDelegate = pDelegate;
            m_nPriority = nPriority;
            m_nEnabledSelectors = 0;

            return true;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// initializes a TouchHandler with a delegate and a priority
        /// </summary>
        protected virtual bool InitWithDelegate(ICCTouchDelegate pDelegate, int nPriority)
        {
            m_pDelegate         = pDelegate;
            m_nPriority         = nPriority;
            m_nEnabledSelectors = 0;

            return(true);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Changes the priority of a previously added delegate.
        /// The lower the number, the higher the priority
        /// </summary>
        public void SetPriority(int nPriority, ICCTouchDelegate pDelegate)
        {
            CCTouchHandler handler = FindHandler(pDelegate);

            handler.Priority = nPriority;

            RearrangeHandlers(m_pTargetedHandlers);
            RearrangeHandlers(m_pStandardHandlers);
        }
Ejemplo n.º 7
0
        public static CCTouchHandler handlerWithDelegate(ICCTouchDelegate pDelegate, int nPriority)
        {
            CCTouchHandler handler = new CCTouchHandler();

            if (handler.initWithDelegate(pDelegate, nPriority))
            {
                return(null);
            }
            return(null);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Changes the priority of a previously added delegate.
        /// The lower the number, the higher the priority
        /// </summary>
        public void setPriority(int nPriority, ICCTouchDelegate pDelegate)
        {
            CCTouchHandler handler = null;

            handler          = this.findHandler(pDelegate);
            handler.Priority = nPriority;

            this.rearrangeHandlers(m_pTargetedHandlers);
            this.rearrangeHandlers(m_pStandardHandlers);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Use this to update the priority of the given delegate when its graph priority
        /// changes due to a parenting change.
        /// </summary>
        /// <param name="d"></param>
        public void UpdateGraphPriority(ICCTouchDelegate d)
        {
            CCTouchHandler h = FindHandler(d);

            if (h != null)
            {
                h.Priority = d.TouchPriority;
                RearrangeAllHandlersUponTouch();
            }
        }
        /// <summary>
        ///  initializes a TargetedTouchHandler with a delegate, a priority and whether or not it swallows touches or not
        /// </summary>
        public bool initWithDelegate(ICCTouchDelegate pDelegate, int nPriority, bool bSwallow)
        {
            if (base.initWithDelegate(pDelegate, nPriority))
            {
                m_pClaimedTouches = new List<CCTouch>();
                m_bSwallowsTouches = bSwallow;

                return true;
            }

            return false;
        }
Ejemplo n.º 11
0
 public void removeDelegate(ICCTouchDelegate pDelegate)
 {
     if (pDelegate == null)
     {
         return;
     }
     if (!this.m_bLocked)
     {
         this.forceRemoveDelegate(pDelegate);
         return;
     }
     this.m_pHandlersToRemove.Add(pDelegate);
     this.m_bToRemove = true;
 }
Ejemplo n.º 12
0
        /// <summary>
        /// allocates a TouchHandler with a delegate and a priority 
        /// </summary>
        public static CCTouchHandler handlerWithDelegate(ICCTouchDelegate pDelegate, int nPriority)
        {
            CCTouchHandler pHandler = new CCTouchHandler();

            if (pHandler.initWithDelegate(pDelegate, nPriority))
            {
                pHandler = null;
            }
            else
            {
                pHandler = null;
            }

            return pHandler;
        }
Ejemplo n.º 13
0
        /// <summary>
        /// allocates a TouchHandler with a delegate and a priority
        /// </summary>
        public static CCTouchHandler handlerWithDelegate(ICCTouchDelegate pDelegate, int nPriority)
        {
            CCTouchHandler pHandler = new CCTouchHandler();

            if (pHandler.initWithDelegate(pDelegate, nPriority))
            {
                pHandler = null;
            }
            else
            {
                pHandler = null;
            }

            return(pHandler);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Removes a touch delegate.
        /// The delegate will be released
        /// </summary>
        public void RemoveDelegate(ICCTouchDelegate pDelegate)
        {
            if (pDelegate == null)
            {
                return;
            }

            if (!m_bLocked)
            {
                ForceRemoveDelegate(pDelegate);
            }
            else
            {
                m_pHandlersToRemove.Add(pDelegate);
                m_bToRemove = true;
            }
        }
Ejemplo n.º 15
0
        public CCTouchHandler FindHandler(ICCTouchDelegate pDelegate)
        {
            foreach (CCTouchHandler handler in m_pTargetedHandlers)
            {
                if (handler.Delegate == pDelegate)
                {
                    return(handler);
                }
            }

            foreach (CCTouchHandler handler in m_pStandardHandlers)
            {
                if (handler.Delegate == pDelegate)
                {
                    return(handler);
                }
            }

            return(null);
        }
Ejemplo n.º 16
0
 protected void forceRemoveDelegate(ICCTouchDelegate pDelegate)
 {
     foreach (CCTouchHandler mPStandardHandler in this.m_pStandardHandlers)
     {
         if (mPStandardHandler == null || mPStandardHandler.Delegate != pDelegate)
         {
             continue;
         }
         this.m_pStandardHandlers.Remove(mPStandardHandler);
         break;
     }
     foreach (CCTouchHandler mPTargetedHandler in this.m_pTargetedHandlers)
     {
         if (mPTargetedHandler == null || mPTargetedHandler.Delegate != pDelegate)
         {
             continue;
         }
         this.m_pTargetedHandlers.Remove(mPTargetedHandler);
         break;
     }
 }
Ejemplo n.º 17
0
        protected void ForceRemoveDelegate(ICCTouchDelegate pDelegate)
        {
            // remove handler from m_pStandardHandlers
            foreach (CCTouchHandler pHandler in m_pStandardHandlers)
            {
                if (pHandler != null && pHandler.Delegate == pDelegate)
                {
                    m_pStandardHandlers.Remove(pHandler);
                    break;
                }
            }

            // remove handler from m_pTargetedHandlers
            foreach (CCTouchHandler pHandler in m_pTargetedHandlers)
            {
                if (pHandler != null && pHandler.Delegate == pDelegate)
                {
                    m_pTargetedHandlers.Remove(pHandler);
                    break;
                }
            }
        }
Ejemplo n.º 18
0
 public CCTouchHandler(ICCTouchDelegate pDelegate)
 {
     m_pDelegate = pDelegate;
     m_nPriority = pDelegate.TouchPriority;
     m_nEnabledSelectors = 0;
 }
Ejemplo n.º 19
0
 public CCTouchHandler(ICCTouchDelegate pDelegate, int nPriority) : this(pDelegate)
 {
     m_nPriority = nPriority;
 }
Ejemplo n.º 20
0
        public CCTouchHandler FindHandler(ICCTouchDelegate pDelegate)
        {
            foreach (CCTouchHandler handler in m_pTargetedHandlers)
            {
                if (handler.Delegate == pDelegate)
                {
                    return handler;
                }
            }

            foreach (CCTouchHandler handler in m_pStandardHandlers)
            {
                if (handler.Delegate == pDelegate)
                {
                    return handler;
                }
            }

            return null;
        }
Ejemplo n.º 21
0
        protected void ForceRemoveDelegate(ICCTouchDelegate pDelegate)
        {
            // remove handler from m_pStandardHandlers
            foreach (CCTouchHandler pHandler in m_pStandardHandlers)
            {
                if (pHandler != null && pHandler.Delegate == pDelegate)
                {
                    m_pStandardHandlers.Remove(pHandler);
                    break;
                }
            }

            // remove handler from m_pTargetedHandlers
            foreach (CCTouchHandler pHandler in m_pTargetedHandlers)
            {
                if (pHandler != null && pHandler.Delegate == pDelegate)
                {
                    m_pTargetedHandlers.Remove(pHandler);
                    break;
                }
            }
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Removes a touch delegate.
        /// The delegate will be released
        /// </summary>
        public void RemoveDelegate(ICCTouchDelegate pDelegate)
        {
            if (pDelegate == null)
            {
                return;
            }

            if (!m_bLocked)
            {
                ForceRemoveDelegate(pDelegate);
            }
            else
            {
                m_pHandlersToRemove.Add(pDelegate);
                m_bToRemove = true;
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Changes the priority of a previously added delegate. 
        /// The lower the number, the higher the priority
        /// </summary>
        public void SetPriority(int nPriority, ICCTouchDelegate pDelegate)
        {
            CCTouchHandler handler = FindHandler(pDelegate);
            handler.Priority = nPriority;

            RearrangeHandlers(m_pTargetedHandlers);
            RearrangeHandlers(m_pStandardHandlers);
        }
Ejemplo n.º 24
0
 public static CCTouchHandler Create(ICCTouchDelegate pDelegate, int nPriority)
 {
     var pHandler = new CCTouchHandler(pDelegate, nPriority);
     return pHandler;
 }
 /// <summary>
 /// Adds a standard touch delegate to the dispatcher's list.
 /// See StandardTouchDelegate description.
 /// IMPORTANT: The delegate will be retained.
 /// </summary>
 public void addStandardDelegate(ICCTouchDelegate pDelegate, int nPriority)
 {
     CCTouchHandler pHandler = CCStandardTouchHandler.handlerWithDelegate(pDelegate, nPriority);
     if (!m_bLocked)
     {
         forceAddHandler(pHandler, m_pStandardHandlers);
     }
     else
     {
         m_pHandlersToAdd.Add(pHandler);
         m_bToAdd = true;
     }
 }
 /// <summary>
 /// allocates a TargetedTouchHandler with a delegate, a priority and whether or not it swallows touches or not 
 /// </summary>
 public static CCTargetedTouchHandler handlerWithDelegate(ICCTouchDelegate pDelegate, int nPriority, bool bSwallow)
 {
     CCTargetedTouchHandler pHandler = new CCTargetedTouchHandler();
     pHandler.initWithDelegate(pDelegate, nPriority, bSwallow);
     return pHandler;
 }
 /// <summary>
 /// allocates a TouchHandler with a delegate and a priority
 /// </summary>
 public static CCStandardTouchHandler handlerWithDelegate(ICCTouchDelegate pDelegate, int nPriority)
 {
     CCStandardTouchHandler pHandler = new CCStandardTouchHandler();
     pHandler.initWithDelegate(pDelegate, nPriority);
     return pHandler;
 }
 /// <summary>
 ///  initializes a TouchHandler with a delegate and a priority
 /// </summary>
 public virtual bool initWithDelegate(ICCTouchDelegate pDelegate, int nPriority)
 {
     return base.initWithDelegate(pDelegate, nPriority);
 }
        /// <summary>
        /// Changes the priority of a previously added delegate. 
        /// The lower the number, the higher the priority
        /// </summary>
        public void setPriority(int nPriority, ICCTouchDelegate pDelegate)
        {
            CCTouchHandler handler = null;

            handler = this.findHandler(pDelegate);
            handler.Priority = nPriority;

            this.rearrangeHandlers(m_pTargetedHandlers);
            this.rearrangeHandlers(m_pStandardHandlers);
        }
 /// <summary>
 /// Adds a targeted touch delegate to the dispatcher's list.
 /// See TargetedTouchDelegate description.
 /// IMPORTANT: The delegate will be retained.
 /// </summary>
 public void addTargetedDelegate(ICCTouchDelegate pDelegate, int nPriority, bool bSwallowsTouches)
 {
     CCTouchHandler pHandler = CCTargetedTouchHandler.handlerWithDelegate(pDelegate, nPriority, bSwallowsTouches);
     if (!m_bLocked)
     {
         forceAddHandler(pHandler, m_pTargetedHandlers);
     }
     else
     {
         m_pHandlersToAdd.Add(pHandler);
         m_bToAdd = true;
     }
 }
Ejemplo n.º 31
0
 public CCTouchHandler(ICCTouchDelegate pDelegate)
 {
     m_pDelegate         = pDelegate;
     m_nPriority         = pDelegate.TouchPriority;
     m_nEnabledSelectors = 0;
 }
Ejemplo n.º 32
0
 public CCTouchHandler(ICCTouchDelegate pDelegate, int nPriority) : this(pDelegate)
 {
     m_nPriority = nPriority;
 }
Ejemplo n.º 33
0
 /// <summary>
 /// Use this to update the priority of the given delegate when its graph priority 
 /// changes due to a parenting change.
 /// </summary>
 /// <param name="d"></param>
 public void UpdateGraphPriority(ICCTouchDelegate d)
 {
     CCTouchHandler h = FindHandler(d);
     if (h != null)
     {
         h.Priority = d.TouchPriority;
         RearrangeAllHandlersUponTouch();
     }
 }
Ejemplo n.º 34
0
 public void setPriority(int nPriority, ICCTouchDelegate pDelegate)
 {
     this.findHandler(pDelegate).Priority = nPriority;
     this.rearrangeHandlers(this.m_pTargetedHandlers);
     this.rearrangeHandlers(this.m_pStandardHandlers);
 }