diff --git a/ChangeLog b/ChangeLog index ddfa9ecb3..05f53b86e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-10-02 Mike Gorse + + * Atk/Makefile.am, Atk/Hyperlink.custom, Atk/glue/Makefile.am, + Atk/glue/hyperlink.c: Add Hyperlink.custom and glue/hyperlink.c. + 2008-09-30 Mike Kestner * generator/EnumGen.cs: diff --git a/atk/Hyperlink.custom b/atk/Hyperlink.custom new file mode 100644 index 000000000..54d320b89 --- /dev/null +++ b/atk/Hyperlink.custom @@ -0,0 +1,293 @@ +// Hyperlink.custom - Atk Hyperlink 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_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 773367c67..9f7abe8a8 100644 --- a/atk/Makefile.am +++ b/atk/Makefile.am @@ -12,6 +12,7 @@ sources = \ customs = \ Global.custom \ + Hyperlink.custom \ Misc.custom \ Object.custom \ TextAdapter.custom \ diff --git a/atk/glue/Makefile.am b/atk/glue/Makefile.am index c612eb0bd..ea23a39f8 100644 --- a/atk/glue/Makefile.am +++ b/atk/glue/Makefile.am @@ -3,6 +3,7 @@ lib_LTLIBRARIES = libatksharpglue-2.la libatksharpglue_2_la_LDFLAGS = -module -avoid-version -no-undefined libatksharpglue_2_la_SOURCES = \ + hyperlink.c \ misc.c \ object.c \ util.c \ diff --git a/atk/glue/hyperlink.c b/atk/glue/hyperlink.c new file mode 100644 index 000000000..d49d63656 --- /dev/null +++ b/atk/glue/hyperlink.c @@ -0,0 +1,117 @@ +/* hyperlink.c : Glue for overriding vms of AtkHyperlink + * + * Author: Mike Gorse + * + * Copyright (c) 2008 Novell, Inc. + * + * 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. + */ + +#include + + +void atksharp_hyperlink_override_get_uri (GType gtype, gpointer cb); + +void atksharp_hyperlink_override_get_object (GType gtype, gpointer cb); + +void atksharp_hyperlink_override_get_end_index (GType gtype, gpointer cb); + +void atksharp_hyperlink_override_get_start_index (GType gtype, gpointer cb); + +void atksharp_hyperlink_override_is_valid (GType gtype, gpointer cb); + +void atksharp_hyperlink_override_get_n_anchors (GType gtype, gpointer cb); + +void atksharp_hyperlink_override_link_state (GType gtype, gpointer cb); + +void atksharp_hyperlink_override_is_selected_link (GType gtype, gpointer cb); + + +void +atksharp_hyperlink_override_get_uri (GType gtype, gpointer cb) +{ + AtkHyperlinkClass *klass = g_type_class_peek (gtype); + if (!klass) + klass = g_type_class_ref (gtype); + ((AtkHyperlinkClass *) klass)->get_uri = cb; +} + +void +atksharp_hyperlink_override_get_object (GType gtype, gpointer cb) +{ + AtkHyperlinkClass *klass = g_type_class_peek (gtype); + if (!klass) + klass = g_type_class_ref (gtype); + ((AtkHyperlinkClass *) klass)->get_object = cb; +} + + +void +atksharp_hyperlink_override_get_end_index (GType gtype, gpointer cb) +{ + AtkHyperlinkClass *klass = g_type_class_peek (gtype); + if (!klass) + klass = g_type_class_ref (gtype); + ((AtkHyperlinkClass *) klass)->get_end_index = cb; +} + +void +atksharp_hyperlink_override_get_start_index (GType gtype, gpointer cb) +{ + AtkHyperlinkClass *klass = g_type_class_peek (gtype); + if (!klass) + klass = g_type_class_ref (gtype); + ((AtkHyperlinkClass *) klass)->get_start_index = cb; +} + + +void +atksharp_hyperlink_override_is_valid (GType gtype, gpointer cb) +{ + AtkHyperlinkClass *klass = g_type_class_peek (gtype); + if (!klass) + klass = g_type_class_ref (gtype); + ((AtkHyperlinkClass *) klass)->is_valid = cb; +} + + +void +atksharp_hyperlink_override_get_n_anchors (GType gtype, gpointer cb) +{ + AtkHyperlinkClass *klass = g_type_class_peek (gtype); + if (!klass) + klass = g_type_class_ref (gtype); + ((AtkHyperlinkClass *) klass)->get_n_anchors = cb; +} + + +void +atksharp_hyperlink_override_link_state (GType gtype, gpointer cb) +{ + AtkHyperlinkClass *klass = g_type_class_peek (gtype); + if (!klass) + klass = g_type_class_ref (gtype); + ((AtkHyperlinkClass *) klass)->link_state = cb; +} + + +void +atksharp_hyperlink_override_is_selected_link (GType gtype, gpointer cb) +{ + AtkHyperlinkClass *klass = g_type_class_peek (gtype); + if (!klass) + klass = g_type_class_ref (gtype); + ((AtkHyperlinkClass *) klass)->is_selected_link = cb; +}