New functions which checks whether the specified AtkHyperlink is selected
authorPadraig O'Briain <padraig.obriain@sun.com>
Thu, 30 Jan 2003 17:09:06 +0000 (17:09 +0000)
committerPadraig O'Briain <padraigo@src.gnome.org>
Thu, 30 Jan 2003 17:09:06 +0000 (17:09 +0000)
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.

ChangeLog
atk/atkhyperlink.c
atk/atkhyperlink.h
atk/atkhypertext.c
atk/atkhypertext.h
docs/atk-sections.txt
docs/tmpl/atkhyperlink.sgml

index a586330..8182650 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+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.
+       
 Tue Jan 28 13:52:20 2003  Manish Singh  <yosh@gimp.org>
 
        * autogen.sh (have_automake): call the versioned automake when
@@ -410,7 +428,7 @@ Fri Nov  8 19:55:25 2002  Soeren Sandmann  <sandmann@daimi.au.dk>
        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
 
index 90f4ff4..f4e5588 100755 (executable)
 
 #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.
    */
 }
index a0c6025..f3c24e8 100755 (executable)
@@ -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
index 328317e..cfca58e 100755 (executable)
 
 #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
index f6cc064..18464d9 100755 (executable)
@@ -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);
 
index 2929091..81fb54e 100644 (file)
@@ -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
 <SUBSECTION Standard>
 ATK_HYPERLINK
 ATK_IS_HYPERLINK
index dd4023b..e90e544 100644 (file)
@@ -94,3 +94,17 @@ The AtkHyperlink structure should not be accessed directly.
 @Returns: 
 
 
+<!-- ##### FUNCTION atk_hyperlink_is_selected_link ##### -->
+<para>
+
+</para>
+
+@link_: 
+@Returns: 
+
+
+<!-- ##### ARG AtkHyperlink:selected-link ##### -->
+<para>
+
+</para>
+