Beispiel #1
0
 void HandleNodeDeleted(object sender, TreeNodeChildEventArgs e)
 {
     if (e.Node == null)
     {
         adapter.EmitRowDeleted(new Gtk.TreePath(new int[] { e.ChildIndex }));
     }
     else
     {
         Gtk.TreeIter it  = IterFromNode(e.Node);
         var          p   = GetPath(it);
         int[]        idx = new int [p.Indices.Length + 1];
         p.Indices.CopyTo(idx, 0);
         idx [idx.Length - 1] = e.ChildIndex;
         adapter.EmitRowDeleted(new Gtk.TreePath(idx));
     }
 }
Beispiel #2
0
            private void child_deleted_cb(object sender, ITreeNode child, int idx)
            {
                ITreeNode node = sender as ITreeNode;

                TreePath path       = GetPath(node);
                TreePath child_path = path.Copy();

                child_path.AppendIndex(idx);

                model_adapter.EmitRowDeleted(child_path);

                if (node.ChildCount <= 0)
                {
                    model_adapter.EmitRowHasChildToggled(GetPath(node), GetIter(node));
                }
            }
Beispiel #3
0
        void HandleRowDeleted(object sender, ListRowEventArgs e)
        {
            var p = new Gtk.TreePath(new int[] { e.Row });

            adapter.EmitRowDeleted(p);
            parent.QueueResize();
        }
Beispiel #4
0
        void HandleNodeDeleted(object sender, TreeNodeChildEventArgs e)
        {
            if (e.Node != null && !handleHash.ContainsKey(e.Node))
            {
                return;
            }

            NodeData data;

            if (e.Child != null && handleHash.TryGetValue(e.Child, out data))
            {
                // Increase the model stamp since the node is gone and there may
                // be iters referencing that node. Increasing the stamp will
                // invalidate all those nodes
                stamp++;
                data.Handle.Free();
                handleHash.Remove(e.Child);

                // Update the indexes of the node following the deleted one
                var count = source.GetChildrenCount(e.Node);
                for (int n = e.ChildIndex; n < count; n++)
                {
                    var child = source.GetChild(e.Node, n);
                    if (child != null)
                    {
                        CacheIndex(child, n);
                    }
                }
            }

            if (e.Node == null)
            {
                adapter.EmitRowDeleted(new Gtk.TreePath(new int[] { e.ChildIndex }));
            }
            else
            {
                var   p   = GetPath(e.Node);
                int[] idx = new int [p.Indices.Length + 1];
                p.Indices.CopyTo(idx, 0);
                idx [idx.Length - 1] = e.ChildIndex;
                adapter.EmitRowDeleted(new Gtk.TreePath(idx));
            }
        }
Beispiel #5
0
 void OnChildRemoved(object o, NodeEventArgs args)
 {
     TreeModelAdapter adapter = new TreeModelAdapter (this);
     adapter.EmitRowDeleted (PathFromNode (args.Node));
 }