本文整理汇总了C#中Gtk.TreeStore.SetSortFunc方法的典型用法代码示例。如果您正苦于以下问题:C# TreeStore.SetSortFunc方法的具体用法?C# TreeStore.SetSortFunc怎么用?C# TreeStore.SetSortFunc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.TreeStore
的用法示例。
在下文中一共展示了TreeStore.SetSortFunc方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GacReferencePanel
public GacReferencePanel(SelectReferenceDialog selectDialog)
{
this.selectDialog = selectDialog;
store = new TreeStore (typeof (string), typeof (string), typeof(string), typeof(bool), typeof(string));
treeView = new TreeView (store);
TreeViewColumn firstColumn = new TreeViewColumn ();
firstColumn.Title = GettextCatalog.GetString ("Reference Name");
CellRendererToggle tog_render = new CellRendererToggle ();
tog_render.Toggled += new Gtk.ToggledHandler (AddReference);
firstColumn.PackStart (tog_render, false);
firstColumn.AddAttribute (tog_render, "active", 3);
CellRendererText text_render = new CellRendererText ();
firstColumn.PackStart (text_render, true);
firstColumn.AddAttribute (text_render, "text", 0);
treeView.AppendColumn (firstColumn);
treeView.AppendColumn (GettextCatalog.GetString ("Version"), new CellRendererText (), "text", 1);
// FIXME: this seems useless
//treeView.AppendColumn (GettextCatalog.GetString ("Path"), new CellRendererText (), "text", 2);
store.SetSortColumnId (0, SortType.Ascending);
store.SetSortFunc (0, new TreeIterCompareFunc (SortTree));
PrintCache();
ScrolledWindow sc = new ScrolledWindow ();
sc.ShadowType = Gtk.ShadowType.In;
sc.Add (treeView);
this.PackStart (sc, true, true, 0);
ShowAll ();
BorderWidth = 6;
}
示例2: Init
//.........这里部分代码省略.........
colCommit.AddAttribute (cellToggle, "active", ColCommit);
colCommit.AddAttribute (cellToggle, "visible", ColShowToggle);
colCommit.AddAttribute (crc, "visible", ColShowComment);
CellRendererText crt = new CellRendererText();
var crp = new CellRendererImage ();
TreeViewColumn colStatus = new TreeViewColumn ();
colStatus.Title = GettextCatalog.GetString ("Status");
colStatus.PackStart (crp, false);
colStatus.PackStart (crt, true);
colStatus.AddAttribute (crp, "image", ColIcon);
colStatus.AddAttribute (crp, "visible", ColShowStatus);
colStatus.AddAttribute (crt, "text", ColStatus);
colStatus.AddAttribute (crt, "foreground", ColStatusColor);
colFile = new TreeViewColumn ();
colFile.Title = GettextCatalog.GetString ("File");
colFile.Spacing = 2;
crp = new CellRendererImage ();
diffRenderer = new CellRendererDiff ();
colFile.PackStart (crp, false);
colFile.PackStart (diffRenderer, true);
colFile.AddAttribute (crp, "image", ColIconFile);
colFile.AddAttribute (crp, "visible", ColShowStatus);
colFile.SetCellDataFunc (diffRenderer, new TreeCellDataFunc (SetDiffCellData));
crt = new CellRendererText();
crp = new CellRendererImage ();
colRemote = new TreeViewColumn ();
colRemote.Title = GettextCatalog.GetString ("Remote Status");
colRemote.PackStart (crp, false);
colRemote.PackStart (crt, true);
colRemote.AddAttribute (crp, "image", ColRemoteIcon);
colRemote.AddAttribute (crt, "text", ColRemoteStatus);
colRemote.AddAttribute (crt, "foreground", ColStatusColor);
filelist.AppendColumn(colStatus);
filelist.AppendColumn(colRemote);
filelist.AppendColumn(colCommit);
filelist.AppendColumn(colFile);
colRemote.Visible = false;
filestore = new TreeStore (typeof (Xwt.Drawing.Image), typeof (string), typeof (string[]), typeof (string), typeof(bool), typeof(bool), typeof(string), typeof(bool), typeof (bool), typeof(Xwt.Drawing.Image), typeof(bool), typeof (Xwt.Drawing.Image), typeof(string), typeof(bool), typeof(bool));
filelist.Model = filestore;
filelist.TestExpandRow += new Gtk.TestExpandRowHandler (OnTestExpandRow);
commitBox = new VBox ();
HeaderBox commitMessageLabelBox = new HeaderBox ();
commitMessageLabelBox.SetPadding (6, 6, 6, 6);
commitMessageLabelBox.SetMargins (1, 1, 0, 0);
HBox labBox = new HBox ();
labelCommit = new Gtk.Label (GettextCatalog.GetString ("Commit message:"));
labelCommit.Xalign = 0;
labBox.PackStart (new Xwt.ImageView (Xwt.Drawing.Image.FromResource ("comment-16.png")).ToGtkWidget (), false, false, 0);
labBox.PackStart (labelCommit, true, true, 3);
commitMessageLabelBox.Add (labBox);
commitMessageLabelBox.ShowAll ();
//commitBox.PackStart (commitMessageLabelBox, false, false, 0);
Gtk.ScrolledWindow frame = new Gtk.ScrolledWindow ();
frame.HeightRequest = 75;
frame.ShadowType = ShadowType.None;
commitText = new TextView ();
commitText.WrapMode = WrapMode.WordChar;
commitText.Buffer.Changed += OnCommitTextChanged;
frame.Add (commitText);
commitBox.PackStart (frame, true, true, 0);
var paned = new VPanedThin ();
paned.HandleWidget = commitMessageLabelBox;
paned.Pack1 (scroller, true, true);
paned.Pack2 (commitBox, false, false);
main.PackStart (paned, true, true, 0);
main.ShowAll();
status.Visible = false;
filelist.Selection.Changed += new EventHandler(OnCursorChanged);
VersionControlService.FileStatusChanged += OnFileStatusChanged;
filelist.HeadersClickable = true;
filestore.SetSortFunc (0, CompareNodes);
colStatus.SortColumnId = 0;
filestore.SetSortFunc (1, CompareNodes);
colRemote.SortColumnId = 1;
filestore.SetSortFunc (2, CompareNodes);
colCommit.SortColumnId = 2;
filestore.SetSortFunc (3, CompareNodes);
colFile.SortColumnId = 3;
filestore.SetSortColumnId (3, Gtk.SortType.Ascending);
filelist.DoPopupMenu = DoPopupMenu;
StartUpdate();
}
示例3: ReferenceTreeViewer
public ReferenceTreeViewer()
{
Build ();
store = new Gtk.TreeStore (typeof(object), typeof(string), typeof(string), typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
treeview.Model = store;
treeview.HeadersClickable = true;
Gtk.TreeViewColumn complete_column = new Gtk.TreeViewColumn ();
complete_column.Title = "Type";
complete_column.Resizable = true;
Gtk.CellRendererPixbuf pix_render = new Gtk.CellRendererPixbuf ();
complete_column.PackStart (pix_render, false);
complete_column.AddAttribute (pix_render, "stock-id", ImageCol);
Gtk.CellRendererText text_render = new Gtk.CellRendererText ();
complete_column.PackStart (text_render, true);
complete_column.AddAttribute (text_render, "text", TypeCol);
complete_column.Clickable = true;
treeview.AppendColumn (complete_column);
AddColumn ("Instances", InstancesCol, "Number of instances of a type. Only instances that contain references are included.");
TreeColRefs = treeview.Columns.Length;
AddColumn ("References", RefsCol, "Number of references to the parent type.");
AddColumn ("Root Refs", RootRefsCol, "Number of indirect references to instances of the tree root type.");
AddColumn ("Root Mem", RootMemCol, "Amount of memory of the root instances indirectly referenced.");
AddColumn ("Memory Size", SizeCol, "Memory allocated by instances of the type.");
AddColumn ("Avg. Size", AvgSizeCol, "Average size of the instances.");
treeview.TestExpandRow += new Gtk.TestExpandRowHandler (OnTestExpandRow);
treeview.RowActivated += new Gtk.RowActivatedHandler (OnNodeActivated);
treeview.AppendColumn (new Gtk.TreeViewColumn());
int nc = 0;
foreach (TreeViewColumn c in treeview.Columns) {
store.SetSortFunc (nc, CompareNodes);
c.SortColumnId = nc++;
}
store.SetSortColumnId (1, Gtk.SortType.Descending);
treeview.RulesHint = true;
tips.Enable ();
}
示例4: UpdateList
private void UpdateList()
{
visibility.Clear();
TreeStore store = new TreeStore(typeof(System.Object));
Model = store;
store.SetSortFunc( 0, compareLayer );
store.SetSortColumnId( 0, SortType.Ascending );
foreach(ILayer ILayer in sector.GetObjects(typeof(ILayer))) {
if (ILayer is IDrawableLayer) {
visibility[ILayer] = application.CurrentRenderer.GetILayerColor(ILayer).Alpha;
}
store.AppendValues(ILayer);
if (ILayer is Tilemap) {
Tilemap Tilemap = (Tilemap) ILayer;
// if no tilemap is yet selected, select the first solid one
if ((application.CurrentTilemap == null) && (Tilemap.Solid)) {
application.CurrentTilemap = Tilemap;
string name = (String.IsNullOrEmpty(Tilemap.Name))?"":" \"" +Tilemap.Name + "\"";
application.EditProperties(application.CurrentTilemap, "Tilemap" + name + " (" + application.CurrentTilemap.Layer + ")");
}
}
}
visibility[separatorObject] = 0;
store.AppendValues(separatorObject);
visibility[badguysObject] = application.CurrentRenderer.GetObjectsColor().Alpha;
store.AppendValues(badguysObject);
QueueDraw();
}
示例5: StatusView
//.........这里部分代码省略.........
var crc = new CellRendererIcon ();
crc.StockId = "vc-comment";
colCommit = new TreeViewColumn ();
colCommit.Spacing = 2;
colCommit.Widget = new Gtk.Image ("vc-commit", Gtk.IconSize.Menu);
colCommit.Widget.Show ();
colCommit.PackStart (cellToggle, false);
colCommit.PackStart (crc, false);
colCommit.AddAttribute (cellToggle, "active", ColCommit);
colCommit.AddAttribute (cellToggle, "visible", ColShowToggle);
colCommit.AddAttribute (crc, "visible", ColShowComment);
CellRendererText crt = new CellRendererText();
var crp = new CellRendererPixbuf ();
TreeViewColumn colStatus = new TreeViewColumn ();
colStatus.Title = GettextCatalog.GetString ("Status");
colStatus.PackStart (crp, false);
colStatus.PackStart (crt, true);
colStatus.AddAttribute (crp, "pixbuf", ColIcon);
colStatus.AddAttribute (crp, "visible", ColShowStatus);
colStatus.AddAttribute (crt, "text", ColStatus);
colStatus.AddAttribute (crt, "foreground", ColStatusColor);
TreeViewColumn colFile = new TreeViewColumn ();
colFile.Title = GettextCatalog.GetString ("File");
colFile.Spacing = 2;
crp = new CellRendererPixbuf ();
diffRenderer = new CellRendererDiff ();
colFile.PackStart (crp, false);
colFile.PackStart (diffRenderer, true);
colFile.AddAttribute (crp, "pixbuf", ColIconFile);
colFile.AddAttribute (crp, "visible", ColShowStatus);
colFile.SetCellDataFunc (diffRenderer, new TreeCellDataFunc (SetDiffCellData));
crt = new CellRendererText();
crp = new CellRendererPixbuf ();
colRemote = new TreeViewColumn ();
colRemote.Title = GettextCatalog.GetString ("Remote Status");
colRemote.PackStart (crp, false);
colRemote.PackStart (crt, true);
colRemote.AddAttribute (crp, "pixbuf", ColRemoteIcon);
colRemote.AddAttribute (crt, "text", ColRemoteStatus);
colRemote.AddAttribute (crt, "foreground", ColStatusColor);
filelist.AppendColumn(colStatus);
filelist.AppendColumn(colRemote);
filelist.AppendColumn(colCommit);
filelist.AppendColumn(colFile);
colRemote.Visible = false;
filestore = new TreeStore (typeof (Gdk.Pixbuf), typeof (string), typeof (string[]), typeof (string), typeof(bool), typeof(bool), typeof(string), typeof(bool), typeof (bool), typeof(Gdk.Pixbuf), typeof(bool), typeof (Gdk.Pixbuf), typeof(string), typeof(bool), typeof(bool));
filelist.Model = filestore;
filelist.TestExpandRow += new Gtk.TestExpandRowHandler (OnTestExpandRow);
commitBox = new VBox ();
HBox labBox = new HBox ();
labelCommit = new Gtk.Label (GettextCatalog.GetString ("Commit message:"));
labelCommit.Xalign = 0;
labBox.PackStart (new Gtk.Image ("vc-comment", Gtk.IconSize.Menu), false, false, 0);
labBox.PackStart (labelCommit, true, true, 3);
commitBox.PackStart (labBox, false, false, 0);
Gtk.ScrolledWindow frame = new Gtk.ScrolledWindow ();
frame.ShadowType = ShadowType.In;
commitText = new TextView ();
commitText.WrapMode = WrapMode.WordChar;
commitText.Buffer.Changed += OnCommitTextChanged;
frame.Add (commitText);
commitBox.PackStart (frame, true, true, 6);
VPaned paned = new VPaned ();
paned.Pack1 (scroller, true, true);
paned.Pack2 (commitBox, false, false);
main.PackStart (paned, true, true, 0);
main.ShowAll();
status.Visible = false;
filelist.Selection.Changed += new EventHandler(OnCursorChanged);
VersionControlService.FileStatusChanged += OnFileStatusChanged;
filelist.HeadersClickable = true;
filestore.SetSortFunc (0, CompareNodes);
colStatus.SortColumnId = 0;
filestore.SetSortFunc (1, CompareNodes);
colRemote.SortColumnId = 1;
filestore.SetSortFunc (2, CompareNodes);
colCommit.SortColumnId = 2;
filestore.SetSortFunc (3, CompareNodes);
colFile.SortColumnId = 3;
filestore.SetSortColumnId (3, Gtk.SortType.Ascending);
filelist.DoPopupMenu = DoPopupMenu;
StartUpdate();
}
示例6: ChangeSetView
public ChangeSetView ()
{
ShadowType = Gtk.ShadowType.In;
filelist = new FileTreeView();
filelist.Selection.Mode = SelectionMode.Multiple;
Add (filelist);
HscrollbarPolicy = PolicyType.Automatic;
VscrollbarPolicy = PolicyType.Automatic;
filelist.RowActivated += OnRowActivated;
filelist.DiffLineActivated += OnDiffLineActivated;
CellRendererToggle cellToggle = new CellRendererToggle();
// cellToggle.Toggled += new ToggledHandler(OnCommitToggledHandler);
var crc = new CellRendererIcon ();
crc.StockId = "vc-comment";
colCommit = new TreeViewColumn ();
colCommit.Spacing = 2;
colCommit.Widget = new Gtk.Image ("vc-commit", Gtk.IconSize.Menu);
colCommit.Widget.Show ();
colCommit.PackStart (cellToggle, false);
colCommit.PackStart (crc, false);
colCommit.AddAttribute (cellToggle, "active", ColCommit);
colCommit.AddAttribute (cellToggle, "visible", ColShowToggle);
colCommit.AddAttribute (crc, "visible", ColShowComment);
colCommit.Visible = false;
CellRendererText crt = new CellRendererText();
var crp = new CellRendererPixbuf ();
TreeViewColumn colStatus = new TreeViewColumn ();
colStatus.Title = GettextCatalog.GetString ("Status");
colStatus.PackStart (crp, false);
colStatus.PackStart (crt, true);
colStatus.AddAttribute (crp, "pixbuf", ColIcon);
colStatus.AddAttribute (crp, "visible", ColShowStatus);
colStatus.AddAttribute (crt, "text", ColStatus);
colStatus.AddAttribute (crt, "foreground", ColStatusColor);
TreeViewColumn colFile = new TreeViewColumn ();
colFile.Title = GettextCatalog.GetString ("File");
colFile.Spacing = 2;
crp = new CellRendererPixbuf ();
diffRenderer = new CellRendererDiff ();
colFile.PackStart (crp, false);
colFile.PackStart (diffRenderer, true);
colFile.AddAttribute (crp, "pixbuf", ColIconFile);
colFile.AddAttribute (crp, "visible", ColShowStatus);
colFile.SetCellDataFunc (diffRenderer, new TreeCellDataFunc (SetDiffCellData));
filelist.AppendColumn(colStatus);
filelist.AppendColumn(colCommit);
filelist.AppendColumn(colFile);
filestore = new TreeStore (typeof (Gdk.Pixbuf), typeof (string), typeof (string[]), typeof(bool), typeof(bool), typeof(string), typeof(bool), typeof (bool), typeof(Gdk.Pixbuf), typeof(bool), typeof(string));
filelist.Model = filestore;
filelist.TestExpandRow += new Gtk.TestExpandRowHandler (OnTestExpandRow);
ShowAll();
filelist.Selection.Changed += new EventHandler(OnCursorChanged);
filelist.HeadersClickable = true;
filestore.SetSortFunc (0, CompareNodes);
colStatus.SortColumnId = 0;
filestore.SetSortFunc (1, CompareNodes);
colCommit.SortColumnId = 1;
filestore.SetSortFunc (2, CompareNodes);
colFile.SortColumnId = 2;
filestore.SetSortColumnId (2, Gtk.SortType.Ascending);
}
示例7: BacktracesView
public BacktracesView ()
{
window = new ScrolledWindow ();
tree = new TreeView ();
tree.RulesHint = true;
// icon type count #bytes avg size avg age
store = new TreeStore (typeof (string), typeof (string), typeof (string), typeof (string), typeof (string), typeof (string), typeof (object));
tree.Model = store;
CellRendererPixbuf pixbufRenderer = new CellRendererPixbuf ();
CellRendererText typeRenderer = new CellRendererText ();
CellRendererText countRenderer = new CellRendererText ();
CellRendererText totalSizeRenderer = new CellRendererText ();
CellRendererText avgSizeRenderer = new CellRendererText ();
CellRendererText avgAgeRenderer = new CellRendererText ();
TreeViewColumn columnType = new TreeViewColumn ();
TreeViewColumn columnCount = new TreeViewColumn ();
TreeViewColumn columnTotalSize = new TreeViewColumn ();
TreeViewColumn columnAvgSize = new TreeViewColumn ();
TreeViewColumn columnAvgAge = new TreeViewColumn ();
columnType.Title = GettextCatalog.GetString ("Type");
columnCount.Title = GettextCatalog.GetString ("Count");
columnTotalSize.Title = GettextCatalog.GetString ("Total Size");
columnAvgSize.Title = GettextCatalog.GetString ("Avg Size");
columnAvgAge.Title = GettextCatalog.GetString ("Avg Age");
columnType.PackStart (pixbufRenderer, false);
columnType.PackStart (typeRenderer, true);
columnCount.PackStart (countRenderer, true);
columnTotalSize.PackStart (totalSizeRenderer, true);
columnAvgSize.PackStart (avgSizeRenderer, true);
columnAvgAge.PackStart (avgAgeRenderer, true);
columnType.AddAttribute (pixbufRenderer, "stock-id", 0);
columnType.AddAttribute (typeRenderer, "text", 1);
columnCount.AddAttribute (countRenderer, "text", 2);
columnTotalSize.AddAttribute (totalSizeRenderer, "text", 3);
columnAvgSize.AddAttribute (avgSizeRenderer, "text", 4);
columnAvgAge.AddAttribute (avgAgeRenderer, "text", 5);
tree.AppendColumn (columnType);
tree.AppendColumn (columnCount);
tree.AppendColumn (columnTotalSize);
tree.AppendColumn (columnAvgSize);
tree.AppendColumn (columnAvgAge);
int nc = 0;
foreach (TreeViewColumn c in tree.Columns) {
store.SetSortFunc (nc, CompareNodes);
c.SortColumnId = nc++;
}
store.SetSortColumnId (1, SortType.Descending);
window.Add (tree);
window.ShowAll ();
}
示例8: InitStores
/// <summary>
/// Initializes the Group and People Stores
/// </summary>
private void InitStores()
{
// Initialize the stores
groupTreeStore = new Gtk.TreeStore(typeof(PersonGroup));
personTreeStore = new Gtk.TreeStore(typeof(Person));
personTreeStore.SetSortFunc(0, PersonTreeSort);
personTreeStore.SetSortColumnId(0, SortType.Ascending);
// Query Evolution for all contact objects (Contacts and Lists)
// to populate the stores
// Evolution.BookQuery q = Evolution.BookQuery.AnyFieldContains ("");
// ArrayList fieldsList = new ArrayList ();
// bookView = systemBook.GetBookView (q, fieldsList, -1);
// bookView.ContactsAdded += OnContactsAdded;
// bookView.ContactsChanged += OnContactsChanged;
// bookView.ContactsRemoved += OnContactsRemoved;
// starting the view will cause the above events to fire
// and begin populating the stores
// bookView.Start();
}