Class ComboRow

All Implemented Interfaces:
Accessible, Actionable, Buildable, ConstraintTarget, Proxy

@Generated("org.javagi.JavaGI") public class ComboRow extends ActionRow implements Accessible, Actionable, Buildable, ConstraintTarget

A ListBoxRow used to choose from a list of items.

combo-row

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:

<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 ComboRow:selected and ComboRow:selected-item properties can be used to keep track of the selected item and react to their changes.

AdwComboRow mirrors DropDown, see that widget for details.

AdwComboRow is 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 ScrolledWindow, which in turn contains a ListView, both are accessible via their regular nodes.

Accessibility

AdwComboRow uses the Gtk.AccessibleRole.combo-box role.

  • Constructor Details

    • ComboRow

      public ComboRow(MemorySegment address)
      Create a ComboRow instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • ComboRow

      public ComboRow()
      Create a new ComboRow.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the ComboRow class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected ComboRow asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class ActionRow
      Returns:
      the instance as if it were its parent type
    • getEnableSearch

      public boolean getEnableSearch()

      Gets whether search is enabled.

      If set to TRUE, a search entry will be shown in the popup that allows to search for items in the list.

      Search requires ComboRow:expression to be set.

      Returns:
      whether the popup includes a search entry
      Since:
      1.4
    • getExpression

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

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

      public @Nullable ListItemFactory getHeaderFactory()
      Gets the factory that's currently used to create header widgets for the popup.
      Returns:
      The factory in use
      Since:
      1.6
    • getListFactory

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

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

      public StringFilterMatchMode getSearchMatchMode()
      Returns the match mode that the search filter is using.
      Returns:
      the match mode of the search filter
      Since:
      1.6
    • getSelected

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

      public @Nullable GObject 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
    • setEnableSearch

      public void setEnableSearch(boolean enableSearch)

      Sets whether to enable search.

      If set to TRUE, a search entry will be shown in the popup that allows to search for items in the list.

      Search requires ComboRow:expression to be set.

      Parameters:
      enableSearch - whether to enable search
      Since:
      1.4
    • 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 ComboRow:factory is not set, or when 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 ComboRow:list-factory is set.

      Parameters:
      factory - the factory to use
    • setHeaderFactory

      public void setHeaderFactory(@Nullable ListItemFactory factory)
      Sets the factory to use for creating header widgets for the popup.
      Parameters:
      factory - the factory to use
      Since:
      1.6
    • setListFactory

      public void setListFactory(@Nullable ListItemFactory factory)

      Sets the factory for populating list items in the popup.

      If this is not set, 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
    • setSearchMatchMode

      public void setSearchMatchMode(StringFilterMatchMode searchMatchMode)
      Sets the match mode for the search filter.
      Parameters:
      searchMatchMode - the new match mode
      Since:
      1.6
    • setSelected

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

      public void setUseSubtitle(boolean useSubtitle)

      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 ComboRow:expression.

      If set to TRUE, you should not access ActionRow:subtitle.

      The subtitle is interpreted as Pango markup if PreferencesRow:use-markup is set to TRUE.

      Parameters:
      useSubtitle - whether to use the current value as the subtitle
    • builder

      public static ComboRow.Builder<? extends ComboRow.Builder> builder()
      A ComboRow.Builder object constructs a ComboRow with the specified properties. Use the various set...() methods to set properties, and finish construction with ComboRow.Builder.build().
      Returns:
      the builder object