ComboRow#
Superclasses: ActionRow, PreferencesRow, ListBoxRow, Widget, InitiallyUnowned, Object
Implemented Interfaces: Accessible, Actionable, Buildable, ConstraintTarget
A ListBoxRow used to choose from a list of items.
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 selected and 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 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_ACCESSIBLE_ROLE_COMBO_BOX role.
Constructors#
Methods#
- class ComboRow
- get_enable_search() bool#
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
expressionto be set.Added in version 1.4.
- get_expression() Expression | None#
Gets the expression used to obtain strings from items.
- get_factory() ListItemFactory | None#
Gets the factory for populating list items.
- get_header_factory() ListItemFactory | None#
Gets the factory that’s currently used to create header widgets for the popup.
Added in version 1.6.
- get_list_factory() ListItemFactory | None#
Gets the factory for populating list items in the popup.
- get_search_match_mode() StringFilterMatchMode#
Returns the match mode that the search filter is using.
Added in version 1.6.
- set_enable_search(enable_search: bool) None#
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
expressionto be set.Added in version 1.4.
- Parameters:
enable_search – whether to enable search
- set_expression(expression: Expression | None = None) None#
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
factoryis not set, or whenuse_subtitleis set toTRUE.- Parameters:
expression – an expression
- set_factory(factory: ListItemFactory | None = None) None#
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
list_factoryis set.- Parameters:
factory – the factory to use
- set_header_factory(factory: ListItemFactory | None = None) None#
Sets the factory to use for creating header widgets for the popup.
Added in version 1.6.
- Parameters:
factory – the factory to use
- set_list_factory(factory: ListItemFactory | None = None) None#
Sets the factory for populating list items in the popup.
If this is not set,
factoryis used.- Parameters:
factory – the factory to use
- set_model(model: ListModel | None = None) None#
Sets the model that provides the displayed items.
- Parameters:
model – the model to use
- set_search_match_mode(search_match_mode: StringFilterMatchMode) None#
Sets the match mode for the search filter.
Added in version 1.6.
- Parameters:
search_match_mode – the new match mode
- set_selected(position: int) None#
Selects the item at the given position.
- Parameters:
position – the position of the item to select, or
INVALID_LIST_POSITION
- set_use_subtitle(use_subtitle: bool) None#
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
expression.If set to
TRUE, you should not accesssubtitle.The subtitle is interpreted as Pango markup if
use_markupis set toTRUE.- Parameters:
use_subtitle – whether to use the current value as the subtitle
Properties#
- class ComboRow
-
- props.expression: Expression#
The type of the None singleton.
- props.factory: ListItemFactory#
The type of the None singleton.
- props.header_factory: ListItemFactory#
The type of the None singleton.
Added in version 1.6.
- props.list_factory: ListItemFactory#
The type of the None singleton.
- props.search_match_mode: StringFilterMatchMode#
The type of the None singleton.
Added in version 1.6.
Fields#
- class ComboRow
- parent_instance#