Gtk.TreeStore.OnRowsReordered C# (CSharp) Method

OnRowsReordered() private method

private OnRowsReordered ( Gtk path, Gtk iter, int new_order ) : void
path Gtk
iter Gtk
new_order int
return void
        protected virtual void OnRowsReordered(Gtk.TreePath path, Gtk.TreeIter iter, int[] new_order)
        {
            GLib.Value ret = GLib.Value.Empty;
            GLib.ValueArray inst_and_params = new GLib.ValueArray (4);
            GLib.Value[] vals = new GLib.Value [4];
            vals [0] = new GLib.Value (this);
            inst_and_params.Append (vals [0]);
            vals [1] = new GLib.Value (path);
            inst_and_params.Append (vals [1]);
            vals [2] = new GLib.Value (iter);
            inst_and_params.Append (vals [2]);
            int cnt = IterNChildren (iter);
            IntPtr new_order_ptr = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (int)) * cnt);
            Marshal.Copy (new_order, 0, new_order_ptr, cnt);
            vals [3] = new GLib.Value (new_order_ptr);
            inst_and_params.Append (vals [3]);
            g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
            Marshal.FreeHGlobal (new_order_ptr);

            foreach (GLib.Value v in vals)
                v.Dispose ();
        }

Usage Example

Beispiel #1
0
 static void rowsreordered_cb(IntPtr tree_model, IntPtr path_ptr, IntPtr iter_ptr, IntPtr new_order)
 {
     try {
         TreeStore store       = GLib.Object.GetObject(tree_model, false) as TreeStore;
         TreePath  path        = GLib.Opaque.GetOpaque(path_ptr, typeof(TreePath), false) as TreePath;
         TreeIter  iter        = TreeIter.New(iter_ptr);
         int       child_cnt   = store.IterNChildren(iter);
         int[]     child_order = new int [child_cnt];
         Marshal.Copy(new_order, child_order, 0, child_cnt);
         store.OnRowsReordered(path, iter, child_order);
     } catch (Exception e) {
         GLib.ExceptionManager.RaiseUnhandledException(e, true);
         // NOTREACHED: above call doesn't return
         throw e;
     }
 }