public Rectangle GetCellBounds (int row, CellView cell, bool includeMargin) { var cellBackend = cell.GetBackend () as CellViewBackend; var r = Table.GetCellFrame (cellBackend.Column, row); var container = Table.GetCell (cellBackend.Column, row) as CompositeCell; r = container.GetCellRect (r, (NSCell)cellBackend.CurrentCell); r.Y -= scroll.DocumentVisibleRect.Y; r.X -= scroll.DocumentVisibleRect.X; if (HeadersVisible) r.Y += Table.HeaderView.Frame.Height; return new Rectangle (r.X, r.Y, r.Width, r.Height); }
static NSView CreateCellView(NSTableView table, CellView cell, int column) { ICellRenderer cr = null; if (cell is ITextCellViewFrontend) { cr = new TextTableCell(); } else if (cell is IImageCellViewFrontend) { cr = new ImageTableCell(); } else if (cell is ICanvasCellViewFrontend) { cr = new CanvasTableCell(); } else if (cell is ICheckBoxCellViewFrontend) { cr = new CheckBoxTableCell(); } else if (cell is IRadioButtonCellViewFrontend) { cr = new RadioButtonTableCell(); } else { throw new NotImplementedException(); } ICellViewFrontend fr = cell; CellViewBackend backend = null; try { //FIXME: although the cell views are based on XwtComponent, they don't implement // the dynamic registration based backend creation and there is no way to // identify whether the frontend has already a valid backend. backend = cell.GetBackend() as CellViewBackend; } catch (InvalidOperationException) { } if (backend == null) { cr.Backend = new CellViewBackend(table, column); fr.AttachBackend(null, cr.Backend); } else { cr.Backend = backend; } return((NSView)cr); }
public Rectangle GetCellBounds(int row, CellView cell, bool includeMargin) { var rect = Rectangle.Zero; var cellBackend = cell.GetBackend() as CellViewBackend; var container = Table.GetView(cellBackend.Column, row, false) as CompositeCell; if (container != null) { var cellView = container.GetCellViewForBackend(cellBackend); rect = cellView.ConvertRectToView(new CGRect(CGPoint.Empty, cellView.Frame.Size), Table).ToXwtRect(); rect.Y -= scroll.DocumentVisibleRect.Y; rect.X -= scroll.DocumentVisibleRect.X; } return(rect); }