static gint _test_paned (gpointer data) { AtkObject *obj = ATK_OBJECT (data); AtkRole role = atk_object_get_role (obj); GtkWidget *widget; static gint times = 0; widget = GTK_ACCESSIBLE (obj)->widget; if (role == ATK_ROLE_SPLIT_PANE) { GValue *value, val; int position; value = &val; memset (value, 0, sizeof (GValue)); atk_value_get_current_value (ATK_VALUE (obj), value); g_return_val_if_fail (G_VALUE_HOLDS_INT (value), FALSE); position = g_value_get_int (value); g_print ("Position is : %d\n", position); last_position = position; position *= 2; g_value_set_int (value, position); atk_value_set_current_value (ATK_VALUE (obj), value); times++; } if (times < 4) return TRUE; else return FALSE; }
double AccessibilityUIElement::intValue() const { if (!ATK_IS_OBJECT(m_element.get())) return 0; if (ATK_IS_VALUE(m_element.get())) { GValue value = G_VALUE_INIT; atk_value_get_current_value(ATK_VALUE(m_element.get()), &value); if (!G_VALUE_HOLDS_FLOAT(&value)) return 0; return g_value_get_float(&value); } // Consider headings as an special case when returning the "int value" of // an AccessibilityUIElement, so we can reuse some tests to check the level // both for HTML headings and objects with the aria-level attribute. if (atk_object_get_role(ATK_OBJECT(m_element.get())) == ATK_ROLE_HEADING) { String headingLevel = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, "level"); bool ok; double headingLevelValue = headingLevel.toDouble(&ok); if (ok) return headingLevelValue; } return 0; }
static void _property_change_handler (AtkObject *obj, AtkPropertyValues *values) { G_CONST_RETURN gchar *type_name = g_type_name (G_TYPE_FROM_INSTANCE (obj)); G_CONST_RETURN gchar *name = atk_object_get_name (obj); g_print ("_property_change_handler: Accessible Type: %s\n", type_name ? type_name : "NULL"); g_print ("_property_change_handler: Accessible name: %s\n", name ? name : "NULL"); g_print ("_property_change_handler: PropertyName: %s\n", values->property_name ? values->property_name: "NULL"); if (strcmp (values->property_name, "accessible-value") == 0) { GValue *value, val; int position; value = &val; memset (value, 0, sizeof (GValue)); atk_value_get_current_value (ATK_VALUE (obj), value); g_return_if_fail (G_VALUE_HOLDS_INT (value)); position = g_value_get_int (value); g_print ("Position is %d previous position was %d\n", position, last_position); last_position = position; atk_value_get_minimum_value (ATK_VALUE (obj), value); g_return_if_fail (G_VALUE_HOLDS_INT (value)); position = g_value_get_int (value); g_print ("Minimum Value is %d\n", position); atk_value_get_maximum_value (ATK_VALUE (obj), value); g_return_if_fail (G_VALUE_HOLDS_INT (value)); position = g_value_get_int (value); g_print ("Maximum Value is %d\n", position); } }
static VALUE rg_current(VALUE self) { GValue gval = G_VALUE_INIT; atk_value_get_current_value(_SELF(self), &gval); return GVAL2RVAL(&gval); }
double AccessibilityUIElement::intValue() const { GValue value = { 0, { { 0 } } }; if (!ATK_IS_VALUE(m_element)) return 0.0f; atk_value_get_current_value(ATK_VALUE(m_element), &value); if (!G_VALUE_HOLDS_FLOAT(&value)) return 0.0f; return g_value_get_float(&value); }
double AccessibilityUIElement::intValue() const { if (!m_element || !ATK_IS_OBJECT(m_element.get())) return 0.0f; GValue value = G_VALUE_INIT; atk_value_get_current_value(ATK_VALUE(m_element.get()), &value); if (!G_VALUE_HOLDS_FLOAT(&value)) return 0.0f; return g_value_get_float(&value); }
void AXObjectCache::postPlatformNotification(AccessibilityObject* coreObject, AXNotification notification) { AtkObject* axObject = coreObject->wrapper(); if (!axObject) return; switch (notification) { case AXCheckedStateChanged: if (!coreObject->isCheckboxOrRadio() && !coreObject->isSwitch()) return; atk_object_notify_state_change(axObject, ATK_STATE_CHECKED, coreObject->isChecked()); break; case AXSelectedChildrenChanged: case AXMenuListValueChanged: // Accessible focus claims should not be made if the associated widget is not focused. if (notification == AXMenuListValueChanged && coreObject->isMenuList() && coreObject->isFocused()) { g_signal_emit_by_name(axObject, "focus-event", true); atk_object_notify_state_change(axObject, ATK_STATE_FOCUSED, true); } notifyChildrenSelectionChange(coreObject); break; case AXValueChanged: if (ATK_IS_VALUE(axObject)) { AtkPropertyValues propertyValues; propertyValues.property_name = "accessible-value"; memset(&propertyValues.new_value, 0, sizeof(GValue)); #if ATK_CHECK_VERSION(2,11,92) double value; atk_value_get_value_and_text(ATK_VALUE(axObject), &value, nullptr); g_value_set_double(g_value_init(&propertyValues.new_value, G_TYPE_DOUBLE), value); #else atk_value_get_current_value(ATK_VALUE(axObject), &propertyValues.new_value); #endif g_signal_emit_by_name(ATK_OBJECT(axObject), "property-change::accessible-value", &propertyValues, NULL); } break; case AXInvalidStatusChanged: atk_object_notify_state_change(axObject, ATK_STATE_INVALID_ENTRY, coreObject->invalidStatus() != "false"); break; default: break; } }
double AccessibilityUIElement::intValue() const { GValue value = { 0, { { 0 } } }; if (!ATK_IS_VALUE(m_element)) return 0.0f; atk_value_get_current_value(ATK_VALUE(m_element), &value); if (G_VALUE_HOLDS_DOUBLE(&value)) return g_value_get_double(&value); else if (G_VALUE_HOLDS_INT(&value)) return static_cast<double>(g_value_get_int(&value)); else return 0.0f; }
static void gail_spin_button_get_current_value (AtkValue *obj, GValue *value) { GailSpinButton *spin_button; g_return_if_fail (GAIL_IS_SPIN_BUTTON (obj)); spin_button = GAIL_SPIN_BUTTON (obj); if (spin_button->adjustment == NULL) /* * Adjustment has not been specified */ return; atk_value_get_current_value (ATK_VALUE (spin_button->adjustment), value); }
static void _value_change_handler (AtkObject *obj, AtkPropertyValues *values) { const gchar *type_name = g_type_name (G_TYPE_FROM_INSTANCE (obj)); GValue *value_back, val; value_back = &val; if (!ATK_IS_VALUE (obj)) { return; } if (strcmp (values->property_name, "accessible-value") == 0) { g_print ("_value_change_handler: Accessible Type: %s\n", type_name ? type_name : "NULL"); if(G_VALUE_HOLDS_DOUBLE (&values->new_value)) { g_print( "adjustment value changed : new value: %f\n", g_value_get_double (&values->new_value)); } g_print("Now calling the AtkValue interface functions\n"); atk_value_get_current_value (ATK_VALUE(obj), value_back); g_return_if_fail (G_VALUE_HOLDS_DOUBLE (value_back)); g_print ("atk_value_get_current_value returns %f\n", g_value_get_double (value_back) ); atk_value_get_maximum_value (ATK_VALUE (obj), value_back); g_return_if_fail (G_VALUE_HOLDS_DOUBLE (value_back)); g_print ("atk_value_get_maximum returns %f\n", g_value_get_double (value_back)); atk_value_get_minimum_value (ATK_VALUE (obj), value_back); g_return_if_fail (G_VALUE_HOLDS_DOUBLE (value_back)); g_print ("atk_value_get_minimum returns %f\n", g_value_get_double (value_back)); } }
static void _set_values (AtkObject *obj) { GValue *value_back, val; static gint count = 0; gdouble double_value; value_back = &val; if(ATK_IS_VALUE(obj)) { /* Spin button also inherits the text interfaces from GailEntry. * Check when spin button recieves focus. */ if(ATK_IS_TEXT(obj) && ATK_IS_EDITABLE_TEXT(obj)) { if(count == 0) { gint x; gchar* text; count++; x = atk_text_get_character_count (ATK_TEXT (obj)); text = atk_text_get_text (ATK_TEXT (obj), 0, x); g_print("Text : %s\n", text); text = "5.7"; atk_editable_text_set_text_contents(ATK_EDITABLE_TEXT(obj),text); g_print("Set text to %s\n",text); atk_value_get_current_value(ATK_VALUE(obj), value_back); g_return_if_fail (G_VALUE_HOLDS_DOUBLE (value_back)); g_print("atk_value_get_current_value returns %f\n", g_value_get_double( value_back)); } } else { memset (value_back, 0, sizeof (GValue)); g_value_init (value_back, G_TYPE_DOUBLE); g_value_set_double (value_back, 10.0); if (atk_value_set_current_value (ATK_VALUE (obj), value_back)) { double_value = g_value_get_double (value_back); g_print("atk_value_set_current_value returns %f\n", double_value); } } } }
void AXObjectCache::postPlatformNotification(AccessibilityObject* coreObject, AXNotification notification) { AtkObject* axObject = coreObject->wrapper(); if (!axObject) return; switch (notification) { case AXCheckedStateChanged: if (!coreObject->isCheckboxOrRadio()) return; atk_object_notify_state_change(axObject, ATK_STATE_CHECKED, coreObject->isChecked()); break; case AXSelectedChildrenChanged: case AXMenuListValueChanged: if (notification == AXMenuListValueChanged && coreObject->isMenuList()) { g_signal_emit_by_name(axObject, "focus-event", true); atk_object_notify_state_change(axObject, ATK_STATE_FOCUSED, true); } notifyChildrenSelectionChange(coreObject); break; case AXValueChanged: if (ATK_IS_VALUE(axObject)) { AtkPropertyValues propertyValues; propertyValues.property_name = "accessible-value"; memset(&propertyValues.new_value, 0, sizeof(GValue)); atk_value_get_current_value(ATK_VALUE(axObject), &propertyValues.new_value); g_signal_emit_by_name(ATK_OBJECT(axObject), "property-change::accessible-value", &propertyValues, NULL); } break; case AXInvalidStatusChanged: atk_object_notify_state_change(axObject, ATK_STATE_INVALID_ENTRY, coreObject->invalidStatus() != "false"); break; default: break; } }
static void alterCurrentValue(PlatformUIElement element, int factor) { if (!element || !ATK_IS_VALUE(element.get())) return; GValue currentValue = G_VALUE_INIT; atk_value_get_current_value(ATK_VALUE(element.get()), ¤tValue); GValue increment = G_VALUE_INIT; atk_value_get_minimum_increment(ATK_VALUE(element.get()), &increment); GValue newValue = G_VALUE_INIT; g_value_init(&newValue, G_TYPE_DOUBLE); g_value_set_float(&newValue, g_value_get_float(¤tValue) + factor * g_value_get_float(&increment)); atk_value_set_current_value(ATK_VALUE(element.get()), &newValue); g_value_unset(&newValue); g_value_unset(&increment); g_value_unset(¤tValue); }
static void _do_test(AtkObject *obj) { int child_count = 0; child_count = atk_object_get_n_accessible_children(obj); g_assert(child_count == 2); _printf("n_accessible_children - done\n"); AtkStateSet *state_set = atk_object_ref_state_set(obj); gboolean v_contains = atk_state_set_contains_state(state_set, ATK_STATE_VERTICAL); gboolean h_contains = atk_state_set_contains_state(state_set, ATK_STATE_HORIZONTAL); g_object_unref(state_set); g_assert(v_contains || h_contains); _printf("ref_state_set - done\n"); /*AtkValue iface tests*/ g_assert(ATK_IS_VALUE(obj)); GValue value = G_VALUE_INIT; double d_value; atk_value_get_maximum_value(ATK_VALUE(obj), &value); d_value = g_value_get_double(&value); g_assert(d_value == 1.0); atk_value_get_minimum_value(ATK_VALUE(obj), &value); d_value = g_value_get_double(&value); g_assert(d_value == 0.0); g_value_set_double(&value, 0.3); gboolean success = atk_value_set_current_value(ATK_VALUE(obj), &value); g_assert(success); atk_value_get_current_value(ATK_VALUE(obj), &value); g_assert(G_VALUE_HOLDS_DOUBLE(&value)); d_value = g_value_get_double(&value); g_assert(d_value == 0.3); _printf("atk_value - done\n"); eailu_test_atk_focus(obj, TRUE); }
void AXObjectCache::postPlatformNotification(AccessibilityObject* coreObject, AXNotification notification) { AtkObject* axObject = coreObject->wrapper(); if (!axObject) return; switch (notification) { case AXCheckedStateChanged: if (!coreObject->isCheckboxOrRadio() && !coreObject->isSwitch()) return; atk_object_notify_state_change(axObject, ATK_STATE_CHECKED, coreObject->isChecked()); break; case AXSelectedChildrenChanged: case AXMenuListValueChanged: // Accessible focus claims should not be made if the associated widget is not focused. if (notification == AXMenuListValueChanged && coreObject->isMenuList() && coreObject->isFocused()) { g_signal_emit_by_name(axObject, "focus-event", true); atk_object_notify_state_change(axObject, ATK_STATE_FOCUSED, true); } notifyChildrenSelectionChange(coreObject); break; case AXValueChanged: if (ATK_IS_VALUE(axObject)) { AtkPropertyValues propertyValues; propertyValues.property_name = "accessible-value"; memset(&propertyValues.new_value, 0, sizeof(GValue)); #if ATK_CHECK_VERSION(2,11,92) double value; atk_value_get_value_and_text(ATK_VALUE(axObject), &value, nullptr); g_value_set_double(g_value_init(&propertyValues.new_value, G_TYPE_DOUBLE), value); #else atk_value_get_current_value(ATK_VALUE(axObject), &propertyValues.new_value); #endif g_signal_emit_by_name(ATK_OBJECT(axObject), "property-change::accessible-value", &propertyValues, NULL); } break; case AXInvalidStatusChanged: atk_object_notify_state_change(axObject, ATK_STATE_INVALID_ENTRY, coreObject->invalidStatus() != "false"); break; case AXElementBusyChanged: atk_object_notify_state_change(axObject, ATK_STATE_BUSY, coreObject->isBusy()); break; case AXCurrentChanged: atk_object_notify_state_change(axObject, ATK_STATE_ACTIVE, coreObject->currentState() != AccessibilityCurrentState::False); break; case AXRowExpanded: atk_object_notify_state_change(axObject, ATK_STATE_EXPANDED, true); break; case AXRowCollapsed: atk_object_notify_state_change(axObject, ATK_STATE_EXPANDED, false); break; case AXExpandedChanged: atk_object_notify_state_change(axObject, ATK_STATE_EXPANDED, coreObject->isExpanded()); break; case AXDisabledStateChanged: { bool enabledState = coreObject->isEnabled(); atk_object_notify_state_change(axObject, ATK_STATE_ENABLED, enabledState); atk_object_notify_state_change(axObject, ATK_STATE_SENSITIVE, enabledState); break; } case AXPressedStateChanged: atk_object_notify_state_change(axObject, ATK_STATE_PRESSED, coreObject->isPressed()); break; case AXReadOnlyStatusChanged: #if ATK_CHECK_VERSION(2,15,3) atk_object_notify_state_change(axObject, ATK_STATE_READ_ONLY, !coreObject->canSetValueAttribute()); #endif break; case AXRequiredStatusChanged: atk_object_notify_state_change(axObject, ATK_STATE_REQUIRED, coreObject->isRequired()); break; case AXActiveDescendantChanged: if (AccessibilityObject* descendant = coreObject->activeDescendant()) platformHandleFocusedUIElementChanged(nullptr, descendant->node()); break; default: break; } }