Exemplo n.º 1
0
        public override NSObject GetObjectValue(NSTableView tableView, NSTableColumn tableColumn, int row)
        {
            NSTableColumn[] cols = tableView.TableColumns();
            int idx = cols.ToList().FindIndex(t => t.HeaderCell.StringValue == tableColumn.HeaderCell.StringValue);

            switch(idx)
            {
                case (int)TableLocation.AV:
                    return new NSString(Rows[row][idx].ToString());
                case (int)TableLocation.TV:
                    return new NSString(Rows[row][idx].ToString());
                case (int)TableLocation.ISO:
                    return new NSString(Rows[row][idx].ToString());
                case (int)TableLocation.Keyframe:
                    return NSObject.FromObject(((bool)(Rows[row][idx])) ? NSCellStateValue.On : NSCellStateValue.Off);
                case (int)TableLocation.Filename:
                    return new NSString(Rows[row][idx].ToString());
                case (int)TableLocation.Nr:
                    return new NSString(Rows[row][idx].ToString());
                case (int)TableLocation.Brightness:
                    return new NSString(Rows[row][idx].ToString());

                default:
                    return new NSString("N/A");
            }
        }
Exemplo n.º 2
0
 public override void SetObjectValue(NSTableView tableView, NSObject theObject, NSTableColumn tableColumn, int row)
 {
     NSTableColumn[] cols = tableView.TableColumns();
     int idx = cols.ToList().FindIndex(t => t.HeaderCell.StringValue == tableColumn.HeaderCell.StringValue);
     if (idx == (int)TableLocation.Brightness && BrightnessCellEdited != null) BrightnessCellEdited(row, theObject.ToString());
 }
Exemplo n.º 3
0
        private void SetTableColumns(NSTableView tableView)
        {
            // Always keep at least one column
            int numColumns = (int) (tableView.EnclosingScrollView.Frame.Width / maxColumnWidth);
            if (numColumns < 1)
            {
                numColumns = 1;
            }

            int existingColumnCount = tableView.TableColumns().Count();
            if (numColumns > existingColumnCount)
            {
                logger.Info("Add columns; {0} to {1}", existingColumnCount, numColumns);
                while (tableView.TableColumns().Count() < numColumns)
                {
                    var copy =  new NSTableColumn();
                    copy.Width = copy.MaxWidth = maxColumnWidth;

                    NSTableColumn column = tableView.TableColumns().First();
                    copy.DataCell = (NSCell) column.DataCell.Copy();
                    tableView.AddColumn(copy);
                }
                tableView.ReloadData();
            }
            else
            if (numColumns < existingColumnCount)
            {
                logger.Info("Remove columns; {0} to {1}", existingColumnCount, numColumns);
                while (tableView.TableColumns().Count() > numColumns)
                {
                    tableView.RemoveColumn(tableView.TableColumns().Last());
                }
                tableView.ReloadData();
            }
        }
Exemplo n.º 4
0
 private int ColumnIndex(NSTableView table, NSTableColumn column)
 {
     var tableColumns = table.TableColumns();
     for (int idx = 0; idx < tableColumns.Length; ++idx)
     {
         if (tableColumns[idx] == column)
         {
             return idx;
         }
     }
     return -1;
 }