Example #1
0
 public TableColumn(ApplicationContext context, ICellSource backend, NSTableView table)
 {
     this.context = context;
     Identifier   = GetHashCode().ToString();             // this is used to identify cached views
     this.backend = backend;
     TableView    = table;
 }
Example #2
0
 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;
 }
Example #3
0
        void ICopiableObject.CopyFrom(object other)
        {
            var ob = (CompositeCell)other;

            if (ob.source == null)
            {
                throw new ArgumentException("Cannot copy from a CompositeCell with a null `source`");
            }
            context       = ob.context;
            source        = ob.source;
            val           = ob.val;
            tablePosition = ob.tablePosition;
            direction     = ob.direction;
            trackingCell  = ob.trackingCell;
            cells         = new List <ICellRenderer> ();
            foreach (var c in ob.cells)
            {
                var copy = (ICellRenderer)Activator.CreateInstance(c.GetType());
                copy.CopyFrom(c);
                AddCell(copy);
            }
            if (tablePosition != null)
            {
                Fill();
            }
        }
Example #4
0
		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;
		}
Example #5
0
		public CompositeCell (ApplicationContext context, Orientation dir, ICellSource source)
		{
			if (source == null)
				throw new ArgumentNullException ("source");
			direction = dir;
			this.context = context;
			this.source = source;
		}
Example #6
0
 public static void UpdateCellView(CompositeCell cellView, ICellSource source, ICollection <CellView> cells, int column)
 {
     cellView.ClearCells();
     foreach (var cell in cells)
     {
         cellView.AddCell((ICellRenderer)CreateCellView(source, cell, column));
     }
 }
Example #7
0
 public static NSCell CreateCell(ICellSource source, CellView cell)
 {
     if (cell is TextCellView)
         return new TextTableCell ((TextCellView) cell);
     if (cell is ImageCellView)
         return new ImageTableCell ((ImageCellView) cell);
     throw new NotImplementedException ();
 }
Example #8
0
 public CompositeCell(ApplicationContext context, ICellSource source)
 {
     if (source == null)
     {
         throw new ArgumentNullException(nameof(source));
     }
     this.context = context;
     this.source  = source;
 }
Example #9
0
        public void Fill(ICellSource source, object pos)
        {
            Image img = (Image)source.GetValue(pos, cellView.ImageField.Index);

            if (img != null)
            {
                ObjectValue = (NSImage)WidgetRegistry.GetBackend(img);
            }
        }
Example #10
0
        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);
        }
Example #11
0
 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 ());
 }
Example #12
0
        public static CompositeCell CreateCellView(ApplicationContext context, ICellSource source, ICollection <CellView> cells, int column)
        {
            CompositeCell c = new CompositeCell(context, source);

            foreach (var cell in cells)
            {
                c.AddCell((ICellRenderer)CreateCellView(source, cell, column));
            }
            return(c);
        }
Example #13
0
 public CompositeCell(ApplicationContext context, Orientation dir, ICellSource source)
 {
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     direction    = dir;
     this.context = context;
     this.source  = source;
 }
Example #14
0
        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);
        }
Example #15
0
 public static NSCell CreateCell(ICellSource source, CellView cell)
 {
     if (cell is TextCellView)
     {
         return(new TextTableCell((TextCellView)cell));
     }
     if (cell is ImageCellView)
     {
         return(new ImageTableCell((ImageCellView)cell));
     }
     throw new NotImplementedException();
 }
Example #16
0
        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 ());
        }
Example #17
0
        static NSView CreateCellView(ICellSource 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();
            }
            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(source.TableView, column);
                fr.AttachBackend((source as ViewBackend).Frontend, cr.Backend);
            }
            else
            {
                cr.Backend = backend;
            }
            return((NSView)cr);
        }
Example #18
0
		void ICopiableObject.CopyFrom (object other)
		{
			var ob = (CompositeCell)other;
			context = ob.context;
			source = ob.source;
			val = ob.val;
			tablePosition = ob.tablePosition;
			direction = ob.direction;
			trackingCell = ob.trackingCell;
			cells = new List<ICellRenderer> ();
			foreach (var c in ob.cells) {
				var copy = (ICellRenderer) Activator.CreateInstance (c.GetType ());
				copy.CopyFrom (c);
				AddCell (copy);
			}
			if (tablePosition != null)
				Fill ();
		}
Example #19
0
        void ICopiableObject.CopyFrom(object other)
        {
            var ob = (CompositeCell)other;

            source        = ob.source;
            val           = ob.val;
            tablePosition = ob.tablePosition;
            direction     = ob.direction;
            trackingCell  = ob.trackingCell;
            cells         = new List <ICellRenderer> ();
            foreach (var c in ob.cells)
            {
                var copy = (ICellRenderer)Activator.CreateInstance(c.GetType());
                copy.CopyFrom(c);
                AddCell(copy);
            }
            if (tablePosition != null)
            {
                Fill();
            }
        }
Example #20
0
 public void Fill(ICellSource source, object pos)
 {
     Image img = (Image) source.GetValue (pos, cellView.ImageField.Index);
     if (img != null)
         ObjectValue = (NSImage) WidgetRegistry.GetBackend (img);
 }
Example #21
0
 public CompositeCell(Orientation dir, ICellSource source)
 {
     direction = dir;
     this.source = source;
 }
Example #22
0
 public CompositeCell(ApplicationContext context, Orientation dir, ICellSource source)
 {
     direction = dir;
     this.context = context;
     this.source = source;
 }
Example #23
0
 public void Fill(ICellSource source, object pos)
 {
     StringValue = (string) source.GetValue (pos, cellView.TextField.Index) ?? "";
 }
Example #24
0
 public CompositeCell(Orientation dir, ICellSource source)
 {
     direction   = dir;
     this.source = source;
 }
Example #25
0
 public CompositeCell(ApplicationContext context, Orientation dir, ICellSource source)
 {
     direction    = dir;
     this.context = context;
     this.source  = source;
 }
Example #26
0
 public void Fill(ICellSource source, object pos)
 {
     StringValue = (string)source.GetValue(pos, cellView.TextField.Index) ?? "";
 }