Skip to main content

ValueExt

Trait ValueExt 

Source
pub trait ValueExt:
    IsA<Value>
    + Sealed
    + 'static {
    // Provided methods
    fn current_value(&self) -> Value { ... }
    fn increment(&self) -> f64 { ... }
    fn maximum_value(&self) -> Value { ... }
    fn minimum_increment(&self) -> Value { ... }
    fn minimum_value(&self) -> Value { ... }
    fn range(&self) -> Option<Range> { ... }
    fn sub_ranges(&self) -> Vec<Range> { ... }
    fn value_and_text(&self) -> (f64, GString) { ... }
    fn set_current_value(&self, value: &Value) -> bool { ... }
    fn set_value(&self, new_value: f64) { ... }
    fn connect_value_changed<F: Fn(&Self, f64, &str) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId { ... }
}
Expand description

Trait containing all Value methods.

§Implementors

NoOpObject, Value

Provided Methods§

Source

fn current_value(&self) -> Value

Gets the value of this object.

§Deprecated

Since 2.12. Use value_and_text() instead.

§Returns
§value

a glib::Value representing the current accessible value

Source

fn increment(&self) -> f64

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.

§Returns

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

Source

fn maximum_value(&self) -> Value

Gets the maximum value of this object.

§Deprecated

Since 2.12. Use range() instead.

§Returns
§value

a glib::Value representing the maximum accessible value

Source

fn minimum_increment(&self) -> 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.

§Deprecated

Since 2.12. Use increment() instead.

§Returns
§value

a glib::Value representing the minimum increment by which the accessible value may be changed

Source

fn minimum_value(&self) -> Value

Gets the minimum value of this object.

§Deprecated

Since 2.12. Use range() instead.

§Returns
§value

a glib::Value representing the minimum accessible value

Source

fn range(&self) -> Option<Range>

Gets the range of this object.

§Returns

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

Source

fn sub_ranges(&self) -> Vec<Range>

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

§Returns

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

Source

fn value_and_text(&self) -> (f64, GString)

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

§Returns
§value

address of gdouble to put the current value of self

§text

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

Source

fn set_current_value(&self, value: &Value) -> bool

Sets the value of this object.

§Deprecated

Since 2.12. Use set_value() instead.

§value

a glib::Value which is the desired new accessible value.

§Returns

true if new value is successfully set, false otherwise.

Source

fn set_value(&self, new_value: f64)

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-changed signal emission.

Note for implementors: the deprecated 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_value

a double which is the desired new accessible value.

Source

fn connect_value_changed<F: Fn(&Self, f64, &str) + 'static>( &self, f: F, ) -> SignalHandlerId

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”.

§value

the new value in a numerical form.

§text

human readable text alternative (also called description) of this object. NULL if not available.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<O: IsA<Value>> ValueExt for O