public virtual bool initWithDelegate(ICCTouchDelegate pDelegate, int nPriority) { this.m_pDelegate = pDelegate; this.m_nPriority = nPriority; this.m_nEnabledSelectors = 0; return(true); }
/// <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); }
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); }
/// <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; }
/// <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); }
/// <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); }
public static CCTouchHandler handlerWithDelegate(ICCTouchDelegate pDelegate, int nPriority) { CCTouchHandler handler = new CCTouchHandler(); if (handler.initWithDelegate(pDelegate, nPriority)) { return(null); } return(null); }
/// <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> /// 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; }
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; }
/// <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; }
/// <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); }
/// <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; } }
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); }
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; } }
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; } } }
public CCTouchHandler(ICCTouchDelegate pDelegate) { m_pDelegate = pDelegate; m_nPriority = pDelegate.TouchPriority; m_nEnabledSelectors = 0; }
public CCTouchHandler(ICCTouchDelegate pDelegate, int nPriority) : this(pDelegate) { m_nPriority = nPriority; }
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; }
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> /// 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; } }
public void setPriority(int nPriority, ICCTouchDelegate pDelegate) { this.findHandler(pDelegate).Priority = nPriority; this.rearrangeHandlers(this.m_pTargetedHandlers); this.rearrangeHandlers(this.m_pStandardHandlers); }