diff options
author | Padraig O'Briain <padraig.obriain@sun.com> | 2003-01-30 17:09:06 +0000 |
---|---|---|
committer | Padraig O'Briain <padraigo@src.gnome.org> | 2003-01-30 17:09:06 +0000 |
commit | bde02d93a1431b802e8d0fde3b7840bfc69698dc (patch) | |
tree | 3ddbd079eb5ad91fbfaba507f0eb051e903ff26c /atk | |
parent | 6a8e887528299abe8520cad7bdd2cc03024ff1f0 (diff) | |
download | atk-bde02d93a1431b802e8d0fde3b7840bfc69698dc.tar.gz |
New functions which checks whether the specified AtkHyperlink is selected
2003-01-30 Padraig O'Briain <padraig.obriain@sun.com>
* 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.
Diffstat (limited to 'atk')
-rwxr-xr-x | atk/atkhyperlink.c | 68 | ||||
-rwxr-xr-x | atk/atkhyperlink.h | 3 | ||||
-rwxr-xr-x | atk/atkhypertext.c | 33 | ||||
-rwxr-xr-x | atk/atkhypertext.h | 8 |
4 files changed, 106 insertions, 6 deletions
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); |