Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
		public virtual NSTableColumn AddColumn (ListViewColumn col)
		{
			var tcol = new NSTableColumn ();
			tcol.Editable = true;
			cols.Add (tcol);
			var c = CellUtil.CreateCell (ApplicationContext, Table, this, col.Views, cols.Count - 1);
			tcol.DataCell = c;
			Table.AddColumn (tcol);
			var hc = new NSTableHeaderCell ();
			hc.Title = col.Title ?? "";
			tcol.HeaderCell = hc;
			Widget.InvalidateIntrinsicContentSize ();
			return tcol;
		}
Exemplo n.º 3
0
        public virtual object AddColumn(ListViewColumn col)
        {
            var tcol = new NSTableColumn();

            cols.Add(tcol);
            var c = CellUtil.CreateCell(this, col.Views);

            tcol.DataCell = c;
            Table.AddColumn(tcol);
            var hc = new NSTableHeaderCell();

            hc.Title        = col.Title;
            tcol.HeaderCell = hc;
            return(tcol);
        }
Exemplo n.º 4
0
        public virtual object AddColumn(ListViewColumn col)
        {
            var tcol = new NSTableColumn();

            cols.Add(tcol);
            var c = CellUtil.CreateCell(this, col.Views);

            tcol.DataCell = c;
            Table.AddColumn(tcol);
            var hc = new NSTableHeaderCell();

            hc.Title        = col.Title ?? "";
            tcol.HeaderCell = hc;
            Widget.InvalidateIntrinsicContentSize();
            return(tcol);
        }
Exemplo n.º 5
0
        public void UpdateColumn(ListViewColumn col, object handle, ListViewColumnChange change)
        {
            NSTableColumn tcol = (NSTableColumn)handle;

            switch (change)
            {
            case ListViewColumnChange.CanResize:
                if (col.CanResize)
                {
                    tcol.ResizingMask |= NSTableColumnResizing.UserResizingMask;
                }
                else
                {
                    tcol.ResizingMask &= ~NSTableColumnResizing.UserResizingMask;
                }
                break;

            case ListViewColumnChange.Expanding:
                if (col.Expands)
                {
                    tcol.ResizingMask |= NSTableColumnResizing.Autoresizing;
                }
                else
                {
                    tcol.ResizingMask &= ~NSTableColumnResizing.Autoresizing;
                }
                break;

            case ListViewColumnChange.Cells:
                var c = CellUtil.CreateCell(ApplicationContext, Table, this, col.Views, cols.IndexOf(tcol));
                c.Alignment   = col.Alignment.ToNSTextAlignment();
                tcol.DataCell = c;
                break;

            case ListViewColumnChange.Title:
                tcol.HeaderCell.Title = col.Title ?? string.Empty;
                if (!col.CanResize)
                {
                    tcol.SizeToFit();
                }
                break;

            case ListViewColumnChange.Alignment:
                tcol.HeaderCell.Alignment = col.Alignment.ToNSTextAlignment();
                break;
            }
        }
Exemplo n.º 6
0
        public virtual NSTableColumn AddColumn(ListViewColumn col)
        {
            var tcol = new NSTableColumn();

            tcol.Editable = true;
            cols.Add(tcol);
            var c = CellUtil.CreateCell(ApplicationContext, Table, this, col.Views, cols.Count - 1);

            tcol.DataCell = c;
            Table.AddColumn(tcol);
            var hc = new NSTableHeaderCell();

            hc.Title                  = col.Title ?? "";
            tcol.HeaderCell           = hc;
            tcol.HeaderCell.Alignment = col.Alignment.ToNSTextAlignment();
            tcol.ResizingMask         = col.CanResize ? NSTableColumnResizing.UserResizingMask : NSTableColumnResizing.Autoresizing;
            tcol.SizeToFit();
            Widget.InvalidateIntrinsicContentSize();
            return(tcol);
        }
Exemplo n.º 7
0
        void UpdateCachedViews(ICollection <CellView> cells)
        {
            if (CachedViews.Count == 0)
            {
                return;
            }
            var col = backend.Columns.IndexOf(this);

            foreach (var cached in CachedViews)
            {
                // update only the alive and not disposed views
                if (cached.IsAlive)
                {
                    var view = cached.Target as CompositeCell;
                    if (view?.IsDisposed == false)
                    {
                        CellUtil.UpdateCellView(view, backend, cells, col);
                    }
                }
            }

            CleanViewCache();
        }
Exemplo n.º 8
0
        public void UpdateColumn(ListViewColumn col, object handle, ListViewColumnChange change)
        {
            NSTableColumn tcol = (NSTableColumn)handle;

            tcol.DataCell = CellUtil.CreateCell(this, col.Views);
        }
Exemplo n.º 9
0
        public void UpdateColumn(ListViewColumn col, object handle, ListViewColumnChange change)
        {
            NSTableColumn tcol = (NSTableColumn)handle;

            tcol.DataCell = CellUtil.CreateCell(ApplicationContext, Table, this, col.Views, cols.IndexOf(tcol));
        }