From bde02d93a1431b802e8d0fde3b7840bfc69698dc Mon Sep 17 00:00:00 2001 From: Padraig O'Briain Date: Thu, 30 Jan 2003 17:09:06 +0000 Subject: New functions which checks whether the specified AtkHyperlink is selected 2003-01-30 Padraig O'Briain * atk/atkhyperlink.[ch] New property selected-link defined. Function pointer is_selected_link added to interface (atk_hyperlink_is_selected_link: New functions which checks whether the specified AtkHyperlink is selected * atk/atkhypertext.[ch] New signal link-selected added. * docs/atk-sections.txt: Add atk_hyperlink_is_selected_link * docs/tmpl/atkhyperlink.sgml: Add reference to property selected-link and function atk_hyperlink_is_selected_link. This fixes bug #104621. --- ChangeLog | 20 ++++++++++++- atk/atkhyperlink.c | 68 +++++++++++++++++++++++++++++++++++++++++++-- atk/atkhyperlink.h | 3 +- atk/atkhypertext.c | 33 +++++++++++++++++++++- atk/atkhypertext.h | 8 +++++- docs/atk-sections.txt | 1 + docs/tmpl/atkhyperlink.sgml | 14 ++++++++++ 7 files changed, 140 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index a586330..8182650 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2003-01-30 Padraig O'Briain + + * atk/atkhyperlink.[ch] + New property selected-link defined. + Function pointer is_selected_link added to interface + (atk_hyperlink_is_selected_link: New functions which checks + whether the specified AtkHyperlink is selected + + * atk/atkhypertext.[ch] + New signal link-selected added. + + * docs/atk-sections.txt: Add atk_hyperlink_is_selected_link + + * docs/tmpl/atkhyperlink.sgml: Add reference to property selected-link + and function atk_hyperlink_is_selected_link. + + This fixes bug #104621. + Tue Jan 28 13:52:20 2003 Manish Singh * autogen.sh (have_automake): call the versioned automake when @@ -410,7 +428,7 @@ Fri Nov 8 19:55:25 2002 Soeren Sandmann increment version to 1.1.0, in view of the fact that we've branched for GNOME-2 and GTK+-2.0, and this is HEAD. Also reset INTERFACE_AGE to zero, since an enum was added. - Use similar librray numbering as GTK. + Use similar library numbering as GTK. * docs/tmpl/atkobject.sgml: Add ATK_LAYER_WINDOW diff --git a/atk/atkhyperlink.c b/atk/atkhyperlink.c index 90f4ff4..f4e5588 100755 --- a/atk/atkhyperlink.c +++ b/atk/atkhyperlink.c @@ -19,11 +19,23 @@ #include "atkhyperlink.h" +enum +{ + PROP_0, /* gobject convention */ + + PROP_SELECTED_LINK, + PROP_LAST +}; static void atk_hyperlink_class_init (AtkHyperlinkClass *klass); static void atk_hyperlink_init (AtkHyperlink *link, AtkHyperlinkClass *klass); +static void atk_hyperlink_real_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); + static void atk_hyperlink_action_iface_init (AtkActionIface *iface); static gpointer parent_class = NULL; @@ -64,8 +76,19 @@ atk_hyperlink_get_type (void) static void atk_hyperlink_class_init (AtkHyperlinkClass *klass) { + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + parent_class = g_type_class_peek_parent (klass); + gobject_class->get_property = atk_hyperlink_real_get_property; + + g_object_class_install_property (gobject_class, + PROP_SELECTED_LINK, + g_param_spec_boolean ("selected-link", + "Selected Link", + "Specifies whether theAtkHyperlink object is selected", + FALSE, + G_PARAM_READABLE)); } static void @@ -74,6 +97,26 @@ atk_hyperlink_init (AtkHyperlink *link, { } +static void +atk_hyperlink_real_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + AtkHyperlink* link; + + link = ATK_HYPERLINK (object); + + switch (prop_id) + { + case PROP_SELECTED_LINK: + g_value_set_boolean (value, atk_hyperlink_is_selected_link (link)); + break; + default: + break; + } +} + /** * atk_hyperlink_get_uri: * @link_: an #AtkHyperlink @@ -246,6 +289,28 @@ atk_hyperlink_get_n_anchors (AtkHyperlink *link) return 0; } +/** + * atk_hyperlink_is_selected_link: + * @link_: an #AtkHyperlink + * + * Determines whether this AtkHyperlink is selected + * + * Returns: True is the AtkHyperlink is selected, False otherwise + **/ +gboolean +atk_hyperlink_is_selected_link (AtkHyperlink *link) +{ + AtkHyperlinkClass *klass; + + g_return_val_if_fail (ATK_IS_HYPERLINK (link), FALSE); + + klass = ATK_HYPERLINK_GET_CLASS (link); + if (klass->is_selected_link) + return (klass->is_selected_link) (link); + else + return FALSE; +} + static void atk_hyperlink_action_iface_init (AtkActionIface *iface) { /* @@ -253,8 +318,5 @@ static void atk_hyperlink_action_iface_init (AtkActionIface *iface) * * When we come to derive a class from AtkHyperlink we will provide an * implementation of the AtkAction interface. - * - * This depends on being able to override an interface in a derived class - * which currently (March 2001) is not implemented but will be in GTK+ 2.0. */ } diff --git a/atk/atkhyperlink.h b/atk/atkhyperlink.h index a0c6025..f3c24e8 100755 --- a/atk/atkhyperlink.h +++ b/atk/atkhyperlink.h @@ -104,9 +104,9 @@ struct _AtkHyperlinkClass */ guint (* link_state) (AtkHyperlink *link_); + gboolean (* is_selected_link) (AtkHyperlink *link_); AtkFunction pad1; AtkFunction pad2; - AtkFunction pad3; }; GType atk_hyperlink_get_type (void); @@ -126,6 +126,7 @@ gboolean atk_hyperlink_is_valid (AtkHyperlink *link_); gboolean atk_hyperlink_is_inline (AtkHyperlink *link_); gint atk_hyperlink_get_n_anchors (AtkHyperlink *link_); +gboolean atk_hyperlink_is_selected_link (AtkHyperlink *link_); #ifdef __cplusplus diff --git a/atk/atkhypertext.c b/atk/atkhypertext.c index 328317e..cfca58e 100755 --- a/atk/atkhypertext.c +++ b/atk/atkhypertext.c @@ -19,6 +19,16 @@ #include "atkhypertext.h" +enum { + LINK_SELECTED, + LAST_SIGNAL +}; + +static void atk_hypertext_base_init (AtkHypertextIface *class); + +static guint atk_hypertext_signals[LAST_SIGNAL] = { 0 }; + + GType atk_hypertext_get_type () { @@ -28,7 +38,7 @@ atk_hypertext_get_type () static const GTypeInfo tinfo = { sizeof (AtkHypertextIface), - (GBaseInitFunc) NULL, + (GBaseInitFunc) atk_hypertext_base_init, (GBaseFinalizeFunc) NULL, }; @@ -39,6 +49,27 @@ atk_hypertext_get_type () return type; } +static void +atk_hypertext_base_init (AtkHypertextIface *class) +{ + static gboolean initialized = FALSE; + + if (!initialized) + { + atk_hypertext_signals[LINK_SELECTED] = + g_signal_new ("link_selected", + ATK_TYPE_HYPERTEXT, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AtkHypertextIface, link_selected), + (GSignalAccumulator) NULL, NULL, + g_cclosure_marshal_VOID__INT, + G_TYPE_NONE, + 1, G_TYPE_INT); + + initialized = TRUE; + } +} + /** * atk_hypertext_get_link: * @hypertext: an #AtkHypertext diff --git a/atk/atkhypertext.h b/atk/atkhypertext.h index f6cc064..18464d9 100755 --- a/atk/atkhypertext.h +++ b/atk/atkhypertext.h @@ -52,10 +52,16 @@ struct _AtkHypertextIface gint (* get_n_links) (AtkHypertext *hypertext); gint (* get_link_index) (AtkHypertext *hypertext, gint char_index); + + /* + * signal handlers + */ + void (* link_selected) (AtkHypertext *hypertext, + gint link_index); + AtkFunction pad1; AtkFunction pad2; AtkFunction pad3; - AtkFunction pad4; }; GType atk_hypertext_get_type (void); diff --git a/docs/atk-sections.txt b/docs/atk-sections.txt index 2929091..81fb54e 100644 --- a/docs/atk-sections.txt +++ b/docs/atk-sections.txt @@ -445,6 +445,7 @@ atk_hyperlink_get_start_index atk_hyperlink_is_valid atk_hyperlink_is_inline atk_hyperlink_get_n_anchors +atk_hyperlink_is_selected_link ATK_HYPERLINK ATK_IS_HYPERLINK diff --git a/docs/tmpl/atkhyperlink.sgml b/docs/tmpl/atkhyperlink.sgml index dd4023b..e90e544 100644 --- a/docs/tmpl/atkhyperlink.sgml +++ b/docs/tmpl/atkhyperlink.sgml @@ -94,3 +94,17 @@ The AtkHyperlink structure should not be accessed directly. @Returns: + + + + + +@link_: +@Returns: + + + + + + + -- cgit v1.2.1