static AtkStateSet* gail_window_ref_state_set (AtkObject *accessible) { AtkStateSet *state_set; GtkWidget *widget; GtkWindow *window; GdkWindowState state; state_set = ATK_OBJECT_CLASS (gail_window_parent_class)->ref_state_set (accessible); widget = GTK_ACCESSIBLE (accessible)->widget; if (widget == NULL) return state_set; window = GTK_WINDOW (widget); if (window->has_focus) atk_state_set_add_state (state_set, ATK_STATE_ACTIVE); if (widget->window) { state = gdk_window_get_state (widget->window); if (state & GDK_WINDOW_STATE_ICONIFIED) atk_state_set_add_state (state_set, ATK_STATE_ICONIFIED); } if (gtk_window_get_modal (window)) atk_state_set_add_state (state_set, ATK_STATE_MODAL); if (gtk_window_get_resizable (window)) atk_state_set_add_state (state_set, ATK_STATE_RESIZABLE); return state_set; }
/** * @brief Get state set of accessible object * * @param obj object instance * * @returns referred AtkStateSet object */ static AtkStateSet * eail_naviframe_page_ref_state_set(AtkObject *obj) { EailNaviframePage *page; AtkStateSet *state_set; Evas_Object *widget; g_return_val_if_fail(EAIL_IS_NAVIFRAME_PAGE(obj), NULL); page = EAIL_NAVIFRAME_PAGE(obj); if (!page->naviframe) return NULL; widget = elm_object_part_content_get(page->naviframe, "default"); state_set = atk_state_set_new(); /* only item-page on top is visible*/ if (elm_naviframe_top_item_get(page->naviframe) == page->page) { atk_state_set_add_state(state_set, ATK_STATE_SHOWING); atk_state_set_add_state(state_set, ATK_STATE_VISIBLE); } if (!elm_object_disabled_get(widget)) atk_state_set_add_state(state_set, ATK_STATE_ENABLED); return state_set; }
/** * @brief Gets obj state set * * The caller must unreference it when it is no longer needed * * @param obj an AtkObject * @return obj state set */ static AtkStateSet * eail_multibuttonentry_ref_state_set(AtkObject *obj) { AtkStateSet *state_set; Evas_Object *widget; g_return_val_if_fail(EAIL_MULTIBUTTONENTRY(obj), NULL); widget = eail_widget_get_widget(EAIL_WIDGET(obj)); state_set = ATK_OBJECT_CLASS(eail_multibuttonentry_parent_class)->ref_state_set(obj); if (!widget) return state_set; if (elm_multibuttonentry_expanded_get(widget)) { atk_state_set_add_state(state_set, ATK_STATE_EXPANDED); if (elm_multibuttonentry_editable_get(widget)) atk_state_set_add_state(state_set, ATK_STATE_EDITABLE); } else { atk_state_set_add_state(state_set, ATK_STATE_DEFAULT); } return state_set; }
static AtkStateSet * gtk_check_menu_item_accessible_ref_state_set (AtkObject *accessible) { AtkStateSet *state_set; GtkCheckMenuItem *check_menu_item; GtkWidget *widget; widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); if (widget == NULL) return NULL; state_set = ATK_OBJECT_CLASS (gtk_check_menu_item_accessible_parent_class)->ref_state_set (accessible); check_menu_item = GTK_CHECK_MENU_ITEM (widget); if (gtk_check_menu_item_get_active (check_menu_item)) atk_state_set_add_state (state_set, ATK_STATE_CHECKED); if (gtk_check_menu_item_get_inconsistent (check_menu_item)) { atk_state_set_remove_state (state_set, ATK_STATE_ENABLED); atk_state_set_add_state (state_set, ATK_STATE_INDETERMINATE); } return state_set; }
static AtkStateSet * gtk_expander_accessible_ref_state_set (AtkObject *obj) { AtkStateSet *state_set; GtkWidget *widget; GtkExpander *expander; widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); if (widget == NULL) return NULL; state_set = ATK_OBJECT_CLASS (gtk_expander_accessible_parent_class)->ref_state_set (obj); expander = GTK_EXPANDER (widget); atk_state_set_add_state (state_set, ATK_STATE_EXPANDABLE); if (gtk_expander_get_expanded (expander)) { atk_state_set_add_state (state_set, ATK_STATE_CHECKED); atk_state_set_add_state (state_set, ATK_STATE_EXPANDED); } return state_set; }
static AtkStateSet* gail_toggle_button_ref_state_set (AtkObject *accessible) { AtkStateSet *state_set; GtkToggleButton *toggle_button; GtkWidget *widget; state_set = ATK_OBJECT_CLASS (gail_toggle_button_parent_class)->ref_state_set (accessible); widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); if (widget == NULL) return state_set; toggle_button = GTK_TOGGLE_BUTTON (widget); if (gtk_toggle_button_get_active (toggle_button)) atk_state_set_add_state (state_set, ATK_STATE_CHECKED); if (gtk_toggle_button_get_inconsistent (toggle_button)) { atk_state_set_remove_state (state_set, ATK_STATE_ENABLED); atk_state_set_add_state (state_set, ATK_STATE_INDETERMINATE); } return state_set; }
static AtkStateSet* jaw_object_ref_state_set (AtkObject *atk_obj) { JawObject *jaw_obj = JAW_OBJECT(atk_obj); AtkStateSet* state_set = jaw_obj->state_set; atk_state_set_clear_states( state_set ); jobject ac = jaw_obj->acc_context; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAccessibleContext = (*jniEnv)->FindClass( jniEnv, "javax/accessibility/AccessibleContext" ); jmethodID jmid = (*jniEnv)->GetMethodID( jniEnv, classAccessibleContext, "getAccessibleStateSet", "()Ljavax/accessibility/AccessibleStateSet;" ); jobject jstate_set = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid ); jclass classAccessibleStateSet = (*jniEnv)->FindClass( jniEnv, "javax/accessibility/AccessibleStateSet" ); jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleStateSet, "toArray", "()[Ljavax/accessibility/AccessibleState;"); jobjectArray jstate_arr = (*jniEnv)->CallObjectMethod( jniEnv, jstate_set, jmid ); jsize jarr_size = (*jniEnv)->GetArrayLength(jniEnv, jstate_arr); jsize i; for (i = 0; i < jarr_size; i++) { jobject jstate = (*jniEnv)->GetObjectArrayElement( jniEnv, jstate_arr, i ); AtkStateType state_type = jaw_util_get_atk_state_type_from_java_state( jniEnv, jstate ); atk_state_set_add_state( state_set, state_type ); if (state_type == ATK_STATE_ENABLED) { atk_state_set_add_state( state_set, ATK_STATE_SENSITIVE ); } } g_object_ref(G_OBJECT(state_set)); return state_set; }
static void gucharmap_chartable_cell_accessible_init (GucharmapChartableCellAccessible *cell) { cell->state_set = atk_state_set_new (); cell->widget = NULL; cell->index = 0; cell->action_idle_handler = 0; atk_state_set_add_state (cell->state_set, ATK_STATE_TRANSIENT); atk_state_set_add_state (cell->state_set, ATK_STATE_ENABLED); }
static AtkStateSet * etcta_ref_state_set (AtkObject *accessible) { AtkStateSet * state_set = NULL; state_set = ATK_OBJECT_CLASS (parent_class)->ref_state_set (accessible); if (state_set != NULL) { atk_state_set_add_state (state_set, ATK_STATE_SENSITIVE); atk_state_set_add_state (state_set, ATK_STATE_SHOWING); } return state_set; }
static void _gtk_icon_view_item_accessible_init (GtkIconViewItemAccessible *item) { item->state_set = atk_state_set_new (); atk_state_set_add_state (item->state_set, ATK_STATE_ENABLED); atk_state_set_add_state (item->state_set, ATK_STATE_FOCUSABLE); atk_state_set_add_state (item->state_set, ATK_STATE_SENSITIVE); atk_state_set_add_state (item->state_set, ATK_STATE_SELECTABLE); atk_state_set_add_state (item->state_set, ATK_STATE_VISIBLE); item->action_description = NULL; item->image_description = NULL; item->action_idle_handler = 0; }
gboolean gucharmap_chartable_cell_accessible_add_state (GucharmapChartableCellAccessible *cell, AtkStateType state_type, gboolean emit_signal) { if (!atk_state_set_contains_state (cell->state_set, state_type)) { gboolean rc; rc = atk_state_set_add_state (cell->state_set, state_type); /* * The signal should only be generated if the value changed, * not when the cell is set up. So states that are set * initially should pass FALSE as the emit_signal argument. */ if (emit_signal) { atk_object_notify_state_change (ATK_OBJECT (cell), state_type, TRUE); /* If state_type is ATK_STATE_VISIBLE, additional notification */ if (state_type == ATK_STATE_VISIBLE) g_signal_emit_by_name (cell, "visible_data_changed"); } return rc; } else return FALSE; }
static AtkStateSet* goo_canvas_item_accessible_ref_state_set (AtkObject *accessible) { GooCanvasItem *item; GooCanvas *canvas; AtkStateSet *state_set; GObject *object; gboolean can_focus = FALSE; g_return_val_if_fail (GOO_IS_CANVAS_ITEM_ACCESSIBLE (accessible), NULL); state_set = ATK_OBJECT_CLASS (goo_canvas_item_accessible_parent_class)->ref_state_set (accessible); object = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (accessible)); if (!object) { atk_state_set_add_state (state_set, ATK_STATE_DEFUNCT); return state_set; } item = GOO_CANVAS_ITEM (object); canvas = goo_canvas_item_get_canvas (item); if (!canvas) return state_set; if (goo_canvas_item_is_visible (item)) { atk_state_set_add_state (state_set, ATK_STATE_VISIBLE); if (goo_canvas_item_accessible_is_item_on_screen (item)) atk_state_set_add_state (state_set, ATK_STATE_SHOWING); } g_object_get (item, "can-focus", &can_focus, NULL); if (GTK_WIDGET_CAN_FOCUS (GTK_WIDGET (canvas)) && can_focus) { atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE); if (GTK_WIDGET_HAS_FOCUS (canvas) && canvas->focused_item == item) atk_state_set_add_state (state_set, ATK_STATE_FOCUSED); } return state_set; }
JNIEXPORT jboolean JNICALL ATK_NATIVE(_1atk_1state_1set_1add_1state) (JNIEnv *env, jclass that, jint arg0, jint arg1) { jboolean rc = 0; ATK_NATIVE_ENTER(env, that, _1atk_1state_1set_1add_1state_FUNC); rc = (jboolean)atk_state_set_add_state((AtkStateSet *)arg0, (AtkStateType)arg1); ATK_NATIVE_EXIT(env, that, _1atk_1state_1set_1add_1state_FUNC); return rc; }
static AtkStateSet * gtk_boolean_cell_accessible_ref_state_set (AtkObject *accessible) { GtkBooleanCellAccessible *cell = GTK_BOOLEAN_CELL_ACCESSIBLE (accessible); AtkStateSet *state_set; state_set = ATK_OBJECT_CLASS (gtk_boolean_cell_accessible_parent_class)->ref_state_set (accessible); if (cell->priv->cell_value) atk_state_set_add_state (state_set, ATK_STATE_CHECKED); if (cell->priv->cell_sensitive) atk_state_set_add_state (state_set, ATK_STATE_SENSITIVE); else atk_state_set_remove_state (state_set, ATK_STATE_SENSITIVE); return state_set; }
/* page accessible's state set is a copy ev-view accessible's state * set but removing ATK_STATE_SHOWING if the page is not on screen and * ATK_STATE_FOCUSED if it is not the relevant page. */ static AtkStateSet * ev_page_accessible_ref_state_set (AtkObject *accessible) { AtkStateSet *state_set; AtkStateSet *copy_set; AtkStateSet *view_accessible_state_set; EvPageAccessible *self; EvView *view; gint relevant_page; g_return_val_if_fail (EV_IS_PAGE_ACCESSIBLE (accessible), NULL); self = EV_PAGE_ACCESSIBLE (accessible); view = ev_page_accessible_get_view (self); state_set = ATK_OBJECT_CLASS (ev_page_accessible_parent_class)->ref_state_set (accessible); atk_state_set_clear_states (state_set); view_accessible_state_set = atk_object_ref_state_set (ATK_OBJECT (self->priv->view_accessible)); copy_set = atk_state_set_or_sets (state_set, view_accessible_state_set); if (self->priv->page >= view->start_page && self->priv->page <= view->end_page) atk_state_set_add_state (copy_set, ATK_STATE_SHOWING); else atk_state_set_remove_state (copy_set, ATK_STATE_SHOWING); relevant_page = ev_view_accessible_get_relevant_page (self->priv->view_accessible); if (atk_state_set_contains_state (view_accessible_state_set, ATK_STATE_FOCUSED) && self->priv->page == relevant_page) atk_state_set_add_state (copy_set, ATK_STATE_FOCUSED); else atk_state_set_remove_state (copy_set, ATK_STATE_FOCUSED); relevant_page = ev_view_accessible_get_relevant_page (self->priv->view_accessible); if (atk_state_set_contains_state (view_accessible_state_set, ATK_STATE_FOCUSED) && self->priv->page == relevant_page) atk_state_set_add_state (copy_set, ATK_STATE_FOCUSED); else atk_state_set_remove_state (copy_set, ATK_STATE_FOCUSED); g_object_unref (state_set); g_object_unref (view_accessible_state_set); return copy_set; }
/** * @brief Implementation of ref_state_set from AtkObject * * @param obj EailCheck instance * * @returns AtkStateSet for EailCheck instance */ static AtkStateSet* eail_check_ref_state_set(AtkObject *obj) { Evas_Object *widget = eail_widget_get_widget(EAIL_WIDGET(obj)); AtkStateSet *state_set = ATK_OBJECT_CLASS(eail_check_parent_class)->ref_state_set(obj); if (NULL == widget) { atk_state_set_add_state(state_set, ATK_STATE_DEFUNCT); return state_set; } if (elm_check_state_get(widget)) { atk_state_set_add_state(state_set, ATK_STATE_CHECKED); } return state_set; }
static void gail_text_cell_init (GailTextCell *text_cell) { text_cell->cell_text = NULL; text_cell->caret_pos = 0; text_cell->cell_length = 0; text_cell->textutil = gail_text_util_new (); atk_state_set_add_state (GAIL_CELL (text_cell)->state_set, ATK_STATE_SINGLE_LINE); }
static AtkStateSet * gtk_notebook_page_accessible_ref_state_set (AtkObject *accessible) { AtkStateSet *state_set, *label_state_set, *merged_state_set; AtkObject *atk_label; GtkWidget *label; state_set = ATK_OBJECT_CLASS (_gtk_notebook_page_accessible_parent_class)->ref_state_set (accessible); label = get_label_from_notebook_page (GTK_NOTEBOOK_PAGE_ACCESSIBLE (accessible)); if (label) { atk_label = gtk_widget_get_accessible (label); label_state_set = atk_object_ref_state_set (atk_label); merged_state_set = atk_state_set_or_sets (state_set, label_state_set); g_object_unref (label_state_set); g_object_unref (state_set); } else { AtkObject *child; child = atk_object_ref_accessible_child (accessible, 0); if (!child) return state_set; merged_state_set = state_set; state_set = atk_object_ref_state_set (child); if (atk_state_set_contains_state (state_set, ATK_STATE_VISIBLE)) { atk_state_set_add_state (merged_state_set, ATK_STATE_VISIBLE); if (atk_state_set_contains_state (state_set, ATK_STATE_ENABLED)) atk_state_set_add_state (merged_state_set, ATK_STATE_ENABLED); if (atk_state_set_contains_state (state_set, ATK_STATE_SHOWING)) atk_state_set_add_state (merged_state_set, ATK_STATE_SHOWING); } g_object_unref (state_set); g_object_unref (child); } return merged_state_set; }
static AtkStateSet * gtk_entry_accessible_ref_state_set (AtkObject *accessible) { AtkStateSet *state_set; gboolean value; GtkWidget *widget; widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); if (widget == NULL) return NULL; state_set = ATK_OBJECT_CLASS (_gtk_entry_accessible_parent_class)->ref_state_set (accessible); g_object_get (G_OBJECT (widget), "editable", &value, NULL); if (value) atk_state_set_add_state (state_set, ATK_STATE_EDITABLE); atk_state_set_add_state (state_set, ATK_STATE_SINGLE_LINE); return state_set; }
static AtkStateSet * gtk_text_cell_accessible_ref_state_set (AtkObject *accessible) { AtkStateSet *state_set; state_set = ATK_OBJECT_CLASS (_gtk_text_cell_accessible_parent_class)->ref_state_set (accessible); atk_state_set_add_state (state_set, ATK_STATE_SINGLE_LINE); return state_set; }
static AtkStateSet* nux_area_accessible_ref_state_set(AtkObject* obj) { AtkStateSet* state_set = NULL; nux::Object* nux_object = NULL; nux::Area* area = NULL; g_return_val_if_fail(NUX_IS_AREA_ACCESSIBLE(obj), NULL); state_set = ATK_OBJECT_CLASS(nux_area_accessible_parent_class)->ref_state_set(obj); nux_object = nux_object_accessible_get_object(NUX_OBJECT_ACCESSIBLE(obj)); if (nux_object == NULL) /* defunct */ return state_set; area = dynamic_cast<nux::Area*>(nux_object); if (area->IsSensitive()) { atk_state_set_add_state(state_set, ATK_STATE_SENSITIVE); atk_state_set_add_state(state_set, ATK_STATE_ENABLED); } if (area->IsVisible()) { atk_state_set_add_state(state_set, ATK_STATE_VISIBLE); if (_check_all_parents_visible(area)) atk_state_set_add_state(state_set, ATK_STATE_SHOWING); } // FIXME CanFocus is no longer part of Nux API // if (area->CanFocus()) // atk_state_set_add_state(state_set, ATK_STATE_FOCUSABLE); if (area->HasKeyFocus()) atk_state_set_add_state(state_set, ATK_STATE_FOCUSED); return state_set; }
static AtkStateSet* gail_notebook_page_ref_state_set (AtkObject *accessible) { AtkStateSet *state_set, *label_state_set, *merged_state_set; AtkObject *atk_label; g_return_val_if_fail (GAIL_NOTEBOOK_PAGE (accessible), NULL); state_set = ATK_OBJECT_CLASS (gail_notebook_page_parent_class)->ref_state_set (accessible); atk_label = _gail_notebook_page_get_tab_label (GAIL_NOTEBOOK_PAGE (accessible)); if (atk_label) { label_state_set = atk_object_ref_state_set (atk_label); merged_state_set = atk_state_set_or_sets (state_set, label_state_set); g_object_unref (label_state_set); g_object_unref (state_set); } else { AtkObject *child; child = atk_object_ref_accessible_child (accessible, 0); gail_return_val_if_fail (child, state_set); merged_state_set = state_set; state_set = atk_object_ref_state_set (child); if (atk_state_set_contains_state (state_set, ATK_STATE_VISIBLE)) { atk_state_set_add_state (merged_state_set, ATK_STATE_VISIBLE); if (atk_state_set_contains_state (state_set, ATK_STATE_ENABLED)) atk_state_set_add_state (merged_state_set, ATK_STATE_ENABLED); if (atk_state_set_contains_state (state_set, ATK_STATE_SHOWING)) atk_state_set_add_state (merged_state_set, ATK_STATE_SHOWING); } g_object_unref (state_set); g_object_unref (child); } return merged_state_set; }
static gboolean my_atk_selection_add_selection (AtkSelection *selection, gint i) { MyAtkSelection *self = MY_ATK_SELECTION(selection); if (!self) return FALSE; AtkObject *child = atk_object_ref_accessible_child (ATK_OBJECT (selection), i); AtkStateSet *ss = atk_object_ref_state_set (child); atk_state_set_add_state (ss, ATK_STATE_SELECTED); return atk_state_set_contains_state (ss, ATK_STATE_SELECTED); }
static void acc_unref(gpointer data) { AtkStateSet * ss; g_object_set_data(G_OBJECT(data), HTML_ID, NULL); ss = atk_object_ref_state_set (data); atk_state_set_add_state (ss, ATK_STATE_DEFUNCT); atk_object_notify_state_change (data, ATK_STATE_DEFUNCT, TRUE); g_object_unref(G_OBJECT(data)); }
/** * @brief Implementation of AtkObject->ref_state_set callback * * ATK doc says:\n * Gets a reference to the state set of the accessible; the caller must * unreference it when it is no longer needed. * * @param obj an AtkObject * * @returns a reference to an AtkStateSet which is the state set of the * accessible. */ static AtkStateSet * eail_entry_ref_state_set(AtkObject *obj) { AtkStateSet *state_set; Evas_Object *widget = eail_widget_get_widget(EAIL_WIDGET(obj)); if (!widget) return NULL; state_set = ATK_OBJECT_CLASS(eail_entry_parent_class)->ref_state_set(obj); if (elm_entry_editable_get(widget)) atk_state_set_add_state(state_set, ATK_STATE_EDITABLE); if (elm_entry_single_line_get(widget)) atk_state_set_add_state(state_set, ATK_STATE_SINGLE_LINE); else atk_state_set_add_state(state_set, ATK_STATE_MULTI_LINE); return state_set; }
static AtkStateSet* gtk_list_box_row_accessible_ref_state_set (AtkObject *obj) { AtkStateSet *state_set; GtkWidget *widget, *parent; state_set = ATK_OBJECT_CLASS (gtk_list_box_row_accessible_parent_class)->ref_state_set (obj); widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); if (widget != NULL) { parent = gtk_widget_get_parent (widget); if (parent != NULL && gtk_list_box_get_selection_mode (GTK_LIST_BOX (parent)) != GTK_SELECTION_NONE) atk_state_set_add_state (state_set, ATK_STATE_SELECTABLE); if (gtk_list_box_row_is_selected (GTK_LIST_BOX_ROW (widget))) atk_state_set_add_state (state_set, ATK_STATE_SELECTED); } return state_set; }
/** * @brief Gets obj state set * * @param obj an AtkObject * @return obj state set */ static AtkStateSet* eail_thumb_ref_state_set(AtkObject *obj) { AtkStateSet *state_set; g_return_val_if_fail(EAIL_IS_THUMB(obj), NULL); state_set = ATK_OBJECT_CLASS(eail_thumb_parent_class)->ref_state_set(obj); if (!state_set) atk_state_set_add_state(state_set, ATK_STATE_ANIMATED); return state_set; }
/** * @brief Implementation of ref_state_set from AtkObject * * @param obj EailGengrid instance * * @returns reference to an state set of accessible */ static AtkStateSet * eail_gengrid_ref_state_set(AtkObject *obj) { Evas_Object *widget = eail_widget_get_widget(EAIL_WIDGET(obj)); AtkStateSet *state_set = ATK_OBJECT_CLASS(eail_gengrid_parent_class)->ref_state_set(obj); if (!widget) return state_set; if (elm_gengrid_multi_select_get(widget)) atk_state_set_add_state(state_set, ATK_STATE_MULTISELECTABLE); return state_set; }
/** * Wrapper for atk_state_set_add_state(). */ static PyObject* _atkstateset_add_state (PyAtkStateSet *self, PyObject *args) { AtkStateType val; debug ("_atkstateset_add_state\n"); if (!PyArg_ParseTuple (args, "i:add_state", &val)) return NULL; if (atk_state_set_add_state (ATKSTATESET (self), val)) Py_RETURN_TRUE; Py_RETURN_FALSE; }
static AtkStateSet* egg_list_box_accessible_ref_state_set (AtkObject *obj) { AtkStateSet *state_set; GtkWidget *widget; state_set = ATK_OBJECT_CLASS (egg_list_box_accessible_parent_class)->ref_state_set (obj); widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); if (widget != NULL) atk_state_set_add_state (state_set, ATK_STATE_MANAGES_DESCENDANTS); return state_set; }