gtk.scale
Module for [Scale] class
Types 3
A gtk.scale.Scale is a slider control used to select a numeric value.
To use it, you’ll probably want to investigate the methods on its base class, gtk.range.Range, in addition to the methods for gtk.scale.Scale itself. To set the value of a scale, you would normally use gtk.range.Range.setValue. To detect changes to the value, you would normally use the gtk.range.Range.valueChanged signal.
Note that using the same upper and lower bounds for the gtk.scale.Scale (through the gtk.range.Range 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
gtk.scale.Scale supports a custom <marks> element, which can contain multiple <mark\> elements. The “value” and “position” attributes have the same meaning as gtk.scale.Scale.addMark 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.
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]
╰── slidergtk.scale.Scale 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 gtk.scale.Scale.setHasOrigin), 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 gtk.range.Range.setShowFillLevel), 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 gtk.scale.Scale.drawValue), there is subnode with name value. This node will get the .top or .bottom style classes similar to the marks node.
Accessibility
gtk.scale.Scale uses the gtk.types.AccessibleRole.Slider role.
ScaleGidBuilder builder() static nothrowGet builder for [gtk.scale.Scale] Returns: New builder objectint digits() @property nothrowGet `digits` property. Returns: The number of decimal places that are displayed in the value.void digits(int propval) @property nothrowSet `digits` property. Params: propval = The number of decimal places that are displayed in the value.bool drawValue() @property nothrowGet `drawValue` property. Returns: Whether the current value is displayed as a string next to the slider.void drawValue(bool propval) @property nothrowSet `drawValue` property. Params: propval = Whether the current value is displayed as a string next to the slider.bool hasOrigin() @property nothrowGet `hasOrigin` property. Returns: Whether the scale has an origin.void hasOrigin(bool propval) @property nothrowSet `hasOrigin` property. Params: propval = Whether the scale has an origin.gtk.types.PositionType valuePos() @property nothrowGet `valuePos` property. Returns: The position in which the current value is displayed.void valuePos(gtk.types.PositionType propval) @property nothrowSet `valuePos` property. Params: propval = The position in which the current value is displayed.gtk.scale.Scale newWithRange(gtk.types.Orientation orientation, double min, double max, double step) static nothrowCreates a new scale widget with a range from min to max.void addMark(double value, gtk.types.PositionType position, string markup = null) nothrowAdds a mark at value.int getDigits() nothrowGets the number of decimal places that are displayed in the value. Returns: the number of decimal places that are displayedbool getDrawValue() nothrowReturns whether the current value is displayed as a string next to the slider. Returns: whether the current value is displayed as a stringbool getHasOrigin() nothrowReturns whether the scale has an origin. Returns: true if the scale has an origin.void getLayoutOffsets(out int x, out int y) nothrowObtains the coordinates where the scale will draw the [pango.layout.Layout] representing the text in the scale.gtk.types.PositionType getValuePos() nothrowGets the position in which the current value is displayed. Returns: the position in which the current value is displayedvoid setDigits(int digits) nothrowSets the number of decimal places that are displayed in the value.void setDrawValue(bool drawValue) nothrowSpecifies whether the current value is displayed as a string next to the slider.void setFormatValueFunc(gtk.types.ScaleFormatValueFunc func = null) nothrowfunc allows you to change how the scale value is displayed.void setValuePos(gtk.types.PositionType pos) nothrowSets the position in which the current value is displayed.this(gtk.types.Orientation orientation, gtk.adjustment.Adjustment adjustment = null)Creates a new [gtk.scale.Scale].Fluent builder implementation template for gtk.scale.Scale
T digits(int propval) nothrowSet `digits` property. Params: propval = The number of decimal places that are displayed in the value. Returns: Builder instance for fluent chainingT drawValue(bool propval) nothrowSet `drawValue` property. Params: propval = Whether the current value is displayed as a string next to the slider. Returns: Builder instance for fluent chainingT hasOrigin(bool propval) nothrowSet `hasOrigin` property. Params: propval = Whether the scale has an origin. Returns: Builder instance for fluent chainingT valuePos(gtk.types.PositionType propval) nothrowSet `valuePos` property. Params: propval = The position in which the current value is displayed. Returns: Builder instance for fluent chainingFluent builder for gtk.scale.Scale