Esempio n. 1
0
        protected CCTableViewCell _cellWithIndex(int cellIndex)
        {
            CCTableViewCell found = null;

            if (m_pIndices.Contains(cellIndex))
            {
                found = (CCTableViewCell)m_pCellsUsed.ObjectWithObjectID(cellIndex);
            }

            return(found);
        }
Esempio n. 2
0
        /**
         * Returns an existing cell at a given index. Returns nil if a cell is nonexistent at the moment of query.
         *
         * @param idx index
         * @return a cell at a given index
         */
        public CCTableViewCell CellAtIndex(int idx)
        {
            CCTableViewCell found = null;

            if (_indices.Contains(idx))
            {
                found = (CCTableViewCell)_cellsUsed.ObjectWithObjectID(idx);
            }

            return(found);
        }
Esempio n. 3
0
        protected void _moveCellOutOfSight(CCTableViewCell cell)
        {
            m_pCellsFreed.Add(cell);
            m_pCellsUsed.RemoveSortedObject(cell);
            m_pIndices.Remove(cell.Index);
            cell.Reset();

            if (cell.Parent == Container)
            {
                Container.RemoveChild(cell, true);
            }
        }
Esempio n. 4
0
        protected void _addCellIfNecessary(CCTableViewCell cell)
        {
            if (cell.Parent != Container)
            {
                Container.AddChild(cell);
            }
            m_pCellsUsed.InsertSortedObject(cell);

            if (!m_pIndices.Contains(cell.Index))
            {
                m_pIndices.Add(cell.Index);
            }
        }
Esempio n. 5
0
        public override void TouchMoved(CCTouch touch, CCEvent pEvent)
        {
            base.TouchMoved(touch, pEvent);

            if (m_pTouchedCell != null && IsTouchMoved)
            {
                if (m_pTableViewDelegate != null)
                {
                    m_pTableViewDelegate.TableCellUnhighlight(this, m_pTouchedCell);
                }

                m_pTouchedCell = null;
            }
        }
Esempio n. 6
0
        public override void TouchMoved(CCTouch touch)
        {
            base.TouchMoved(touch);

            if (_touchedCell != null && IsTouchMoved)
            {
                if (_tableViewDelegate != null)
                {
                    _tableViewDelegate.TableCellUnhighlight(this, _touchedCell);
                }

                _touchedCell = null;
            }
        }
Esempio n. 7
0
        public override void TouchCancelled(CCTouch touch)
        {
            base.TouchCancelled(touch);

            if (m_pTouchedCell != null)
            {
                if (m_pTableViewDelegate != null)
                {
                    m_pTableViewDelegate.TableCellUnhighlight(this, m_pTouchedCell);
                }

                m_pTouchedCell = null;
            }
        }
Esempio n. 8
0
        protected void _moveCellOutOfSight(CCTableViewCell cell)
        {
            if (m_pTableViewDelegate != null)
            {
                m_pTableViewDelegate.TableCellWillRecycle(this, cell);
            }

            m_pCellsFreed.Add(cell);
            m_pCellsUsed.RemoveSortedObject(cell);
            m_pIndices.Remove(cell.Index);
            cell.Reset();
            if (cell.Parent == Container)
            {
                Container.RemoveChild(cell, true);
            }
        }
Esempio n. 9
0
        public override bool TouchBegan(CCTouch pTouch)
        {
            if (!Visible)
            {
                return(false);
            }

            bool touchResult = base.TouchBegan(pTouch);

            if (m_pTouches.Count == 1)
            {
                var point = Container.ConvertTouchToNodeSpace(pTouch);
                var index = _indexFromOffset(point);
                if (index == CCArrayForObjectSorting.CC_INVALID_INDEX)
                {
                    m_pTouchedCell = null;
                }
                else
                {
                    m_pTouchedCell = CellAtIndex(index);
                }

                if (m_pTouchedCell != null && m_pTableViewDelegate != null)
                {
                    m_pTableViewDelegate.TableCellHighlight(this, m_pTouchedCell);
                }
            }
            else if (m_pTouchedCell != null)
            {
                if (m_pTableViewDelegate != null)
                {
                    m_pTableViewDelegate.TableCellUnhighlight(this, m_pTouchedCell);
                }

                m_pTouchedCell = null;
            }

            return(touchResult);
        }
Esempio n. 10
0
        public override void TouchEnded(CCTouch pTouch)
        {
            if (!Visible)
            {
                return;
            }

            if (m_pTouchedCell != null)
            {
                CCRect bb = BoundingBox;
                bb.Origin = Parent.ConvertToWorldSpace(bb.Origin);

                if (bb.ContainsPoint(pTouch.Location) && m_pTableViewDelegate != null)
                {
                    m_pTableViewDelegate.TableCellUnhighlight(this, m_pTouchedCell);
                    m_pTableViewDelegate.TableCellTouched(this, m_pTouchedCell);
                }

                m_pTouchedCell = null;
            }

            base.TouchEnded(pTouch);
        }
