From 70bcdc77ff42c74fcd8e6e7dffd4eb6b16f24f39 Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Fri, 19 Feb 2016 16:10:32 +0100 Subject: [PATCH] GtkCrowContainer test, functionnal, keyboard issue --- Crow.csproj | 18 +- Crow.sln | 12 + GtkCrow/CrowContainer.cs | 620 +++++++++++++++++++++++++++ GtkCrow/GtkCrow.csproj | 67 +++ OTKCrow/OTKCrow.csproj | 4 +- Tests/GOLIBTests.cs | 65 +-- Tests/Interfaces/testCheckbox.goml | 15 +- Tests/Tests.csproj | 27 +- src/Input/MouseState.cs | 10 +- src/Interface.cs | 12 + src/rsvg/DimensionData.cs | 32 ++ src/rsvg/Global.cs | 41 ++ src/rsvg/Handle.cs | 262 +++++++++++ src/rsvg/Pixbuf.cs | 133 ++++++ src/rsvg/RsvgSharp.SizeFuncNative.cs | 94 ++++ src/rsvg/SizeFunc.cs | 10 + 16 files changed, 1375 insertions(+), 47 deletions(-) create mode 100644 GtkCrow/CrowContainer.cs create mode 100644 GtkCrow/GtkCrow.csproj create mode 100644 src/rsvg/DimensionData.cs create mode 100644 src/rsvg/Global.cs create mode 100644 src/rsvg/Handle.cs create mode 100644 src/rsvg/Pixbuf.cs create mode 100644 src/rsvg/RsvgSharp.SizeFuncNative.cs create mode 100644 src/rsvg/SizeFunc.cs diff --git a/Crow.csproj b/Crow.csproj index 2a048cee..a87b1548 100644 --- a/Crow.csproj +++ b/Crow.csproj @@ -142,6 +142,12 @@ + + + + + + @@ -151,9 +157,16 @@ glib-sharp-3.0 - - + + gtk-sharp-3.0 + + + gdk-sharp-3.0 + + + gio-sharp-3.0 + + + + + + + + + + diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index d913c6ee..ec90518c 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -44,13 +44,23 @@ ..\..\opentk\Binaries\OpenTK\Release\OpenTK.dll - + + gtk-sharp-3.0 + + + gio-sharp-3.0 + + + glib-sharp-3.0 + + + gtk-sharp-3.0 + + + gtk-sharp-3.0 + - - - - @@ -203,7 +213,6 @@ PreserveNewest - PreserveNewest @@ -269,9 +278,9 @@ {C2980F9B-4798-4C05-99E2-E174810F7C7B} Crow - - {350D4F49-9901-4998-9903-BCA7D48DA58C} - OTKCrow + + {D6F98B08-56B8-405C-9212-F9D26097E35F} + GtkCrow diff --git a/src/Input/MouseState.cs b/src/Input/MouseState.cs index e0438fc7..594619ac 100644 --- a/src/Input/MouseState.cs +++ b/src/Input/MouseState.cs @@ -115,8 +115,8 @@ namespace Crow /// public int X { - get { return position.X; } - internal set { position.X = value; } + get { return position.X; } + set { position.X = value; } } /// @@ -124,8 +124,8 @@ namespace Crow /// public int Y { - get { return position.Y; } - internal set { position.Y = value; } + get { return position.Y; } + set { position.Y = value; } } /// @@ -291,7 +291,7 @@ namespace Crow buttons |= unchecked((ushort)(1 << offset)); } - internal void DisableBit(int offset) + public void DisableBit(int offset) { ValidateOffset(offset); buttons &= unchecked((ushort)(~(1 << offset))); diff --git a/src/Interface.cs b/src/Interface.cs index 6b2e82fe..3dd20a25 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -60,6 +60,18 @@ namespace Crow public delegate void loadDefaultInvoker(object instance); public static Dictionary DefaultValuesLoader = new Dictionary(); + public static void LoadCursors(){ + //Load cursors + XCursor.Cross = XCursorFile.Load("#Crow.Images.Icons.Cursors.cross").Cursors[0]; + XCursor.Default = XCursorFile.Load("#Crow.Images.Icons.Cursors.arrow").Cursors[0]; + XCursor.NW = XCursorFile.Load("#Crow.Images.Icons.Cursors.top_left_corner").Cursors[0]; + XCursor.NE = XCursorFile.Load("#Crow.Images.Icons.Cursors.top_right_corner").Cursors[0]; + XCursor.SW = XCursorFile.Load("#Crow.Images.Icons.Cursors.bottom_left_corner").Cursors[0]; + XCursor.SE = XCursorFile.Load("#Crow.Images.Icons.Cursors.bottom_right_corner").Cursors[0]; + XCursor.H = XCursorFile.Load("#Crow.Images.Icons.Cursors.sb_h_double_arrow").Cursors[0]; + XCursor.V = XCursorFile.Load("#Crow.Images.Icons.Cursors.sb_v_double_arrow").Cursors[0]; + } + #region Load/Save public static void Save (string file, T graphicObject) diff --git a/src/rsvg/DimensionData.cs b/src/rsvg/DimensionData.cs new file mode 100644 index 00000000..20da1aab --- /dev/null +++ b/src/rsvg/DimensionData.cs @@ -0,0 +1,32 @@ +// This file was generated by the Gtk# code generator. +// Any changes made will be lost if regenerated. + +namespace Rsvg { + + using System; + using System.Collections; + using System.Runtime.InteropServices; + +#region Autogenerated code + [StructLayout(LayoutKind.Sequential)] + public struct DimensionData { + + public int Width; + public int Height; + public double Em; + public double Ex; + + public static Rsvg.DimensionData Zero = new Rsvg.DimensionData (); + + public static Rsvg.DimensionData New(IntPtr raw) { + if (raw == IntPtr.Zero) + return Rsvg.DimensionData.Zero; + return (Rsvg.DimensionData) Marshal.PtrToStructure (raw, typeof (Rsvg.DimensionData)); + } + + private static GLib.GType GType { + get { return GLib.GType.Pointer; } + } +#endregion + } +} diff --git a/src/rsvg/Global.cs b/src/rsvg/Global.cs new file mode 100644 index 00000000..65917012 --- /dev/null +++ b/src/rsvg/Global.cs @@ -0,0 +1,41 @@ +// This file was generated by the Gtk# code generator. +// Any changes made will be lost if regenerated. + +namespace Rsvg { + + using System; + using System.Runtime.InteropServices; + +#region Autogenerated code + public class Global { + + [DllImport("rsvg-2")] + static extern void rsvg_set_default_dpi_x_y(double dpi_x, double dpi_y); + + public static void SetDefaultDpiXY(double dpi_x, double dpi_y) { + rsvg_set_default_dpi_x_y(dpi_x, dpi_y); + } + + [DllImport("rsvg-2")] + static extern int rsvg_error_quark(); + + public static int ErrorQuark { + get { + int raw_ret = rsvg_error_quark(); + int ret = raw_ret; + return ret; + } + } + + [DllImport("rsvg-2")] + static extern void rsvg_set_default_dpi(double dpi); + + public static double DefaultDpi { + set { + rsvg_set_default_dpi(value); + } + } + +#endregion + } +} diff --git a/src/rsvg/Handle.cs b/src/rsvg/Handle.cs new file mode 100644 index 00000000..51eec1fb --- /dev/null +++ b/src/rsvg/Handle.cs @@ -0,0 +1,262 @@ +// This file was generated by the Gtk# code generator. +// Any changes made will be lost if regenerated. + +namespace Rsvg { + + using System; + using System.Collections; + using System.Runtime.InteropServices; + +#region Autogenerated code + public class Handle : GLib.Object { + + public Handle(IntPtr raw) : base(raw) {} + + [DllImport("rsvg-2")] + static extern IntPtr rsvg_handle_new(); + + public Handle () : base (IntPtr.Zero) + { + if (GetType () != typeof (Handle)) { + CreateNativeObject (new string [0], new GLib.Value[0]); + return; + } + Raw = rsvg_handle_new(); + } + + [DllImport("rsvg-2")] + static extern unsafe IntPtr rsvg_handle_new_from_data(byte[] data, UIntPtr n_data, out IntPtr error); + + public unsafe Handle (byte[] data) : base (IntPtr.Zero) + { + if (GetType () != typeof (Handle)) { + throw new InvalidOperationException ("Can't override this constructor."); + } + IntPtr error = IntPtr.Zero; + Raw = rsvg_handle_new_from_data(data, new UIntPtr ((ulong) (data == null ? 0 : data.Length)), out error); + if (error != IntPtr.Zero) throw new GLib.GException (error); + } + + [DllImport("rsvg-2")] + static extern unsafe IntPtr rsvg_handle_new_from_file(IntPtr file_name, out IntPtr error); + + public unsafe Handle (string file_name) : base (IntPtr.Zero) + { + if (GetType () != typeof (Handle)) { + throw new InvalidOperationException ("Can't override this constructor."); + } + IntPtr native_file_name = GLib.Marshaller.StringToPtrGStrdup (file_name); + IntPtr error = IntPtr.Zero; + Raw = rsvg_handle_new_from_file(native_file_name, out error); + GLib.Marshaller.Free (native_file_name); + if (error != IntPtr.Zero) throw new GLib.GException (error); + } + + [DllImport("rsvg-2")] + static extern IntPtr rsvg_handle_get_pixbuf(IntPtr raw); + + public Gdk.Pixbuf Pixbuf { + get { + IntPtr raw_ret = rsvg_handle_get_pixbuf(Handle); + Gdk.Pixbuf ret = GLib.Object.GetObject(raw_ret) as Gdk.Pixbuf; + return ret; + } + } + + [DllImport("rsvg-2")] + static extern IntPtr rsvg_handle_get_base_uri(IntPtr raw); + + [DllImport("rsvg-2")] + static extern void rsvg_handle_set_base_uri(IntPtr raw, IntPtr base_uri); + + public string BaseUri { + get { + IntPtr raw_ret = rsvg_handle_get_base_uri(Handle); + string ret = GLib.Marshaller.Utf8PtrToString (raw_ret); + return ret; + } + set { + IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value); + rsvg_handle_set_base_uri(Handle, native_value); + GLib.Marshaller.Free (native_value); + } + } + + [DllImport("rsvg-2")] + static extern void rsvg_handle_set_dpi(IntPtr raw, double dpi); + + public double Dpi { + set { + rsvg_handle_set_dpi(Handle, value); + } + } + + [DllImport("rsvg-2")] + static extern unsafe bool rsvg_handle_write(IntPtr raw, byte[] buf, UIntPtr n_buf, out IntPtr error); + + public unsafe bool Write(byte[] buf) { + IntPtr error = IntPtr.Zero; + bool raw_ret = rsvg_handle_write(Handle, buf, new UIntPtr ((ulong) (buf == null ? 0 : buf.Length)), out error); + bool ret = raw_ret; + if (error != IntPtr.Zero) throw new GLib.GException (error); + return ret; + } + + [DllImport("rsvg-2")] + static extern void rsvg_handle_render_cairo(IntPtr raw, IntPtr cr); + + public void RenderCairo(Cairo.Context cr) { + rsvg_handle_render_cairo(Handle, cr == null ? IntPtr.Zero : cr.Handle); + } + + [DllImport("rsvg-2")] + static extern void rsvg_handle_set_size_callback(IntPtr raw, RsvgSharp.SizeFuncNative size_func, IntPtr user_data, GLib.DestroyNotify user_data_destroy); + + [Obsolete] + public Rsvg.SizeFunc SizeCallback { + set { + RsvgSharp.SizeFuncWrapper value_wrapper = new RsvgSharp.SizeFuncWrapper (value); + IntPtr user_data; + GLib.DestroyNotify user_data_destroy; + if (value == null) { + user_data = IntPtr.Zero; + user_data_destroy = null; + } else { + user_data = (IntPtr) GCHandle.Alloc (value_wrapper); + user_data_destroy = GLib.DestroyHelper.NotifyHandler; + } + rsvg_handle_set_size_callback(Handle, value_wrapper.NativeDelegate, user_data, user_data_destroy); + } + } + + [DllImport("rsvg-2")] + static extern void rsvg_handle_set_dpi_x_y(IntPtr raw, double dpi_x, double dpi_y); + + public void SetDpiXY(double dpi_x, double dpi_y) { + rsvg_handle_set_dpi_x_y(Handle, dpi_x, dpi_y); + } + + [DllImport("rsvg-2")] + static extern void rsvg_handle_get_dimensions(IntPtr raw, IntPtr dimension_data); + + public Rsvg.DimensionData Dimensions { + get { + Rsvg.DimensionData dimension_data; + IntPtr native_dimension_data = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (Rsvg.DimensionData))); + rsvg_handle_get_dimensions(Handle, native_dimension_data); + dimension_data = Rsvg.DimensionData.New (native_dimension_data); + Marshal.FreeHGlobal (native_dimension_data); + return dimension_data; + } + } + + [DllImport("rsvg-2")] + static extern unsafe bool rsvg_handle_close(IntPtr raw, out IntPtr error); + + public unsafe bool Close() { + IntPtr error = IntPtr.Zero; + bool raw_ret = rsvg_handle_close(Handle, out error); + bool ret = raw_ret; + if (error != IntPtr.Zero) throw new GLib.GException (error); + return ret; + } + + [DllImport("rsvg-2")] + static extern IntPtr rsvg_handle_get_pixbuf_sub(IntPtr raw, IntPtr id); + + public Gdk.Pixbuf GetPixbufSub(string id) { + IntPtr native_id = GLib.Marshaller.StringToPtrGStrdup (id); + IntPtr raw_ret = rsvg_handle_get_pixbuf_sub(Handle, native_id); + Gdk.Pixbuf ret = GLib.Object.GetObject(raw_ret) as Gdk.Pixbuf; + GLib.Marshaller.Free (native_id); + return ret; + } + + [DllImport("rsvg-2")] + static extern IntPtr rsvg_handle_get_desc(IntPtr raw); + + public string Desc { + get { + IntPtr raw_ret = rsvg_handle_get_desc(Handle); + string ret = GLib.Marshaller.Utf8PtrToString (raw_ret); + return ret; + } + } + + [DllImport("rsvg-2")] + static extern IntPtr rsvg_handle_get_type(); + + public static new GLib.GType GType { + get { + IntPtr raw_ret = rsvg_handle_get_type(); + GLib.GType ret = new GLib.GType(raw_ret); + return ret; + } + } + + [DllImport("rsvg-2")] + static extern IntPtr rsvg_handle_get_title(IntPtr raw); + + public string Title { + get { + IntPtr raw_ret = rsvg_handle_get_title(Handle); + string ret = GLib.Marshaller.Utf8PtrToString (raw_ret); + return ret; + } + } + + [DllImport("rsvg-2")] + static extern void rsvg_handle_render_cairo_sub(IntPtr raw, IntPtr cr, IntPtr id); + + public void RenderCairoSub(Cairo.Context cr, string id) { + IntPtr native_id = GLib.Marshaller.StringToPtrGStrdup (id); + rsvg_handle_render_cairo_sub(Handle, cr == null ? IntPtr.Zero : cr.Handle, native_id); + GLib.Marshaller.Free (native_id); + } + + [DllImport("rsvg-2")] + static extern IntPtr rsvg_handle_get_metadata(IntPtr raw); + + public string Metadata { + get { + IntPtr raw_ret = rsvg_handle_get_metadata(Handle); + string ret = GLib.Marshaller.Utf8PtrToString (raw_ret); + return ret; + } + } + +#endregion +#region Customized extensions +#line 1 "Handle.custom" +// Rsvg.Handle.custom - Rsvg Handle class customizations +// +// Copyright (C) 2007 Novell, Inc. +// +// This code is inserted after the automatically generated code. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2 of the Lesser GNU General +// Public License as published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + + public unsafe bool Write (byte[] buf, ulong count) + { + IntPtr error; + bool result = rsvg_handle_write (Handle, buf, new UIntPtr (count), out error); + if (error != IntPtr.Zero) throw new GLib.GException (error); + return result; + } + + +#endregion + } +} diff --git a/src/rsvg/Pixbuf.cs b/src/rsvg/Pixbuf.cs new file mode 100644 index 00000000..690d454a --- /dev/null +++ b/src/rsvg/Pixbuf.cs @@ -0,0 +1,133 @@ +// This file was generated by the Gtk# code generator. +// Any changes made will be lost if regenerated. + +namespace Rsvg { + + using System; + using System.Runtime.InteropServices; + +#region Autogenerated code + public class Pixbuf { + + [DllImport("rsvg-2")] + static extern unsafe IntPtr rsvg_pixbuf_from_file(IntPtr file_name, out IntPtr error); + + [Obsolete] + public static unsafe Gdk.Pixbuf FromFile(string file_name) { + IntPtr native_file_name = GLib.Marshaller.StringToPtrGStrdup (file_name); + IntPtr error = IntPtr.Zero; + IntPtr raw_ret = rsvg_pixbuf_from_file(native_file_name, out error); + Gdk.Pixbuf ret = GLib.Object.GetObject(raw_ret) as Gdk.Pixbuf; + GLib.Marshaller.Free (native_file_name); + if (error != IntPtr.Zero) throw new GLib.GException (error); + return ret; + } + + [DllImport("rsvg-2")] + static extern unsafe IntPtr rsvg_pixbuf_from_file_at_size(IntPtr file_name, int width, int height, out IntPtr error); + + [Obsolete] + public static unsafe Gdk.Pixbuf FromFileAtSize(string file_name, int width, int height) { + IntPtr native_file_name = GLib.Marshaller.StringToPtrGStrdup (file_name); + IntPtr error = IntPtr.Zero; + IntPtr raw_ret = rsvg_pixbuf_from_file_at_size(native_file_name, width, height, out error); + Gdk.Pixbuf ret = GLib.Object.GetObject(raw_ret) as Gdk.Pixbuf; + GLib.Marshaller.Free (native_file_name); + if (error != IntPtr.Zero) throw new GLib.GException (error); + return ret; + } + + [DllImport("rsvg-2")] + static extern unsafe IntPtr rsvg_pixbuf_from_file_at_zoom(IntPtr file_name, double x_zoom, double y_zoom, out IntPtr error); + + [Obsolete] + public static unsafe Gdk.Pixbuf FromFileAtZoom(string file_name, double x_zoom, double y_zoom) { + IntPtr native_file_name = GLib.Marshaller.StringToPtrGStrdup (file_name); + IntPtr error = IntPtr.Zero; + IntPtr raw_ret = rsvg_pixbuf_from_file_at_zoom(native_file_name, x_zoom, y_zoom, out error); + Gdk.Pixbuf ret = GLib.Object.GetObject(raw_ret) as Gdk.Pixbuf; + GLib.Marshaller.Free (native_file_name); + if (error != IntPtr.Zero) throw new GLib.GException (error); + return ret; + } + + [DllImport("rsvg-2")] + static extern unsafe IntPtr rsvg_pixbuf_from_file_at_zoom_with_max(IntPtr file_name, double x_zoom, double y_zoom, int max_width, int max_height, out IntPtr error); + + [Obsolete] + public static unsafe Gdk.Pixbuf FromFileAtZoomWithMax(string file_name, double x_zoom, double y_zoom, int max_width, int max_height) { + IntPtr native_file_name = GLib.Marshaller.StringToPtrGStrdup (file_name); + IntPtr error = IntPtr.Zero; + IntPtr raw_ret = rsvg_pixbuf_from_file_at_zoom_with_max(native_file_name, x_zoom, y_zoom, max_width, max_height, out error); + Gdk.Pixbuf ret = GLib.Object.GetObject(raw_ret) as Gdk.Pixbuf; + GLib.Marshaller.Free (native_file_name); + if (error != IntPtr.Zero) throw new GLib.GException (error); + return ret; + } + + [DllImport("rsvg-2")] + static extern unsafe IntPtr rsvg_pixbuf_from_file_at_max_size(IntPtr file_name, int max_width, int max_height, out IntPtr error); + + [Obsolete] + public static unsafe Gdk.Pixbuf FromFileAtMaxSize(string file_name, int max_width, int max_height) { + IntPtr native_file_name = GLib.Marshaller.StringToPtrGStrdup (file_name); + IntPtr error = IntPtr.Zero; + IntPtr raw_ret = rsvg_pixbuf_from_file_at_max_size(native_file_name, max_width, max_height, out error); + Gdk.Pixbuf ret = GLib.Object.GetObject(raw_ret) as Gdk.Pixbuf; + GLib.Marshaller.Free (native_file_name); + if (error != IntPtr.Zero) throw new GLib.GException (error); + return ret; + } + +#endregion +#region Customized extensions +#line 1 "Pixbuf.custom" +// Rsvg.Pixbuf.custom - Rsvg Pixbuf class customizations +// +// Author: John Luke +// +// Copyright (C) 2004 Novell, Inc. +// +// This code is inserted after the automatically generated code. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2 of the Lesser GNU General +// Public License as published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + + public static Gdk.Pixbuf LoadFromResource (string resource) + { + if (resource == null) + throw new ArgumentNullException ("resource"); + + System.IO.Stream s = System.Reflection.Assembly.GetCallingAssembly ().GetManifestResourceStream (resource); + if (s == null) + throw new ArgumentException ("resource must be a valid resource name of 'assembly'."); + + return LoadFromStream (s); + } + + public static Gdk.Pixbuf LoadFromStream (System.IO.Stream input) + { + Handle loader = new Handle (); + byte [] buffer = new byte [8192]; + int n; + while ((n = input.Read (buffer, 0, 8192)) != 0) + loader.Write (buffer, (uint) n); + + loader.Close (); + return loader.Pixbuf; + } + +#endregion + } +} diff --git a/src/rsvg/RsvgSharp.SizeFuncNative.cs b/src/rsvg/RsvgSharp.SizeFuncNative.cs new file mode 100644 index 00000000..43bf5b4e --- /dev/null +++ b/src/rsvg/RsvgSharp.SizeFuncNative.cs @@ -0,0 +1,94 @@ +// This file was generated by the Gtk# code generator. +// Any changes made will be lost if regenerated. + +namespace RsvgSharp { + + using System; + using System.Runtime.InteropServices; + +#region Autogenerated code + + internal delegate void SizeFuncNative(out int width, out int height, IntPtr user_data); + + internal class SizeFuncInvoker { + + SizeFuncNative native_cb; + IntPtr __data; + GLib.DestroyNotify __notify; + + ~SizeFuncInvoker () + { + if (__notify == null) + return; + __notify (__data); + } + + internal SizeFuncInvoker (SizeFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {} + + internal SizeFuncInvoker (SizeFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {} + + internal SizeFuncInvoker (SizeFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify) + { + this.native_cb = native_cb; + __data = data; + __notify = notify; + } + + internal Rsvg.SizeFunc Handler { + get { + return new Rsvg.SizeFunc(InvokeNative); + } + } + + void InvokeNative (out int width, out int height) + { + native_cb (out width, out height, __data); + } + } + + internal class SizeFuncWrapper { + + public void NativeCallback (out int width, out int height, IntPtr user_data) + { + try { + managed (out width, out height); + if (release_on_call) + gch.Free (); + } catch (Exception e) { + GLib.ExceptionManager.RaiseUnhandledException (e, true); + // NOTREACHED: Above call does not return. + throw e; + } + } + + bool release_on_call = false; + GCHandle gch; + + public void PersistUntilCalled () + { + release_on_call = true; + gch = GCHandle.Alloc (this); + } + + internal SizeFuncNative NativeDelegate; + Rsvg.SizeFunc managed; + + public SizeFuncWrapper (Rsvg.SizeFunc managed) + { + this.managed = managed; + if (managed != null) + NativeDelegate = new SizeFuncNative (NativeCallback); + } + + public static Rsvg.SizeFunc GetManagedDelegate (SizeFuncNative native) + { + if (native == null) + return null; + SizeFuncWrapper wrapper = (SizeFuncWrapper) native.Target; + if (wrapper == null) + return null; + return wrapper.managed; + } + } +#endregion +} diff --git a/src/rsvg/SizeFunc.cs b/src/rsvg/SizeFunc.cs new file mode 100644 index 00000000..4c84738b --- /dev/null +++ b/src/rsvg/SizeFunc.cs @@ -0,0 +1,10 @@ +// This file was generated by the Gtk# code generator. +// Any changes made will be lost if regenerated. + +namespace Rsvg { + + using System; + + public delegate void SizeFunc(out int width, out int height); + +} -- 2.47.3