Class ComboRow

All Implemented Interfaces:
PointerInterface

public class ComboRow extends ActionRow
A [class@Gtk.ListBoxRow] used to choose from a list of items.

<picture>
<source srcset="combo-row-dark.png" media="(prefers-color-scheme: dark)">
<img src="combo-row.png" alt="combo-row">
</picture>

The `AdwComboRow` widget allows the user to choose from a list of valid
choices. The row displays the selected choice. When activated, the row
displays a popover which allows the user to make a new choice.

Example of an `AdwComboRow` UI definition:
```xml
<object class="AdwComboRow">
<property name="title" translatable="yes">Combo Row</property>
<property name="model">
<object class="GtkStringList">
<items>
<item translatable="yes">Foo</item>
<item translatable="yes">Bar</item>
<item translatable="yes">Baz</item>
</items>
</object>
</property>
</object>
```

The [property@ComboRow:selected] and [property@ComboRow:selected-item]
properties can be used to keep track of the selected item and react to their
changes.

`AdwComboRow` mirrors [class@Gtk.DropDown], see that widget for details.

`AdwComboRow` is [property@Gtk.ListBoxRow:activatable] if a model is set.

## CSS nodes

`AdwComboRow` has a main CSS node with name `row` and the `.combo` style
class.

Its popover has the node named `popover` with the `.menu` style class, it
contains a [class@Gtk.ScrolledWindow], which in turn contains a
[class@Gtk.ListView], both are accessible via their regular nodes.

## Accessibility

`AdwComboRow` uses the `GTK_ACCESSIBLE_ROLE_COMBO_BOX` role.

https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.ComboRow.html

  • Constructor Details

    • ComboRow

      public ComboRow(PointerContainer pointer)
    • ComboRow

      public ComboRow()
      Creates a new `AdwComboRow`.
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getExpression

      public Expression getExpression()
      Gets the expression used to obtain strings from items.
      Returns:
      the expression used to obtain strings from items
    • getFactory

      public ListItemFactory getFactory()
      Gets the factory for populating list items.
      Returns:
      the factory in use
    • getListFactory

      public ListItemFactory getListFactory()
      Gets the factory for populating list items in the popup.
      Returns:
      the factory in use
    • getModel

      public ListModel getModel()
      Gets the model that provides the displayed items.
      Returns:
      The model in use
    • getSelected

      public int getSelected()
      Gets the position of the selected item.
      Returns:
      the position of the selected item, or [const@Gtk.INVALID_LIST_POSITION] if no item is selected
    • getSelectedItem

      public Pointer getSelectedItem()
      Gets the selected item.
      Returns:
      the selected item
    • getUseSubtitle

      public boolean getUseSubtitle()
      Gets whether to use the current value as the subtitle.
      Returns:
      whether to use the current value as the subtitle
    • setExpression

      public void setExpression(@Nullable Expression expression)
      Sets the expression used to obtain strings from items.

      The expression must have a value type of `G_TYPE_STRING`.

      It's used to bind strings to labels produced by the default factory if
      [property@ComboRow:factory] is not set, or when
      [property@ComboRow:use-subtitle] is set to `TRUE`.
      Parameters:
      expression - an expression
    • setFactory

      public void setFactory(@Nullable ListItemFactory factory)
      Sets the factory for populating list items.

      This factory is always used for the item in the row. It is also used for
      items in the popup unless [property@ComboRow:list-factory] is set.
      Parameters:
      factory - the factory to use
    • setListFactory

      public void setListFactory(@Nullable ListItemFactory factory)
      Sets the factory for populating list items in the popup.

      If this is not set, [property@ComboRow:factory] is used.
      Parameters:
      factory - the factory to use
    • setModel

      public void setModel(@Nullable ListModel model)
      Sets the model that provides the displayed items.
      Parameters:
      model - the model to use
    • setSelected

      public void setSelected(int position)
      Selects the item at the given position.
      Parameters:
      position - the position of the item to select, or [const@Gtk.INVALID_LIST_POSITION]
    • setUseSubtitle

      public void setUseSubtitle(boolean use_subtitle)
      Sets whether to use the current value as the subtitle.

      If you use a custom list item factory, you will need to give the row a
      name conversion expression with [property@ComboRow:expression].

      If set to `TRUE`, you should not access [property@ActionRow:subtitle].

      The subtitle is interpreted as Pango markup if
      [property@PreferencesRow:use-markup] is set to `TRUE`.
      Parameters:
      use_subtitle - whether to use the current value as the subtitle
    • asAccessible

      public Accessible asAccessible()
      Implements interface Accessible. Call this to get access to interface functions.
      Overrides:
      asAccessible in class ActionRow
      Returns:
      Accessible
    • asActionable

      public Actionable asActionable()
      Implements interface Actionable. Call this to get access to interface functions.
      Overrides:
      asActionable in class ActionRow
      Returns:
      Actionable
    • asBuildable

      public Buildable asBuildable()
      Implements interface Buildable. Call this to get access to interface functions.
      Overrides:
      asBuildable in class ActionRow
      Returns:
      Buildable
    • asConstraintTarget

      public ConstraintTarget asConstraintTarget()
      Implements interface ConstraintTarget. Call this to get access to interface functions.
      Overrides:
      asConstraintTarget in class ActionRow
      Returns:
      ConstraintTarget
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()