示例#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;
 }
示例#2
0
文件: CellUtil.cs 项目: nite2006/xwt
 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;
 }
示例#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();
            }
        }
示例#4
0
文件: CellUtil.cs 项目: StEvUgnIn/xwt
		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;
		}
示例#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;
		}
示例#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));
     }
 }
示例#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 ();
 }
示例#8
0
 public CompositeCell(ApplicationContext context, ICellSource source)
 {
     if (source == null)
     {
         throw new ArgumentNullException(nameof(source));
     }
     this.context = context;
     this.source  = source;
 }
示例#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);
            }
        }
示例#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);
        }
示例#11
0
文件: CellUtil.cs 项目: Gaushick/xwt
 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 ());
 }
示例#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);
        }
示例#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;
 }
示例#14
0
文件: CellUtil.cs 项目: wesreid/xwt
        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);
        }
示例#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();
 }
示例#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 ());
        }
示例#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);
        }
示例#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 ();
		}
示例#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();
            }
        }
示例#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);
 }
示例#21
0
 public CompositeCell(Orientation dir, ICellSource source)
 {
     direction = dir;
     this.source = source;
 }
示例#22
0
 public CompositeCell(ApplicationContext context, Orientation dir, ICellSource source)
 {
     direction = dir;
     this.context = context;
     this.source = source;
 }
示例#23
0
 public void Fill(ICellSource source, object pos)
 {
     StringValue = (string) source.GetValue (pos, cellView.TextField.Index) ?? "";
 }
示例#24
0
 public CompositeCell(Orientation dir, ICellSource source)
 {
     direction   = dir;
     this.source = source;
 }
示例#25
0
 public CompositeCell(ApplicationContext context, Orientation dir, ICellSource source)
 {
     direction    = dir;
     this.context = context;
     this.source  = source;
 }
示例#26
0
 public void Fill(ICellSource source, object pos)
 {
     StringValue = (string)source.GetValue(pos, cellView.TextField.Index) ?? "";
 }