From 291ee61b2d254c9d44e1f436e79001c702301ecf Mon Sep 17 00:00:00 2001 From: Christian Hoff Date: Mon, 13 Apr 2009 17:44:48 +0000 Subject: [PATCH] 2009-04-13 Christian Hoff Add support for virtual methods(vm) to the generator. * parser/gapi2xml.pl: Generate a class_struct element with all members of the class structure. Dump the first (instance) parameter for signal and vm elements. Bump up parser version. * generator/GObjectVM.cs: Added. Support for GObject virtual methods. * generator/DefaultSignalHandler.cs: Signal specific part of vm generation. * generator/InterfaceVM.cs: New class for interface vms. * generator/ObjectBase.cs: Parse the class struct. svn path=/trunk/gtk-sharp/; revision=131604 --- ChangeLog | 12 + atk/Atk.metadata | 7 + atk/Hyperlink.custom | 265 -- atk/Makefile.am | 1 - atk/Misc.custom | 58 - atk/Object.custom | 185 -- atk/ObjectFactory.custom | 124 - atk/Util.custom | 168 -- atk/atk-api-2.14.raw | 1135 ++++---- atk/glue/Makefile.am | 3 - atk/glue/hyperlink.c | 117 - atk/glue/misc.c | 23 - atk/glue/object.c | 103 - atk/glue/object_factory.c | 56 - atk/glue/util.c | 39 - gapi-cdecl-insert | 85 +- gdk/gdk-api-2.14.raw | 276 +- generator/CallbackGen.cs | 2 +- generator/ClassBase.cs | 86 +- generator/ClassField.cs | 49 + generator/DefaultSignalHandler.cs | 146 + generator/GObjectVM.cs | 368 +++ generator/GenerationInfo.cs | 12 - generator/InterfaceGen.cs | 89 +- generator/InterfaceVM.cs | 97 + generator/Makefile.am | 4 + generator/ManagedCallString.cs | 4 +- generator/MarshalGen.cs | 4 +- generator/MethodBase.cs | 13 +- generator/ObjectBase.cs | 262 +- generator/ObjectGen.cs | 85 +- generator/Parameters.cs | 14 +- generator/Parser.cs | 2 +- generator/ReturnValue.cs | 2 +- generator/Signal.cs | 312 +- generator/SymbolTable.cs | 3 +- generator/VMSignature.cs | 22 +- generator/VirtualMethod.cs | 160 +- gio/gio-api.raw | 1321 ++++++--- glade/glade-api-2.14.raw | 7 +- glib/GType.cs | 33 +- glib/Object.cs | 2 +- gtk/CellRenderer.custom | 205 +- gtk/CellRendererAccel.custom | 9 +- gtk/CellRendererCombo.custom | 9 +- gtk/CellRendererPixbuf.custom | 9 +- gtk/CellRendererProgress.custom | 9 +- gtk/CellRendererSpin.custom | 9 +- gtk/CellRendererText.custom | 9 +- gtk/CellRendererToggle.custom | 9 +- gtk/Container.custom | 31 +- gtk/Gtk.metadata | 21 +- gtk/glue/cellrenderer.c | 88 +- gtk/glue/container.c | 11 - gtk/gtk-api-2.14.raw | 4421 ++++++++++++++++++++++------- pango/pango-api-2.14.raw | 51 +- parser/gapi2xml.pl | 183 +- sample/CustomCellRenderer.cs | 6 +- 58 files changed, 6617 insertions(+), 4219 deletions(-) delete mode 100644 atk/ObjectFactory.custom delete mode 100644 atk/glue/hyperlink.c delete mode 100644 atk/glue/object.c delete mode 100644 atk/glue/object_factory.c create mode 100644 generator/ClassField.cs create mode 100644 generator/DefaultSignalHandler.cs create mode 100644 generator/GObjectVM.cs create mode 100644 generator/InterfaceVM.cs diff --git a/ChangeLog b/ChangeLog index 47a6a88d9..5d7d7622c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2009-04-13 Christian Hoff + Add support for virtual methods(vm) to the generator. + + * parser/gapi2xml.pl: Generate a class_struct element with + all members of the class structure. Dump the first (instance) + parameter for signal and vm elements. Bump up parser version. + * generator/GObjectVM.cs: Added. Support for GObject virtual methods. + * generator/DefaultSignalHandler.cs: Signal specific part of vm + generation. + * generator/InterfaceVM.cs: New class for interface vms. + * generator/ObjectBase.cs: Parse the class struct. + 2009-04-09 Mike Kestner * glib/ListBase.cs: fix g_object_unref dllimport lib. diff --git a/atk/Atk.metadata b/atk/Atk.metadata index 9fd24175b..55e3ed98b 100644 --- a/atk/Atk.metadata +++ b/atk/Atk.metadata @@ -25,9 +25,16 @@ true true true + true + true + declaring_class 1 true AtkObject* + declaring_class + 1 + 1 + 1 1 AtkAttribute* AtkAttribute* diff --git a/atk/Hyperlink.custom b/atk/Hyperlink.custom index 54d320b89..011987d02 100644 --- a/atk/Hyperlink.custom +++ b/atk/Hyperlink.custom @@ -21,271 +21,6 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. - [DllImport("atksharpglue-2")] - static extern void atksharp_hyperlink_override_get_uri (IntPtr type, GetUriDelegate cb); - - [GLib.CDeclCallback] - delegate IntPtr GetUriDelegate (IntPtr raw, int i); - - static GetUriDelegate GetUriCallback; - - static IntPtr GetUri_cb (IntPtr raw, int i) - { - try { - Atk.Hyperlink obj = GLib.Object.GetObject (raw, false) as Atk.Hyperlink; - return GLib.Marshaller.StringToPtrGStrdup (obj.OnGetUri (i)); - } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); - } - - return IntPtr.Zero; - } - - static void OverrideGetUri (GLib.GType gtype) - { - if (GetUriCallback == null) - GetUriCallback = new GetUriDelegate (GetUri_cb); - atksharp_hyperlink_override_get_uri (gtype.Val, GetUriCallback); - } - - [GLib.DefaultSignalHandler (Type=typeof(Atk.Hyperlink), ConnectionMethod="OverrideGetUri")] - protected virtual string OnGetUri (int i) - { - return null; - } - - [DllImport("atksharpglue-2")] - static extern void atksharp_hyperlink_override_get_object (IntPtr type, GetObjectDelegate cb); - - [GLib.CDeclCallback] - delegate IntPtr GetObjectDelegate (IntPtr raw, int i); - - static GetObjectDelegate GetObjectCallback; - - static IntPtr GetObject_cb (IntPtr raw, int i) - { - try { - Atk.Hyperlink obj = GLib.Object.GetObject (raw, false) as Atk.Hyperlink; - Atk.Object ret = obj.OnGetObject (i); - return ret == null ? IntPtr.Zero : ret.Handle; - } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); - } - - return IntPtr.Zero; - } - - static void OverrideGetObject (GLib.GType gtype) - { - if (GetObjectCallback == null) - GetObjectCallback = new GetObjectDelegate (GetObject_cb); - atksharp_hyperlink_override_get_object (gtype.Val, GetObjectCallback); - } - - [GLib.DefaultSignalHandler (Type=typeof(Atk.Hyperlink), ConnectionMethod="OverrideGetObject")] - protected virtual Atk.Object OnGetObject (int i) - { - return null; - } - - [DllImport("atksharpglue-2")] - static extern void atksharp_hyperlink_override_get_end_index (IntPtr type, GetEndIndexDelegate cb); - - [GLib.CDeclCallback] - delegate int GetEndIndexDelegate (IntPtr raw); - - static GetEndIndexDelegate GetEndIndexCallback; - - static int GetEndIndex_cb (IntPtr raw) - { - try { - Atk.Hyperlink obj = GLib.Object.GetObject (raw, false) as Atk.Hyperlink; - return obj.OnGetEndIndex (); - } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); - } - - return -1; - } - - static void OverrideGetEndIndex (GLib.GType gtype) - { - if (GetEndIndexCallback == null) - GetEndIndexCallback = new GetEndIndexDelegate (GetEndIndex_cb); - atksharp_hyperlink_override_get_end_index (gtype.Val, GetEndIndexCallback); - } - - [GLib.DefaultSignalHandler (Type=typeof(Atk.Hyperlink), ConnectionMethod="OverrideGetEndIndex")] - protected virtual int OnGetEndIndex () - { - return -1; - } - - [DllImport("atksharpglue-2")] - static extern void atksharp_hyperlink_override_get_start_index (IntPtr type, GetStartIndexDelegate cb); - - [GLib.CDeclCallback] - delegate int GetStartIndexDelegate (IntPtr raw); - - static GetStartIndexDelegate GetStartIndexCallback; - - static int GetStartIndex_cb (IntPtr raw) - { - try { - Atk.Hyperlink obj = GLib.Object.GetObject (raw, false) as Atk.Hyperlink; - return obj.OnGetStartIndex (); - } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); - } - - return -1; - } - - static void OverrideGetStartIndex (GLib.GType gtype) - { - if (GetStartIndexCallback == null) - GetStartIndexCallback = new GetStartIndexDelegate (GetStartIndex_cb); - atksharp_hyperlink_override_get_start_index (gtype.Val, GetStartIndexCallback); - } - - [GLib.DefaultSignalHandler (Type=typeof(Atk.Hyperlink), ConnectionMethod="OverrideGetStartIndex")] - protected virtual int OnGetStartIndex () - { - return -1; - } - - [DllImport("atksharpglue-2")] - static extern void atksharp_hyperlink_override_is_valid (IntPtr type, IsValidDelegate cb); - - [GLib.CDeclCallback] - delegate bool IsValidDelegate (IntPtr raw); - - static IsValidDelegate IsValidCallback; - - static bool IsValid_cb (IntPtr raw) - { - try { - Atk.Hyperlink obj = GLib.Object.GetObject (raw, false) as Atk.Hyperlink; - return obj.OnIsValid (); - } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); - } - - return false; - } - - static void OverrideIsValid (GLib.GType gtype) - { - if (IsValidCallback == null) - IsValidCallback = new IsValidDelegate (IsValid_cb); - atksharp_hyperlink_override_is_valid (gtype.Val, IsValidCallback); - } - - [GLib.DefaultSignalHandler (Type=typeof(Atk.Hyperlink), ConnectionMethod="OverrideIsValid")] - protected virtual bool OnIsValid() - { - return false; - } - - [DllImport("atksharpglue-2")] - static extern void atksharp_hyperlink_override_get_n_anchors (IntPtr type, GetNAnchorsDelegate cb); - - [GLib.CDeclCallback] - delegate int GetNAnchorsDelegate (IntPtr raw); - - static GetNAnchorsDelegate GetNAnchorsCallback; - - static int GetNAnchors_cb (IntPtr raw) - { - try { - Atk.Hyperlink obj = GLib.Object.GetObject (raw, false) as Atk.Hyperlink; - return obj.OnGetNAnchors (); - } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); - } - - return 0; - } - - static void OverrideGetNAnchors (GLib.GType gtype) - { - if (GetNAnchorsCallback == null) - GetNAnchorsCallback = new GetNAnchorsDelegate (GetNAnchors_cb); - atksharp_hyperlink_override_get_n_anchors (gtype.Val, GetNAnchorsCallback); - } - - [GLib.DefaultSignalHandler (Type=typeof(Atk.Hyperlink), ConnectionMethod="OverrideGetNAnchors")] - protected virtual int OnGetNAnchors () - { - return 0; - } - - [DllImport("atksharpglue-2")] - static extern void atksharp_hyperlink_override_link_state (IntPtr type, LinkStateDelegate cb); - - [GLib.CDeclCallback] - delegate uint LinkStateDelegate (IntPtr raw); - - static LinkStateDelegate LinkStateCallback; - - static uint LinkState_cb (IntPtr raw) - { - try { - Atk.Hyperlink obj = GLib.Object.GetObject (raw, false) as Atk.Hyperlink; - return obj.OnLinkState (); - } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); - } - - return 0; - } - - static void OverrideLinkState (GLib.GType gtype) - { - if (LinkStateCallback == null) - LinkStateCallback = new LinkStateDelegate (LinkState_cb); - atksharp_hyperlink_override_link_state (gtype.Val, LinkStateCallback); - } - - [GLib.DefaultSignalHandler (Type=typeof(Atk.Hyperlink), ConnectionMethod="OverrideLinkState")] - protected virtual uint OnLinkState () - { - return 0; - } - - [DllImport("atksharpglue-2")] - static extern void atksharp_hyperlink_override_is_selected_link (IntPtr type, IsSelectedLinkDelegate cb); - - [GLib.CDeclCallback] - delegate bool IsSelectedLinkDelegate (IntPtr raw); - - static IsSelectedLinkDelegate IsSelectedLinkCallback; - - static bool IsSelectedLink_cb (IntPtr raw) - { - try { - Atk.Hyperlink obj = GLib.Object.GetObject (raw, false) as Atk.Hyperlink; - return obj.OnIsSelectedLink (); - } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); - } - - return false; - } - - static void OverrideIsSelectedLink (GLib.GType gtype) - { - if (IsSelectedLinkCallback == null) - IsSelectedLinkCallback = new IsSelectedLinkDelegate (IsSelectedLink_cb); - atksharp_hyperlink_override_is_selected_link (gtype.Val, IsSelectedLinkCallback); - } - - [GLib.DefaultSignalHandler (Type=typeof(Atk.Hyperlink), ConnectionMethod="OverrideIsSelectedLink")] - protected virtual bool OnIsSelectedLink () - { - return false; - } - protected void EmitLinkActivated () { GLib.Signal.Emit (this, "link_activated"); diff --git a/atk/Makefile.am b/atk/Makefile.am index 16b8f3b6f..ce5d0b36e 100644 --- a/atk/Makefile.am +++ b/atk/Makefile.am @@ -15,7 +15,6 @@ customs = \ Hyperlink.custom \ Misc.custom \ Object.custom \ - ObjectFactory.custom \ SelectionAdapter.custom \ TextAdapter.custom \ Util.custom diff --git a/atk/Misc.custom b/atk/Misc.custom index c00e8212a..4f7a60c26 100644 --- a/atk/Misc.custom +++ b/atk/Misc.custom @@ -21,64 +21,6 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. - - [DllImport("atksharpglue-2")] - static extern int atksharp_misc_override_threads_enter (IntPtr type, ThreadDelegate cb); - - [GLib.CDeclCallback] - delegate void ThreadDelegate (IntPtr raw); - - static ThreadDelegate ThreadsEnterCallback; - - static void ThreadsEnter_cb (IntPtr raw) - { - try { - Atk.Misc __obj = GLib.Object.GetObject (raw, false) as Atk.Misc; - __obj.OnThreadsEnter (); - } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); - } - } - - static void OverrideThreadsEnter (GLib.GType gtype) - { - if (ThreadsEnterCallback == null) - ThreadsEnterCallback = new ThreadDelegate (ThreadsEnter_cb); - atksharp_misc_override_threads_enter (gtype.Val, ThreadsEnterCallback); - } - - [GLib.DefaultSignalHandler (Type=typeof (Atk.Misc), ConnectionMethod="OverrideThreadsEnter")] - protected virtual void OnThreadsEnter () - { - } - - [DllImport("atksharpglue-2")] - static extern int atksharp_misc_override_threads_leave (IntPtr type, ThreadDelegate cb); - - static ThreadDelegate ThreadsLeaveCallback; - - static void ThreadsLeave_cb (IntPtr raw) - { - try { - Atk.Misc __obj = GLib.Object.GetObject (raw, false) as Atk.Misc; - __obj.OnThreadsLeave (); - } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); - } - } - - static void OverrideThreadsLeave (GLib.GType gtype) - { - if (ThreadsLeaveCallback == null) - ThreadsLeaveCallback = new ThreadDelegate (ThreadsLeave_cb); - atksharp_misc_override_threads_leave (gtype.Val, ThreadsLeaveCallback); - } - - [GLib.DefaultSignalHandler (Type=typeof (Atk.Misc), ConnectionMethod="OverrideThreadsLeave")] - protected virtual void OnThreadsLeave () - { - } - [DllImport("atksharpglue-2")] static extern void atksharp_misc_set_singleton_instance (IntPtr misc); diff --git a/atk/Object.custom b/atk/Object.custom index 05ac21cff..0c5b5c820 100644 --- a/atk/Object.custom +++ b/atk/Object.custom @@ -21,77 +21,6 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. - [DllImport("atksharpglue-2")] - static extern void atksharp_object_override_get_n_children (IntPtr type, NChildrenDelegate cb); - - [GLib.CDeclCallback] - delegate int NChildrenDelegate (IntPtr raw); - - static NChildrenDelegate NChildrenCallback; - - static int NChildren_cb (IntPtr raw) - { - try { - Atk.Object obj = GLib.Object.GetObject (raw, false) as Atk.Object; - return obj.OnGetNChildren (); - } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); - } - - return 0; - } - - static void OverrideNChildren (GLib.GType gtype) - { - if (NChildrenCallback == null) - NChildrenCallback = new NChildrenDelegate (NChildren_cb); - atksharp_object_override_get_n_children (gtype.Val, NChildrenCallback); - } - - [GLib.DefaultSignalHandler (Type=typeof(Atk.Object), ConnectionMethod="OverrideNChildren")] - protected virtual int OnGetNChildren() { - return 0; - } - - [DllImport("atksharpglue-2")] - static extern void atksharp_object_override_ref_child (IntPtr type, RefChildDelegate cb); - - [GLib.CDeclCallback] - delegate IntPtr RefChildDelegate (IntPtr raw, int i); - - static RefChildDelegate RefChildCallback; - - [DllImport("libgobject-2.0-0.dll")] - static extern IntPtr g_object_ref (IntPtr handle); - - static IntPtr RefChild_cb (IntPtr raw, int i) - { - try { - Atk.Object obj = GLib.Object.GetObject (raw, false) as Atk.Object; - Atk.Object child = obj.OnRefChild (i); - if (child != null) - g_object_ref (child.Handle); - return child == null ? IntPtr.Zero : child.Handle; - } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); - } - - return IntPtr.Zero; - } - - - static void OverrideRefChild (GLib.GType gtype) - { - if (RefChildCallback == null) - RefChildCallback = new RefChildDelegate (RefChild_cb); - atksharp_object_override_ref_child (gtype.Val, RefChildCallback); - } - - [GLib.DefaultSignalHandler (Type=typeof(Atk.Object), ConnectionMethod="OverrideRefChild")] - protected virtual Atk.Object OnRefChild (int i) { - return null; - } - protected void EmitChildrenChanged (ChildrenChangedDetail detail, uint child_index, Atk.Object child) { GLib.Signal.Emit (this, @@ -110,125 +39,11 @@ GLib.Signal.Emit (this, "visible-data-changed"); } - [DllImport("atksharpglue-2")] - static extern void atksharp_object_override_ref_state_set (IntPtr type, RefStateSetDelegate cb); - - [DllImport("atksharpglue-2")] - static extern IntPtr atksharp_object_base_ref_state_set (IntPtr atk_obj); - - [GLib.CDeclCallback] - delegate IntPtr RefStateSetDelegate (IntPtr raw); - - static RefStateSetDelegate RefStateSetCallback; - - static IntPtr RefStateSet_cb (IntPtr raw) - { - try { - Atk.Object obj = GLib.Object.GetObject (raw, false) as Atk.Object; - Atk.StateSet state_set = obj.OnRefStateSet (); - if (state_set != null) - g_object_ref (state_set.Handle); - return state_set == null ? IntPtr.Zero : state_set.Handle; - } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); - } - - return IntPtr.Zero; - } - - static void OverrideRefStateSet (GLib.GType gtype) - { - if (RefStateSetCallback == null) - RefStateSetCallback = new RefStateSetDelegate (RefStateSet_cb); - atksharp_object_override_ref_state_set (gtype.Val, RefStateSetCallback); - } - - [GLib.DefaultSignalHandler (Type=typeof(Atk.Object), ConnectionMethod="OverrideRefStateSet")] - protected virtual Atk.StateSet OnRefStateSet () - { - IntPtr raw = atksharp_object_base_ref_state_set (Handle); - return GLib.Object.GetObject (raw, true) as StateSet; - } - - [DllImport("atksharpglue-2")] - static extern void atksharp_object_override_get_index_in_parent (IntPtr type, IndexInParentDelegate cb); - - [GLib.CDeclCallback] - delegate int IndexInParentDelegate (IntPtr raw); - - static IndexInParentDelegate IndexInParentCallback; - - static int IndexInParent_cb (IntPtr raw) - { - try { - Atk.Object obj = GLib.Object.GetObject (raw, false) as Atk.Object; - return obj.OnGetIndexInParent (); - } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); - } - - return -1; - } - - static void OverrideIndexInParent (GLib.GType gtype) - { - if (IndexInParentCallback == null) - IndexInParentCallback = new IndexInParentDelegate (IndexInParent_cb); - atksharp_object_override_get_index_in_parent (gtype.Val, IndexInParentCallback); - } - - [GLib.DefaultSignalHandler (Type=typeof(Atk.Object), ConnectionMethod="OverrideIndexInParent")] - protected virtual int OnGetIndexInParent() { - return -1; - } - public void NotifyStateChange (Atk.StateType state, bool value) { NotifyStateChange ((ulong)state, value); } - [DllImport("atksharpglue-2")] - static extern void atksharp_object_override_ref_relation_set (IntPtr type, RefRelationSetDelegate cb); - - [DllImport("atksharpglue-2")] - static extern IntPtr atksharp_object_base_ref_relation_set (IntPtr atk_obj); - - [GLib.CDeclCallback] - delegate IntPtr RefRelationSetDelegate (IntPtr raw); - - static RefRelationSetDelegate RefRelationSetCallback; - - static IntPtr RefRelationSet_cb (IntPtr raw) - { - try { - Atk.Object obj = GLib.Object.GetObject (raw, false) as Atk.Object; - Atk.RelationSet relation_set = obj.OnRefRelationSet (); - if (relation_set != null) - g_object_ref (relation_set.Handle); - return relation_set == null ? IntPtr.Zero : relation_set.Handle; - } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); - } - - return IntPtr.Zero; - } - - - static void OverrideRefRelationSet (GLib.GType gtype) - { - if (RefRelationSetCallback == null) - RefRelationSetCallback = new RefRelationSetDelegate (RefRelationSet_cb); - atksharp_object_override_ref_relation_set (gtype.Val, RefRelationSetCallback); - } - - [GLib.DefaultSignalHandler (Type=typeof(Atk.Object), ConnectionMethod="OverrideRefRelationSet")] - protected virtual Atk.RelationSet OnRefRelationSet () - { - IntPtr raw = atksharp_object_base_ref_relation_set (Handle); - return GLib.Object.GetObject (raw, true) as RelationSet; - } - protected void EmitFocusEvent (bool gained) { GLib.Signal.Emit (this, "focus-event", gained); } - \ No newline at end of file diff --git a/atk/ObjectFactory.custom b/atk/ObjectFactory.custom deleted file mode 100644 index be091b209..000000000 --- a/atk/ObjectFactory.custom +++ /dev/null @@ -1,124 +0,0 @@ -// ObjectFactory.custom - Atk ObjectFactory class customizations -// -// Author: Mike Gorse -// -// Copyright (c) 2008 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. - - [DllImport("atksharpglue-2")] - static extern void atksharp_object_factory_override_create_accessible (IntPtr type, CreateAccessibleDelegate cb); - - [GLib.CDeclCallback] - delegate IntPtr CreateAccessibleDelegate (IntPtr raw); - - static CreateAccessibleDelegate CreateAccessibleCallback; - - [DllImport("libgobject-2.0-0.dll")] - static extern IntPtr g_object_ref (IntPtr handle); - - static IntPtr CreateAccessible_cb (IntPtr raw) - { - try { - Atk.ObjectFactory obj = GLib.Object.GetObject (raw, false) as Atk.ObjectFactory; - Atk.Object ret = obj.OnCreateAccessible (); - if (ret != null) - g_object_ref (ret.Handle); - return ret == null ? IntPtr.Zero : ret.Handle; - } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); - } - - return IntPtr.Zero; - } - - static void OverrideCreateAccessible (GLib.GType gtype) - { - if (CreateAccessibleCallback == null) - CreateAccessibleCallback = new CreateAccessibleDelegate (CreateAccessible_cb); - atksharp_object_factory_override_create_accessible (gtype.Val, CreateAccessibleCallback); - } - - [GLib.DefaultSignalHandler (Type=typeof(Atk.ObjectFactory), ConnectionMethod="OverrideCreateAccessible")] - protected virtual Atk.Object OnCreateAccessible () - { - return null; - } - - [DllImport("atksharpglue-2")] - static extern void atksharp_object_factory_override_invalidate (IntPtr type, InvalidateDelegate cb); - - [GLib.CDeclCallback] - delegate void InvalidateDelegate (IntPtr raw); - - static InvalidateDelegate InvalidateCallback; - - static void Invalidate_cb (IntPtr raw) - { - try { - Atk.ObjectFactory obj = GLib.Object.GetObject (raw, false) as Atk.ObjectFactory; - obj.OnInvalidate (); - } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); - } - } - - static void OverrideInvalidate (GLib.GType gtype) - { - if (InvalidateCallback == null) - InvalidateCallback = new InvalidateDelegate (Invalidate_cb); - atksharp_object_factory_override_invalidate (gtype.Val, InvalidateCallback); - } - - [GLib.DefaultSignalHandler (Type=typeof(Atk.ObjectFactory), ConnectionMethod="OverrideInvalidate")] - protected virtual void OnInvalidate () - { - } - - [DllImport("atksharpglue-2")] - static extern void atksharp_object_factory_override_get_accessible_type (IntPtr type, GetAccessibleTypeDelegate cb); - - [GLib.CDeclCallback] - delegate IntPtr GetAccessibleTypeDelegate (IntPtr raw); - - static GetAccessibleTypeDelegate GetAccessibleTypeCallback; - - static IntPtr GetAccessibleType_cb (IntPtr raw) - { - try { - Atk.ObjectFactory obj = GLib.Object.GetObject (raw, false) as Atk.ObjectFactory; - return obj.OnGetAccessibleType ().Val; - } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); - } - - return IntPtr.Zero; - } - - static void OverrideGetAccessibleType (GLib.GType gtype) - { - if (GetAccessibleTypeCallback == null) - GetAccessibleTypeCallback = new GetAccessibleTypeDelegate (GetAccessibleType_cb); - atksharp_object_factory_override_get_accessible_type (gtype.Val, GetAccessibleTypeCallback); - } - - [GLib.DefaultSignalHandler (Type=typeof(Atk.ObjectFactory), ConnectionMethod="OverrideGetAccessibleType")] - protected virtual GLib.GType OnGetAccessibleType () - { - return GLib.GType.Invalid; - } diff --git a/atk/Util.custom b/atk/Util.custom index 79e87c242..8013a9793 100644 --- a/atk/Util.custom +++ b/atk/Util.custom @@ -80,63 +80,6 @@ } } - class KeySnoopFuncInvoker { - - AtkSharp.KeySnoopFuncNative native_cb; - IntPtr data; - - internal KeySnoopFuncInvoker (AtkSharp.KeySnoopFuncNative native_cb, IntPtr data) - { - this.native_cb = native_cb; - this.data = data; - } - - internal KeySnoopFunc Handler { - get { - return new KeySnoopFunc (InvokeNative); - } - } - - int InvokeNative (KeyEventStruct evnt) - { - IntPtr native_evnt = GLib.Marshaller.StructureToPtrAlloc (evnt); - int result = native_cb (native_evnt, data); - evnt = KeyEventStruct.New (native_evnt); - Marshal.FreeHGlobal (native_evnt); - return result; - } - } - - [GLib.CDeclCallback] - delegate uint AddKeyEventListenerNativeDelegate (AtkSharp.KeySnoopFuncNative native_func, IntPtr data); - - static AddKeyEventListenerDelegate add_key_event_listener_handler; - static AddKeyEventListenerNativeDelegate add_key_event_listener_callback; - - static uint AddKeyEventListenerCallback (AtkSharp.KeySnoopFuncNative func, IntPtr data) - { - try { - return add_key_event_listener_handler (new KeySnoopFuncInvoker (func, data).Handler); - } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); - } - return 0; - } - - [DllImport("atksharpglue-2")] - static extern void atksharp_util_override_add_key_event_listener (AddKeyEventListenerNativeDelegate cb); - - public delegate uint AddKeyEventListenerDelegate (KeySnoopFunc listener); - - public static AddKeyEventListenerDelegate AddKeyEventListenerHandler { - set { - add_key_event_listener_handler = value; - if (add_key_event_listener_callback == null) - add_key_event_listener_callback = new AddKeyEventListenerNativeDelegate (AddKeyEventListenerCallback); - atksharp_util_override_add_key_event_listener (add_key_event_listener_callback); - } - } - static RemoveListenerDelegate remove_key_event_listener_handler; static RemoveListenerNativeDelegate remove_key_event_listener_callback; @@ -160,114 +103,3 @@ atksharp_util_override_remove_key_event_listener (remove_key_event_listener_callback); } } - - [GLib.CDeclCallback] - delegate IntPtr GetRootNativeDelegate (); - - static GetRootDelegate get_root_handler; - static GetRootNativeDelegate get_root_callback; - - static IntPtr GetRootCallback () - { - try { - return get_root_handler ().Handle; - } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); - } - return IntPtr.Zero; - } - - [DllImport("atksharpglue-2")] - static extern void atksharp_util_override_get_root (GetRootNativeDelegate cb); - - public delegate Atk.Object GetRootDelegate (); - - public static GetRootDelegate GetRootHandler { - set { - get_root_handler = value; - if (value == null) - atksharp_util_override_get_root (null); - else { - if (get_root_callback == null) - get_root_callback = new GetRootNativeDelegate (GetRootCallback); - atksharp_util_override_get_root (get_root_callback); - } - } - } - - [GLib.CDeclCallback] - delegate IntPtr GetToolkitNameNativeDelegate (); - - static GetToolkitNameDelegate get_toolkit_name_handler; - static GetToolkitNameNativeDelegate get_toolkit_name_callback; - static string toolkit_name; - static IntPtr toolkit_name_native; - - static IntPtr GetToolkitNameCallback () - { - try { - string name = get_toolkit_name_handler (); - if (name != toolkit_name) { - GLib.Marshaller.Free (toolkit_name_native); - toolkit_name_native = GLib.Marshaller.StringToPtrGStrdup (name); - toolkit_name = name; - } - return toolkit_name_native; - } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); - } - return IntPtr.Zero; - } - - [DllImport("atksharpglue-2")] - static extern void atksharp_util_override_get_toolkit_name (GetToolkitNameNativeDelegate cb); - - public delegate string GetToolkitNameDelegate (); - - public static GetToolkitNameDelegate GetToolkitNameHandler { - set { - get_toolkit_name_handler = value; - if (get_toolkit_name_callback == null) - get_toolkit_name_callback = new GetToolkitNameNativeDelegate (GetToolkitNameCallback); - atksharp_util_override_get_toolkit_name (get_toolkit_name_callback); - } - } - - [GLib.CDeclCallback] - delegate IntPtr GetToolkitVersionNativeDelegate (); - - static GetToolkitVersionDelegate get_toolkit_version_handler; - static GetToolkitVersionNativeDelegate get_toolkit_version_callback; - static string toolkit_version; - static IntPtr toolkit_version_native; - - static IntPtr GetToolkitVersionCallback () - { - try { - string version = get_toolkit_version_handler (); - if (version != toolkit_version) { - GLib.Marshaller.Free (toolkit_version_native); - toolkit_version_native = GLib.Marshaller.StringToPtrGStrdup (version); - toolkit_version = version; - } - return toolkit_version_native; - } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); - } - return IntPtr.Zero; - } - - [DllImport("atksharpglue-2")] - static extern void atksharp_util_override_get_toolkit_version (GetToolkitVersionNativeDelegate cb); - - public delegate string GetToolkitVersionDelegate (); - - public static GetToolkitVersionDelegate GetToolkitVersionHandler { - set { - get_toolkit_version_handler = value; - if (get_toolkit_version_callback == null) - get_toolkit_version_callback = new GetToolkitVersionNativeDelegate (GetToolkitVersionCallback); - atksharp_util_override_get_toolkit_version (get_toolkit_version_callback); - } - } - diff --git a/atk/atk-api-2.14.raw b/atk/atk-api-2.14.raw index 93bc3fe05..d1b21faf0 100644 --- a/atk/atk-api-2.14.raw +++ b/atk/atk-api-2.14.raw @@ -1,5 +1,5 @@ - +