Example #1
0
        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 if (cell is IRadioButtonCellViewFrontend)
            {
                cr = new RadioButtonTableCell();
            }
            else
            {
                throw new NotImplementedException();
            }
            cr.Backend = new CellViewBackend(table, column);
            ICellViewFrontend fr = cell;

            fr.AttachBackend(null, cr.Backend);
            return((NSCell)cr);
        }
Example #2
0
        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);
        }