get_highlight_index callback added to the AtkComponentInterface
[platform/upstream/atk.git] / atk / atkstateset.c
index eba179a..1497bed 100755 (executable)
 #include "atkobject.h"
 #include "atkstateset.h"
 
-#define ATK_STATE(state_enum)             ((AtkState)(1 << ((guint64)(state_enum)%64)))
+/**
+ * SECTION:atkstateset
+ * @Short_description: An AtkStateSet determines a component's state set.
+ * @Title:AtkStateSet
+ *
+ * An AtkStateSet determines a component's state set. It is composed
+ * of a set of AtkStates.
+ */
+
+#define ATK_STATE(state_enum)             ((AtkState)((guint64)1 << ((state_enum)%64)))
 
 struct _AtkRealStateSet
 {
@@ -94,9 +103,9 @@ atk_state_set_is_empty (AtkStateSet   *set)
   real_set = (AtkRealStateSet *)set;
 
   if (real_set->state)
-    return TRUE;
-  else
     return FALSE;
+  else
+    return TRUE;
 }
 
 /**
@@ -129,7 +138,7 @@ atk_state_set_add_state (AtkStateSet   *set,
 /**
  * atk_state_set_add_states:
  * @set: an #AtkStateSet
- * @types: an array of #AtkStateType
+ * @types: (array length=n_types): an array of #AtkStateType
  * @n_types: The number of elements in the array
  *
  * Add the states for the specified types to the current state set.
@@ -195,7 +204,7 @@ atk_state_set_contains_state (AtkStateSet   *set,
 /**
  * atk_state_set_contains_states:
  * @set: an #AtkStateSet
- * @types: an array of #AtkStateType
+ * @types: (array length=n_types): an array of #AtkStateType
  * @n_types: The number of elements in the array
  *
  * Checks whether the states for all the specified types are in the 
@@ -257,7 +266,8 @@ atk_state_set_remove_state (AtkStateSet  *set,
  * Constructs the intersection of the two sets, returning %NULL if the
  * intersection is empty.
  *
- * Returns: a new #AtkStateSet which is the intersection of the two sets.
+ * Returns: (transfer full): a new #AtkStateSet which is the intersection of
+ * the two sets.
  **/
 AtkStateSet*
 atk_state_set_and_sets (AtkStateSet  *set,
@@ -267,8 +277,8 @@ atk_state_set_and_sets (AtkStateSet  *set,
   AtkStateSet *return_set = NULL;
   AtkState state;
 
-  g_return_val_if_fail (ATK_IS_STATE_SET (set), FALSE);
-  g_return_val_if_fail (ATK_IS_STATE_SET (compare_set), FALSE);
+  g_return_val_if_fail (ATK_IS_STATE_SET (set), NULL);
+  g_return_val_if_fail (ATK_IS_STATE_SET (compare_set), NULL);
 
   real_set = (AtkRealStateSet *)set;
   real_compare_set = (AtkRealStateSet *)compare_set;
@@ -289,8 +299,8 @@ atk_state_set_and_sets (AtkStateSet  *set,
  *
  * Constructs the union of the two sets.
  *
- * Returns: a new #AtkStateSet which is the union of the two sets,
- * returning %NULL is empty.
+ * Returns: (transfer full): a new #AtkStateSet which is the union of the two
+ * sets, returning %NULL is empty.
  **/
 AtkStateSet*
 atk_state_set_or_sets (AtkStateSet  *set,
@@ -300,16 +310,19 @@ atk_state_set_or_sets (AtkStateSet  *set,
   AtkStateSet *return_set = NULL;
   AtkState state;
 
-  g_return_val_if_fail (ATK_IS_STATE_SET (set), FALSE);
-  g_return_val_if_fail (ATK_IS_STATE_SET (compare_set), FALSE);
+  g_return_val_if_fail (ATK_IS_STATE_SET (set), NULL);
+  g_return_val_if_fail (ATK_IS_STATE_SET (compare_set), NULL);
 
   real_set = (AtkRealStateSet *)set;
   real_compare_set = (AtkRealStateSet *)compare_set;
 
   state = real_set->state | real_compare_set->state;
 
-  return_set = atk_state_set_new();
-  ((AtkRealStateSet *) return_set)->state = state;
+  if (state)
+  {
+    return_set = atk_state_set_new();
+    ((AtkRealStateSet *) return_set)->state = state;
+  }
 
   return return_set;
 }
@@ -323,8 +336,8 @@ atk_state_set_or_sets (AtkStateSet  *set,
  * The set returned by this operation contains the states in exactly
  * one of the two sets.
  *
- * Returns: a new #AtkStateSet which contains the states which are 
- * in exactly one of the two sets.
+ * Returns: (transfer full): a new #AtkStateSet which contains the states
+ * which are in exactly one of the two sets.
  **/
 AtkStateSet*
 atk_state_set_xor_sets (AtkStateSet  *set,
@@ -334,8 +347,8 @@ atk_state_set_xor_sets (AtkStateSet  *set,
   AtkStateSet *return_set = NULL;
   AtkState state, state1, state2;
 
-  g_return_val_if_fail (ATK_IS_STATE_SET (set), FALSE);
-  g_return_val_if_fail (ATK_IS_STATE_SET (compare_set), FALSE);
+  g_return_val_if_fail (ATK_IS_STATE_SET (set), NULL);
+  g_return_val_if_fail (ATK_IS_STATE_SET (compare_set), NULL);
 
   real_set = (AtkRealStateSet *)set;
   real_compare_set = (AtkRealStateSet *)compare_set;