Method

GtkSelectionModelset_selection

Declaration [src]

gboolean
gtk_selection_model_set_selection (
  GtkSelectionModel* model,
  GtkBitset* selected,
  GtkBitset* mask
)

Description [src]

Make 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:

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.

Parameters

selected GtkBitset
 

Bitmask specifying if items should be selected or unselected.

 The data is owned by the caller of the function.
mask GtkBitset
 

Bitmask specifying which items should be updated.

 The data is owned by the caller of the function.

Return value

Returns: gboolean
 

TRUE if this action was supported and no fallback should be tried. This does not mean that all items were updated according to the inputs.