role: new role ATK_ROLE_TITLE_BAR
[platform/upstream/atk.git] / atk / atkselection.c
index 1ca3b39..c324a4a 100755 (executable)
 
 #include "atkselection.h"
 
+/**
+ * SECTION:atkselection
+ * @Short_description: The ATK interface implemented by container
+ *  objects whose #AtkObject children can be selected.
+ * @Title:AtkSelection
+ *
+ * #AtkSelection should be implemented by UI components with children
+ * which are exposed by #atk_object_ref_child and
+ * #atk_object_get_n_children, if the use of the parent UI component
+ * ordinarily involves selection of one or more of the objects
+ * corresponding to those #AtkObject children - for example,
+ * selectable lists.
+ *
+ * Note that other types of "selection" (for instance text selection)
+ * are accomplished a other ATK interfaces - #AtkSelection is limited
+ * to the selection/deselection of children.
+ */
+
+
+enum {
+  SELECTION_CHANGED,
+  LAST_SIGNAL
+};
+
+static void atk_selection_base_init (gpointer *g_class);
+
+static guint atk_selection_signals[LAST_SIGNAL] = { 0 };
+
 GType
-atk_selection_get_type ()
+atk_selection_get_type (void)
 {
   static GType type = 0;
 
@@ -28,7 +56,7 @@ atk_selection_get_type ()
     GTypeInfo tinfo =
     {
       sizeof (AtkSelectionIface),
-      (GBaseInitFunc) NULL,
+      (GBaseInitFunc)atk_selection_base_init,
       (GBaseFinalizeFunc) NULL,
 
     };
@@ -39,6 +67,34 @@ atk_selection_get_type ()
   return type;
 }
 
+static void
+atk_selection_base_init (gpointer *g_class)
+{
+  static gboolean initialized = FALSE;
+
+  if (! initialized)
+    {
+      /**
+       * AtkSelection::selection-changed:
+       * @atkselection: the object which received the signal.
+       *
+       * The "selection-changed" signal is emitted by an object which
+       * implements AtkSelection interface when the selection changes.
+       */
+      atk_selection_signals[SELECTION_CHANGED] =
+        g_signal_new ("selection_changed",
+                      ATK_TYPE_SELECTION,
+                      G_SIGNAL_RUN_LAST,
+                      G_STRUCT_OFFSET (AtkSelectionIface, selection_changed),
+                      (GSignalAccumulator) NULL, NULL,
+                      g_cclosure_marshal_VOID__VOID,
+                      G_TYPE_NONE, 0);
+
+
+      initialized = TRUE;
+    }
+}
+
 /**
  * atk_selection_add_selection:
  * @selection: a #GObject instance that implements AtkSelectionIface
@@ -55,7 +111,6 @@ atk_selection_add_selection (AtkSelection *obj,
 {
   AtkSelectionIface *iface;
 
-  g_return_val_if_fail (obj != NULL, FALSE);
   g_return_val_if_fail (ATK_IS_SELECTION (obj), FALSE);
 
   iface = ATK_SELECTION_GET_IFACE (obj);
@@ -80,7 +135,6 @@ atk_selection_clear_selection (AtkSelection *obj)
 {
   AtkSelectionIface *iface;
 
-  g_return_val_if_fail (obj != NULL, FALSE);
   g_return_val_if_fail (ATK_IS_SELECTION (obj), FALSE);
 
   iface = ATK_SELECTION_GET_IFACE (obj);
@@ -104,8 +158,8 @@ atk_selection_clear_selection (AtkSelection *obj)
  * use type checking/interface checking macros or the
  * atk_get_accessible_value() convenience method.
  *
- * Returns: an #AtkObject representing the selected accessible , or %NULL
- * if @selection does not implement this interface.
+ * Returns: (transfer full): an #AtkObject representing the selected
+ * accessible , or %NULL if @selection does not implement this interface.
  **/
 AtkObject*
 atk_selection_ref_selection (AtkSelection *obj,
@@ -113,7 +167,6 @@ atk_selection_ref_selection (AtkSelection *obj,
 {
   AtkSelectionIface *iface;
 
-  g_return_val_if_fail (obj != NULL, NULL);
   g_return_val_if_fail (ATK_IS_SELECTION (obj), NULL);
 
   iface = ATK_SELECTION_GET_IFACE (obj);
@@ -142,7 +195,6 @@ atk_selection_get_selection_count (AtkSelection *obj)
 {
   AtkSelectionIface *iface;
 
-  g_return_val_if_fail (obj != NULL, 0);
   g_return_val_if_fail (ATK_IS_SELECTION (obj), 0);
 
   iface = ATK_SELECTION_GET_IFACE (obj);
@@ -173,7 +225,6 @@ atk_selection_is_child_selected (AtkSelection *obj,
 {
   AtkSelectionIface *iface;
 
-  g_return_val_if_fail (obj != NULL, FALSE);
   g_return_val_if_fail (ATK_IS_SELECTION (obj), FALSE);
 
   iface = ATK_SELECTION_GET_IFACE (obj);
@@ -200,7 +251,6 @@ atk_selection_remove_selection (AtkSelection *obj,
 {
   AtkSelectionIface *iface;
 
-  g_return_val_if_fail (obj != NULL, FALSE);
   g_return_val_if_fail (ATK_IS_SELECTION (obj), FALSE);
 
   iface = ATK_SELECTION_GET_IFACE (obj);
@@ -225,7 +275,6 @@ atk_selection_select_all_selection (AtkSelection *obj)
 {
   AtkSelectionIface *iface;
 
-  g_return_val_if_fail (obj != NULL, FALSE);
   g_return_val_if_fail (ATK_IS_SELECTION (obj), FALSE);
 
   iface = ATK_SELECTION_GET_IFACE (obj);