doc: adding further explanation on atk_add_global_event_listener
[platform/upstream/atk.git] / atk / atkhyperlink.c
index 0b61853..e31f982 100755 (executable)
  * Boston, MA 02111-1307, USA.
  */
 
+#include "config.h"
 #include "atkhyperlink.h"
+#include <glib/gi18n-lib.h>
+
+/**
+ * SECTION:atkhyperlink
+ * @Short_description: An ATK object which encapsulates a link or set
+ *  of links in a hypertext document.
+ * @Title:AtkHyperlink
+ *
+ * An ATK object which encapsulates a link or set of links (for
+ * instance in the case of client-side image maps) in a hypertext
+ * document.  It may implement the AtkAction interface.  AtkHyperlink
+ * may also be used to refer to inline embedded content, since it
+ * allows specification of a start and end offset within the host
+ * AtkHypertext object.
+ */
+
+enum
+{
+  LINK_ACTIVATED,
+
+  LAST_SIGNAL
+};
 
 enum
 {
   PROP_0,  /* gobject convention */
 
   PROP_SELECTED_LINK,
+  PROP_NUMBER_ANCHORS,
+  PROP_END_INDEX,
+  PROP_START_INDEX,
   PROP_LAST
 };
 
@@ -38,6 +64,8 @@ static void atk_hyperlink_real_get_property (GObject            *object,
 
 static void atk_hyperlink_action_iface_init (AtkActionIface *iface);
 
+static guint atk_hyperlink_signals[LAST_SIGNAL] = { 0, };
+
 static gpointer  parent_class = NULL;
 
 GType
@@ -82,13 +110,69 @@ atk_hyperlink_class_init (AtkHyperlinkClass *klass)
 
   gobject_class->get_property = atk_hyperlink_real_get_property;
 
+  klass->link_activated = NULL;
+
+  /**
+   * AtkHyperlink:selected-link:
+   *
+   * Selected link
+   *
+   * Deprecated: Since 1.8. This property is deprecated since ATK
+   * version 1.8. Please use ATK_STATE_FOCUSABLE for all links, and
+   * ATK_STATE_FOCUSED for focused links.
+   *
+   */
   g_object_class_install_property (gobject_class,
                                    PROP_SELECTED_LINK,
                                    g_param_spec_boolean ("selected-link",
-                                                         "Selected Link",
-                                                         "Specifies whether the AtkHyperlink object is selected",
+                                                         _("Selected Link"),
+                                                         _("Specifies whether the AtkHyperlink object is selected"),
                                                          FALSE,
                                                          G_PARAM_READABLE));
+  g_object_class_install_property (gobject_class,
+                                   PROP_NUMBER_ANCHORS,
+                                   g_param_spec_int ("number-of-anchors",
+                                                     _("Number of Anchors"),
+                                                     _("The number of anchors associated with the AtkHyperlink object"),
+                                                     0,
+                                                     G_MAXINT,
+                                                     0,
+                                                     G_PARAM_READABLE));
+  g_object_class_install_property (gobject_class,
+                                   PROP_END_INDEX,
+                                   g_param_spec_int ("end-index",
+                                                     _("End index"),
+                                                     _("The end index of the AtkHyperlink object"),
+                                                     0,
+                                                     G_MAXINT,
+                                                     0,
+                                                     G_PARAM_READABLE));
+  g_object_class_install_property (gobject_class,
+                                   PROP_START_INDEX,
+                                   g_param_spec_int ("start-index",
+                                                     _("Start index"),
+                                                     _("The start index of the AtkHyperlink object"),
+                                                     0,
+                                                     G_MAXINT,
+                                                     0,
+                                                     G_PARAM_READABLE));
+
+  /**
+   * AtkHyperlink::link-activated:
+   * @atkhyperlink: the object which received the signal.
+   *
+   * The signal link-activated is emitted when a link is activated.
+   */
+  atk_hyperlink_signals[LINK_ACTIVATED] =
+    g_signal_new ("link_activated",
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (AtkHyperlinkClass, link_activated),
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__VOID,
+                  G_TYPE_NONE,
+                  0);
+
 }
 
 static void
@@ -110,7 +194,17 @@ atk_hyperlink_real_get_property (GObject    *object,
   switch (prop_id)
     {
     case PROP_SELECTED_LINK:
-      g_value_set_boolean (value, atk_hyperlink_is_selected_link (link));
+      // This property is deprecated, also the method to get the value
+      g_value_set_boolean (value, FALSE);
+      break;
+    case PROP_NUMBER_ANCHORS:
+      g_value_set_int (value,  atk_hyperlink_get_n_anchors (link));
+      break;
+    case PROP_END_INDEX:
+      g_value_set_int (value, atk_hyperlink_get_end_index (link));
+      break;
+    case PROP_START_INDEX:
+      g_value_set_int (value, atk_hyperlink_get_start_index (link));
       break;
     default:
       break;
@@ -156,7 +250,8 @@ atk_hyperlink_get_uri (AtkHyperlink *link,
  * 
  * Multiple anchors are primarily used by client-side image maps.
  *
- * Returns: an #AtkObject associated with this hyperlinks i-th anchor
+ * Returns: (transfer none): an #AtkObject associated with this hyperlinks
+ * i-th anchor
  **/
 AtkObject*
 atk_hyperlink_get_object (AtkHyperlink *link,
@@ -249,7 +344,7 @@ atk_hyperlink_is_valid (AtkHyperlink *link)
  *           content inline.  Ordinary HTML links will usually return
  *           %FALSE, but an inline &lt;src&gt; HTML element will return
  *           %TRUE.
-a *
+ *
  * Returns: whether or not this link displays its content inline.
  *
  **/
@@ -295,7 +390,13 @@ atk_hyperlink_get_n_anchors (AtkHyperlink *link)
  *
  * Determines whether this AtkHyperlink is selected
  *
- * Returns: True is the AtkHyperlink is selected, False otherwise
+ * Since: 1.4
+ *
+ * Deprecated: This method is deprecated since ATK version 1.8.
+ * Please use ATK_STATE_FOCUSABLE for all links, and ATK_STATE_FOCUSED
+ * for focused links.
+ *
+ * Returns: True if the AtkHyperlink is selected, False otherwise
  **/
 gboolean
 atk_hyperlink_is_selected_link (AtkHyperlink *link)