protected CCTableViewCell _cellWithIndex(int cellIndex) { CCTableViewCell found = null; if (m_pIndices.Contains(cellIndex)) { found = (CCTableViewCell)m_pCellsUsed.ObjectWithObjectID(cellIndex); } return(found); }
/** * 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); }
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); } }
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); } }
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; } }
public override void TouchMoved(CCTouch touch) { base.TouchMoved(touch); if (_touchedCell != null && IsTouchMoved) { if (_tableViewDelegate != null) { _tableViewDelegate.TableCellUnhighlight(this, _touchedCell); } _touchedCell = null; } }
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; } }
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 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); }
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); }
/** * 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); }
public void TableCellUnhighlight(CCTableView table, CCTableViewCell cell) { }
public void TableCellWillRecycle(CCTableView table, CCTableViewCell cell) { }
protected void _setIndexForCell(int index, CCTableViewCell cell) { cell.AnchorPoint = CCPoint.Zero; cell.Position = _offsetFromIndex(index); cell.Index = index; }
protected void _addCellIfNecessary(CCTableViewCell cell) { if (cell.Parent != Container) { Container.AddChild(cell); } m_pCellsUsed.InsertSortedObject(cell); m_pIndices.Add(cell.Index); }
public virtual void TableCellTouched(CCTableView table, CCTableViewCell cell) { CCLog.Log("cell touched at index: {0}", cell.Index); }
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; }