public static NSCell CreateCell (ApplicationContext context, NSTableView table, ICellSource source, ICollection<CellView> cells, int column) { CompositeCell c = new CompositeCell (context, Orientation.Horizontal, source); foreach (var cell in cells) c.AddCell ((ICellRenderer) CreateCell (table, c, cell, column)); return c; }
public void UpdateColumn(ListViewColumn col) { Editable = true; var hc = new NSTableHeaderCell { Title = col.Title ?? string.Empty }; HeaderCell = hc; HeaderCell.Alignment = col.Alignment.ToNSTextAlignment(); DataView = CellUtil.CreateCellView(context, backend, col.Views, backend.Columns.IndexOf(this)); DataView.Identifier = Identifier; UpdateCachedViews(col.Views); if (col.CanResize) { ResizingMask |= NSTableColumnResizing.UserResizingMask; } else { ResizingMask &= ~NSTableColumnResizing.UserResizingMask; } if (col.Expands) { ResizingMask |= NSTableColumnResizing.Autoresizing; } else { ResizingMask &= ~NSTableColumnResizing.Autoresizing; } SizeToFit(); TableView?.InvalidateIntrinsicContentSize(); }
static NSCell CreateCell(NSTableView table, CompositeCell source, 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 { throw new NotImplementedException(); } cr.Backend = new CellViewBackend(table, column); ICellViewFrontend fr = cell; fr.AttachBackend(null, cr.Backend); return((NSCell)cr); }
public override nfloat GetSizeToFitColumnWidth(NSOutlineView outlineView, nint column) { var tableColumn = Backend.Columns[(int)column] as TableColumn; var width = tableColumn.HeaderCell.CellSize.Width; CompositeCell templateCell = null; for (int i = 0; i < outlineView.RowCount; i++) { var cellView = outlineView.GetView(column, i, false) as CompositeCell; if (cellView == null) // use template for invisible rows { cellView = templateCell ?? (templateCell = (tableColumn as TableColumn)?.DataView?.Copy() as CompositeCell); if (cellView != null) { cellView.ObjectValue = outlineView.ItemAtRow(i); } } if (cellView != null) { if (column == 0) // first column contains expanders { width = (nfloat)Math.Max(width, cellView.Frame.X + cellView.FittingSize.Width); } else { width = (nfloat)Math.Max(width, cellView.FittingSize.Width); } } } return(width); }
public static NSCell CreateCell(ICellSource source, ICollection<CellView> cells) { CompositeCell c = new CompositeCell (Orientation.Horizontal, source); foreach (var cell in cells) c.AddCell ((ICellRenderer) CreateCell (c, cell)); return c; }
public static void UpdateCellView(CompositeCell cellView, NSTableView table, ICollection <CellView> cells, int column) { cellView.ClearCells(); foreach (var cell in cells) { cellView.AddCell((ICellRenderer)CreateCellView(table, cell, column)); } }
public static CompositeCell CreateCellView(ApplicationContext context, NSTableView table, ICellSource source, ICollection <CellView> cells, int column) { CompositeCell c = new CompositeCell(context, source); foreach (var cell in cells) { c.AddCell((ICellRenderer)CreateCellView(table, cell, column)); } return(c); }
public static NSCell CreateCell(ICellSource source, ICollection <CellView> cells) { CompositeCell c = new CompositeCell(Orientation.Horizontal, source); foreach (var cell in cells) { c.AddCell((ICellRenderer)CreateCell(c, cell)); } return(c); }
public static NSCell CreateCell(NSTableView table, ICellSource source, ICollection <CellView> cells, int column) { CompositeCell c = new CompositeCell(Orientation.Horizontal, source); foreach (var cell in cells) { c.AddCell((ICellRenderer)CreateCell(table, c, cell, column)); } return(c); }
public static NSCell CreateCell(ICellSource source, ICollection<CellView> cells) { // if (cells.Count > 1) { CompositeCell c = new CompositeCell (Orientation.Horizontal, source); foreach (var cell in cells) c.AddCell ((ICellRenderer) CreateCell (source, cell)); return c; // } else // return CreateCell (source, cells.First ()); }
static NSCell CreateCell(CompositeCell source, CellView cell) { if (cell is ITextCellViewFrontend) return new TextTableCell ((ITextCellViewFrontend) cell); if (cell is IImageCellViewFrontend) return new ImageTableCell ((IImageCellViewFrontend) cell); if (cell is ICanvasCellViewFrontend) return new CanvasTableCell ((ICanvasCellViewFrontend) cell); if (cell is ICheckBoxCellViewFrontend) return new CheckBoxTableCell ((ICheckBoxCellViewFrontend) cell); throw new NotImplementedException (); }
public static NSCell CreateCell(ICellSource source, ICollection <CellView> cells) { // if (cells.Count > 1) { CompositeCell c = new CompositeCell(Orientation.Horizontal, source); foreach (var cell in cells) { c.AddCell((ICellRenderer)CreateCell(source, cell)); } return(c); // } else // return CreateCell (source, cells.First ()); }
public void UpdateColumn(ListViewColumn col, ListViewColumnChange change) { if (TableView == null) { throw new InvalidOperationException("Add the column to a table first"); } switch (change) { case ListViewColumnChange.CanResize: if (col.CanResize) { ResizingMask |= NSTableColumnResizing.UserResizingMask; } else { ResizingMask &= ~NSTableColumnResizing.UserResizingMask; } break; case ListViewColumnChange.Expanding: if (col.Expands) { ResizingMask |= NSTableColumnResizing.Autoresizing; } else { ResizingMask &= ~NSTableColumnResizing.Autoresizing; } break; case ListViewColumnChange.Cells: DataView = CellUtil.CreateCellView(context, backend, col.Views, backend.Columns.IndexOf(this)); DataView.Identifier = Identifier; UpdateCachedViews(col.Views); TableView.ReloadData(); break; case ListViewColumnChange.Title: HeaderCell.Title = col.Title ?? string.Empty; if (!col.CanResize) { SizeToFit(); } break; case ListViewColumnChange.Alignment: HeaderCell.Alignment = col.Alignment.ToNSTextAlignment(); break; } }
static NSCell CreateCell (NSTableView table, CompositeCell source, 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 throw new NotImplementedException (); cr.Backend = new CellViewBackend (table, column); ICellViewFrontend fr = cell; fr.AttachBackend (null, cr.Backend); return (NSCell)cr; }
static NSCell CreateCell(CompositeCell source, CellView cell) { if (cell is ITextCellViewFrontend) { return(new TextTableCell((ITextCellViewFrontend)cell)); } if (cell is IImageCellViewFrontend) { return(new ImageTableCell((IImageCellViewFrontend)cell)); } if (cell is ICanvasCellViewFrontend) { return(new CanvasTableCell((ICanvasCellViewFrontend)cell)); } if (cell is ICheckBoxCellViewFrontend) { return(new CheckBoxTableCell((ICheckBoxCellViewFrontend)cell)); } throw new NotImplementedException(); }
public override nfloat GetSizeToFitColumnWidth(NSTableView tableView, nint column) { var tableColumn = Backend.Columns[(int)column] as TableColumn; var width = tableColumn.HeaderCell.CellSize.Width; CompositeCell templateCell = null; for (int i = 0; i < tableView.RowCount; i++) { var cellView = tableView.GetView(column, i, false) as CompositeCell; if (cellView == null) // use template for invisible rows { cellView = templateCell ?? (templateCell = (tableColumn as TableColumn)?.DataView?.Copy() as CompositeCell); if (cellView != null) { cellView.ObjectValue = NSNumber.FromInt32(i); } } width = (nfloat)Math.Max(width, cellView.FittingSize.Width); } return(width); }
nfloat CalcRowHeight(nint row, bool tryReuse = true) { updatingRowHeight = true; var height = Table.RowHeight; for (int i = 0; i < Columns.Count; i++) { CompositeCell cell = tryReuse ? Table.GetView(i, row, false) as CompositeCell : null; if (cell == null) { cell = (Columns [i] as TableColumn)?.DataView as CompositeCell; } if (cell != null) { cell.ObjectValue = NSNumber.FromNInt(row); height = (nfloat)Math.Max(height, cell.FittingSize.Height); } } updatingRowHeight = false; return(height); }
nfloat CalcRowHeight(TreeItem pos, bool tryReuse = true) { updatingRowHeight = true; var height = Table.RowHeight; var row = Tree.RowForItem(pos); for (int i = 0; i < Columns.Count; i++) { CompositeCell cell = tryReuse ? Tree.GetView(i, row, false) as CompositeCell : null; if (cell == null) { cell = (Columns [i] as TableColumn)?.DataView as CompositeCell; } if (cell != null) { cell.ObjectValue = pos; height = (nfloat)Math.Max(height, cell.FittingSize.Height); } } updatingRowHeight = false; return(height); }