Merge pull request #355 from mono/fix_tree_operations
[Xwt] Fixed/Added Tree Operations:
This commit is contained in:
Коммит
1472bacb89
|
@ -209,7 +209,17 @@ namespace Xwt.GtkBackend
|
|||
|
||||
public TreePosition GetPrevious (TreePosition pos)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
IterPos tpos = GetIterPos (pos);
|
||||
Gtk.TreePath path = Tree.GetPath (tpos.Iter);
|
||||
int [] indices = path.Indices;
|
||||
if (indices.Length < 1 || indices [indices.Length - 1] == 0)
|
||||
return null;
|
||||
indices [indices.Length - 1] --;
|
||||
Gtk.TreePath previousPath = new Gtk.TreePath (indices);
|
||||
Gtk.TreeIter previous;
|
||||
if (!Tree.GetIter (out previous, previousPath))
|
||||
return null;
|
||||
return new IterPos (version, previous);
|
||||
}
|
||||
|
||||
public TreePosition GetParent (TreePosition pos)
|
||||
|
|
|
@ -94,6 +94,16 @@ namespace Xwt
|
|||
return CommitPos (backend.GetParent (pos));
|
||||
}
|
||||
|
||||
public bool MoveToFirstSibling ()
|
||||
{
|
||||
return CommitPos (backend.GetChild (backend.GetParent (pos), 0));
|
||||
}
|
||||
|
||||
public bool MoveToLastSibling ()
|
||||
{
|
||||
return CommitPos (backend.GetChild (backend.GetParent (pos), backend.GetChildrenCount (backend.GetParent (pos)) - 1));
|
||||
}
|
||||
|
||||
public TreeNavigator InsertBefore ()
|
||||
{
|
||||
pos = backend.InsertBefore (pos);
|
||||
|
|
|
@ -92,6 +92,18 @@ namespace Xwt
|
|||
var pos = Backend.AddChild (position);
|
||||
return new TreeNavigator (Backend, pos);
|
||||
}
|
||||
|
||||
public TreeNavigator InsertNodeAfter (TreePosition positon)
|
||||
{
|
||||
var pos = Backend.InsertAfter (positon);
|
||||
return new TreeNavigator (Backend, pos);
|
||||
}
|
||||
|
||||
public TreeNavigator InsertNodeBefore (TreePosition positon)
|
||||
{
|
||||
var pos = Backend.InsertBefore (positon);
|
||||
return new TreeNavigator (Backend, pos);
|
||||
}
|
||||
|
||||
public void Clear ()
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче