public Activities() { this.Build(); Gtk.TreeViewColumn columnName = new TreeViewColumnLocalized() { Title = "Activity", Sizing = Gtk.TreeViewColumnSizing.Fixed, FixedWidth = 100 }; Gtk.TreeViewColumn columnDesc = new TreeViewColumnLocalized() { Title = "Description", Sizing = Gtk.TreeViewColumnSizing.Fixed, FixedWidth = 200 }; Gtk.TreeViewColumn columnStatus = new TreeViewColumnLocalized() { Title = "Status", Sizing = Gtk.TreeViewColumnSizing.Fixed, FixedWidth = 100 }; treeview1.AppendColumn(columnName); treeview1.AppendColumn(columnDesc); treeview1.AppendColumn(columnStatus); Gtk.CellRendererText rendererName = new Gtk.CellRendererText (); Gtk.CellRendererText rendererDesc = new Gtk.CellRendererText (); Gtk.CellRendererProgress rendererStatus = new Gtk.CellRendererProgress (); columnName.PackStart(rendererName, true); columnDesc.PackStart(rendererDesc, true); columnStatus.PackStart(rendererStatus, true); columnName.AddAttribute(rendererName, "text", COLUMN_NAME); columnDesc.AddAttribute(rendererDesc, "text", COLUMN_DESCRIPTION); columnStatus.AddAttribute(rendererStatus, "value", COLUMN_STATUS); listStore = new Gtk.ListStore (typeof(JobInfo), typeof (string), typeof (string), typeof (int)); treeview1.Model = listStore; treeview1.Selection.Changed += HandleCursorChanged; // do not use treeview1.CursorChanged - see http://ntswiki.nts.neusoft.local/wiki/Known_GTKSharp_Issues }
public Activities() { this.Build(); Gtk.TreeViewColumn columnName = new TreeViewColumnLocalized() { Title = "Activity", Sizing = Gtk.TreeViewColumnSizing.Fixed, FixedWidth = 100 }; Gtk.TreeViewColumn columnDesc = new TreeViewColumnLocalized() { Title = "Description", Sizing = Gtk.TreeViewColumnSizing.Fixed, FixedWidth = 200 }; Gtk.TreeViewColumn columnStatus = new TreeViewColumnLocalized() { Title = "Status", Sizing = Gtk.TreeViewColumnSizing.Fixed, FixedWidth = 100 }; treeview1.AppendColumn(columnName); treeview1.AppendColumn(columnDesc); treeview1.AppendColumn(columnStatus); Gtk.CellRendererText rendererName = new Gtk.CellRendererText(); Gtk.CellRendererText rendererDesc = new Gtk.CellRendererText(); Gtk.CellRendererProgress rendererStatus = new Gtk.CellRendererProgress(); columnName.PackStart(rendererName, true); columnDesc.PackStart(rendererDesc, true); columnStatus.PackStart(rendererStatus, true); columnName.AddAttribute(rendererName, "text", COLUMN_NAME); columnDesc.AddAttribute(rendererDesc, "text", COLUMN_DESCRIPTION); columnStatus.AddAttribute(rendererStatus, "value", COLUMN_STATUS); listStore = new Gtk.ListStore(typeof(JobInfo), typeof(string), typeof(string), typeof(int)); treeview1.Model = listStore; treeview1.Selection.Changed += HandleCursorChanged; // do not use treeview1.CursorChanged }
private void buildColumns() { Column downloadColumn = new Column { Ignore = true, Visible = false, Title = "N/A" }; Gtk.CellRendererText torrentNameCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentStatusCell = new Gtk.CellRendererText(); Gtk.CellRendererProgress torrentDoneCell = new Gtk.CellRendererProgress(); Gtk.CellRendererText torrentSeedsCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentPeersCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentPriorityCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentDownSpeedCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentUpSpeedCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentRatioCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentSizeCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentEtaCell = new Gtk.CellRendererText(); nameColumn.PackStart(torrentNameCell, true); statusColumn.PackStart(torrentStatusCell, true); doneColumn.PackStart(torrentDoneCell, true); seedsColumn.PackStart(torrentSeedsCell, true); peersColumn.PackStart(torrentPeersCell, true); priorityColumn.PackStart(torrentPriorityCell, true); downSpeedColumn.PackStart(torrentDownSpeedCell, true); upSpeedColumn.PackStart(torrentUpSpeedCell, true); ratioColumn.PackStart(torrentRatioCell, true); sizeColumn.PackStart(torrentSizeCell, true); etaColumn.PackStart(torrentEtaCell, true); nameColumn.AddAttribute(torrentNameCell, "text", 1); statusColumn.AddAttribute(torrentStatusCell, "text", 2); statusColumn.AddAttribute(torrentStatusCell, "foreground", 11); doneColumn.AddAttribute(torrentDoneCell, "value", 3); seedsColumn.AddAttribute(torrentSeedsCell, "text", 4); peersColumn.AddAttribute(torrentPeersCell, "text", 5); priorityColumn.AddAttribute(torrentPriorityCell, "text", 12); downSpeedColumn.AddAttribute(torrentDownSpeedCell, "text", 6); upSpeedColumn.AddAttribute(torrentUpSpeedCell, "text", 7); ratioColumn.AddAttribute(torrentRatioCell, "text", 8); sizeColumn.AddAttribute(torrentSizeCell, "text", 9); etaColumn.AddAttribute(torrentEtaCell, "text", 10); AppendColumn(priorityColumn); AppendColumn(downloadColumn); AppendColumn(nameColumn); AppendColumn(statusColumn); AppendColumn(doneColumn); AppendColumn(seedsColumn); AppendColumn(peersColumn); AppendColumn(downSpeedColumn); AppendColumn(upSpeedColumn); AppendColumn(etaColumn); AppendColumn(ratioColumn); AppendColumn(sizeColumn); foreach (TreeViewColumn c in this.Columns) { c.Sizing = TreeViewColumnSizing.Fixed; c.Reorderable = true; c.Resizable = true; c.Clicked += delegate(object o, EventArgs e) { int oldId; SortType oldSort; TreeViewColumn sender = (TreeViewColumn)o; Torrents.GetSortColumnId(out oldId, out oldSort); // Invert the sort order if we're the same if (oldId == sender.SortColumnId) { sender.SortOrder = sender.SortOrder == SortType.Ascending ? SortType.Descending : SortType.Ascending; } else { sender.SortOrder = SortType.Ascending; } Torrents.SetSortColumnId(sender.SortColumnId, sender.SortOrder); }; } }
private void buildColumns() { nameColumn = new TreeViewColumn(); statusColumn = new TreeViewColumn(); doneColumn = new TreeViewColumn(); seedsColumn = new TreeViewColumn(); peersColumn = new TreeViewColumn(); downSpeedColumn = new TreeViewColumn(); upSpeedColumn = new TreeViewColumn(); ratioColumn = new TreeViewColumn(); sizeColumn = new TreeViewColumn(); nameColumn.Title = "Name"; statusColumn.Title = "Status"; doneColumn.Title = "Done"; seedsColumn.Title = "Seeds"; peersColumn.Title = "Peers"; downSpeedColumn.Title = "DL Speed"; upSpeedColumn.Title = "UP Speed"; ratioColumn.Title = "Ratio"; sizeColumn.Title = "Size"; nameColumn.Resizable = true; statusColumn.Resizable = true; doneColumn.Resizable = true; seedsColumn.Resizable = true; peersColumn.Resizable = true; downSpeedColumn.Resizable = true; upSpeedColumn.Resizable = true; ratioColumn.Resizable = true; sizeColumn.Resizable = true; nameColumn.Reorderable = true; statusColumn.Reorderable = true; doneColumn.Reorderable = true; seedsColumn.Reorderable = true; peersColumn.Reorderable = true; downSpeedColumn.Reorderable = true; upSpeedColumn.Reorderable = true; ratioColumn.Reorderable = true; sizeColumn.Reorderable = true; Gtk.CellRendererText torrentNameCell = new Gtk.CellRendererText (); Gtk.CellRendererText torrentStatusCell = new Gtk.CellRendererText(); Gtk.CellRendererProgress torrentDoneCell = new Gtk.CellRendererProgress(); Gtk.CellRendererText torrentSeedsCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentPeersCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentDownSpeedCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentUpSpeedCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentRatioCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentSizeCell = new Gtk.CellRendererText(); nameColumn.PackStart(torrentNameCell, true); statusColumn.PackStart(torrentStatusCell, true); doneColumn.PackStart(torrentDoneCell, true); seedsColumn.PackStart(torrentSeedsCell, true); peersColumn.PackStart(torrentPeersCell, true); downSpeedColumn.PackStart(torrentDownSpeedCell, true); upSpeedColumn.PackStart(torrentUpSpeedCell, true); ratioColumn.PackStart(torrentRatioCell, true); sizeColumn.PackStart(torrentSizeCell, true); nameColumn.SetCellDataFunc (torrentNameCell, new Gtk.TreeCellDataFunc (RenderTorrentName)); statusColumn.SetCellDataFunc (torrentStatusCell, new Gtk.TreeCellDataFunc (RenderTorrentStatus)); doneColumn.SetCellDataFunc (torrentDoneCell, new Gtk.TreeCellDataFunc (RenderTorrentDone)); seedsColumn.SetCellDataFunc (torrentSeedsCell, new Gtk.TreeCellDataFunc (RenderTorrentSeeds)); peersColumn.SetCellDataFunc (torrentPeersCell, new Gtk.TreeCellDataFunc (RenderTorrentPeers)); downSpeedColumn.SetCellDataFunc (torrentDownSpeedCell, new Gtk.TreeCellDataFunc (RenderTorrentDownSpeed)); upSpeedColumn.SetCellDataFunc (torrentUpSpeedCell, new Gtk.TreeCellDataFunc (RenderTorrentUpSpeed)); ratioColumn.SetCellDataFunc (torrentRatioCell, new Gtk.TreeCellDataFunc (RenderTorrentRatio)); sizeColumn.SetCellDataFunc (torrentSizeCell, new Gtk.TreeCellDataFunc (RenderTorrentSize)); nameColumn.Sizing = TreeViewColumnSizing.Fixed; statusColumn.Sizing = TreeViewColumnSizing.Fixed; doneColumn.Sizing = TreeViewColumnSizing.Fixed; seedsColumn.Sizing = TreeViewColumnSizing.Fixed; peersColumn.Sizing = TreeViewColumnSizing.Fixed; downSpeedColumn.Sizing = TreeViewColumnSizing.Fixed; upSpeedColumn.Sizing = TreeViewColumnSizing.Fixed; ratioColumn.Sizing = TreeViewColumnSizing.Fixed; sizeColumn.Sizing = TreeViewColumnSizing.Fixed; AppendColumn(nameColumn); AppendColumn(statusColumn); AppendColumn(doneColumn); AppendColumn(seedsColumn); AppendColumn(peersColumn); AppendColumn(downSpeedColumn); AppendColumn(upSpeedColumn); AppendColumn(ratioColumn); AppendColumn(sizeColumn); }
private void buildColumns() { Column downloadColumn = new Column { Ignore = true, Visible = false, Title = "N/A" }; Gtk.CellRendererText torrentNameCell = new Gtk.CellRendererText (); Gtk.CellRendererText torrentStatusCell = new Gtk.CellRendererText(); Gtk.CellRendererProgress torrentDoneCell = new Gtk.CellRendererProgress(); Gtk.CellRendererText torrentSeedsCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentPeersCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentPriorityCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentDownSpeedCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentUpSpeedCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentRatioCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentSizeCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentEtaCell = new Gtk.CellRendererText(); nameColumn.PackStart(torrentNameCell, true); statusColumn.PackStart(torrentStatusCell, true); doneColumn.PackStart(torrentDoneCell, true); seedsColumn.PackStart(torrentSeedsCell, true); peersColumn.PackStart(torrentPeersCell, true); priorityColumn.PackStart(torrentPriorityCell, true); downSpeedColumn.PackStart(torrentDownSpeedCell, true); upSpeedColumn.PackStart(torrentUpSpeedCell, true); ratioColumn.PackStart(torrentRatioCell, true); sizeColumn.PackStart(torrentSizeCell, true); etaColumn.PackStart(torrentEtaCell, true); nameColumn.AddAttribute (torrentNameCell, "text", 1); statusColumn.AddAttribute (torrentStatusCell, "text", 2); statusColumn.AddAttribute (torrentStatusCell, "foreground", 11); doneColumn.AddAttribute (torrentDoneCell, "value", 3); seedsColumn.AddAttribute (torrentSeedsCell, "text", 4); peersColumn.AddAttribute (torrentPeersCell, "text", 5); priorityColumn.AddAttribute (torrentPriorityCell, "text", 12); downSpeedColumn.AddAttribute (torrentDownSpeedCell, "text", 6); upSpeedColumn.AddAttribute (torrentUpSpeedCell, "text", 7); ratioColumn.AddAttribute (torrentRatioCell, "text", 8); sizeColumn.AddAttribute (torrentSizeCell, "text", 9); etaColumn.AddAttribute (torrentEtaCell, "text", 10); AppendColumn(priorityColumn); AppendColumn(downloadColumn); AppendColumn(nameColumn); AppendColumn(statusColumn); AppendColumn(doneColumn); AppendColumn(seedsColumn); AppendColumn(peersColumn); AppendColumn(downSpeedColumn); AppendColumn(upSpeedColumn); AppendColumn(etaColumn); AppendColumn(ratioColumn); AppendColumn(sizeColumn); foreach (TreeViewColumn c in this.Columns) { c.Sizing = TreeViewColumnSizing.Fixed; c.Reorderable = true; c.Resizable = true; c.Clicked += delegate (object o, EventArgs e) { int oldId; SortType oldSort; TreeViewColumn sender = (TreeViewColumn) o; Torrents.GetSortColumnId (out oldId, out oldSort); // Invert the sort order if we're the same if (oldId == sender.SortColumnId) sender.SortOrder = sender.SortOrder == SortType.Ascending ? SortType.Descending : SortType.Ascending; else sender.SortOrder = SortType.Ascending; Torrents.SetSortColumnId (sender.SortColumnId, sender.SortOrder); }; } }
private void buildColumns() { nameColumn = new TreeViewColumn(); statusColumn = new TreeViewColumn(); doneColumn = new TreeViewColumn(); seedsColumn = new TreeViewColumn(); peersColumn = new TreeViewColumn(); downSpeedColumn = new TreeViewColumn(); upSpeedColumn = new TreeViewColumn(); ratioColumn = new TreeViewColumn(); sizeColumn = new TreeViewColumn(); nameColumn.Title = "Name"; statusColumn.Title = "Status"; doneColumn.Title = "Done"; seedsColumn.Title = "Seeds"; peersColumn.Title = "Peers"; downSpeedColumn.Title = "DL Speed"; upSpeedColumn.Title = "UP Speed"; ratioColumn.Title = "Ratio"; sizeColumn.Title = "Size"; nameColumn.Resizable = true; statusColumn.Resizable = true; doneColumn.Resizable = true; seedsColumn.Resizable = true; peersColumn.Resizable = true; downSpeedColumn.Resizable = true; upSpeedColumn.Resizable = true; ratioColumn.Resizable = true; sizeColumn.Resizable = true; nameColumn.Reorderable = true; statusColumn.Reorderable = true; doneColumn.Reorderable = true; seedsColumn.Reorderable = true; peersColumn.Reorderable = true; downSpeedColumn.Reorderable = true; upSpeedColumn.Reorderable = true; ratioColumn.Reorderable = true; sizeColumn.Reorderable = true; Gtk.CellRendererText torrentNameCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentStatusCell = new Gtk.CellRendererText(); Gtk.CellRendererProgress torrentDoneCell = new Gtk.CellRendererProgress(); Gtk.CellRendererText torrentSeedsCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentPeersCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentDownSpeedCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentUpSpeedCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentRatioCell = new Gtk.CellRendererText(); Gtk.CellRendererText torrentSizeCell = new Gtk.CellRendererText(); nameColumn.PackStart(torrentNameCell, true); statusColumn.PackStart(torrentStatusCell, true); doneColumn.PackStart(torrentDoneCell, true); seedsColumn.PackStart(torrentSeedsCell, true); peersColumn.PackStart(torrentPeersCell, true); downSpeedColumn.PackStart(torrentDownSpeedCell, true); upSpeedColumn.PackStart(torrentUpSpeedCell, true); ratioColumn.PackStart(torrentRatioCell, true); sizeColumn.PackStart(torrentSizeCell, true); nameColumn.SetCellDataFunc(torrentNameCell, new Gtk.TreeCellDataFunc(RenderTorrentName)); statusColumn.SetCellDataFunc(torrentStatusCell, new Gtk.TreeCellDataFunc(RenderTorrentStatus)); doneColumn.SetCellDataFunc(torrentDoneCell, new Gtk.TreeCellDataFunc(RenderTorrentDone)); seedsColumn.SetCellDataFunc(torrentSeedsCell, new Gtk.TreeCellDataFunc(RenderTorrentSeeds)); peersColumn.SetCellDataFunc(torrentPeersCell, new Gtk.TreeCellDataFunc(RenderTorrentPeers)); downSpeedColumn.SetCellDataFunc(torrentDownSpeedCell, new Gtk.TreeCellDataFunc(RenderTorrentDownSpeed)); upSpeedColumn.SetCellDataFunc(torrentUpSpeedCell, new Gtk.TreeCellDataFunc(RenderTorrentUpSpeed)); ratioColumn.SetCellDataFunc(torrentRatioCell, new Gtk.TreeCellDataFunc(RenderTorrentRatio)); sizeColumn.SetCellDataFunc(torrentSizeCell, new Gtk.TreeCellDataFunc(RenderTorrentSize)); nameColumn.Sizing = TreeViewColumnSizing.Fixed; statusColumn.Sizing = TreeViewColumnSizing.Fixed; doneColumn.Sizing = TreeViewColumnSizing.Fixed; seedsColumn.Sizing = TreeViewColumnSizing.Fixed; peersColumn.Sizing = TreeViewColumnSizing.Fixed; downSpeedColumn.Sizing = TreeViewColumnSizing.Fixed; upSpeedColumn.Sizing = TreeViewColumnSizing.Fixed; ratioColumn.Sizing = TreeViewColumnSizing.Fixed; sizeColumn.Sizing = TreeViewColumnSizing.Fixed; AppendColumn(nameColumn); AppendColumn(statusColumn); AppendColumn(doneColumn); AppendColumn(seedsColumn); AppendColumn(peersColumn); AppendColumn(downSpeedColumn); AppendColumn(upSpeedColumn); AppendColumn(ratioColumn); AppendColumn(sizeColumn); }