Atk.Value

g Atk.Value Atk.Value GObject.GInterface GObject.GInterface GObject.GInterface->Atk.Value

Implementations:

Atk.NoOpObject

Methods

get_current_value ()

get_increment ()

get_maximum_value ()

get_minimum_increment ()

get_minimum_value ()

get_range ()

get_sub_ranges ()

get_value_and_text ()

set_current_value (value)

set_value (new_value)

Virtual Methods

do_get_current_value ()

do_get_increment ()

do_get_maximum_value ()

do_get_minimum_increment ()

do_get_minimum_value ()

do_get_range ()

do_get_sub_ranges ()

do_get_value_and_text ()

do_set_current_value (value)

do_set_value (new_value)

Properties

None

Signals

Name

Short Description

value-changed

The ‘value-changed’ signal is emitted when the current value that represent the object changes.

Fields

None

Class Details

class Atk.Value
Bases:

GObject.GInterface

Structure:

Atk.ValueIface

The ATK interface implemented by valuators and components which display or select a value from a bounded range of values.

Atk.Value should be implemented for components which either display a value from a bounded range, or which allow the user to specify a value from a bounded range, or both. For instance, most sliders and range controls, as well as dials, should have Atk.Object representations which implement Atk.Value on the component’s behalf. #AtKValues may be read-only, in which case attempts to alter the value return would fail.

On the subject of current value text

In addition to providing the current value, implementors can optionally provide an end-user-consumable textual description associated with this value. This description should be included when the numeric value fails to convey the full, on-screen representation seen by users.

Password strength

A password strength meter whose value changes as the user types their new password. Red is used for values less than 4.0, yellow for values between 4.0 and 7.0, and green for values greater than 7.0. In this instance, value text should be provided by the implementor. Appropriate value text would be “weak”, “acceptable,” and “strong” respectively.

A level bar whose value changes to reflect the battery charge. The color remains the same regardless of the charge and there is no on-screen text reflecting the fullness of the battery. In this case, because the position within the bar is the only indication the user has of the current charge, value text should not be provided by the implementor.

Implementor Notes

Implementors should bear in mind that assistive technologies will likely prefer the value text provided over the numeric value when presenting a widget’s value. As a result, strings not intended for end users should not be exposed in the value text, and strings which are exposed should be localized. In the case of widgets which display value text on screen, for instance through a separate label in close proximity to the value-displaying widget, it is still expected that implementors will expose the value text using the above API.

Atk.Value should NOT be implemented for widgets whose displayed value is not reflective of a meaningful amount. For instance, a progress pulse indicator whose value alternates between 0.0 and 1.0 to indicate that some process is still taking place should not implement Atk.Value because the current value does not reflect progress towards completion.

On the subject of ranges

In addition to providing the minimum and maximum values, implementors can optionally provide details about subranges associated with the widget. These details should be provided by the implementor when both of the following are communicated visually to the end user:

  • The existence of distinct ranges such as “weak”, “acceptable”, and “strong” indicated by color, bar tick marks, and/or on-screen text.

  • Where the current value stands within a given subrange, for instance illustrating progression from very “weak” towards nearly “acceptable” through changes in shade and/or position on the bar within the “weak” subrange.

If both of the above do not apply to the widget, it should be sufficient to expose the numeric value, along with the value text if appropriate, to make the widget accessible.

Implementor Notes

If providing subrange details is deemed necessary, all possible values of the widget are expected to fall within one of the subranges defined by the implementor.

On the subject of localization of end-user-consumable text values

Because value text and subrange descriptors are human-consumable, implementors are expected to provide localized strings which can be directly presented to end users via their assistive technology. In order to simplify this for implementors, implementors can use Atk.ValueType.get_localized_name() with the following already-localized constants for commonly-needed values can be used:

Proposals for additional constants, along with their use cases, should be submitted to the GNOME Accessibility Team.

On the subject of changes

Note that if there is a textual description associated with the new numeric value, that description should be included regardless of whether or not it has also changed.

get_current_value()[source]
Returns:

a GObject.Value representing the current accessible value

Return type:

value: GObject.Value

Gets the value of this object.

Deprecated since version 2.12: Use Atk.Value.get_value_and_text() instead.

get_increment()[source]
Returns:

the minimum increment by which the value of this object may be changed. zero if undefined.

Return type:

float

Gets the minimum increment by which the value of this object may be changed. If zero, the minimum increment is undefined, which may mean that it is limited only by the floating point precision of the platform.

New in version 2.12.

get_maximum_value()[source]
Returns:

a GObject.Value representing the maximum accessible value

Return type:

value: GObject.Value

Gets the maximum value of this object.

Deprecated since version 2.12: Use Atk.Value.get_range() instead.

get_minimum_increment()[source]
Returns:

a GObject.Value representing the minimum increment by which the accessible value may be changed

Return type:

value: GObject.Value

Gets the minimum increment by which the value of this object may be changed. If zero, the minimum increment is undefined, which may mean that it is limited only by the floating point precision of the platform.

New in version 1.12.

Deprecated since version 2.12: Use Atk.Value.get_increment() instead.

get_minimum_value()[source]
Returns:

a GObject.Value representing the minimum accessible value

Return type:

value: GObject.Value

Gets the minimum value of this object.

Deprecated since version 2.12: Use Atk.Value.get_range() instead.

get_range()[source]
Returns:

a newly allocated Atk.Range that represents the minimum, maximum and descriptor (if available) of self. None if that range is not defined.

Return type:

Atk.Range or None

Gets the range of this object.

New in version 2.12.

get_sub_ranges()[source]
Returns:

an GLib.SList of Atk.Range which each of the subranges defined for this object. Free the returns list with g_slist_free().

Return type:

[Atk.Range]

Gets the list of subranges defined for this object. See Atk.Value introduction for examples of subranges and when to expose them.

New in version 2.12.

get_value_and_text()[source]
Returns:

value:

address of float to put the current value of self

text:

address of str to put the human readable text alternative for value

Return type:

(value: float, text: str)

Gets the current value and the human readable text alternative of self. text is a newly created string, that must be freed by the caller. Can be None if no descriptor is available.

New in version 2.12.

set_current_value(value)[source]
Parameters:

value (GObject.Value) – a GObject.Value which is the desired new accessible value.

Returns:

True if new value is successfully set, False otherwise.

Return type:

bool

Sets the value of this object.

Deprecated since version 2.12: Use Atk.Value.set_value() instead.

set_value(new_value)[source]
Parameters:

new_value (float) – a double which is the desired new accessible value.

Sets the value of this object.

This method is intended to provide a way to change the value of the object. In any case, it is possible that the value can’t be modified (ie: a read-only component). If the value changes due this call, it is possible that the text could change, and will trigger an Atk.Value ::value-changed signal emission.

Note for implementors: the deprecated Atk.Value.set_current_value() method returned True or False depending if the value was assigned or not. In the practice several implementors were not able to decide it, and returned True in any case. For that reason it is not required anymore to return if the value was properly assigned or not.

New in version 2.12.

do_get_current_value() virtual
Returns:

a GObject.Value representing the current accessible value

Return type:

value: GObject.Value

Gets the value of this object.

Deprecated since version 2.12: Use Atk.Value.get_value_and_text() instead.

do_get_increment() virtual
Returns:

the minimum increment by which the value of this object may be changed. zero if undefined.

Return type:

float

Gets the minimum increment by which the value of this object may be changed. If zero, the minimum increment is undefined, which may mean that it is limited only by the floating point precision of the platform.

New in version 2.12.

do_get_maximum_value() virtual
Returns:

a GObject.Value representing the maximum accessible value

Return type:

value: GObject.Value

Gets the maximum value of this object.

Deprecated since version 2.12: Use Atk.Value.get_range() instead.

do_get_minimum_increment() virtual
Returns:

a GObject.Value representing the minimum increment by which the accessible value may be changed

Return type:

value: GObject.Value

Gets the minimum increment by which the value of this object may be changed. If zero, the minimum increment is undefined, which may mean that it is limited only by the floating point precision of the platform.

New in version 1.12.

Deprecated since version 2.12: Use Atk.Value.get_increment() instead.

do_get_minimum_value() virtual
Returns:

a GObject.Value representing the minimum accessible value

Return type:

value: GObject.Value

Gets the minimum value of this object.

Deprecated since version 2.12: Use Atk.Value.get_range() instead.

do_get_range() virtual
Returns:

a newly allocated Atk.Range that represents the minimum, maximum and descriptor (if available) of obj. None if that range is not defined.

Return type:

Atk.Range or None

Gets the range of this object.

New in version 2.12.

do_get_sub_ranges() virtual
Returns:

an GLib.SList of Atk.Range which each of the subranges defined for this object. Free the returns list with g_slist_free().

Return type:

[Atk.Range]

Gets the list of subranges defined for this object. See Atk.Value introduction for examples of subranges and when to expose them.

New in version 2.12.

do_get_value_and_text() virtual
Returns:

value:

address of float to put the current value of obj

text:

address of str to put the human readable text alternative for value

Return type:

(value: float, text: str)

Gets the current value and the human readable text alternative of obj. text is a newly created string, that must be freed by the caller. Can be None if no descriptor is available.

New in version 2.12.

do_set_current_value(value) virtual
Parameters:

value (GObject.Value) – a GObject.Value which is the desired new accessible value.

Returns:

True if new value is successfully set, False otherwise.

Return type:

bool

Sets the value of this object.

Deprecated since version 2.12: Use Atk.Value.set_value() instead.

do_set_value(new_value) virtual
Parameters:

new_value (float) – a double which is the desired new accessible value.

Sets the value of this object.

This method is intended to provide a way to change the value of the object. In any case, it is possible that the value can’t be modified (ie: a read-only component). If the value changes due this call, it is possible that the text could change, and will trigger an Atk.Value ::value-changed signal emission.

Note for implementors: the deprecated Atk.Value.set_current_value() method returned True or False depending if the value was assigned or not. In the practice several implementors were not able to decide it, and returned True in any case. For that reason it is not required anymore to return if the value was properly assigned or not.

New in version 2.12.

Signal Details

Atk.Value.signals.value_changed(value, value, text)
Signal Name:

value-changed

Flags:

RUN_LAST

Parameters:
  • value (float) – The object which received the signal

  • value – the new value in a numerical form.

  • text (str) – human readable text alternative (also called description) of this object. None if not available.

The ‘value-changed’ signal is emitted when the current value that represent the object changes. value is the numerical representation of this new value. text is the human readable text alternative of value, and can be None if it is not available. Note that if there is a textual description associated with the new numeric value, that description should be included regardless of whether or not it has also changed.

Example: a password meter whose value changes as the user types their new password. Appropiate value text would be “weak”, “acceptable” and “strong”.

New in version 2.12.