public override NSView GetViewForItem (NSTableView tableView, NSTableColumn tableColumn, nint row) { int r = (int)row; if (tableColumn.Identifier == CellIdentifierApply) { //var v = (NSButton)tableView.MakeView (CellIdentifier, this); NSButton v = null; if (v == null) { v = new NSButton(); v.Title = string.Empty; v.SetButtonType(NSButtonType.Switch); if (_dataSource.Items[r].Apply) { v.State = NSCellStateValue.On; } else { v.State = NSCellStateValue.Off; } v.Activated += (object sender, EventArgs e) => { _dataSource.Items[r].Apply = v.State == NSCellStateValue.On; }; } return v; } // This pattern allows you reuse existing views when they are no-longer in use. // If the returned view is null, you instance up a new view // If a non-null view is returned, you modify it enough to reflect the new data NSTextField view = (NSTextField)tableView.MakeView (CellIdentifier, this); if (view == null) { view = new NSTextField (); view.Identifier = CellIdentifier; view.BackgroundColor = NSColor.Clear; view.Bordered = false; view.Selectable = false; view.Editable = false; } // Setup view based on the column selected switch (tableColumn.Identifier) { case CellIdentifierApply: view.StringValue = _dataSource.Items[r].Apply.ToString(); break; case CellIdentifierLineNumber: view.StringValue = _dataSource.Items[r].LineNumber; break; case CellIdentifierBefore: view.StringValue = _dataSource.Items[r].Before.ToListViewString(); break; case CellIdentifierAfter: view.StringValue = _dataSource.Items[r].After.ToListViewString(); break; } return view; }
public override NSView GetViewForItem (NSTableView tableView, NSTableColumn tableColumn, int row) { var product = WebService.Shared.CurrentOrder.Products [row]; ShoppingBasketTableViewCellController controller = new ShoppingBasketTableViewCellController (); controller.Product = product; return (ShoppingBasketTableViewCell)controller.View; }
public override NSObject GetObjectValue(NSTableView tableView, NSTableColumn tableColumn, int row) { AreaInfo a = Items[row]; if (tableColumn.Identifier == "List") { if(a.UserList == AreaInfo.UserListType.WhiteList) return NSImage.ImageNamed("blacklist_0.png"); else if(a.UserList == AreaInfo.UserListType.BlackList) return NSImage.ImageNamed("blacklist_1.png"); else return NSImage.ImageNamed("blacklist_2.png"); } else if (tableColumn.Identifier == "Flag") { return NSImage.ImageNamed("flag_" + a.Code.ToLowerInvariant() + ".png"); } else if (tableColumn.Identifier == "Name") { return new NSString (a.Name); } else if (tableColumn.Identifier == "Servers") { return new NSString (a.Servers.ToString()); } else if (tableColumn.Identifier == "LoadIcon") { return NSImage.ImageNamed("status_" + a.GetLoadColorForList().ToLowerInvariant() + ".png"); } else if (tableColumn.Identifier == "Load") { return new NSString (a.GetLoadForList()); } else if (tableColumn.Identifier == "Users") { return new NSString (a.Users.ToString()); } else throw new NotImplementedException (string.Format ("{0} is not recognized", tableColumn.Identifier)); }
public override NSObject GetObjectValue(NSTableView tableView, NSTableColumn tableColumn, int row) { // var valueKey = (string)(NSString)tableColumn.Identifier; // var dataRow = _profiles[row]; return null; }
// This sets up a NSOutlineView for demonstration internal static NSView SetupOutlineView (CGRect frame) { // Create our NSOutlineView and set it's frame to a reasonable size. It will be autosized via the NSClipView NSOutlineView outlineView = new NSOutlineView () { Frame = frame }; // Every NSOutlineView must have at least one column or your Delegate will not be called. NSTableColumn column = new NSTableColumn ("Values"); outlineView.AddColumn (column); // You must set OutlineTableColumn or the arrows showing children/expansion will not be drawn outlineView.OutlineTableColumn = column; // Setup the Delegate/DataSource instances to be interrogated for data and view information // In Unified, these take an interface instead of a base class and you can combine these into // one instance. outlineView.Delegate = new OutlineViewDelegate (); outlineView.DataSource = new OutlineViewDataSource (); // NSOutlineView expects to be hosted inside an NSClipView and won't draw correctly otherwise NSClipView clipView = new NSClipView (frame) { AutoresizingMask = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable }; clipView.DocumentView = outlineView; return clipView; }
public NSView GetViewForItem(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item) { var libraryBrowserItem = (LibraryBrowserItem)item; var view = (NSTableCellView)outlineView.MakeView("cellLibrary", this); view.TextField.Font = NSFont.FromFontName("Roboto", 11); view.TextField.StringValue = libraryBrowserItem.Entity.Title; switch (libraryBrowserItem.Entity.EntityType) { case LibraryBrowserEntityType.AllSongs: view.ImageView.Image = ImageResources.Images.FirstOrDefault(x => x.Name == "icon_artists"); break; case LibraryBrowserEntityType.Artists: view.ImageView.Image = ImageResources.Images.FirstOrDefault(x => x.Name == "icon_artists"); break; case LibraryBrowserEntityType.Album: case LibraryBrowserEntityType.Albums: case LibraryBrowserEntityType.ArtistAlbum: view.ImageView.Image = ImageResources.Images.FirstOrDefault(x => x.Name == "icon_vinyl"); break; case LibraryBrowserEntityType.Artist: view.ImageView.Image = ImageResources.Images.FirstOrDefault(x => x.Name == "icon_user"); break; } return view; }
public NSObject ObjectValueForTableColumn (NSTableView table, NSTableColumn col, int row) { try { if (Entries != null) { X509Certificate2 cert = Entries [row].Cert; switch (col.Identifier) { case "Alias": return (NSString)Entries [row].Alias; case VMIdentityConstants.CERT_ISSUED_BY: return (NSString)cert.Issuer; case VMIdentityConstants.CERT_ISSUED_DATE: return (NSString)cert.NotBefore.ToShortDateString (); case VMIdentityConstants.CERT_EXPIRATION_DATE: return (NSString)cert.NotAfter.ToShortDateString (); case VMIdentityConstants.CERT_INTENDED_PURPOSES: return (NSString)cert.GetKeyUsage (); case VMIdentityConstants.CERT_STATUS: break; case VMIdentityConstants.CERT_ISSUED_TO: return (NSString)cert.Subject; } } } catch (Exception e) { System.Diagnostics.Debug.WriteLine ("Error in fetching data : " + e.Message); } return null; }
public NSObject ObjectValueForTableColumn (NSTableView table, NSTableColumn col, int row) { var value = (NSString)string.Empty; ActionHelper.Execute (delegate() { if (Entries != null) { var obj = (this.Entries [row]) as AssertionConsumerServiceDto; switch (col.Identifier) { case "Name": value = (NSString)obj.Name; break; case "Index": value = (NSString)obj.Index.ToString (); break; case "Binding": value = (NSString)obj.Binding; break; case "Endpoint": value = (NSString)obj.Endpoint; break; case "IsDefault": value = (NSString)obj.IsDefault.ToString (); break; default: break; } } }); return value; }
public override NSObject GetObjectValue(NSTableView tableView, NSTableColumn tableColumn, int row) { ServerInfo s = Items [row]; if (tableColumn.Identifier == "List") { if(s.UserList == ServerInfo.UserListType.WhiteList) return NSImage.ImageNamed("blacklist_0.png"); else if(s.UserList == ServerInfo.UserListType.BlackList) return NSImage.ImageNamed("blacklist_1.png"); else return NSImage.ImageNamed("blacklist_2.png"); } else if (tableColumn.Identifier == "Flag") { return NSImage.ImageNamed("flag_" + s.CountryCode.ToLowerInvariant() + ".png"); } else if (tableColumn.Identifier == "Name") { return new NSString (s.GetNameForList ()); } else if (tableColumn.Identifier == "Score") { int p = Convert.ToInt32(5 * s.ScorePerc()); return NSImage.ImageNamed ("stars_" + p.ToString() + ".png"); } else if (tableColumn.Identifier == "Location") { return new NSString (s.GetLocationForList()); } else if (tableColumn.Identifier == "Latency") { return new NSString (s.GetLatencyForList()); } else if (tableColumn.Identifier == "LoadIcon") { return NSImage.ImageNamed("status_" + s.GetLoadColorForList().ToLowerInvariant() + ".png"); } else if (tableColumn.Identifier == "Load") { return new NSString (s.GetLoadForList()); } else if (tableColumn.Identifier == "Users") { return new NSString (s.GetUsersForList()); } else throw new NotImplementedException (string.Format ("{0} is not recognized", tableColumn.Identifier)); }
public override NSView GetViewForItem (NSTableView tableView, NSTableColumn tableColumn, int row) { var view = (NSTableCellView)tableView.MakeView (tableColumn.Identifier, this); string value = string.Empty; switch (tableColumn.HeaderCell.Title) { case "Added": value = _notes [row].Added.ToShortDateString(); break; case "Author": value = _notes [row].Author; break; case "Note": value = _notes [row].Content; break; default: break; } view.TextField.StringValue = value; return view; }
public override NSObject GetObjectValue(NSTableView table, NSTableColumn col, int row) { int column; // Determine which column is being selected switch (col.HeaderCell.Title) { case "Count": column = 0; break; case "Number": column = 1; break; case "Distance": column = 2; break; case "Interval": column = 3; break; case "Stroke": column = 4; break; case "Comment": column = 5; break; default: break; } if (row + 1 > m_tableData [column].Count) return new NSString (""); else return new NSString (m_tableData [column] [row]); }
public NSObject GetObjectValue(NSTableView tableView, NSTableColumn tableColumn, nint row) { if (IsViewReady) { Employee emp = DataStore.Employees[(int)row]; switch (tableColumn.Identifier) { case "FirstName": return new NSString(emp.FirstName); case "LastName": return new NSString(emp.LastName); case "DepartmentName": NSPopUpButtonCell button = tableColumn.DataCellForRow(row) as NSPopUpButtonCell; button.RemoveAllItems(); foreach(Department dep in DataStore.Departments) { button.Menu.AddItem(dep.Name, new ObjCRuntime.Selector("departmentSelected:"), ""); } return button; default: return new NSString(""); } } else return new NSString(""); }
public static List<NSTableColumn> ToNSTableColumns (List<ColumnOptions> options) { var columns = new List<NSTableColumn> (); //var bgColor = NSColor.FromDeviceRgba ((float)(229.0 / 255), (float)(229.0 / 255), (float)(255.0 / 255), (float)1.0); foreach (var option in options.OrderBy(x=>x.DisplayOrder)) { var width = option.Width == 0 ? 200 : option.Width; var col = new NSTableColumn (option.Id) { HeaderCell = new NSTableHeaderCell { Title = option.DisplayName, Alignment = NSTextAlignment.Left, //BackgroundColor = bgColor, //TextColor = NSColor.Blue, //DrawsBackground = true, //Bordered = true }, MinWidth = width, Width = width, ResizingMask = NSTableColumnResizing.UserResizingMask }; if (option.Type == ColumnType.Browser) col.DataCell = new NSBrowserCell (); else col.DataCell = new NSTextFieldCell (); col.HeaderToolTip = "Displays " + option.DisplayName; columns.Add (col); } return columns; }
public override void SetObjectValue (NSTableView tableView, NSObject theObject, NSTableColumn tableColumn, int row) { NSString newNSValue = theObject as NSString; if (newNSValue == null) return; string newValue = newNSValue.ToString (); int columnIndex = tableView.FindColumn ((NSString)tableColumn.Identifier); BookmarkManager.Entry entry = entries[row]; switch (columnIndex) { case 0: if (!string.IsNullOrWhiteSpace (newValue)) entry.Name = newValue; break; case 1: entry.Notes = newValue; break; case 2: if (!string.IsNullOrWhiteSpace (newValue)) entry.Url = newValue; break; default: break; } manager.CommitBookmarkChange (entry); }
public override NSView GetViewForItem(NSTableView tableView, NSTableColumn tableColumn, nint row) { int r = (int)row; if (tableColumn.Identifier == CellIdentifierEnabled) { NSButton v = null; if (v == null) { v = new NSButton(); v.Title = string.Empty; v.SetButtonType(NSButtonType.Switch); if (_dataSource.Items[r].Checked) { v.State = NSCellStateValue.On; } else { v.State = NSCellStateValue.Off; } v.Activated += (object sender, EventArgs e) => { var b = v.State == NSCellStateValue.On; _dataSource.Items[r].Checked = b; _controller.SaveRuleState(r, b); }; } return v; } // This pattern allows you reuse existing views when they are no-longer in use. // If the returned view is null, you instance up a new view // If a non-null view is returned, you modify it enough to reflect the new data NSTextField view = (NSTextField)tableView.MakeView(CellIdentifier, this); if (view == null) { view = new NSTextField(); view.Identifier = CellIdentifier; view.BackgroundColor = NSColor.Clear; view.Bordered = false; view.Selectable = false; view.Editable = false; } // Setup view based on the column selected switch (tableColumn.Identifier) { case CellIdentifierEnabled: view.StringValue = _dataSource.Items[r].Checked.ToString(); break; case CellIdentifierFixWhat: view.StringValue = _dataSource.Items[r].Name; break; case CellIdentifierExample: view.StringValue = _dataSource.Items[r].Example; break; } return view; }
public override NSCell GetCell(NSOutlineView view, NSTableColumn column, MonoMac.Foundation.NSObject item) { NSCmisTree cmis = item as NSCmisTree; if (cmis == null) { Console.WriteLine ("GetCell Error"); return null; } if (column == null) { return null; } else if (column.Identifier.Equals ("Name")) { // Console.WriteLine ("GetCell " + cmis); NSButtonCell cell = new NSButtonCell (); if (cmis.Parent != null) cell.SetButtonType (NSButtonType.Switch); else cell.SetButtonType (NSButtonType.Radio); // FIXME cell.AllowsMixedState = true; cell.Title = cmis.Name; cell.Editable = true; return cell; } else { NSTextFieldCell cell = new NSTextFieldCell (); return cell; } }
public NSObject ObjectValueForTableColumn (NSTableView table, NSTableColumn col, int row) { var value = (NSString)string.Empty; ActionHelper.Execute (delegate() { if (Entries != null) { var obj = (this.Entries [row]) as UserDto; switch (col.Identifier) { case "Name": value = (NSString)obj.Name; break; case "FirstName": value = (NSString)obj.PersonDetails.FirstName; break; case "LastName": value = (NSString)obj.PersonDetails.LastName; break; case "Email": value = (NSString)obj.PersonDetails.EmailAddress; break; case "Description": value = (NSString)obj.PersonDetails.Description; break; default: break; } } }); return value; }
public override NSView GetViewForItem (NSTableView tableView, NSTableColumn tableColumn, nint row) { int r = (int)row; // This pattern allows you reuse existing views when they are no-longer in use. // If the returned view is null, you instance up a new view // If a non-null view is returned, you modify it enough to reflect the new data NSTextField view = (NSTextField)tableView.MakeView (CellIdentifier, this); if (view == null) { view = new NSTextField (); view.Identifier = CellIdentifier; view.BackgroundColor = NSColor.Clear; view.Bordered = false; view.Selectable = false; view.Editable = false; } // Setup view based on the column selected switch (tableColumn.Identifier) { case CellIdentifierFirst: view.StringValue = DataSource.Items[r]; break; } return view; }
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"); } }
public override NSObject GetObjectValue (NSTableView tableView, NSTableColumn tableColumn, int row) { TableAdvancedEventsControllerItem i = Items [row]; if (tableColumn.Identifier == "Event") { return new NSString (i.Title); } else if (tableColumn.Identifier == "FileName") { return new NSString (i.Filename); } else if (tableColumn.Identifier == "Arguments") { return new NSString (i.Arguments); } else if (tableColumn.Identifier == "WaitEnd") { if ((i.Filename.Trim () != "") || (i.Arguments.Trim () != "")) { if (i.WaitEnd) return NSImage.ImageNamed ("status_green_16.png"); else return NSImage.ImageNamed ("status_red_16.png"); } else return NSImage.ImageNamed ("status_unknown.png"); } else throw new NotImplementedException (string.Format ("{0} is not recognized", tableColumn.Identifier)); }
public override NSObject GetObjectValue(NSTableView tableView, NSTableColumn tableColumn, int row) { if (row != -1) return (NSString)Program.Instance.StreamDeskCoreInstance.SettingsInstance.ActiveDatabases[row]; return null; }
public override NSView GetView (NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item) { // Cast item var product = item as Product; // This pattern allows you reuse existing views when they are no-longer in use. // If the returned view is null, you instance up a new view // If a non-null view is returned, you modify it enough to reflect the new data NSTableCellView view = (NSTableCellView)outlineView.MakeView (tableColumn.Title, this); if (view == null) { view = new NSTableCellView (); if (tableColumn.Title == "Product") { view.ImageView = new NSImageView (new CGRect (0, 0, 16, 16)); view.AddSubview (view.ImageView); view.TextField = new NSTextField (new CGRect (20, 0, 400, 16)); } else { view.TextField = new NSTextField (new CGRect (0, 0, 400, 16)); } view.TextField.AutoresizingMask = NSViewResizingMask.WidthSizable; view.AddSubview (view.TextField); view.Identifier = tableColumn.Title; view.TextField.BackgroundColor = NSColor.Clear; view.TextField.Bordered = false; view.TextField.Selectable = false; view.TextField.Editable = !product.IsProductGroup; } // Tag view view.TextField.Tag = outlineView.RowForItem (item); // Allow for edit view.TextField.EditingEnded += (sender, e) => { // Grab product var prod = outlineView.ItemAtRow(view.Tag) as Product; // Take action based on type switch(view.Identifier) { case "Product": prod.Title = view.TextField.StringValue; break; case "Details": prod.Description = view.TextField.StringValue; break; } }; // Setup view based on the column selected switch (tableColumn.Title) { case "Product": view.ImageView.Image = NSImage.ImageNamed (product.IsProductGroup ? "tags.png" : "tag.png"); view.TextField.StringValue = product.Title; break; case "Details": view.TextField.StringValue = product.Description; break; } return view; }
public override bool ShouldEditTableColumn(NSTableView tableView, NSTableColumn tableColumn, int row) { switch(tableColumn.Identifier) { case "label": return !Data.Wallet.IsLocked; default: return false; } }
public override void WillDisplayCell (NSOutlineView outlineView, NSObject cell, NSTableColumn tableColumn, NSObject item) { var textCell = cell as MacImageListItemCell; if (textCell != null) { textCell.UseTextShadow = true; textCell.SetGroupItem (this.IsGroupItem (outlineView, item), outlineView, NSFont.SmallSystemFontSize, NSFont.SmallSystemFontSize); } }
public override void SetObjectValue(NSTableView tableView, NSObject theObject, NSTableColumn tableColumn, int row) { var proposedValue = theObject.ToString(); if (proposedValue.Trim().Length > 0) { controller.gamerList[row].Gamertag = theObject.ToString(); controller.gamerList[row].DisplayName = theObject.ToString(); } }
public override NSObject GetObjectValue (NSOutlineView outlineView, NSTableColumn forTableColumn, NSObject byItem) { TreeDataNode nodeItem = byItem as TreeDataNode; if (nodeItem == null) return null; return (NSString)nodeItem.CombinedName; }
public override void Initialize () { base.Initialize (); HeadersVisible = false; columnHandle = AddColumn (column); VerticalScrollPolicy = ScrollPolicy.Automatic; HorizontalScrollPolicy = ScrollPolicy.Automatic; }
public NSObject ObjectValueForTableColumn(NSTableView table, NSTableColumn col, int row) { Console.WriteLine("tableView:objectValueForTableColumn:row:"); if (row > _categories.Count - 1) return null; return new NSString(_categories [row].Name); }
public NSObject ObjectValueForTableColumn(NSTableView table, NSTableColumn col, int row) { if (row < Rows.Count) { return new NSString(Rows[row].ToString()); } return new NSString (); }
public override NSObject GetObjectValue (NSTableView tableView, NSTableColumn col, int row) { var entry = data [row]; string value = entry.Value; if (col.DataCell.Tag == 0) return new NSString (entry.Key); else return new NSString (entry.Value); }
public override NSView GetViewForItem(NSTableView tableView, NSTableColumn tableColumn, int row, NSObject obj, Func <NSObject, int, object> getItem) { var view = tableView.MakeView(tableColumn.Identifier, tableView) as CellView; if (view == null) { view = new CellView(); view.Cell = new MacImageListItemCell { VerticalAlignment = VerticalAlignment.Center }; view.Identifier = tableColumn.Identifier; view.Selectable = false; view.DrawsBackground = false; view.Bezeled = false; view.Bordered = false; view.AutoresizingMask = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable; view.Cell.Wraps = false; view.Cell.Scrollable = true; view.Cell.UsesSingleLineMode = true; var col = Array.IndexOf(tableView.TableColumns(), tableColumn); view.BecameFirstResponder += (sender, e) => { var control = (CellView)sender; var r = (int)control.Tag; var item = getItem(control.Item, r); var ee = new GridViewCellEventArgs(ColumnHandler.Widget, r, (int)col, item); ColumnHandler.DataViewHandler.Callback.OnCellEditing(ColumnHandler.DataViewHandler.Widget, ee); }; view.EditingEnded += (sender, e) => { var notification = (NSNotification)sender; var control = (CellView)notification.Object; var r = (int)control.Tag; var item = getItem(control.Item, r); SetObjectValue(item, control.ObjectValue); var ee = new GridViewCellEventArgs(ColumnHandler.Widget, r, (int)col, item); ColumnHandler.DataViewHandler.Callback.OnCellEdited(ColumnHandler.DataViewHandler.Widget, ee); control.ObjectValue = GetObjectValue(item); }; view.ResignedFirstResponder += (sender, e) => { var control = (CellView)sender; var r = (int)control.Tag; var item = getItem(control.Item, r); SetObjectValue(item, control.ObjectValue); var ee = new GridViewCellEventArgs(ColumnHandler.Widget, r, (int)col, item); ColumnHandler.DataViewHandler.Callback.OnCellEdited(ColumnHandler.DataViewHandler.Widget, ee); }; view.Bind("editable", tableColumn, "editable", null); } view.Tag = row; view.Item = obj; ((MacImageListItemCell)view.Cell).ImageInterpolation = ImageInterpolation.ToNS(); var args = new MacCellFormatArgs(ColumnHandler.Widget, getItem(obj, row), row, view); ColumnHandler.DataViewHandler.OnCellFormatting(args); return(view); }
public override void SetObjectValue(NSTableView tableView, NSObject theObject, NSTableColumn tableColumn, nint row) { Debug.WriteLine("Clicked"); base.SetObjectValue(tableView, theObject, tableColumn, row); }
public override void SetObjectValue(NSTableView tableView, NSObject theObject, NSTableColumn tableColumn, nint row) { if (row >= Handler.collection.Count) { return; } var item = Handler.collection.ElementAt((int)row); var colHandler = Handler.GetColumn(tableColumn); if (colHandler != null && Handler.SuppressUpdate == 0) { colHandler.SetObjectValue(item, theObject); Handler.SetIsEditing(false); Handler.Callback.OnCellEdited(Handler.Widget, new GridViewCellEventArgs(colHandler.Widget, (int)row, colHandler.Column, item)); } }
public override void SetObjectValue(NSTableView tableView, NSObject editedVal, NSTableColumn col, nint row) { try { if (data != null) { if (col.Identifier == "Value") { string currKey = this.data[(int)row].Key; if (currKey != "objectClass") { if (!string.IsNullOrEmpty(editedVal.ToString())) { this.data[(int)row] = new KeyValuePair <string, string>(currKey, (NSString)editedVal); this.PendingMod.Add(new KeyValuePair <string, string>(currKey, this.data[(int)row].Value)); } else { this.DeleteMod.Add(new KeyValuePair <string, string>(currKey, this.data[(int)row].Value)); this.data[(int)row] = new KeyValuePair <string, string>(currKey, (NSString)editedVal); } } } } } catch (Exception e) { System.Diagnostics.Debug.WriteLine("Error in List Operation " + e.Message); } }
public NSObject GetObjectValue(NSTableView tableView, NSTableColumn tableColumn, nint row) { return((NSString)values[(int)row]); }
public void tableView(NSTableView tableView) setObjectValue(id obj) forTableColumn(NSTableColumn tableColumn) row(NSInteger row)
public id tableView(NSTableView tableView) objectValueForTableColumn(NSTableColumn tableColumn) row(NSInteger row)
public override NSObject GetObjectValue(NSOutlineView outlineView, NSTableColumn forTableColumn, NSObject byItem) { return(byItem); }
public override NSObject GetObjectValue(NSTableView tableView, NSTableColumn tableColumn, nint row) { return(new NSString(todoItems[(int)row])); }
public override NSObject GetObjectValue(NSTableView tableView, NSTableColumn tableColumn, nint row) { var song = GetSong(tableColumn, row); return((NSString)(song?.ToString() ?? "")); }
public override NSObject GetObjectValue(NSTableView tableView, NSTableColumn tableColumn, int row) { return((NSString)me.results [row].Name); }
public override void WillDisplayCell(NSOutlineView outlineView, NSObject cell, NSTableColumn tableColumn, NSObject item) { var textCell = cell as MacImageListItemCell; if (textCell != null) { textCell.UseTextShadow = true; textCell.SetGroupItem(this.IsGroupItem(outlineView, item), outlineView, NSFont.SmallSystemFontSize, NSFont.SmallSystemFontSize); } }
public override MonoMac.Foundation.NSObject GetObjectValue(NSTableView tableView, NSTableColumn tableColumn, int row) { return(new TableRow() { Row = row }); }
public override void AddColumn(NSTableColumn tableColumn) { base.AddColumn(tableColumn); AutosizeColumns(); }
public void ShowPage(PageType type, string [] warnings) { if (type == PageType.Setup) { Header = "Welcome to SparkleShare!"; Description = "First off, what's your name and email?\n(visible only to team members)"; FullNameLabel = new NSTextField() { Alignment = NSTextAlignment.Right, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF(165, Frame.Height - 234, 160, 17), StringValue = "Full Name:", Font = SparkleUI.Font }; FullNameTextField = new NSTextField() { Frame = new RectangleF(330, Frame.Height - 238, 196, 22), StringValue = UnixUserInfo.GetRealUser().RealName, Delegate = new SparkleTextFieldDelegate() }; EmailLabel = new NSTextField() { Alignment = NSTextAlignment.Right, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF(165, Frame.Height - 264, 160, 17), StringValue = "Email:", Font = SparkleUI.Font }; EmailTextField = new NSTextField() { Frame = new RectangleF(330, Frame.Height - 268, 196, 22), Delegate = new SparkleTextFieldDelegate() }; EmailHelpLabel = new NSTextField() { BackgroundColor = NSColor.WindowBackground, Bordered = false, TextColor = NSColor.DisabledControlText, Editable = false, Frame = new RectangleF(330, Frame.Height - 290, 204, 17), Font = NSFontManager.SharedFontManager.FontWithFamily("Lucida Grande", NSFontTraitMask.Condensed, 0, 11), StringValue = "(used to find your Gravatar)" }; CancelButton = new NSButton() { Title = "Cancel" }; ContinueButton = new NSButton() { Title = "Continue", Enabled = false }; (FullNameTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckSetupPage(FullNameTextField.StringValue, EmailTextField.StringValue); }; (EmailTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckSetupPage(FullNameTextField.StringValue, EmailTextField.StringValue); }; ContinueButton.Activated += delegate { string full_name = FullNameTextField.StringValue.Trim(); string email = EmailTextField.StringValue.Trim(); Controller.SetupPageCompleted(full_name, email); }; CancelButton.Activated += delegate { Controller.SetupPageCancelled(); }; Controller.UpdateSetupContinueButtonEvent += delegate(bool button_enabled) { InvokeOnMainThread(delegate { ContinueButton.Enabled = button_enabled; }); }; ContentView.AddSubview(FullNameLabel); ContentView.AddSubview(FullNameTextField); ContentView.AddSubview(EmailLabel); ContentView.AddSubview(EmailTextField); ContentView.AddSubview(EmailHelpLabel); Buttons.Add(ContinueButton); Buttons.Add(CancelButton); Controller.CheckSetupPage(FullNameTextField.StringValue, EmailTextField.StringValue); } if (type == PageType.Invite) { Header = "You've received an invite!"; Description = "Do you want to add this project to SparkleShare?"; AddressLabel = new NSTextField() { Alignment = NSTextAlignment.Right, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF(165, Frame.Height - 240, 160, 17), StringValue = "Address:", Font = SparkleUI.Font }; PathLabel = new NSTextField() { Alignment = NSTextAlignment.Right, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF(165, Frame.Height - 264, 160, 17), StringValue = "Remote Path:", Font = SparkleUI.Font }; AddressTextField = new NSTextField() { Alignment = NSTextAlignment.Left, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF(330, Frame.Height - 240, 260, 17), StringValue = Controller.PendingInvite.Address, Font = SparkleUI.BoldFont }; PathTextField = new NSTextField() { Alignment = NSTextAlignment.Left, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF(330, Frame.Height - 264, 260, 17), StringValue = Controller.PendingInvite.RemotePath, Font = SparkleUI.BoldFont }; CancelButton = new NSButton() { Title = "Cancel" }; AddButton = new NSButton() { Title = "Add" }; CancelButton.Activated += delegate { Controller.PageCancelled(); }; AddButton.Activated += delegate { Controller.InvitePageCompleted(); }; ContentView.AddSubview(AddressLabel); ContentView.AddSubview(PathLabel); ContentView.AddSubview(AddressTextField); ContentView.AddSubview(PathTextField); Buttons.Add(AddButton); Buttons.Add(CancelButton); } if (type == PageType.Add) { Header = "Where's your project hosted?"; Description = ""; AddressLabel = new NSTextField() { Alignment = NSTextAlignment.Left, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF(190, Frame.Height - 308, 160, 17), StringValue = "Address:", Font = SparkleUI.BoldFont }; AddressTextField = new NSTextField() { Frame = new RectangleF(190, Frame.Height - 336, 196, 22), Font = SparkleUI.Font, Enabled = (Controller.SelectedPlugin.Address == null), Delegate = new SparkleTextFieldDelegate(), StringValue = "" + Controller.PreviousAddress }; AddressTextField.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; PathLabel = new NSTextField() { Alignment = NSTextAlignment.Left, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF(190 + 196 + 16, Frame.Height - 308, 160, 17), StringValue = "Remote Path:", Font = SparkleUI.BoldFont }; PathTextField = new NSTextField() { Frame = new RectangleF(190 + 196 + 16, Frame.Height - 336, 196, 22), Enabled = (Controller.SelectedPlugin.Path == null), Delegate = new SparkleTextFieldDelegate(), StringValue = "" + Controller.PreviousPath }; PathTextField.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; PathHelpLabel = new NSTextField() { BackgroundColor = NSColor.WindowBackground, Bordered = false, TextColor = NSColor.DisabledControlText, Editable = false, Frame = new RectangleF(190 + 196 + 16, Frame.Height - 355, 204, 17), Font = NSFontManager.SharedFontManager.FontWithFamily("Lucida Grande", NSFontTraitMask.Condensed, 0, 11), StringValue = "" + Controller.SelectedPlugin.PathExample }; AddressHelpLabel = new NSTextField() { BackgroundColor = NSColor.WindowBackground, Bordered = false, TextColor = NSColor.DisabledControlText, Editable = false, Frame = new RectangleF(190, Frame.Height - 355, 204, 17), Font = NSFontManager.SharedFontManager.FontWithFamily("Lucida Grande", NSFontTraitMask.Condensed, 0, 11), StringValue = "" + Controller.SelectedPlugin.AddressExample }; TableView = new NSTableView() { Frame = new RectangleF(0, 0, 0, 0), RowHeight = 34, IntercellSpacing = new SizeF(8, 12), HeaderView = null, Delegate = new SparkleTableViewDelegate() }; ScrollView = new NSScrollView() { Frame = new RectangleF(190, Frame.Height - 280, 408, 185), DocumentView = TableView, HasVerticalScroller = true, BorderType = NSBorderType.BezelBorder }; IconColumn = new NSTableColumn(new NSImage()) { Width = 36, HeaderToolTip = "Icon", DataCell = new NSImageCell() { ImageAlignment = NSImageAlignment.Right } }; DescriptionColumn = new NSTableColumn() { Width = 350, HeaderToolTip = "Description", Editable = false }; DescriptionColumn.DataCell.Font = NSFontManager.SharedFontManager.FontWithFamily("Lucida Grande", NSFontTraitMask.Condensed, 0, 11); TableView.AddColumn(IconColumn); TableView.AddColumn(DescriptionColumn); DataSource = new SparkleDataSource(Controller.Plugins); TableView.DataSource = DataSource; TableView.ReloadData(); HistoryCheckButton = new NSButton() { Frame = new RectangleF(190, Frame.Height - 400, 300, 18), Title = "Fetch prior revisions" }; if (Controller.FetchPriorHistory) { HistoryCheckButton.State = NSCellStateValue.On; } HistoryCheckButton.SetButtonType(NSButtonType.Switch); AddButton = new NSButton() { Title = "Add", Enabled = false }; CancelButton = new NSButton() { Title = "Cancel" }; Controller.ChangeAddressFieldEvent += delegate(string text, string example_text, FieldState state) { InvokeOnMainThread(delegate { AddressTextField.StringValue = text; AddressTextField.Enabled = (state == FieldState.Enabled); AddressHelpLabel.StringValue = example_text; }); }; Controller.ChangePathFieldEvent += delegate(string text, string example_text, FieldState state) { InvokeOnMainThread(delegate { PathTextField.StringValue = text; PathTextField.Enabled = (state == FieldState.Enabled); PathHelpLabel.StringValue = example_text; }); }; TableView.SelectRow(Controller.SelectedPluginIndex, false); TableView.ScrollRowToVisible(Controller.SelectedPluginIndex); (AddressTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckAddPage(AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); }; (PathTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckAddPage(AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); }; (TableView.Delegate as SparkleTableViewDelegate).SelectionChanged += delegate { Controller.SelectedPluginChanged(TableView.SelectedRow); Controller.CheckAddPage(AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); }; HistoryCheckButton.Activated += delegate { Controller.HistoryItemChanged(HistoryCheckButton.State == NSCellStateValue.On); }; AddButton.Activated += delegate { Controller.AddPageCompleted(AddressTextField.StringValue, PathTextField.StringValue); }; CancelButton.Activated += delegate { Controller.PageCancelled(); }; Controller.UpdateAddProjectButtonEvent += delegate(bool button_enabled) { InvokeOnMainThread(delegate { AddButton.Enabled = button_enabled; }); }; ContentView.AddSubview(ScrollView); ContentView.AddSubview(AddressLabel); ContentView.AddSubview(AddressTextField); ContentView.AddSubview(AddressHelpLabel); ContentView.AddSubview(PathLabel); ContentView.AddSubview(PathTextField); ContentView.AddSubview(PathHelpLabel); ContentView.AddSubview(HistoryCheckButton); Buttons.Add(AddButton); Buttons.Add(CancelButton); Controller.CheckAddPage(AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); } if (type == PageType.Syncing) { Header = "Adding project ‘" + Controller.SyncingFolder + "’…"; Description = "This may take a while for large projects.\nIsn't it coffee-o'clock?"; ProgressIndicator = new NSProgressIndicator() { Frame = new RectangleF(190, Frame.Height - 200, 640 - 150 - 80, 20), Style = NSProgressIndicatorStyle.Bar, MinValue = 0.0, MaxValue = 100.0, Indeterminate = false, DoubleValue = Controller.ProgressBarPercentage }; ProgressIndicator.StartAnimation(this); CancelButton = new NSButton() { Title = "Cancel" }; FinishButton = new NSButton() { Title = "Finish", Enabled = false }; Controller.UpdateProgressBarEvent += delegate(double percentage) { InvokeOnMainThread(() => { ProgressIndicator.DoubleValue = percentage; }); }; CancelButton.Activated += delegate { Controller.SyncingCancelled(); }; ContentView.AddSubview(ProgressIndicator); Buttons.Add(FinishButton); Buttons.Add(CancelButton); } if (type == PageType.Error) { Header = "Oops! Something went wrong…"; Description = "Please check the following:"; // Displaying marked up text with Cocoa is // a pain, so we just use a webview instead WebView web_view = new WebView(); web_view.Frame = new RectangleF(190, Frame.Height - 525, 375, 400); string html = "<style>" + "* {" + " font-family: 'Lucida Grande';" + " font-size: 12px; cursor: default;" + "}" + "body {" + " -webkit-user-select: none;" + " margin: 0;" + " padding: 3px;" + "}" + "li {" + " margin-bottom: 16px;" + " margin-left: 0;" + " padding-left: 0;" + " line-height: 20px;" + "}" + "ul {" + " padding-left: 24px;" + "}" + "</style>" + "<ul>" + " <li><b>" + Controller.PreviousUrl + "</b> is the address we've compiled. Does this look alright?</li>" + " <li>Do you have access rights to this remote project?</li>" + "</ul>"; if (warnings.Length > 0) { string warnings_markup = ""; foreach (string warning in warnings) { warnings_markup += "<br><b>" + warning + "</b>"; } html = html.Replace("</ul>", "<li>Here's the raw error message: " + warnings_markup + "</li></ul>"); } web_view.MainFrame.LoadHtmlString(html, new NSUrl("")); web_view.DrawsBackground = false; CancelButton = new NSButton() { Title = "Cancel" }; TryAgainButton = new NSButton() { Title = "Try again…" }; CancelButton.Activated += delegate { Controller.PageCancelled(); }; TryAgainButton.Activated += delegate { Controller.ErrorPageCompleted(); }; ContentView.AddSubview(web_view); Buttons.Add(TryAgainButton); Buttons.Add(CancelButton); } if (type == PageType.CryptoSetup) { Header = "Set up file encryption"; Description = "This project is supposed to be encrypted, but it doesn't yet have a password set. Please provide one below:"; PasswordLabel = new NSTextField() { Alignment = NSTextAlignment.Right, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF(155, Frame.Height - 204, 160, 17), StringValue = "Password:"******"Show password", State = NSCellStateValue.Off }; ShowPasswordCheckButton.SetButtonType(NSButtonType.Switch); WarningImage = NSImage.ImageNamed("NSInfo"); WarningImage.Size = new SizeF(24, 24); WarningImageView = new NSImageView() { Image = WarningImage, Frame = new RectangleF(200, Frame.Height - 320, 24, 24) }; WarningTextField = new NSTextField() { Frame = new RectangleF(235, Frame.Height - 390, 325, 100), StringValue = "This password can't be changed later, and your files can't be recovered if it's forgotten.", BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Font = SparkleUI.Font }; CancelButton = new NSButton() { Title = "Cancel" }; ContinueButton = new NSButton() { Title = "Continue", Enabled = false }; ShowPasswordCheckButton.Activated += delegate { if (PasswordTextField.Superview == ContentView) { PasswordTextField.RemoveFromSuperview(); ContentView.AddSubview(VisiblePasswordTextField); } else { VisiblePasswordTextField.RemoveFromSuperview(); ContentView.AddSubview(PasswordTextField); } }; (PasswordTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { VisiblePasswordTextField.StringValue = PasswordTextField.StringValue; Controller.CheckCryptoSetupPage(PasswordTextField.StringValue); }; (VisiblePasswordTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { PasswordTextField.StringValue = VisiblePasswordTextField.StringValue; Controller.CheckCryptoSetupPage(PasswordTextField.StringValue); }; Controller.UpdateCryptoSetupContinueButtonEvent += delegate(bool button_enabled) { InvokeOnMainThread(() => { ContinueButton.Enabled = button_enabled; }); }; ContinueButton.Activated += delegate { Controller.CryptoSetupPageCompleted(PasswordTextField.StringValue); }; CancelButton.Activated += delegate { Controller.CryptoPageCancelled(); }; ContentView.AddSubview(PasswordLabel); ContentView.AddSubview(PasswordTextField); ContentView.AddSubview(ShowPasswordCheckButton); ContentView.AddSubview(WarningImageView); ContentView.AddSubview(WarningTextField); Buttons.Add(ContinueButton); Buttons.Add(CancelButton); NSApplication.SharedApplication.RequestUserAttention(NSRequestUserAttentionType.CriticalRequest); } if (type == PageType.CryptoPassword) { Header = "This project contains encrypted files"; Description = "Please enter the password to see their contents."; PasswordLabel = new NSTextField() { Alignment = NSTextAlignment.Right, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF(155, Frame.Height - 224, 160, 17), StringValue = "Password:"******"Show password", State = NSCellStateValue.Off }; ShowPasswordCheckButton.SetButtonType(NSButtonType.Switch); CancelButton = new NSButton() { Title = "Cancel" }; ContinueButton = new NSButton() { Title = "Continue", Enabled = false }; Controller.UpdateCryptoPasswordContinueButtonEvent += delegate(bool button_enabled) { InvokeOnMainThread(() => { ContinueButton.Enabled = button_enabled; }); }; ShowPasswordCheckButton.Activated += delegate { if (PasswordTextField.Superview == ContentView) { PasswordTextField.RemoveFromSuperview(); ContentView.AddSubview(VisiblePasswordTextField); } else { VisiblePasswordTextField.RemoveFromSuperview(); ContentView.AddSubview(PasswordTextField); } }; (PasswordTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { VisiblePasswordTextField.StringValue = PasswordTextField.StringValue; Controller.CheckCryptoPasswordPage(PasswordTextField.StringValue); }; (VisiblePasswordTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { PasswordTextField.StringValue = VisiblePasswordTextField.StringValue; Controller.CheckCryptoPasswordPage(PasswordTextField.StringValue); }; ContinueButton.Activated += delegate { Controller.CryptoPasswordPageCompleted(PasswordTextField.StringValue); }; CancelButton.Activated += delegate { Controller.CryptoPageCancelled(); }; ContentView.AddSubview(PasswordLabel); ContentView.AddSubview(PasswordTextField); ContentView.AddSubview(ShowPasswordCheckButton); Buttons.Add(ContinueButton); Buttons.Add(CancelButton); NSApplication.SharedApplication.RequestUserAttention(NSRequestUserAttentionType.CriticalRequest); } if (type == PageType.Finished) { Header = "Your shared project is ready!"; Description = "You can find the files in your SparkleShare folder."; if (warnings.Length > 0) { WarningImage = NSImage.ImageNamed("NSInfo"); WarningImage.Size = new SizeF(24, 24); WarningImageView = new NSImageView() { Image = WarningImage, Frame = new RectangleF(200, Frame.Height - 175, 24, 24) }; WarningTextField = new NSTextField() { Frame = new RectangleF(235, Frame.Height - 245, 325, 100), StringValue = warnings [0], BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Font = SparkleUI.Font }; ContentView.AddSubview(WarningImageView); ContentView.AddSubview(WarningTextField); } OpenFolderButton = new NSButton() { Title = "Show folder" }; FinishButton = new NSButton() { Title = "Finish" }; OpenFolderButton.Activated += delegate { Controller.OpenFolderClicked(); }; FinishButton.Activated += delegate { Controller.FinishPageCompleted(); }; Buttons.Add(FinishButton); Buttons.Add(OpenFolderButton); NSApplication.SharedApplication.RequestUserAttention(NSRequestUserAttentionType.CriticalRequest); } if (type == PageType.Tutorial) { string slide_image_path = Path.Combine(NSBundle.MainBundle.ResourcePath, "Pixmaps", "tutorial-slide-" + Controller.TutorialPageNumber + ".png"); SlideImage = new NSImage(slide_image_path) { Size = new SizeF(350, 200) }; SlideImageView = new NSImageView() { Image = SlideImage, Frame = new RectangleF(215, Frame.Height - 350, 350, 200) }; ContentView.AddSubview(SlideImageView); switch (Controller.TutorialPageNumber) { case 1: { Header = "What's happening next?"; Description = "SparkleShare creates a special folder on your computer " + "that will keep track of your projects."; SkipTutorialButton = new NSButton() { Title = "Skip Tutorial" }; ContinueButton = new NSButton() { Title = "Continue" }; SkipTutorialButton.Activated += delegate { Controller.TutorialSkipped(); }; ContinueButton.Activated += delegate { Controller.TutorialPageCompleted(); }; ContentView.AddSubview(SlideImageView); Buttons.Add(ContinueButton); Buttons.Add(SkipTutorialButton); break; } case 2: { Header = "Sharing files with others"; Description = "All files added to your project folders are synced automatically with " + "the host and your team members."; ContinueButton = new NSButton() { Title = "Continue" }; ContinueButton.Activated += delegate { Controller.TutorialPageCompleted(); }; Buttons.Add(ContinueButton); break; } case 3: { Header = "The status icon is here to help"; Description = "It shows the syncing progress, provides easy access to " + "your projects and let's you view recent changes."; ContinueButton = new NSButton() { Title = "Continue" }; ContinueButton.Activated += delegate { Controller.TutorialPageCompleted(); }; Buttons.Add(ContinueButton); break; } case 4: { Header = "Adding projects to SparkleShare"; Description = "You can do this through the status icon menu, or by clicking " + "magic buttons on webpages that look like this:"; StartupCheckButton = new NSButton() { Frame = new RectangleF(190, Frame.Height - 400, 300, 18), Title = "Add SparkleShare to startup items", State = NSCellStateValue.On }; StartupCheckButton.SetButtonType(NSButtonType.Switch); FinishButton = new NSButton() { Title = "Finish" }; SlideImage.Size = new SizeF(350, 64); StartupCheckButton.Activated += delegate { Controller.StartupItemChanged(StartupCheckButton.State == NSCellStateValue.On); }; FinishButton.Activated += delegate { Controller.TutorialPageCompleted(); }; ContentView.AddSubview(StartupCheckButton); Buttons.Add(FinishButton); break; } } } }
public override void SetObjectValue(NSOutlineView outlineView, NSObject theObject, NSTableColumn tableColumn, NSObject item) { }