Beispiel #1
0
        static void RowsReorderedSignalCallback(IntPtr arg0, IntPtr arg1, IntPtr arg2, IntPtr arg3, IntPtr gch)
        {
            Gtk.RowsReorderedArgs args = new Gtk.RowsReorderedArgs();
            try {
                GLib.Signal sig = ((GCHandle)gch).Target as GLib.Signal;
                if (sig == null)
                {
                    throw new Exception("Unknown signal GC handle received " + gch);
                }

                TreeModelFilter sender = GLib.Object.GetObject(arg0) as TreeModelFilter;
                args.Args    = new object[3];
                args.Args[0] = arg1 == IntPtr.Zero ? null : (Gtk.TreePath)GLib.Opaque.GetOpaque(arg1, typeof(Gtk.TreePath), false);
                args.Args[1] = Gtk.TreeIter.New(arg2);
                int   child_cnt = arg2 == IntPtr.Zero ? sender.IterNChildren() : sender.IterNChildren((TreeIter)args.Args[1]);
                int[] new_order = new int [child_cnt];
                Marshal.Copy(arg3, new_order, 0, child_cnt);
                args.Args[2] = new_order;
                Gtk.RowsReorderedHandler handler = (Gtk.RowsReorderedHandler)sig.Handler;
                handler(sender, args);
            } catch (Exception e) {
                GLib.ExceptionManager.RaiseUnhandledException(e, false);
            }
        }
Beispiel #2
0
 static void rowsreordered_cb(IntPtr tree_model, IntPtr path_ptr, IntPtr iter_ptr, IntPtr new_order)
 {
     try {
         TreeModelFilter store       = GLib.Object.GetObject(tree_model, false) as TreeModelFilter;
         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;
     }
 }