Class: Gtk::Scale

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#add_mark(value, position, markup) ⇒ nil

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 nil, text is shown next to the tick mark.

To remove marks from a scale, use gtk_scale_clear_marks().

Parameters:

  • value (Float)

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

  • position (Gtk::PositionType)

    where to draw the mark. For a horizontal scale, #GTK_POS_TOP and %GTK_POS_LEFT are drawn above the scale, anything else below. For a vertical scale, #GTK_POS_LEFT and %GTK_POS_TOP are drawn to the left of the scale, anything else to the right.

  • markup (String)

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

Returns:

  • (nil)

#clear_marksnil

Removes any marks that have been added with gtk_scale_add_mark().

Returns:

  • (nil)

#digitsInteger

Returns digits.

Returns:

  • (Integer)

    digits

#digits=(digits) ⇒ Integer

Parameters:

  • digits (Integer)

Returns:

  • (Integer)

    digits

  • (Integer)

    digits

#draw_valueTrueClass

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

Returns:

  • (TrueClass)

    whether the current value is displayed as a string

#draw_value=(draw_value) ⇒ TrueClass

Parameters:

  • draw_value (TrueClass)

Returns:

  • (TrueClass)

    draw-value

  • (TrueClass)

    draw-value

#draw_value?TrueClass

Returns draw-value.

Returns:

  • (TrueClass)

    draw-value

#get_layout_offsets(x, y) ⇒ nil

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 Gtk::Scale:draw-value property is false, the return values are undefined.

Parameters:

  • x (Integer)

    location to store X offset of layout, or nil

  • y (Integer)

    location to store Y offset of layout, or nil

Returns:

  • (nil)

#has_originTrueClass

Returns whether the scale has an origin.

Returns:

  • (TrueClass)

    true if the scale has an origin.

#has_origin=(has_origin) ⇒ TrueClass

Parameters:

  • has_origin (TrueClass)

Returns:

  • (TrueClass)

    has-origin

  • (TrueClass)

    has-origin

#has_origin?TrueClass

Returns has-origin.

Returns:

  • (TrueClass)

    has-origin

#layoutPango::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:

  • (Pango::Layout)

    the Pango::Layout for this scale, or nil if the Gtk::Scale:draw-value property is false.

#new(orientation, adjustment) ⇒ Gtk::Widget

Creates a new Gtk::Scale.

Parameters:

  • orientation (Gtk::Orientation)

    the scale’s orientation.

  • adjustment (Gtk::Adjustment)

    the Gtk::Adjustment which sets the range of the scale, or nil to create a new adjustment.

Returns:

#new_with_range(orientation, min, max, step) ⇒ Gtk::Widget

Creates a new scale widget with the given orientation that lets the user input a number between min and max (including min and max) with the increment step. step must be nonzero; it’s the distance the slider moves when using the arrow keys to adjust the scale value.

Note that the way in which the precision is derived works best if step is a power of ten. If the resulting precision is not suitable for your needs, use gtk_scale_set_digits() to correct it.

Parameters:

  • orientation (Gtk::Orientation)

    the scale’s orientation.

  • min (Float)

    minimum value

  • max (Float)

    maximum value

  • step (Float)

    step increment (tick size) used with keyboard shortcuts

Returns:

#value_posGtk::PositionType

Returns value-pos.

Returns:

#value_pos=(value_pos) ⇒ Gtk::PositionType

Parameters:

Returns: