gi-atk-2.0.27: Atk bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | Safe-Inferred
Language | Haskell2010

GI.Atk.Interfaces.Value

Contents

- Exported types
- Methods
  - getCurrentValue
  - getIncrement
  - getMaximumValue
  - getMinimumIncrement
  - getMinimumValue
  - getRange
  - getSubRanges
  - getValueAndText
  - setCurrentValue
  - setValue
- Signals
  - valueChanged

Description

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

`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 `Object` representations which implement `Value` on the component's behalf. `AtKValues` may be read-only, in which case attempts to alter the value return would fail.

<refsect1 id="current-value-text"> <title>On the subject of current value text</title> <para> 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. </para>

<example> <title>Password strength</title> 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. </example>

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.

<refsect2 id="implementor-notes"> <title>Implementor Notes</title> <para> 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. </para>

<para> `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 `Value` because the current value does not reflect progress towards completion. </para> </refsect2> </refsect1>

<refsect1 id="ranges"> <title>On the subject of ranges</title> <para> 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: </para> <itemizedlist> <listitem>The existence of distinct ranges such as "weak", "acceptable", and "strong" indicated by color, bar tick marks, and/or on-screen text.</listitem> <listitem>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.</listitem> </itemizedlist> <para> 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. </para>

<refsect2 id="ranges-implementor-notes"> <title>Implementor Notes</title> <para> 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. </para> </refsect2> </refsect1>

<refsect1 id="localization"> <title>On the subject of localization of end-user-consumable text values</title> <para> 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 `valueTypeGetLocalizedName` with the following already-localized constants for commonly-needed values can be used: </para>

<itemizedlist> <listitem>ATK_VALUE_VERY_WEAK</listitem> <listitem>ATK_VALUE_WEAK</listitem> <listitem>ATK_VALUE_ACCEPTABLE</listitem> <listitem>ATK_VALUE_STRONG</listitem> <listitem>ATK_VALUE_VERY_STRONG</listitem> <listitem>ATK_VALUE_VERY_LOW</listitem> <listitem>ATK_VALUE_LOW</listitem> <listitem>ATK_VALUE_MEDIUM</listitem> <listitem>ATK_VALUE_HIGH</listitem> <listitem>ATK_VALUE_VERY_HIGH</listitem> <listitem>ATK_VALUE_VERY_BAD</listitem> <listitem>ATK_VALUE_BAD</listitem> <listitem>ATK_VALUE_GOOD</listitem> <listitem>ATK_VALUE_VERY_GOOD</listitem> <listitem>ATK_VALUE_BEST</listitem> <listitem>ATK_VALUE_SUBSUBOPTIMAL</listitem> <listitem>ATK_VALUE_SUBOPTIMAL</listitem> <listitem>ATK_VALUE_OPTIMAL</listitem> </itemizedlist> <para> Proposals for additional constants, along with their use cases, should be submitted to the GNOME Accessibility Team. </para> </refsect1>

<refsect1 id="changes"> <title>On the subject of changes</title> <para> 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. </para> </refsect1>

Synopsis

- newtype Value = Value (ManagedPtr Value)
- class (GObject o, IsDescendantOf Value o) => IsValue o
- toValue :: (MonadIO m, IsValue o) => o -> m Value
- valueGetCurrentValue :: (HasCallStack, MonadIO m, IsValue a) => a -> m GValue
- valueGetIncrement :: (HasCallStack, MonadIO m, IsValue a) => a -> m Double
- valueGetMaximumValue :: (HasCallStack, MonadIO m, IsValue a) => a -> m GValue
- valueGetMinimumIncrement :: (HasCallStack, MonadIO m, IsValue a) => a -> m GValue
- valueGetMinimumValue :: (HasCallStack, MonadIO m, IsValue a) => a -> m GValue
- valueGetRange :: (HasCallStack, MonadIO m, IsValue a) => a -> m (Maybe Range)
- valueGetSubRanges :: (HasCallStack, MonadIO m, IsValue a) => a -> m [Range]
- valueGetValueAndText :: (HasCallStack, MonadIO m, IsValue a) => a -> m (Double, Text)
- valueSetCurrentValue :: (HasCallStack, MonadIO m, IsValue a) => a -> GValue -> m Bool
- valueSetValue :: (HasCallStack, MonadIO m, IsValue a) => a -> Double -> m ()
- type ValueValueChangedCallback = Double -> Text -> IO ()
- afterValueValueChanged :: (IsValue a, MonadIO m) => a -> ((?self :: a) => ValueValueChangedCallback) -> m SignalHandlerId
- onValueValueChanged :: (IsValue a, MonadIO m) => a -> ((?self :: a) => ValueValueChangedCallback) -> m SignalHandlerId

# Exported types

newtype Value Source #

Memory-managed wrapper type.

Constructors

Value (ManagedPtr Value) |

#### Instances

Instances details

Eq Value Source # |
Instance details Defined in GI.Atk.Interfaces.Value Methods (==) :: Value -> Value -> Bool Source # (/=) :: Value -> Value -> Bool Source #
GObject Value Source # |
Instance details Defined in GI.Atk.Interfaces.Value
ManagedPtrNewtype Value Source # |
Instance details Defined in GI.Atk.Interfaces.Value Methods toManagedPtr :: Value -> ManagedPtr Value Source #
TypedObject Value Source # |
Instance details Defined in GI.Atk.Interfaces.Value Methods glibType :: IO GType Source #
HasParentTypes Value Source # |
Instance details Defined in GI.Atk.Interfaces.Value
IsGValue (Maybe Value) Source # | Convert `Value` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Atk.Interfaces.Value Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe Value -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe Value) Source #
type ParentTypes Value Source # |
Instance details Defined in GI.Atk.Interfaces.Value type ParentTypes Value = '[Object]

class (GObject o, IsDescendantOf Value o) => IsValue o Source #

Type class for types which can be safely cast to `Value`, for instance with `toValue`.

#### Instances

Instances details

(GObject o, IsDescendantOf Value o) => IsValue o Source # |
Instance details Defined in GI.Atk.Interfaces.Value

toValue :: (MonadIO m, IsValue o) => o -> m Value Source #

Cast to `Value`, for types for which this is known to be safe. For general casts, use `castTo`.

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.

#### Getters

getCurrentValue, getData, getIncrement, getMaximumValue, getMinimumIncrement, getMinimumValue, getProperty, getQdata, getRange, getSubRanges, getValueAndText.

#### Setters

setCurrentValue, setData, setDataFull, setProperty, setValue.

## getCurrentValue

valueGetCurrentValue Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) |
=> a | `obj`: a GObject instance that implements AtkValueIface
-> m GValue |

Deprecated: Since 2.12. Use `valueGetValueAndText`instead.

Gets the value of this object.

## getIncrement

valueGetIncrement Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) |
=> a | `obj`: a GObject instance that implements AtkValueIface
-> m Double | Returns: the minimum increment by which the value of this object may be changed. zero if undefined.

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.

Since: 2.12

## getMaximumValue

valueGetMaximumValue Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) |
=> a | `obj`: a GObject instance that implements AtkValueIface
-> m GValue |

Deprecated: Since 2.12. Use `valueGetRange` instead.

Gets the maximum value of this object.

## getMinimumIncrement

valueGetMinimumIncrement Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) |
=> a | `obj`: a GObject instance that implements AtkValueIface
-> m GValue |

Deprecated: Since 2.12. Use `valueGetIncrement` instead.

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.

Since: 1.12

## getMinimumValue

valueGetMinimumValue Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) |
=> a | `obj`: a GObject instance that implements AtkValueIface
-> m GValue |

Deprecated: Since 2.12. Use `valueGetRange` instead.

Gets the minimum value of this object.

## getRange

valueGetRange Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) |
=> a | `obj`: a GObject instance that implements AtkValueIface
-> m (Maybe Range) | Returns: a newly allocated `Range` that represents the minimum, maximum and descriptor (if available) of `obj`. NULL if that range is not defined.

Gets the range of this object.

Since: 2.12

## getSubRanges

valueGetSubRanges Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) |
=> a | `obj`: a GObject instance that implements AtkValueIface
-> m [Range] | Returns: an `SList` of `Range` which each of the subranges defined for this object. Free the returns list with `g_slist_free()`.

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

Since: 2.12

## getValueAndText

valueGetValueAndText Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) |
=> a | `obj`: a GObject instance that implements AtkValueIface
-> m (Double, Text) |

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 NULL if no descriptor is available.

Since: 2.12

## setCurrentValue

valueSetCurrentValue Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) |
=> a | `obj`: a GObject instance that implements AtkValueIface
-> GValue | `value`: a `Value` which is the desired new accessible value.
-> m Bool | Returns: `True` if new value is successfully set, `False` otherwise.

Deprecated: Since 2.12. Use `valueSetValue` instead.

Sets the value of this object.

## setValue

valueSetValue Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) |
=> a | `obj`: a GObject instance that implements AtkValueIface
-> Double | `newValue`: a double which is the desired new accessible value.
-> m () |

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 Value::valueChanged signal emission.

Note for implementors: the deprecated `valueSetCurrentValue` 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.

Since: 2.12

# Signals

## valueChanged

type ValueValueChangedCallback Source #

Arguments

= Double | `value`: the new value in a numerical form.
-> Text | `text`: human readable text alternative (also called description) of this object. NULL if not available.
-> IO () |

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 NULL 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".

Since: 2.12

afterValueValueChanged :: (IsValue a, MonadIO m) => a -> ((?self :: a) => ValueValueChangedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the valueChanged signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after value #valueChanged callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onValueValueChanged :: (IsValue a, MonadIO m) => a -> ((?self :: a) => ValueValueChangedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the valueChanged signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on value #valueChanged callback