本文整理汇总了C#中Gtk.TreeStore.IterHasChild方法的典型用法代码示例。如果您正苦于以下问题:C# TreeStore.IterHasChild方法的具体用法?C# TreeStore.IterHasChild怎么用?C# TreeStore.IterHasChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.TreeStore
的用法示例。
在下文中一共展示了TreeStore.IterHasChild方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 ();
}