Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: ScaleCtors

[398:14] static extends: object

Alternate constructors for Scale. Usage: ScaleCtors.<name>(...). The primary constructor lives directly on Scale.

Methods

  • newWithRange (string orientation, double min, double max, double step)

    Creates a new scale widget with a range from @min to @max. The returns scale will have the given orientation and will let 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 [method@Gtk.Scale.set_digits] to correct it.
    • @p orientation is the scale’s orientation..
    • @p min is minimum value.
    • @p max is maximum value.
    • @p step is step increment (tick size) used with keyboard shortcuts.
    • @r A new Scale.

class: ScaleMeta

[426:14] static extends: object

Generated metadata helpers for Scale class surfaces.

Methods

  • properties ()

    Returns property metadata for Scale.

    • @r A list.

class: Scale

[57:7] extends: object

Allows to select a numeric value with a slider control. An
example GtkScale To use it, you’ll probably want to investigate the methods on its base class, [class@Gtk.Range], in addition to the methods for GtkScale itself. To set the value of a scale, you would normally use [method@Gtk.Range.set_value]. To detect changes to the value, you would normally use the [signal@Gtk.Range::value-changed] signal. Note that using the same upper and lower bounds for the GtkScale (through the GtkRange methods) will hide the slider itself. This is useful for applications that want to show an undeterminate value on the scale, without changing the layout of the application (such as movie or music players). # GtkScale as GtkBuildable GtkScale supports a custom <marks> element, which can contain multiple <mark\> elements. The “value” and “position” attributes have the same meaning as [method@Gtk.Scale.add_mark] parameters of the same name. If the element is not empty, its content is taken as the markup to show at the mark. It can be translated with the usual ”translatable” and “context” attributes. # Shortcuts and Gestures GtkPopoverMenu supports the following keyboard shortcuts: - Arrow keys, + and - will increment or decrement by step, or by page when combined with Ctrl. - PgUp and PgDn will increment or decrement by page. - Home and End will set the minimum or maximum value. # CSS nodes scale[.fine-tune][.marks-before][.marks-after] ├── [value][.top][.right][.bottom][.left] ├── marks.top │ ├── mark │ ┊ ├── [label] │ ┊ ╰── indicator ┊ ┊ │ ╰── mark ├── marks.bottom │ ├── mark │ ┊ ├── indicator │ ┊ ╰── [label] ┊ ┊ │ ╰── mark ╰── trough ├── [fill] ├── [highlight] ╰── slider GtkScale has a main CSS node with name scale and a subnode for its contents, with subnodes named trough and slider. The main node gets the style class .fine-tune added when the scale is in 'fine-tuning' mode. If the scale has an origin (see [method@Gtk.Scale.set_has_origin]), there is a subnode with name highlight below the trough node that is used for rendering the highlighted part of the trough. If the scale is showing a fill level (see [method@Gtk.Range.set_show_fill_level]), there is a subnode with name fill below the trough node that is used for rendering the filled in part of the trough. If marks are present, there is a marks subnode before or after the trough node, below which each mark gets a node with name mark. The marks nodes get either the .top or .bottom style class. The mark node has a subnode named indicator. If the mark has text, it also has a subnode named label. When the mark is either above or left of the scale, the label subnode is the first when present. Otherwise, the indicator subnode is the first. The main CSS node gets the 'marks-before' and/or 'marks-after' style classes added depending on what marks are present. If the scale is displaying the value (see [property@Gtk.Scale:draw-value]), there is subnode with name value. This node will get the .top or .bottom style classes similar to the marks node. # Accessibility GtkScale uses the [enum@Gtk.AccessibleRole.slider] role.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • Scale (orientation = null, adjustment = null)

    Creates a new GtkScale.

    • @p orientation is the scale’s orientation..
    • @p adjustment is the [class@Gtk.Adjustment] which sets the range of the scale, or %NULL to create a new adjustment..
  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • asRange ()

    Wraps this handle as Range.

    • @r A Range object.
  • asAccessible ()

    Wraps this handle as Accessible.

    • @r A Accessible object.
  • asAccessibleRange ()

    Wraps this handle as AccessibleRange.

    • @r A AccessibleRange object.
  • asBuildable ()

    Wraps this handle as Buildable.

    • @r A Buildable object.
  • asConstraintTarget ()

    Wraps this handle as ConstraintTarget.

    • @r A ConstraintTarget object.
  • asOrientable ()

    Wraps this handle as Orientable.

    • @r A Orientable object.
  • getProperty (string Name)

    Reads one generated property by name.

  • setProperty (string Name, Value)

    Writes one generated property by name.

  • setDigits (int Value)

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

    • @p Value is the new property value.
    • @r None.
  • setDrawvalue (bool Value)

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

    • @p Value is the new property value.
    • @r None.
  • setHasorigin (bool Value)

    Whether the scale has an origin.

    • @p Value is the new property value.
    • @r None.
  • setValuepos (string Value)

    The position in which the current value is displayed.

    • @p Value is the new property value.
    • @r None.
  • add_mark (double value, string position, string markup)

    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 %NULL, text is shown next to the tick mark. To remove marks from a scale, use [method@Gtk.Scale.clear_marks].

    • @p value is the value at which the mark is placed, must be between the lower and upper limits of the scales’ adjustment.
    • @p position is 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..
    • @p markup is Text to be shown at the mark, using Pango markup.
    • @r None.
  • clear_marks ()

    Removes any marks that have been added.

    • @r None.
  • get_digits ()

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

  • get_draw_value ()

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

  • get_has_origin ()

    Returns whether the scale has an origin.

  • get_layout ()

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

  • get_value_pos ()

    Gets the position in which the current value is displayed.

  • set_digits (int digits)

    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 [property@Gtk.Scale:draw-value] is %TRUE when the value changes. If you want to enforce rounding the value when [property@Gtk.Scale:draw-value] is %FALSE, you can set [property@Gtk.Range:round-digits] instead. Note that rounding to a small number of digits can interfere with the smooth autoscrolling that is built into GtkScale. As an alternative, you can use [method@Gtk.Scale.set_format_value_func] to format the displayed value yourself.

    • @p digits is the number of decimal places to display, e.g. use 1 to display 1.0, 2 to display 1.00, etc.
    • @r None.
  • set_draw_value (bool draw_value)

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

    • @p draw_value is %TRUE to draw the value.
    • @r None.
  • set_has_origin (bool has_origin)

    Sets whether the scale has an origin. If [property@Gtk.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.

    • @p has_origin is %TRUE if the scale has an origin.
    • @r None.
  • set_value_pos (string pos)

    Sets the position in which the current value is displayed.

    • @p pos is the position in which the current value is displayed.
    • @r None.