Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: SingleSelection

[16:7] extends: object

A selection model that allows selecting a single item. Note that the selection is persistent -- if the selected item is removed and re-added in the same [signal@Gio.ListModel::items-changed] emission, it stays selected. In particular, this means that changing the sort order of an underlying sort model will preserve the selection.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • SingleSelection (model = null)

    Creates a new selection to handle @model.

    • @p model is the GListModel to manage.
  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • asObject ()

    Wraps this handle as Object.

    • @r A Object object.
  • asListModel ()

    Wraps this handle as ListModel.

    • @r A ListModel object.
  • asSectionModel ()

    Wraps this handle as SectionModel.

    • @r A SectionModel object.
  • asSelectionModel ()

    Wraps this handle as SelectionModel.

    • @r A SelectionModel object.
  • getProperty (string Name)

    Reads one generated property by name.

  • setProperty (string Name, Value)

    Writes one generated property by name.

  • setAutoselect (bool Value)

    If the selection will always select an item.

    • @p Value is the new property value.
    • @r None.
  • setCanunselect (bool Value)

    If unselecting the selected item is allowed.

    • @p Value is the new property value.
    • @r None.
  • setModel (object Value)

    The model being managed.

    • @p Value is the new property value.
    • @r None.
  • setSelected (int Value)

    Position of the selected item.

    • @p Value is the new property value.
    • @r None.
  • get_autoselect ()

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

  • get_can_unselect ()

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

  • get_model ()

    Gets the model that @self is wrapping.

  • get_selected ()

    Gets the position of the selected item. If no item is selected, %GTK_INVALID_LIST_POSITION is returned.

  • get_selected_item ()

    Gets the selected item. If no item is selected, %NULL is returned.

  • set_autoselect (bool autoselect)

    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.

    • @p autoselect is %TRUE to always select an item.
    • @r None.
  • set_can_unselect (bool can_unselect)

    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.

    • @p can_unselect is %TRUE to allow unselecting.
    • @r None.
  • set_model (object model)

    Sets the model that @self should wrap. If @model is %NULL, @self will be empty.

    • @p model is A GListModel to wrap.
    • @r None.
  • set_selected (int position)

    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. This also applies if [property@Gtk.SingleSelection:can-unselect] is set to %FALSE.

    • @p position is the item to select or %GTK_INVALID_LIST_POSITION.
    • @r None.
  • model ()

    Returns get_model as an Aussom list of wrapper objects. This companion method materializes the full collection up front; use get_model() when lazy or change-notify access is required.

    • @r An Aussom list of elements.

class: SingleSelectionMeta

[332:14] static extends: object

Generated metadata helpers for SingleSelection class surfaces.

Methods

  • properties ()

    Returns property metadata for SingleSelection.

    • @r A list.