Esempio n. 11
0
        /**
         * Updates the content of the cell at a given index.
         *
         * @param idx index to find a cell
         */

        public void UpdateCellAtIndex(int idx)
        {
            if (idx == CCArrayForObjectSorting.CC_INVALID_INDEX)
            {
                return;
            }

            var uCountOfItems = m_pDataSource.NumberOfCellsInTableView(this);

            if (uCountOfItems == 0 || idx > uCountOfItems - 1)
            {
                return;
            }

            CCTableViewCell cell = _cellWithIndex(idx);

            if (cell != null)
            {
                _moveCellOutOfSight(cell);
            }
            cell = m_pDataSource.TableCellAtIndex(this, idx);
            _setIndexForCell(idx, cell);
            _addCellIfNecessary(cell);
        }
Esempio n. 12
0
        public override void TouchEnded(CCTouch pTouch)
        {
            if (!Visible)
            {
                return;
            }

            if (m_pTouchedCell != null)
            {
                CCRect bb = BoundingBox;
                bb.Origin = Parent.ConvertToWorldSpace(bb.Origin);

                if (bb.ContainsPoint(pTouch.Location) && m_pTableViewDelegate != null)
                {
                    m_pTableViewDelegate.TableCellUnhighlight(this, m_pTouchedCell);
                    m_pTableViewDelegate.TableCellTouched(this, m_pTouchedCell);
                }

                m_pTouchedCell = null;
            }

            base.TouchEnded(pTouch);
        }
Esempio n. 13
0
 public void TableCellUnhighlight(CCTableView table, CCTableViewCell cell)
 {
 }
Esempio n. 14
0
        protected void _moveCellOutOfSight(CCTableViewCell cell)
        {
            m_pCellsFreed.Add(cell);
            m_pCellsUsed.RemoveSortedObject(cell);
            m_pIndices.Remove(cell.Index);
            cell.Reset();

            if (cell.Parent == Container)
            {
                Container.RemoveChild(cell, true);
            }
        }
Esempio n. 15
0
 public void TableCellWillRecycle(CCTableView table, CCTableViewCell cell)
 {
 }
Esempio n. 16
0
 protected void _setIndexForCell(int index, CCTableViewCell cell)
 {
     cell.AnchorPoint = CCPoint.Zero;
     cell.Position    = _offsetFromIndex(index);
     cell.Index       = index;
 }
Esempio n. 17
0
 protected void _addCellIfNecessary(CCTableViewCell cell)
 {
     if (cell.Parent != Container)
     {
         Container.AddChild(cell);
     }
     m_pCellsUsed.InsertSortedObject(cell);
     m_pIndices.Add(cell.Index);
 }
Esempio n. 18
0
        public override void TouchMoved(CCTouch touch)
        {
            base.TouchMoved(touch);

            if (_touchedCell != null && IsTouchMoved)
            {
                if (_tableViewDelegate != null)
                {
                    _tableViewDelegate.TableCellUnhighlight(this, _touchedCell);
                }

                _touchedCell = null;
            }
        }
Esempio n. 19
0
        protected void _moveCellOutOfSight(CCTableViewCell cell)
        {
            if (m_pTableViewDelegate != null)
            {
                m_pTableViewDelegate.TableCellWillRecycle(this, cell);
            }

            m_pCellsFreed.Add(cell);
            m_pCellsUsed.RemoveSortedObject(cell);
            m_pIndices.Remove(cell.Index);
            cell.Reset();
            if (cell.Parent == Container)
            {
                Container.RemoveChild(cell, true);
            }
        }
		public virtual void TableCellTouched(CCTableView table, CCTableViewCell cell)
		{
            CCLog.Log("cell touched at index: {0}", cell.Index);
		}
Esempio n. 21
0
        public override void TouchCancelled(CCTouch touch)
        {
            base.TouchCancelled(touch);

            if (m_pTouchedCell != null)
            {
                if (m_pTableViewDelegate != null)
                {
                    m_pTableViewDelegate.TableCellUnhighlight(this, m_pTouchedCell);
                }

                m_pTouchedCell = null;
            }
        }
Esempio n. 22
0
        public override bool TouchBegan(CCTouch pTouch)
        {
            if (!Visible)
            {
                return false;
            }
            
            bool touchResult = base.TouchBegan(pTouch);

            if (m_pTouches.Count == 1)
            {
                var point = Container.ConvertTouchToNodeSpace(pTouch);
                var index = _indexFromOffset(point);
                if (index == CCArrayForObjectSorting.CC_INVALID_INDEX)
                {
                    m_pTouchedCell = null;
                }
                else
                {
                    m_pTouchedCell = CellAtIndex(index); 
                }

                if (m_pTouchedCell != null && m_pTableViewDelegate != null)
                {
                    m_pTableViewDelegate.TableCellHighlight(this, m_pTouchedCell);
                }
            }
            else if (m_pTouchedCell != null)
            {
                if (m_pTableViewDelegate != null)
                {
                    m_pTableViewDelegate.TableCellUnhighlight(this, m_pTouchedCell);
                }

                m_pTouchedCell = null;
            }

            return touchResult;
        }
Esempio n. 23
0
 protected void _setIndexForCell(int index, CCTableViewCell cell)
 {
     cell.AnchorPoint = CCPoint.Zero;
     cell.Position = _offsetFromIndex(index);
     cell.Index = index;
 }