[][src]Trait gtk::ScaleExt

pub trait ScaleExt: 'static {
    fn add_mark<'a, P: Into<Option<&'a str>>>(
        &self,
        value: f64,
        position: PositionType,
        markup: P
    );
fn clear_marks(&self);
fn get_digits(&self) -> i32;
fn get_draw_value(&self) -> bool;
fn get_has_origin(&self) -> bool;
fn get_layout(&self) -> Option<Layout>;
fn get_layout_offsets(&self) -> (i32, i32);
fn get_value_pos(&self) -> PositionType;
fn set_digits(&self, digits: i32);
fn set_draw_value(&self, draw_value: bool);
fn set_has_origin(&self, has_origin: bool);
fn set_value_pos(&self, pos: PositionType);
fn connect_format_value<F: Fn(&Self, f64) -> String + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_digits_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_draw_value_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_has_origin_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_value_pos_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; }

Trait containing all Scale methods.

Implementors

Scale

Required methods

fn add_mark<'a, P: Into<Option<&'a str>>>(
    &self,
    value: f64,
    position: PositionType,
    markup: P
)

Adds a mark at value.

A mark is indicated visually by drawing a tick mark next to the scale, and GTK+ makes it easy for the user to position the scale exactly at the marks value.

If markup is not None, text is shown next to the tick mark.

To remove marks from a scale, use ScaleExt::clear_marks.

value

the value at which the mark is placed, must be between the lower and upper limits of the scales’ adjustment

position

where to draw the mark. For a horizontal scale, PositionType::Top and PositionType::Left are drawn above the scale, anything else below. For a vertical scale, PositionType::Left and PositionType::Top are drawn to the left of the scale, anything else to the right.

markup

Text to be shown at the mark, using [Pango markup][PangoMarkupFormat], or None

fn clear_marks(&self)

Removes any marks that have been added with ScaleExt::add_mark.

fn get_digits(&self) -> i32

Gets the number of decimal places that are displayed in the value.

Returns

the number of decimal places that are displayed

fn get_draw_value(&self) -> bool

Returns whether the current value is displayed as a string next to the slider.

Returns

whether the current value is displayed as a string

fn get_has_origin(&self) -> bool

Returns whether the scale has an origin.

Returns

true if the scale has an origin.

fn get_layout(&self) -> Option<Layout>

Gets the pango::Layout used to display the scale. The returned object is owned by the scale so does not need to be freed by the caller.

Returns

the pango::Layout for this scale, or None if the Scale:draw-value property is false.

fn get_layout_offsets(&self) -> (i32, i32)

Obtains the coordinates where the scale will draw the pango::Layout representing the text in the scale. Remember when using the pango::Layout function you need to convert to and from pixels using PANGO_PIXELS() or PANGO_SCALE.

If the Scale:draw-value property is false, the return values are undefined.

x

location to store X offset of layout, or None

y

location to store Y offset of layout, or None

fn get_value_pos(&self) -> PositionType

Gets the position in which the current value is displayed.

Returns

the position in which the current value is displayed

fn set_digits(&self, digits: i32)

Sets the number of decimal places that are displayed in the value. Also causes the value of the adjustment to be rounded to this number of digits, so the retrieved value matches the displayed one, if Scale:draw-value is true when the value changes. If you want to enforce rounding the value when Scale:draw-value is false, you can set Range:round-digits instead.

Note that rounding to a small number of digits can interfere with the smooth autoscrolling that is built into Scale. As an alternative, you can use the Scale::format-value signal to format the displayed value yourself.

digits

the number of decimal places to display, e.g. use 1 to display 1.0, 2 to display 1.00, etc

fn set_draw_value(&self, draw_value: bool)

Specifies whether the current value is displayed as a string next to the slider.

draw_value

true to draw the value

fn set_has_origin(&self, has_origin: bool)

If Scale:has-origin is set to true (the default), the scale will highlight the part of the trough between the origin (bottom or left side) and the current value.

has_origin

true if the scale has an origin

fn set_value_pos(&self, pos: PositionType)

Sets the position in which the current value is displayed.

pos

the position in which the current value is displayed

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

Signal which allows you to change how the scale value is displayed. Connect a signal handler which returns an allocated string representing value. That string will then be used to display the scale's value.

If no user-provided handlers are installed, the value will be displayed on its own, rounded according to the value of the Scale:digits property.

Here's an example signal handler which displays a value 1.0 as with "-->1.0<--".

static gchar*
format_value_callback (GtkScale *scale,
                       gdouble   value)
{
  return g_strdup_printf ("-->\%0.*g<--",
                          gtk_scale_get_digits (scale), value);
 }

value

the value to format

Returns

allocated string representing value

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

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

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

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

Loading content...

Implementors

impl<O: IsA<Scale>> ScaleExt for O[src]

Loading content...