package ocgtk
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054
doc/ocgtk.gtk/Ocgtk_gtk/Gtk/Wrappers/Selection_model/index.html
Module Wrappers.Selection_model
type t = [ `selection_model ] Gobject.objval from_gobject : 'a Gobject.obj -> tval unselect_range : t -> int -> int -> boolRequests to unselect a range of items in the model.
val unselect_item : t -> int -> boolRequests to unselect an item in the model.
val unselect_all : t -> boolRequests to unselect all items in the model.
val set_selection :
t ->
[ `bitset ] Gobject.obj ->
[ `bitset ] Gobject.obj ->
boolMake selection changes.
This is the most advanced selection updating method that allows the most fine-grained control over selection changes. If you can, you should try the simpler versions, as implementations are more likely to implement support for those.
Requests that the selection state of all positions set in @mask be updated to the respective value in the @selected bitmask.
In pseudocode, it would look something like this:
```c for (i = 0; i < n_items; i++)
// don't change values not in the mask
if (!gtk_bitset_contains (mask, i))
continue;
if (gtk_bitset_contains (selected, i))
select_item (i);
else
unselect_item (i);
gtk_selection_model_selection_changed (model, first_changed_item, n_changed_items); ```
@mask and @selected must not be modified. They may refer to the same bitset, which would mean that every item in the set should be selected.
val selection_changed : t -> int -> int -> unitHelper function for implementations of `GtkSelectionModel`.
Call this when the selection changes to emit the signal@Gtk.SelectionModel::selection-changed signal.
val select_range : t -> int -> int -> bool -> boolRequests to select a range of items in the model.
val select_item : t -> int -> bool -> boolRequests to select an item in the model.
val select_all : t -> boolRequests to select all items in the model.
val is_selected : t -> int -> boolChecks if the given item is selected.
val get_selection_in_range : t -> int -> int -> [ `bitset ] Gobject.objGets the set of selected items in a range.
This function is an optimization for method@Gtk.SelectionModel.get_selection when you are only interested in part of the model's selected state. A common use case is in response to the signal@Gtk.SelectionModel::selection-changed signal.
val get_selection : t -> [ `bitset ] Gobject.objGets the set containing all currently selected items in the model.
This function may be slow, so if you are only interested in single item, consider using method@Gtk.SelectionModel.is_selected or if you are only interested in a few, consider method@Gtk.SelectionModel.get_selection_in_range.
val on_selection_changed :
?after:bool ->
t ->
callback:(position:int -> n_items:int -> unit) ->
Gobject.Signal.handler_id