本文整理汇总了C#中Gtk.TreeStore.GetPath方法的典型用法代码示例。如果您正苦于以下问题:C# TreeStore.GetPath方法的具体用法?C# TreeStore.GetPath怎么用?C# TreeStore.GetPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.TreeStore
的用法示例。
在下文中一共展示了TreeStore.GetPath方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ObjectWindow
public ObjectWindow(RuntimeThread runtimeThread, object root)
: base(GetTitle(root))
{
SetDefaultSize(250, 300);
SkipPagerHint = true;
SkipTaskbarHint = true;
scroller = new ScrolledWindow();
scroller.BorderWidth = 5;
scroller.ShadowType = ShadowType.In;
Add(scroller);
store = new TreeStore(typeof(string), typeof(object), typeof(bool));
//TreeModelSort storeSort = new TreeModelSort(store);
//storeSort.SetSortColumnId(0, SortType.Ascending);
view = new TreeView(store);
view.AppendColumn(null, new CellRendererText(), "text", VALUE_TEXT);
view.HeadersVisible = false;
view.RowExpanded += OnTreeRowExpanded;
view.RowCollapsed += OnTreeRowCollapsed;
scroller.Add(view);
Add(false, new TreeIter(), "", root, false, false);
TreeIter first;
store.GetIterFirst(out first);
view.ExpandRow(store.GetPath(first), false);
}
示例2: GetIsExpanded
bool GetIsExpanded (Gtk.TreeIter iter, TreeStore treeStore)
{
if (TreeIter.Zero.Equals (iter))
return false;
var path = treeStore.GetPath (iter);
return path != null ? treeview.GetRowExpanded (path) : false;
}
示例3: TreeviewAddRow
//startOrEnd is true at start, false at end
public static void TreeviewAddRow(Gtk.TreeView tv, TreeStore store, string [] row, bool startOrEnd)
{
TreeIter iter = new TreeIter();
store.GetIterFirst(out iter);
if(startOrEnd)
iter = store.InsertWithValues(0,row);
else
iter = store.AppendValues(row);
//scroll treeview if needed
TreePath path = store.GetPath (iter);
tv.ScrollToCell (path, null, true, 0, 0);
}
示例4: ShowAdd2Page
private void ShowAdd2Page()
{
Header = CmisSync.Properties_Resources.ResourceManager.GetString("Which", CultureInfo.CurrentCulture);
VBox layout_vertical = new VBox (false, 12);
Button cancel_button = new Button (cancelText);
cancel_button.Clicked += delegate {
Controller.PageCancelled ();
};
Button continue_button = new Button (continueText)
{
Sensitive = false
};
continue_button.Clicked += delegate {
Controller.Add2PageCompleted(
Controller.saved_repository, Controller.saved_remote_path);
};
Button back_button = new Button (backText)
{
Sensitive = true
};
back_button.Clicked += delegate {
Controller.BackToPage1();
};
TreeStore repoStore = new Gtk.TreeStore(typeof (string), typeof (SelectionTreeItem));
TreeIter iter;
foreach (KeyValuePair<String, String> repository in Controller.repositories)
{
iter = repoStore.AppendNode();
repoStore.SetValues(iter, repository.Value , new SelectionTreeItem(repository.Key, "/"));
}
Gtk.TreeView treeView = new Gtk.TreeView(repoStore);
treeView.HeadersVisible = false;
treeView.Selection.Mode = SelectionMode.Single;
treeView.AppendColumn("Name", new CellRendererText(), "text", 0);
treeView.CursorChanged += delegate(object o, EventArgs args) {
TreeSelection selection = (o as TreeView).Selection;
TreeModel model;
if (selection.GetSelected(out model, out iter)) {
SelectionTreeItem sti = model.GetValue(iter, 1) as SelectionTreeItem;
// Identify the selected remote path.
Controller.saved_remote_path = sti.fullPath;
// Identify the selected repository.
TreeIter cnode = iter;
TreeIter pnode = iter;
while (model.IterParent(out pnode, cnode)) {
cnode = pnode;
}
Controller.saved_repository = (model.GetValue(cnode, 1) as SelectionTreeItem).repository;
// Load sub-folders if it has not been done already.
// We use each item's Tag to store metadata: whether this item's subfolders have been loaded or not.
if (sti.childrenLoaded == false)
{
this.GdkWindow.Cursor = wait_cursor;
// Get list of subfolders asynchronously
GetSubfoldersDelegate dlgt = new GetSubfoldersDelegate(CmisUtils.GetSubfolders);
IAsyncResult ar = dlgt.BeginInvoke(Controller.saved_repository,
Controller.saved_remote_path, Controller.saved_address,
Controller.saved_user, Controller.saved_password, null, null);
while (!ar.AsyncWaitHandle.WaitOne(100)) {
while (Application.EventsPending()) {
Application.RunIteration();
}
}
string[] subfolders = dlgt.EndInvoke(ar);
TreePath tp = null;
// Create a sub-item for each subfolder
foreach (string subfolder in subfolders) {
TreeIter newchild = repoStore.AppendNode(iter);
repoStore.SetValues(newchild, System.IO.Path.GetFileName(subfolder),
new SelectionTreeItem(null, subfolder));
if (null == tp) {
tp = repoStore.GetPath(newchild);
}
}
sti.childrenLoaded = true;
if (null != tp) {
treeView.ExpandToPath(tp);
}
this.GdkWindow.Cursor = default_cursor;
}
continue_button.Sensitive = true;
}
};
ScrolledWindow sw = new ScrolledWindow() {
ShadowType = Gtk.ShadowType.In
};
sw.Add(treeView);
//.........这里部分代码省略.........
示例5: CoverageView
public CoverageView (string fileName, ProgressBar status)
{
TreeStore store = new TreeStore (typeof (string), typeof (string), typeof (string), typeof (string), typeof (object));
tree = new TreeView (store);
CellRendererText renderer = new CellRendererText ();
// LAME: Why is this property a float instead of a double ?
renderer.Xalign = 0.5f;
tree.AppendColumn ("Classes", new CellRendererText (), "text", 0);
tree.AppendColumn ("Lines Hit", renderer, "text", 1);
tree.AppendColumn ("Lines Missed", renderer, "text", 2);
tree.AppendColumn ("Coverage", renderer, "text", 3);
tree.GetColumn (0).Resizable = true;
tree.GetColumn (1).Alignment = 0.0f;
tree.GetColumn (1).Resizable = true;
tree.GetColumn (2).Alignment = 0.0f;
tree.GetColumn (2).Resizable = true;
tree.GetColumn (3).Alignment = 0.0f;
tree.GetColumn (3).Resizable = true;
tree.HeadersVisible = true;
model = new CoverageModel ();
foreach (string filter in DEFAULT_FILTERS) {
model.AddFilter (filter);
}
this.status = status;
model.Progress += Progress;
model.ReadFromFile (fileName);
TreeItem root = new TreeItem (store, null, model, "PROJECT");
Hashtable classes2 = model.Classes;
namespaces = new Hashtable ();
string[] sorted_names = new string [classes2.Count];
classes2.Keys.CopyTo (sorted_names, 0);
Array.Sort (sorted_names);
Progress ("Building tree", 0.95);
foreach (string name in sorted_names) {
ClassCoverageItem klass = (ClassCoverageItem)classes2 [name];
if (klass.filtered)
continue;
string namespace2 = klass.name_space;
TreeItem nsItem = (TreeItem)namespaces [namespace2];
if (nsItem == null) {
nsItem = new TreeItem (store, root, (CoverageItem)model.Namespaces [namespace2], namespace2);
// nsItem.SetPixmap (0, namespaceOpenPixmap);
namespaces [namespace2] = nsItem;
}
if (nsItem.model.filtered)
continue;
ClassItem classItem = new ClassItem (store, nsItem, klass, klass.name);
// We should create the method nodes only when the class item
// is opened
foreach (MethodCoverageItem method in klass.Methods) {
if (method.filtered)
continue;
string title = method.Name;
if (title.Length > 64)
title = title.Substring (0, 63) + "...)";
new MethodItem (store, classItem, classItem, method, title);
}
}
tree.ExpandRow (store.GetPath (root.Iter), false);
// it becomes very hard to navigate if everything is expanded
//foreach (string ns in namespaces.Keys)
// tree.ExpandRow (store.GetPath (((TreeItem)namespaces [ns]).Iter), false);
tree.ButtonPressEvent += new ButtonPressEventHandler (OnButtonPress);
tree.Selection.Mode = SelectionMode.Single;
source_views = new Hashtable ();
window_maps = new Hashtable ();
Progress ("Done", 1.0);
// LAME: Why doesn't widgets visible by default ???
tree.Show ();
}
示例6: ViewsTreeView
public ViewsTreeView()
: base()
{
viewsStore = new TreeStore (typeof (Gdk.Pixbuf), typeof (string));
this.Model = viewsStore;
this.HeadersVisible = false;
this.AppendColumn ("viewsIcon", new CellRendererPixbuf (), "pixbuf", (int)TreeCols.Icon);
this.AppendColumn ("viewsRoot", new CellRendererText (), "text", (int)TreeCols.Name);
Gdk.Pixbuf dirIcon = Pixbuf.LoadFromResource ("x-directory-remote-server.png");
viewRootIter = viewsStore.AppendValues (dirIcon, "Servers");
TreePath path = viewsStore.GetPath (viewRootIter);
foreach (string n in Global.Connections.ConnectionNames) {
TreeIter iter = viewsStore.AppendValues (viewRootIter, dirIcon, n);
viewsStore.AppendValues (iter, null, "");
}
this.RowExpanded += new RowExpandedHandler (OnRowExpanded);
this.RowActivated += new RowActivatedHandler (OnRowActivated);
this.ExpandRow (path, false);
this.ShowAll ();
}
示例7: CoverageView
public CoverageView(string fileName, ProgressBar status)
{
store = new TreeStore (typeof(string), typeof(string), typeof(string), typeof(string), typeof(object));
tree = new TreeView (store);
CellRendererText renderer = new CellRendererText ();
CellRendererText coverageRenderer = new CellRendererText ();
// LAME: Why is this property a float instead of a double ?
renderer.Xalign = 0.5f;
tree.AppendColumn ("Classes", new CellRendererText (), "text", 0);
tree.AppendColumn ("Lines Hit", renderer, "text", 1);
tree.AppendColumn ("Lines Missed", renderer, "text", 2);
tree.AppendColumn ("Coverage", coverageRenderer, "text", 3);
tree.GetColumn (0).Resizable = true;
tree.GetColumn (1).Alignment = 0.0f;
tree.GetColumn (1).Resizable = true;
tree.GetColumn (2).Alignment = 0.0f;
tree.GetColumn (2).Resizable = true;
tree.GetColumn (3).Alignment = 0.0f;
tree.GetColumn (3).Resizable = true;
tree.GetColumn (3).SetCellDataFunc (coverageRenderer, new TreeCellDataFunc (RenderCoverage));
tree.HeadersVisible = true;
model = new CoverageModel ();
foreach (string filter in DEFAULT_FILTERS) {
model.AddFilter (filter);
}
this.status = status;
model.Progress += Progress;
model.ReadFromFile (fileName);
TreeItem root = new TreeItem (store, null, model, "PROJECT");
Hashtable classes2 = model.Classes;
namespaces = new Hashtable ();
string[] sorted_names = new string[classes2.Count];
classes2.Keys.CopyTo (sorted_names, 0);
Array.Sort (sorted_names);
Progress ("Building tree", 0.95);
foreach (string name in sorted_names) {
ClassCoverageItem klass = (ClassCoverageItem)classes2[name];
if (klass.filtered)
continue;
string namespace2 = klass.name_space;
TreeItem nsItem = (TreeItem)namespaces[namespace2];
if (nsItem == null) {
nsItem = new TreeItem (store, root, (CoverageItem)model.Namespaces[namespace2], namespace2);
// nsItem.SetPixmap (0, namespaceOpenPixmap);
namespaces[namespace2] = nsItem;
}
if (nsItem.model.filtered)
continue;
ClassItem classItem = new ClassItem (store, nsItem, klass, klass.name);
if (klass.ChildCount != 0) {
TreeIter treeIter = store.AppendNode (classItem.iter);
store.SetValues (treeIter, "<loading>");
}
}
tree.ExpandRow (store.GetPath (root.Iter), false);
// it becomes very hard to navigate if everything is expanded
//foreach (string ns in namespaces.Keys)
// tree.ExpandRow (store.GetPath (((TreeItem)namespaces [ns]).Iter), false);
tree.RowExpanded += new RowExpandedHandler (OnRowExpanded);
tree.RowCollapsed += new RowCollapsedHandler (OnRowCollapsed);
tree.ButtonPressEvent += new ButtonPressEventHandler (OnButtonPress);
tree.Selection.Mode = SelectionMode.Single;
Progress ("Done", 1.0);
// LAME: Why doesn't widgets visible by default ???
tree.Show ();
}
示例8: SchemaTreeView
public SchemaTreeView(Gtk.Window parent)
: base()
{
parentWindow = parent;
schemaStore = new TreeStore (typeof (Gdk.Pixbuf), typeof (string));
this.Model = schemaStore;
this.HeadersVisible = false;
this.RowActivated += new RowActivatedHandler (OnRowActivated);
this.RowExpanded += new RowExpandedHandler (OnRowExpanded);
this.AppendColumn ("icon", new CellRendererPixbuf (), "pixbuf", (int)TreeCols.Icon);
this.AppendColumn ("ldapRoot", new CellRendererText (), "text", (int)TreeCols.ObjectName);
Gdk.Pixbuf dirIcon = Gdk.Pixbuf.LoadFromResource ("x-directory-remote-server.png");
Gdk.Pixbuf folderIcon = Gdk.Pixbuf.LoadFromResource ("x-directory-normal.png");
rootIter = schemaStore.AppendValues (dirIcon, "Servers");
foreach (string n in Global.Connections.ConnectionNames) {
TreeIter iter = schemaStore.AppendValues (rootIter, dirIcon, n);
TreeIter objIter;
TreeIter attrIter;
TreeIter matIter;
TreeIter synIter;
objIter = schemaStore.AppendValues (iter, folderIcon, "Object Classes");
schemaStore.AppendValues (objIter, null, "");
attrIter = schemaStore.AppendValues (iter, folderIcon, "Attribute Types");
schemaStore.AppendValues (attrIter, null, "");
matIter = schemaStore.AppendValues (iter, folderIcon, "Matching Rules");
schemaStore.AppendValues (matIter, null, "");
synIter = schemaStore.AppendValues (iter, folderIcon, "LDAP Syntaxes");
schemaStore.AppendValues (synIter, null, "");
}
TreePath path = schemaStore.GetPath (rootIter);
this.ExpandRow (path, false);
this.ShowAll ();
}
示例9: setTaskComboBoxItems
public void setTaskComboBoxItems(List<Task> tasks)
{
taskTree = new Gtk.TreeStore (typeof(string));
taskCombobox.Model = taskTree;
LinkedList<Task> tasksCopy = new LinkedList<Task> ();
foreach (Task t in tasks) {
tasksCopy.AddLast (t);
}
taskComboBoxTaskPaths.Clear ();
Dictionary<Int64, Gtk.TreeIter> projectTree = new Dictionary<Int64, Gtk.TreeIter> ();
while (tasksCopy.Count > 0) {
Task t = tasksCopy.First.Value;
tasksCopy.RemoveFirst ();
if (t.ParentProjectId == null) {
Gtk.TreeIter iter = taskTree.AppendValues (t.ProjectName);
projectTree.Add (t.ProjectId, iter);
string path = taskTree.GetPath (iter).ToString ();
Console.WriteLine (path + t.ProjectName);
taskComboBoxTaskPaths.Add (path, t);
} else if (projectTree.ContainsKey ((Int64)t.ParentProjectId)) {
Gtk.TreeIter parentIter = projectTree[(Int64)t.ParentProjectId];
Gtk.TreeIter iter = taskTree.AppendValues (parentIter, t.ProjectName);
projectTree.Add (t.ProjectId, iter);
string path = taskTree.GetPath (iter).ToString ();
Console.WriteLine (path);
taskComboBoxTaskPaths.Add (path, t);
} else {
tasksCopy.AddLast (t);
}
}
// Dictionary<string,Gtk.TreeIter> categoryIters =
// new Dictionary<string, Gtk.TreeIter>();
//
// Dictionary<string,Gtk.TreeIter> projectIters =
// new Dictionary<string, Gtk.TreeIter>();
//
// Dictionary<string,Gtk.TreeIter> taskIters =
// new Dictionary<string, Gtk.TreeIter>();
//
// taskComboBoxTaskPaths.Clear();
//
// foreach(Task t in tasks)
// {
// if (!categoryIters.ContainsKey(t.CategoryName))
// {
// Gtk.TreeIter iter = taskTree.AppendValues(t.CategoryName);
// categoryIters.Add(t.CategoryName, iter);
// }
// Gtk.TreeIter catIter = categoryIters[t.CategoryName];
//
// if (!projectIters.ContainsKey(t.ProjectName))
// {
// Gtk.TreeIter iter = taskTree.AppendValues(catIter, t.ProjectName);
// projectIters.Add(t.ProjectName, iter);
// }
//
//
// Gtk.TreeIter projectIter = projectIters[t.ProjectName];
// Gtk.TreeIter taskIter =
// taskTree.AppendValues(projectIter, t.TaskName);
//
// taskComboBoxTaskPaths.Add(taskTree.GetPath(taskIter).ToString(), t);
// }
}