本文整理汇总了C#中Gtk.TreeStore.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# TreeStore.Remove方法的具体用法?C# TreeStore.Remove怎么用?C# TreeStore.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.TreeStore
的用法示例。
在下文中一共展示了TreeStore.Remove方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HelpTree
public HelpTree () : base (GettextCatalog.GetString ("Help"), Gtk.Stock.Help)
{
tree_view = new MonoDevelop.Ide.Gui.Components.PadTreeView ();
tree_view.AppendColumn ("name_col", tree_view.TextRenderer, "text", 0);
tree_view.RowExpanded += new Gtk.RowExpandedHandler (RowExpanded);
tree_view.Selection.Changed += new EventHandler (RowActivated);
store = new TreeStore (typeof (string), typeof (Node));
tree_view.Model = store;
tree_view.HeadersVisible = false;
scroller = new MonoDevelop.Components.CompactScrolledWindow ();
scroller.ShadowType = Gtk.ShadowType.None;
scroller.Add (tree_view);
if (HelpService.HelpTree != null) {
root_iter = store.AppendValues (GettextCatalog.GetString ("Mono Documentation"), HelpService.HelpTree);
PopulateNode (root_iter);
tree_view.ExpandRow (new TreePath ("0"), false);
TreeIter child_iter;
start:
if (store.IterChildren (out child_iter, root_iter)) {
do {
if (!store.IterHasChild (child_iter)) {
store.Remove (ref child_iter);
goto start;
}
} while (store.IterNext (ref child_iter));
}
}
Control.ShowAll ();
}
示例2: HelpTree
public HelpTree()
: base(GettextCatalog.GetString ("Help"), Gtk.Stock.Help)
{
tree_view = new TreeView ();
tree_view.AppendColumn ("name_col", new CellRendererText (), "text", 0);
tree_view.RowExpanded += new Gtk.RowExpandedHandler (RowExpanded);
tree_view.Selection.Changed += new EventHandler (RowActivated);
store = new TreeStore (typeof (string), typeof (Node));
root_iter = store.AppendValues (GettextCatalog.GetString ("Mono Documentation"), Runtime.Documentation.HelpTree);
PopulateNode (root_iter);
tree_view.Model = store;
tree_view.HeadersVisible = false;
scroller = new ScrolledWindow ();
scroller.ShadowType = Gtk.ShadowType.In;
scroller.Add (tree_view);
tree_view.ExpandRow (new TreePath ("0"), false);
TreeIter child_iter;
start:
store.IterChildren (out child_iter, root_iter);
do {
if (!store.IterHasChild (child_iter)) {
store.Remove (ref child_iter);
goto start;
}
} while (store.IterNext (ref child_iter));
Control.ShowAll ();
}
示例3: DirtyFilesDialog
public DirtyFilesDialog () : base (GettextCatalog.GetString ("Save Files"), IdeApp.Workbench.RootWindow, DialogFlags.Modal)
{
tsFiles = new TreeStore (typeof(string), typeof(bool), typeof(SdiWorkspaceWindow), typeof(bool));
tvFiles = new TreeView (tsFiles);
TreeIter topCombineIter = TreeIter.Zero;
Hashtable projectIters = new Hashtable ();
foreach (Document doc in IdeApp.Workbench.Documents) {
if (!doc.IsDirty)
continue;
IViewContent viewcontent = doc.Window.ViewContent;
if (viewcontent.Project != null) {
TreeIter projIter = TreeIter.Zero;
if (projectIters.ContainsKey (viewcontent.Project))
projIter = (TreeIter)projectIters [viewcontent.Project];
else {
if (topCombineIter.Equals (TreeIter.Zero))
projIter = tsFiles.AppendValues (GettextCatalog.GetString ("Project: {0}", viewcontent.Project.Name), true, null, false);
else
projIter = tsFiles.AppendValues (topCombineIter, GettextCatalog.GetString ("Project: {0}", viewcontent.Project.Name), true, null, false);
projectIters [viewcontent.Project] = projIter;
}
tsFiles.AppendValues (projIter, viewcontent.PathRelativeToProject, true, viewcontent.WorkbenchWindow);
} else {
if (viewcontent.ContentName == null) {
viewcontent.ContentName = System.IO.Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), viewcontent.UntitledName);
}
tsFiles.AppendValues (viewcontent.ContentName, true, viewcontent.WorkbenchWindow);
}
}
if (!topCombineIter.Equals (TreeIter.Zero)) {
if (!tsFiles.IterHasChild (topCombineIter))
tsFiles.Remove (ref topCombineIter);
}
TreeViewColumn mainColumn = new TreeViewColumn ();
mainColumn.Title = "header";
togRender = new CellRendererToggle ();
togRender.Toggled += toggled;
mainColumn.PackStart (togRender, false);
mainColumn.AddAttribute (togRender, "active", 1);
mainColumn.AddAttribute (togRender, "inconsistent", 3);
textRender = new CellRendererText ();
mainColumn.PackStart (textRender, true);
mainColumn.AddAttribute (textRender, "text", 0);
tvFiles.AppendColumn (mainColumn);
tvFiles.HeadersVisible = false;
tvFiles.ExpandAll ();
ScrolledWindow sc = new ScrolledWindow ();
sc.Add (tvFiles);
sc.ShadowType = ShadowType.In;
sc.BorderWidth = 6;
this.VBox.PackStart (sc, true, true, 6);
btnSaveAndQuit = new Button (GettextCatalog.GetString ("_Save and Close"));
btnQuit = new Button (Gtk.Stock.Quit);
btnQuit.Label = GettextCatalog.GetString ("_Close");
btnCancel = new Button (Gtk.Stock.Cancel);
btnSaveAndQuit.Clicked += SaveAndQuit;
btnQuit.Clicked += Quit;
btnCancel.Clicked += Cancel;
this.ActionArea.PackStart (btnCancel);
this.ActionArea.PackStart (btnQuit);
this.ActionArea.PackStart (btnSaveAndQuit);
this.SetDefaultSize (300, 200);
this.Child.ShowAll ();
}
示例4: DirtyFilesDialog
public DirtyFilesDialog()
: base(GettextCatalog.GetString ("Save Files"), (Gtk.Window)WorkbenchSingleton.Workbench, DialogFlags.Modal)
{
tsFiles = new TreeStore (typeof (string), typeof (bool), typeof (SdiWorkspaceWindow), typeof (bool));
tvFiles = new TreeView (tsFiles);
TreeIter topCombineIter = TreeIter.Zero;
Hashtable projectIters = new Hashtable ();
if (Runtime.ProjectService.CurrentOpenCombine != null) {
topCombineIter = tsFiles.AppendValues (String.Format (GettextCatalog.GetString ("Solution: {0}"), Runtime.ProjectService.CurrentOpenCombine.Name), true, null, false);
}
foreach (IViewContent viewcontent in WorkbenchSingleton.Workbench.ViewContentCollection) {
if (!viewcontent.IsDirty)
continue;
if (viewcontent.HasProject) {
TreeIter projIter = TreeIter.Zero;
if (projectIters.ContainsKey (viewcontent.Project))
projIter = (TreeIter) projectIters[viewcontent.Project];
else {
if (topCombineIter.Equals (TreeIter.Zero))
projIter = tsFiles.AppendValues (String.Format (GettextCatalog.GetString ("Project: {0}"), viewcontent.Project.Name), true, null, false);
else
projIter = tsFiles.AppendValues (topCombineIter, String.Format (GettextCatalog.GetString ("Project: {0}"), viewcontent.Project.Name), true, null, false);
projectIters[viewcontent.Project] = projIter;
}
tsFiles.AppendValues (projIter, viewcontent.PathRelativeToProject, true, viewcontent.WorkbenchWindow);
} else {
if (viewcontent.ContentName == null) {
viewcontent.ContentName = System.IO.Path.Combine (Environment.GetEnvironmentVariable ("HOME"), viewcontent.UntitledName);
}
tsFiles.AppendValues (viewcontent.ContentName, true, viewcontent.WorkbenchWindow);
}
}
if (!topCombineIter.Equals (TreeIter.Zero)) {
if (!tsFiles.IterHasChild (topCombineIter))
tsFiles.Remove (ref topCombineIter);
}
TreeViewColumn mainColumn = new TreeViewColumn ();
mainColumn.Title = "header";
CellRendererToggle togRender = new CellRendererToggle ();
togRender.Toggled += new ToggledHandler (toggled);
mainColumn.PackStart (togRender, false);
mainColumn.AddAttribute (togRender, "active", 1);
mainColumn.AddAttribute (togRender, "inconsistent", 3);
CellRendererText textRender = new CellRendererText ();
mainColumn.PackStart (textRender, true);
mainColumn.AddAttribute (textRender, "text", 0);
tvFiles.AppendColumn (mainColumn);
tvFiles.HeadersVisible = false;
tvFiles.ExpandAll ();
ScrolledWindow sc = new ScrolledWindow ();
sc.Add (tvFiles);
sc.ShadowType = ShadowType.In;
sc.BorderWidth = 6;
this.VBox.PackStart (sc, true, true, 6);
btnSaveAndQuit = new Button (GettextCatalog.GetString ("_Save and Quit"));
btnQuit = new Button (Gtk.Stock.Quit);
btnCancel = new Button (Gtk.Stock.Cancel);
btnSaveAndQuit.Clicked += new EventHandler (SaveAndQuit);
btnQuit.Clicked += new EventHandler (Quit);
btnCancel.Clicked += new EventHandler (Cancel);
this.ActionArea.PackStart (btnCancel);
this.ActionArea.PackStart (btnQuit);
this.ActionArea.PackStart (btnSaveAndQuit);
this.SetDefaultSize (300, 200);
this.ShowAll ();
}
示例5: AddinView
public AddinView()
{
var hbox = new HBox () { Spacing = 6 };
var filter_label = new Label (Catalog.GetString ("Show:"));
var filter_combo = new ComboBoxText ();
filter_combo.AppendText (Catalog.GetString ("All"));
filter_combo.AppendText (Catalog.GetString ("Enabled"));
filter_combo.AppendText (Catalog.GetString ("Not Enabled"));
filter_combo.Active = 0;
var search_label = new Label (Catalog.GetString ("Search:"));
var search_entry = new Banshee.Widgets.SearchEntry () {
WidthRequest = 160,
Visible = true,
Ready = true
};
hbox.PackStart (filter_label, false, false, 0);
hbox.PackStart (filter_combo, false, false, 0);
hbox.PackEnd (search_entry, false, false, 0);
hbox.PackEnd (search_label, false, false, 0);
var model = new TreeStore (typeof(bool), typeof(bool), typeof (string), typeof (Addin));
var addins = AddinManager.Registry.GetAddins ().Where (a => { return
a.Name != a.Id && a.Description != null &&
!String.IsNullOrEmpty (a.Description.Category) && !a.Description.Category.StartsWith ("required:") &&
(!a.Description.Category.Contains ("Debug") || ApplicationContext.Debugging);
});
var categorized_addins = addins.GroupBy<Addin, string> (a => a.Description.Category)
.Select (c => new {
Addins = c.OrderBy (a => Catalog.GetString (a.Name)).ToList (),
Name = c.Key,
NameLocalized = Catalog.GetString (c.Key) })
.OrderBy (c => c.NameLocalized)
.ToList ();
tree_view = new TreeView () {
FixedHeightMode = false,
HeadersVisible = false,
SearchColumn = 1,
RulesHint = true,
Model = model
};
var update_model = new System.Action (() => {
string search = search_entry.Query;
bool? enabled = filter_combo.Active > 0 ? (bool?) (filter_combo.Active == 1 ? true : false) : null;
model.Clear ();
foreach (var cat in categorized_addins) {
var cat_iter = model.AppendValues (false, false, String.Format ("<b>{0}</b>", GLib.Markup.EscapeText (cat.NameLocalized)), null);
bool any = false;
foreach (var a in cat.Addins.Matching (search)) {
if (enabled == null || (a.Enabled == enabled.Value)) {
model.AppendValues (cat_iter, true,
a.Enabled,
String.Format (
"<b>{0}</b>\n<small>{1}</small>",
GLib.Markup.EscapeText (Catalog.GetString (a.Name)),
GLib.Markup.EscapeText (Catalog.GetString (a.Description.Description))),
a
);
any = true;
}
}
if (!any) {
model.Remove (ref cat_iter);
}
}
tree_view.ExpandAll ();
});
var txt_cell = new CellRendererText () { WrapMode = Pango.WrapMode.Word };
tree_view.AppendColumn ("Name", txt_cell , "markup", Columns.Name);
var check_cell = new CellRendererToggle () { Activatable = true };
tree_view.AppendColumn ("Enable", check_cell, "visible", Columns.IsAddin, "active", Columns.IsEnabled);
check_cell.Toggled += (o, a) => {
TreeIter iter;
if (model.GetIter (out iter, new TreePath (a.Path))) {
var addin = model.GetValue (iter, 3) as Addin;
bool enabled = (bool) model.GetValue (iter, 1);
addin.Enabled = !enabled;
model.SetValue (iter, 1, addin.Enabled);
model.Foreach (delegate (ITreeModel current_model, TreePath path, TreeIter current_iter) {
var an = current_model.GetValue (current_iter, 3) as Addin;
if (an != null) {
current_model.SetValue (current_iter, 1, an.Enabled);
}
return false;
});
}
};
update_model ();
search_entry.Changed += (o, a) => update_model ();
filter_combo.Changed += (o, a) => update_model ();
//.........这里部分代码省略.........
示例6: processOldSelectedSessions
//oldSelectedSessions is an ArrayList with three cols (values of the old selectedSessions)
//now, find iters corresponding to each of this sessions and put in the selected treeview, and delete from the unselected treeview
private void processOldSelectedSessions(Gtk.TreeView treeview1, TreeStore store1, TreeStore store2, ArrayList oldSelectedSessions)
{
TreeIter iter1 = new TreeIter();
string [] strIter = {"", "", "", "", ""};
for (int i=0; i < oldSelectedSessions.Count ; i ++) {
string [] str = oldSelectedSessions[i].ToString().Split(new char[] {':'});
findRowForIter(treeview1, store1, out iter1, Convert.ToInt32(str[0]));
for (int j=0; j < 5; j ++) {
strIter [j] = (string) treeview1.Model.GetValue (iter1, j);
}
//print values
store2.AppendValues (strIter[0], strIter[1], strIter[2], strIter[3], strIter[4]);
//delete iter1
store1.Remove(ref iter1);
}
}