pub trait ValueExt: 'static {
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
Required Methods
sourcefn current_value(&self) -> Value
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
sourcefn increment(&self) -> f64
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.
sourcefn maximum_value(&self) -> Value
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
sourcefn minimum_increment(&self) -> Value
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
sourcefn minimum_value(&self) -> Value
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
sourcefn sub_ranges(&self) -> Vec<Range>
fn sub_ranges(&self) -> Vec<Range>
sourcefn value_and_text(&self) -> (f64, GString)
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
sourcefn set_current_value(&self, value: &Value) -> bool
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
sourcefn set_value(&self, new_value: f64)
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 signal::Value::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.
sourcefn connect_value_changed<F: Fn(&Self, f64, &str) + 'static>(
&self,
f: F
) -> SignalHandlerId
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.