Scale

Description 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 "value_changed" signal. The GtkScale widget is an abstract class, used only for deriving the subclasses GtkHScale and GtkVScale. To create a scale widget, call gtk_hscale_new_with_range() or gtk_vscale_new_with_range(). 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)

Sets our main struct and passes it to the parent class

Members

Functions

addMark
void addMark(double value, GtkPositionType 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 gtk_scale_clear_marks(). Since 2.16

addOnFormatValue
void addOnFormatValue(string delegate(gdouble, 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. Here's an example signal handler which displays a value 1.0 as with "-->1.0<--".

clearMarks
void clearMarks()

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

getDigits
int getDigits()

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

getDrawValue
int getDrawValue()

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

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. Since 2.4

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. If the "draw-value" property is FALSE, the return values are undefined. Since 2.4

getScaleStruct
GtkScale* getScaleStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
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(int drawValue)

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

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
void callBackFormatValue(GtkScale* scaleStruct, gdouble value, Scale _scale)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

connectedSignals
int[string] connectedSignals;
gtkScale
GtkScale* gtkScale;

the main Gtk struct

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

Inherited Members

From Range

gtkRange
GtkRange* gtkRange;

the main Gtk struct

getRangeStruct
GtkRange* getRangeStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
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.
connectedSignals
int[string] connectedSignals;
onAdjustBoundsListeners
void delegate(gdouble, Range)[] onAdjustBoundsListeners;
Undocumented in source.
addOnAdjustBounds
void addOnAdjustBounds(void delegate(gdouble, Range) dlg, ConnectFlags connectFlags)
callBackAdjustBounds
void callBackAdjustBounds(GtkRange* rangeStruct, gdouble arg1, Range _range)
Undocumented in source. Be warned that the author may not have intended to support it.
onChangeValueListeners
bool delegate(GtkScrollType, gdouble, Range)[] onChangeValueListeners;
Undocumented in source.
addOnChangeValue
void addOnChangeValue(bool delegate(GtkScrollType, gdouble, Range) dlg, ConnectFlags connectFlags)

The ::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. The value parameter is unrounded. An application that overrides the ::change-value signal is responsible for clamping the value to the desired number of decimal digits; the default GTK+ handler clamps the value based on "round_digits". It is not possible to use delayed update policies in an overridden ::change-value handler. TRUE to prevent other handlers from being invoked for the signal, FALSE to propagate the signal further Since 2.6

callBackChangeValue
gboolean callBackChangeValue(GtkRange* rangeStruct, GtkScrollType scroll, gdouble 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.
getFillLevel
double getFillLevel()

Gets the current position of the fill level indicator. Since 2.12

getRestrictToFillLevel
int getRestrictToFillLevel()

Gets whether the range is restricted to the fill level. Since 2.12

getShowFillLevel
int getShowFillLevel()

Gets whether the range displays the fill level graphically. Since 2.12

setFillLevel
void setFillLevel(double fillLevel)

Set the new position of the fill level indicator. The "fill level" is probably best described by its most prominent use case, which is an indicator for the amount of pre-buffering in a streaming media player. In that use case, the value of the range would indicate the current play position, and the fill level would be the position up to which the file/stream has been downloaded. This amount of prebuffering can be displayed on the range's trough and is themeable separately from the trough. To enable fill level display, use gtk_range_set_show_fill_level(). The range defaults to not showing the fill level. Additionally, it's possible to restrict the range's slider position to values which are smaller than the fill level. This is controller by gtk_range_set_restrict_to_fill_level() and is by default enabled. Since 2.12

setRestrictToFillLevel
void setRestrictToFillLevel(int 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. Since 2.12

setShowFillLevel
void setShowFillLevel(int 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. Since 2.12

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.

setUpdatePolicy
void setUpdatePolicy(GtkUpdateType policy)

Warning gtk_range_set_update_policy has been deprecated since version 2.24 and should not be used in newly-written code. There is no replacement. If you require delayed updates, you need to code it yourself. Sets the update policy for the range. GTK_UPDATE_CONTINUOUS means that anytime the range slider is moved, the range value will change and the value_changed signal will be emitted. GTK_UPDATE_DELAYED means that the value will be updated after a brief timeout where no slider motion occurs, so updates are spaced by a short time rather than continuous. GTK_UPDATE_DISCONTINUOUS means that the value will only be updated when the user releases the button and ends the slider drag operation.

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.

getInverted
int getInverted()

Gets the value set by gtk_range_set_inverted().

setInverted
void setInverted(int 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.

getUpdatePolicy
GtkUpdateType getUpdatePolicy()

Warning gtk_range_get_update_policy has been deprecated since version 2.24 and should not be used in newly-written code. There is no replacement. If you require delayed updates, you need to code it yourself. Gets the update policy of range. See gtk_range_set_update_policy().

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.

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.)

getValue
double getValue()

Gets the current value of the range.

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 "value-changed" signal if the value changes.

getRoundDigits
int getRoundDigits()

Gets the number of digits to round the value to when it changes. See "change-value". Since 2.24

setRoundDigits
void setRoundDigits(int roundDigits)

Sets the number of digits to round the value to when it changes. See "change-value". Since 2.24

setLowerStepperSensitivity
void setLowerStepperSensitivity(GtkSensitivityType sensitivity)

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

getLowerStepperSensitivity
GtkSensitivityType getLowerStepperSensitivity()

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

setUpperStepperSensitivity
void setUpperStepperSensitivity(GtkSensitivityType sensitivity)

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

getUpperStepperSensitivity
GtkSensitivityType getUpperStepperSensitivity()

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

getFlippable
int getFlippable()

Gets the value set by gtk_range_set_flippable(). Since 2.18

setFlippable
void setFlippable(int flippable)

If a range is flippable, it will switch its direction if it is horizontal and its direction is GTK_TEXT_DIR_RTL. See gtk_widget_get_direction(). Since 2.18

getMinSliderSize
int getMinSliderSize()

This function is useful mainly for GtkRange subclasses. See gtk_range_set_min_slider_size(). Since 2.20

getRangeRect
void getRangeRect(Rectangle rangeRect)

This function returns the area that contains the range's trough and its steppers, in widget->window coordinates. This function is useful mainly for GtkRange subclasses. Since 2.20

getSliderRange
void getSliderRange(int sliderStart, int sliderEnd)

This function returns sliders range along the long dimension, in widget->window coordinates. This function is useful mainly for GtkRange subclasses. Since 2.20

getSliderSizeFixed
int getSliderSizeFixed()

This function is useful mainly for GtkRange subclasses. See gtk_range_set_slider_size_fixed(). Since 2.20

setMinSliderSize
void setMinSliderSize(int minSize)

Sets the minimum size of the range's slider. This function is useful mainly for GtkRange subclasses. Since 2.20

setSliderSizeFixed
void setSliderSizeFixed(int sizeFixed)

Sets whether the range's slider has a fixed size, or a size that depends on it's adjustment's page size. This function is useful mainly for GtkRange subclasses. Since 2.20

Meta