package ocgtk

  1. Overview
  2. Docs
OCaml bindings for GTK 4

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1-preview2.tar.gz
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054

doc/ocgtk.gtk/Ocgtk_gtk/Gtk/Wrappers/Scale/index.html

Module Wrappers.Scale

type t = [ `scale | `range | `widget | `initially_unowned | `object_ ] Gobject.obj
val new_ : Gtk_enums.orientation -> [ `adjustment | `initially_unowned | `object_ ] Gobject.obj option -> t

Create a new Scale

val new_with_range : Gtk_enums.orientation -> float -> float -> float -> t

Create a new Scale

val set_value_pos : t -> Gtk_enums.positiontype -> unit

Sets the position in which the current value is displayed.

val set_has_origin : t -> bool -> unit

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.

val set_draw_value : t -> bool -> unit

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

val set_digits : t -> int -> unit

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.

val get_value_pos : t -> Gtk_enums.positiontype

Gets the position in which the current value is displayed.

val get_layout_offsets : t -> int * int

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

val get_layout : t -> Ocgtk_pango.Pango.Wrappers.Layout.t option

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.

val get_has_origin : t -> bool

Returns whether the scale has an origin.

val get_draw_value : t -> bool

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

val get_digits : t -> int

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

val clear_marks : t -> unit

Removes any marks that have been added.

val add_mark : t -> float -> Gtk_enums.positiontype -> string option -> unit

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.