Scale

A GtkScale 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, #GtkRange, in addition to the methods for GtkScale itself. To set the value of a scale, you would normally use gtk_range_set_value(). To detect changes to the value, you would normally use the #GtkRange::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 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.

Constructors

this
this(GtkScale* gtkScale, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this(GtkOrientation orientation, Adjustment adjustment)

Creates a new #GtkScale.

this
this(GtkOrientation orientation, double min, double max, double step)

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.

Members

Functions

addMark
void addMark(double value, GtkPositionType position, string markup)

Adds a mark at @value.

addOnFormatValue
void addOnFormatValue(string delegate(double, Scale) dlg, ConnectFlags connectFlags)

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.

clearMarks
void clearMarks()

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

getDigits
int getDigits()

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

getDrawValue
bool getDrawValue()

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

getHasOrigin
bool getHasOrigin()

Returns whether the scale has an origin.

getLayout
PgLayout getLayout()

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.

getLayoutOffsets
void getLayoutOffsets(int x, int y)

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

getScaleStruct
GtkScale* getScaleStruct()

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

getValuePos
GtkPositionType getValuePos()

Gets the position in which the current value is displayed.

setDigits
void setDigits(int digits)

Sets the number of decimal places that are displayed in the value. Also causes the value of the adjustment to be rounded off to this number of digits, so the retrieved value matches the value the user saw.

setDrawValue
void setDrawValue(bool drawValue)

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

setHasOrigin
void setHasOrigin(bool hasOrigin)

If @has_origin is set to %TRUE (the default), the scale will highlight the part of the scale between the origin (bottom or left side) of the scale and the current value.

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
setValuePos
void setValuePos(GtkPositionType pos)

Sets the position in which the current value is displayed.

Static functions

callBackFormatValue
string callBackFormatValue(GtkScale* scaleStruct, double value, Scale _scale)
Undocumented in source. Be warned that the author may not have intended to support it.
getType
GType getType()

Variables

connectedSignals
int[string] connectedSignals;
Undocumented in source.
gtkScale
GtkScale* gtkScale;

the main Gtk struct

onFormatValueListeners
string delegate(double, Scale)[] onFormatValueListeners;
Undocumented in source.

Inherited Members

From Range

gtkRange
GtkRange* gtkRange;

the main Gtk struct

getRangeStruct
GtkRange* getRangeStruct()

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
__anonymous
mixin OrientableT!(GtkRange)
Undocumented in source.
getType
GType getType()
getAdjustment
Adjustment getAdjustment()

Get the #GtkAdjustment which is the “model” object for #GtkRange. See gtk_range_set_adjustment() for details. The return value does not have a reference added, so should not be unreferenced.

getFillLevel
double getFillLevel()

Gets the current position of the fill level indicator.

getFlippable
bool getFlippable()

Gets the value set by gtk_range_set_flippable().

getInverted
bool getInverted()

Gets the value set by gtk_range_set_inverted().

getLowerStepperSensitivity
GtkSensitivityType getLowerStepperSensitivity()

Gets the sensitivity policy for the stepper that points to the 'lower' end of the GtkRange’s adjustment.

getMinSliderSize
int getMinSliderSize()

This function is useful mainly for #GtkRange subclasses.

getRangeRect
void getRangeRect(GdkRectangle rangeRect)

This function returns the area that contains the range’s trough and its steppers, in widget->window coordinates.

getRestrictToFillLevel
bool getRestrictToFillLevel()

Gets whether the range is restricted to the fill level.

getRoundDigits
int getRoundDigits()

Gets the number of digits to round the value to when it changes. See #GtkRange::change-value.

getShowFillLevel
bool getShowFillLevel()

Gets whether the range displays the fill level graphically.

getSliderRange
void getSliderRange(int sliderStart, int sliderEnd)

This function returns sliders range along the long dimension, in widget->window coordinates.

getSliderSizeFixed
bool getSliderSizeFixed()

This function is useful mainly for #GtkRange subclasses.

getUpperStepperSensitivity
GtkSensitivityType getUpperStepperSensitivity()

Gets the sensitivity policy for the stepper that points to the 'upper' end of the GtkRange’s adjustment.

getValue
double getValue()

Gets the current value of the range.

setAdjustment
void setAdjustment(Adjustment adjustment)

Sets the adjustment to be used as the “model” object for this range widget. The adjustment indicates the current range value, the minimum and maximum range values, the step/page increments used for keybindings and scrolling, and the page size. The page size is normally 0 for #GtkScale and nonzero for #GtkScrollbar, and indicates the size of the visible area of the widget being scrolled. The page size affects the size of the scrollbar slider.

setFillLevel
void setFillLevel(double fillLevel)

Set the new position of the fill level indicator.

setFlippable
void setFlippable(bool flippable)

If a range is flippable, it will switch its direction if it is horizontal and its direction is %GTK_TEXT_DIR_RTL.

setIncrements
void setIncrements(double step, double page)

Sets the step and page sizes for the range. The step size is used when the user clicks the #GtkScrollbar arrows or moves #GtkScale via arrow keys. The page size is used for example when moving via Page Up or Page Down keys.

setInverted
void setInverted(bool setting)

Ranges normally move from lower to higher values as the slider moves from top to bottom or left to right. Inverted ranges have higher values at the top or on the right rather than on the bottom or left.

setLowerStepperSensitivity
void setLowerStepperSensitivity(GtkSensitivityType sensitivity)

Sets the sensitivity policy for the stepper that points to the 'lower' end of the GtkRange’s adjustment.

setMinSliderSize
void setMinSliderSize(int minSize)

Sets the minimum size of the range’s slider.

setRange
void setRange(double min, double max)

Sets the allowable values in the #GtkRange, and clamps the range value to be between @min and @max. (If the range has a non-zero page size, it is clamped between @min and @max - page-size.)

setRestrictToFillLevel
void setRestrictToFillLevel(bool restrictToFillLevel)

Sets whether the slider is restricted to the fill level. See gtk_range_set_fill_level() for a general description of the fill level concept.

setRoundDigits
void setRoundDigits(int roundDigits)

Sets the number of digits to round the value to when it changes. See #GtkRange::change-value.

setShowFillLevel
void setShowFillLevel(bool showFillLevel)

Sets whether a graphical fill level is show on the trough. See gtk_range_set_fill_level() for a general description of the fill level concept.

setSliderSizeFixed
void setSliderSizeFixed(bool sizeFixed)

Sets whether the range’s slider has a fixed size, or a size that depends on its adjustment’s page size.

setUpperStepperSensitivity
void setUpperStepperSensitivity(GtkSensitivityType sensitivity)

Sets the sensitivity policy for the stepper that points to the 'upper' end of the GtkRange’s adjustment.

setValue
void setValue(double value)

Sets the current value of the range; if the value is outside the minimum or maximum range values, it will be clamped to fit inside them. The range emits the #GtkRange::value-changed signal if the value changes.

connectedSignals
int[string] connectedSignals;
Undocumented in source.
onAdjustBoundsListeners
void delegate(double, Range)[] onAdjustBoundsListeners;
Undocumented in source.
addOnAdjustBounds
void addOnAdjustBounds(void delegate(double, Range) dlg, ConnectFlags connectFlags)

Emitted before clamping a value, to give the application a chance to adjust the bounds.

callBackAdjustBounds
void callBackAdjustBounds(GtkRange* rangeStruct, double value, Range _range)
Undocumented in source. Be warned that the author may not have intended to support it.
onChangeValueListeners
bool delegate(GtkScrollType, double, Range)[] onChangeValueListeners;
Undocumented in source.
addOnChangeValue
void addOnChangeValue(bool delegate(GtkScrollType, double, Range) dlg, ConnectFlags connectFlags)

The #GtkRange::change-value signal is emitted when a scroll action is performed on a range. It allows an application to determine the type of scroll event that occurred and the resultant new value. The application can handle the event itself and return %TRUE to prevent further processing. Or, by returning %FALSE, it can pass the event to other handlers until the default GTK+ handler is reached.

callBackChangeValue
int callBackChangeValue(GtkRange* rangeStruct, GtkScrollType scroll, double value, Range _range)
Undocumented in source. Be warned that the author may not have intended to support it.
onMoveSliderListeners
void delegate(GtkScrollType, Range)[] onMoveSliderListeners;
Undocumented in source.
addOnMoveSlider
void addOnMoveSlider(void delegate(GtkScrollType, Range) dlg, ConnectFlags connectFlags)

Virtual function that moves the slider. Used for keybindings.

callBackMoveSlider
void callBackMoveSlider(GtkRange* rangeStruct, GtkScrollType step, Range _range)
Undocumented in source. Be warned that the author may not have intended to support it.
onValueChangedListeners
void delegate(Range)[] onValueChangedListeners;
Undocumented in source.
addOnValueChanged
void addOnValueChanged(void delegate(Range) dlg, ConnectFlags connectFlags)

Emitted when the range value changes.

callBackValueChanged
void callBackValueChanged(GtkRange* rangeStruct, Range _range)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta