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/Single_selection/index.html

Module Wrappers.Single_selection

type t = [ `single_selection | `object_ ] Gobject.obj

Create a new SingleSelection

val set_selected : t -> int -> unit

Selects the item at the given position.

If the list does not have an item at @position or %GTK_INVALID_LIST_POSITION is given, the behavior depends on the value of the property@Gtk.SingleSelection:autoselect property: If it is set, no change will occur and the old item will stay selected. If it is unset, the selection will be unset and no item will be selected.

val set_model : t -> Ocgtk_gio.Gio.Wrappers.List_model.t option -> unit

Sets the model that @self should wrap.

If @model is %NULL, @self will be empty.

val set_can_unselect : t -> bool -> unit

If %TRUE, unselecting the current item via gtk_selection_model_unselect_item() is supported.

Note that setting property@Gtk.SingleSelection:autoselect will cause unselecting to not work, so it practically makes no sense to set both at the same time the same time.

val set_autoselect : t -> bool -> unit

Enables or disables autoselect.

If @autoselect is %TRUE, @self will enforce that an item is always selected. It will select a new item when the currently selected item is deleted and it will disallow unselecting the current item.

val get_selected_item : t -> [ `object_ ] Gobject.obj option

Gets the selected item.

If no item is selected, %NULL is returned.

val get_selected : t -> int

Gets the position of the selected item.

If no item is selected, %GTK_INVALID_LIST_POSITION is returned.

val get_model : t -> Ocgtk_gio.Gio.Wrappers.List_model.t option

Gets the model that @self is wrapping.

val get_can_unselect : t -> bool

If %TRUE, gtk_selection_model_unselect_item() is supported and allows unselecting the selected item.

val get_autoselect : t -> bool

Checks if autoselect has been enabled or disabled via gtk_single_selection_set_autoselect().

val get_item_type : t -> Gobject.Type.t

Get property: item-type

val get_n_items : t -> int

Get property: n-items