Inheritance: TreePosition
Beispiel #1
0
        public void Remove(TreePosition pos)
        {
            IterPos tpos = (IterPos)pos;

            Gtk.TreeIter it = tpos.Iter;
            Tree.Remove(ref it);
        }
Beispiel #2
0
        public TreePosition InsertAfter(TreePosition pos)
        {
            IterPos tpos = (IterPos)pos;
            var     p    = Tree.InsertNodeAfter(tpos.Iter);

            return(new IterPos(p));
        }
Beispiel #3
0
        public void Remove(TreePosition pos)
        {
            version++;
            IterPos tpos = GetIterPos(pos);

            Gtk.TreeIter it = tpos.Iter;
            Tree.Remove(ref it);
        }
Beispiel #4
0
        public TreePosition InsertAfter(TreePosition pos)
        {
            version++;
            IterPos tpos = GetIterPos(pos);
            var     p    = Tree.InsertNodeAfter(tpos.Iter);

            return(new IterPos(version, p));
        }
Beispiel #5
0
        public void SetValue(TreePosition pos, int column, object value)
        {
            IterPos tpos = GetIterPos(pos);

            SetValue(tpos.Iter, column, value);
            if (NodeChanged != null)
            {
                NodeChanged(this, new TreeNodeEventArgs(pos));
            }
        }
 void HandleRowActivated(object o, Gtk.RowActivatedArgs args)
 {
     Gtk.TreeIter it;
     if (Widget.Model.GetIter(out it, args.Path))
     {
         CurrentEventRow = new IterPos(-1, it);
         ApplicationContext.InvokeUserCode(delegate {
             EventSink.OnRowActivated(new IterPos(-1, it));
         });
     }
 }
Beispiel #7
0
        IterPos GetIterPos(TreePosition pos)
        {
            IterPos tpos = (IterPos)pos;

            if (tpos != null && tpos.Version != version)
            {
                tpos.LastChildIndex = -1;
                tpos.ChildrenCount  = -1;
            }
            return(tpos);
        }
Beispiel #8
0
        public TreePosition GetNext(TreePosition pos)
        {
            IterPos tpos = GetIterPos(pos);

            Gtk.TreeIter it = tpos.Iter;
            if (!Tree.IterNext(ref it))
            {
                return(null);
            }
            return(new IterPos(version, it));
        }
Beispiel #9
0
        public TreePosition GetParent(TreePosition pos)
        {
            IterPos tpos = (IterPos)pos;

            Gtk.TreeIter it;
            if (!Tree.IterParent(out it, tpos.Iter))
            {
                return(null);
            }
            return(new IterPos(it));
        }
Beispiel #10
0
        public TreePosition GetNext(TreePosition pos)
        {
            IterPos tpos = (IterPos)pos;

            Gtk.TreeIter it = tpos.Iter;
            if (!Tree.IterNext(ref it))
            {
                return(null);
            }
            return(new IterPos(it));
        }
Beispiel #11
0
        public TreePosition GetParent(TreePosition pos)
        {
            IterPos tpos = GetIterPos(pos);

            Gtk.TreeIter it;
            if (!Tree.IterParent(out it, tpos.Iter))
            {
                return(null);
            }
            return(new IterPos(version, it));
        }
Beispiel #12
0
        public TreePosition GetChild(TreePosition pos, int index)
        {
            IterPos tpos = (IterPos)pos;

            if (tpos.LastChildIndex == index)
            {
                return(new IterPos(tpos.LastChildIter));
            }
            if (index == 0)
            {
                Gtk.TreeIter it;
                if (Tree.GetIterFirst(out it))
                {
                    tpos.LastChildIter  = it;
                    tpos.LastChildIndex = 0;
                    return(new IterPos(it));
                }
                else
                {
                    return(null);
                }
            }
            if (tpos.LastChildIndex == -1 || tpos.LastChildIndex > index)
            {
                Gtk.TreeIter it;
                if (Tree.IterNthChild(out it, index))
                {
                    tpos.LastChildIter  = it;
                    tpos.LastChildIndex = index;
                    return(new IterPos(it));
                }
                else
                {
                    return(null);
                }
            }

            // tpos.LastChildIndex < index

            Gtk.TreeIter iter = tpos.LastChildIter;
            for (int n = tpos.LastChildIndex; n < index; n++)
            {
                if (!Tree.IterNext(ref iter))
                {
                    return(null);
                }
            }
            tpos.LastChildIter  = iter;
            tpos.LastChildIndex = index;
            return(new IterPos(iter));
        }
Beispiel #13
0
        public TreePosition InsertAfter(TreePosition pos)
        {
            version++;
            IterPos tpos = GetIterPos(pos);
            var     p    = Tree.InsertNodeAfter(tpos.Iter);

            var node = new IterPos(version, p);

            if (NodeInserted != null)
            {
                NodeInserted(this, new TreeNodeEventArgs(node));
            }
            return(node);
        }
Beispiel #14
0
        public TreePosition AddChild(TreePosition pos)
        {
            IterPos tpos = (IterPos)pos;

            Gtk.TreeIter it;
            if (pos == null)
            {
                it = Tree.AppendNode();
            }
            else
            {
                it = Tree.AppendNode(tpos.Iter);
            }
            return(new IterPos(it));
        }
Beispiel #15
0
        public void Remove(TreePosition pos)
        {
            version++;
            IterPos tpos = GetIterPos(pos);

            Gtk.TreeIter it        = tpos.Iter;
            var          delPath   = Tree.GetPath(it);
            var          eventArgs = new TreeNodeChildEventArgs(GetParent(tpos), delPath.Indices[delPath.Indices.Length - 1], pos);

            Tree.Remove(ref it);
            if (NodeDeleted != null)
            {
                NodeDeleted(this, eventArgs);
            }
        }
Beispiel #16
0
        public int GetChildrenCount(TreePosition pos)
        {
            if (pos == null)
            {
                return(Tree.IterNChildren());
            }

            IterPos tpos = GetIterPos(pos);

            if (tpos.ChildrenCount != -1)
            {
                return(tpos.ChildrenCount);
            }

            return(tpos.ChildrenCount = Tree.IterNChildren(tpos.Iter));
        }
Beispiel #17
0
        public TreePosition AddChild(TreePosition pos)
        {
            version++;
            IterPos tpos = GetIterPos(pos);

            Gtk.TreeIter it;
            if (pos == null)
            {
                it = Tree.AppendNode();
            }
            else
            {
                it = Tree.AppendNode(tpos.Iter);
            }
            return(new IterPos(version, it));
        }
Beispiel #18
0
        public int GetChildrenCount(TreePosition pos)
        {
            IterPos tpos = (IterPos)pos;

            if (tpos.ChildrenCount != -1)
            {
                return(tpos.ChildrenCount);
            }
            if (pos == null)
            {
                tpos.ChildrenCount = Tree.IterNChildren();
            }
            else
            {
                tpos.ChildrenCount = Tree.IterNChildren(tpos.Iter);
            }
            return(tpos.ChildrenCount);
        }
Beispiel #19
0
        public TreePosition GetPrevious(TreePosition pos)
        {
            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));
        }
Beispiel #20
0
        public TreePosition AddChild(TreePosition pos)
        {
            version++;
            IterPos tpos = GetIterPos(pos);

            Gtk.TreeIter it;
            if (pos == null)
            {
                it = Tree.AppendNode();
            }
            else
            {
                it = Tree.AppendNode(tpos.Iter);
            }

            var node = new IterPos(version, it);

            if (NodeInserted != null)
            {
                NodeInserted(this, new TreeNodeEventArgs(node));
            }
            return(node);
        }
Beispiel #21
0
        public bool GetDropTargetRow(double x, double y, out RowDropPosition pos, out TreePosition nodePosition)
        {
            Gtk.TreeViewDropPosition tpos;
            Gtk.TreePath             path;
            if (!Widget.GetDestRowAtPos((int)x, (int)y, out path, out tpos))
            {
                pos          = RowDropPosition.Into;
                nodePosition = null;
                return(false);
            }

            Gtk.TreeIter it;
            Widget.Model.GetIter(out it, path);
            nodePosition = new IterPos(-1, it);
            switch (tpos)
            {
            case Gtk.TreeViewDropPosition.After: pos = RowDropPosition.After; break;

            case Gtk.TreeViewDropPosition.Before: pos = RowDropPosition.Before; break;

            default: pos = RowDropPosition.Into; break;
            }
            return(true);
        }
Beispiel #22
0
        public bool GetDropTargetRow(double x, double y, out RowDropPosition pos, out TreePosition nodePosition)
        {
            Gtk.TreeViewDropPosition tpos;
            Gtk.TreePath path;
            if (!Widget.GetDestRowAtPos ((int)x, (int)y, out path, out tpos)) {
                pos = RowDropPosition.Into;
                nodePosition = null;
                return false;
            }

            Gtk.TreeIter it;
            Widget.Model.GetIter (out it, path);
            nodePosition = new IterPos (-1, it);
            switch (tpos) {
            case Gtk.TreeViewDropPosition.After: pos = RowDropPosition.After; break;
            case Gtk.TreeViewDropPosition.Before: pos = RowDropPosition.Before; break;
            default: pos = RowDropPosition.Into; break;
            }
            return true;
        }
Beispiel #23
0
        public TreePosition AddChild(TreePosition pos)
        {
            version++;
            IterPos tpos = GetIterPos (pos);
            Gtk.TreeIter it;
            if (pos == null)
                it = Tree.AppendNode ();
            else
                it = Tree.AppendNode (tpos.Iter);

            var node = new IterPos (version, it);
            if (NodeInserted != null)
                NodeInserted (this, new TreeNodeEventArgs (node));
            return node;
        }
Beispiel #24
0
        public TreePosition InsertBefore(TreePosition pos)
        {
            version++;
            IterPos tpos = GetIterPos (pos);
            var p = Tree.InsertNodeBefore (tpos.Iter);

            var node = new IterPos (version, p);
            if (NodeInserted != null)
                NodeInserted (this, new TreeNodeEventArgs (node));
            return node;
        }
Beispiel #25
0
 void HandleTestExpandRow(object o, Gtk.TestExpandRowArgs args)
 {
     Gtk.TreeIter it;
     if (Widget.Model.GetIter (out it, args.Path)) {
         CurrentEventRow = new IterPos (-1, it);
         ApplicationContext.InvokeUserCode (delegate {
             EventSink.OnRowExpanding (new IterPos (-1, it));
         });
     }
 }
Beispiel #26
0
        public void SetValue(TreePosition pos, int column, object value)
        {
            IterPos tpos = GetIterPos(pos);

            SetValue(tpos.Iter, column, value);
        }
Beispiel #27
0
        public object GetValue(TreePosition pos, int column)
        {
            IterPos tpos = GetIterPos(pos);

            return(GetValue(tpos.Iter, column));
        }