예제 #1
0
        public override nfloat GetPreferredSize(object value, CGSize cellSize, NSCell cell)
        {
            cell.ObjectValue = value as NSObject;
            var size = cell.CellSizeForBounds(new CGRect(0, 0, nfloat.MaxValue, cellSize.Height)).Width;

            return(size);
        }
예제 #2
0
        public override nfloat GetRowHeight(NSTableView tableView, nint row)
        {
            var cell = new NSCell(source.entries[(int)row].details)
            {
                Wraps = true
            };
            var width  = tableView.FindTableColumn((NSString)"Details").Width;
            var bounds = new CGRect(0, 0, width, nfloat.MaxValue);

            return(cell.CellSizeForBounds(bounds).Height);
        }
예제 #3
0
            public void TableWillDisplayCellForTableColumn(NSTableView tableView, NSCell cell, NSTableColumn tableColumn, nint rowIndex)
            {
                // check if anything is null first
                if (ControlView == null || ControlView.Window == null || ControlView.Window.Screen == null || tableView.Window == null)
                {
                    return;
                }
                // hack (using public api's) to set size of popup to at least show this item's entire text.
                var size   = cell.CellSizeForBounds(ControlView.Window.Screen.VisibleFrame);
                var window = tableView.Window;
                var frame  = window.Frame;

                size.Width += frame.Width - tableView.Frame.Width;
                if (frame.Width < size.Width)
                {
                    frame.Width = size.Width;
                    window.SetFrame(frame, true);
                }
            }