:right-sidebar: True ComboRow =================================================================== .. currentmodule:: gi.repository.Adw .. class:: ComboRow(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Adw.ActionRow`, :class:`~gi.repository.Adw.PreferencesRow`, :class:`~gi.repository.Gtk.ListBoxRow`, :class:`~gi.repository.Gtk.Widget`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gtk.Accessible`, :class:`~gi.repository.Gtk.Actionable`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.ConstraintTarget` A :obj:`~gi.repository.Gtk.ListBoxRow` used to choose from a list of items. .. image:: https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1-latest/combo-row.png 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: .. code-block:: xml :dedent: Combo Row Foo Bar Baz The :obj:`~gi.repository.Adw.ComboRow.props.selected` and :obj:`~gi.repository.Adw.ComboRow.props.selected_item` properties can be used to keep track of the selected item and react to their changes. ``AdwComboRow`` mirrors :obj:`~gi.repository.Gtk.DropDown`\, see that widget for details. ``AdwComboRow`` is :obj:`~gi.repository.Gtk.ListBoxRow.props.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 :obj:`~gi.repository.Gtk.ScrolledWindow`\, which in turn contains a :obj:`~gi.repository.Gtk.ListView`\, both are accessible via their regular nodes. Accessibility -------------------------------------------------------------------------------- ``AdwComboRow`` uses the ``GTK_ACCESSIBLE_ROLE_COMBO_BOX`` role. Constructors ------------ .. rst-class:: interim-class .. class:: ComboRow :no-index: .. classmethod:: new() -> ~gi.repository.Gtk.Widget Creates a new ``AdwComboRow``\. Methods ------- .. rst-class:: interim-class .. class:: ComboRow :no-index: .. method:: 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 :obj:`~gi.repository.Adw.ComboRow.props.expression` to be set. .. versionadded:: 1.4 .. method:: get_expression() -> ~gi.repository.Gtk.Expression | None Gets the expression used to obtain strings from items. .. method:: get_factory() -> ~gi.repository.Gtk.ListItemFactory | None Gets the factory for populating list items. .. method:: get_header_factory() -> ~gi.repository.Gtk.ListItemFactory | None Gets the factory that's currently used to create header widgets for the popup. .. versionadded:: 1.6 .. method:: get_list_factory() -> ~gi.repository.Gtk.ListItemFactory | None Gets the factory for populating list items in the popup. .. method:: get_model() -> ~gi.repository.Gio.ListModel | None Gets the model that provides the displayed items. .. method:: get_search_match_mode() -> ~gi.repository.Gtk.StringFilterMatchMode Returns the match mode that the search filter is using. .. versionadded:: 1.6 .. method:: get_selected() -> int Gets the position of the selected item. .. method:: get_selected_item() -> ~gi.repository.GObject.Object | None Gets the selected item. .. method:: get_use_subtitle() -> bool Gets whether to use the current value as the subtitle. .. method:: 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 :obj:`~gi.repository.Adw.ComboRow.props.expression` to be set. .. versionadded:: 1.4 :param enable_search: whether to enable search .. method:: set_expression(expression: ~gi.repository.Gtk.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 :obj:`~gi.repository.Adw.ComboRow.props.factory` is not set, or when :obj:`~gi.repository.Adw.ComboRow.props.use_subtitle` is set to ``TRUE``\. :param expression: an expression .. method:: set_factory(factory: ~gi.repository.Gtk.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 :obj:`~gi.repository.Adw.ComboRow.props.list_factory` is set. :param factory: the factory to use .. method:: set_header_factory(factory: ~gi.repository.Gtk.ListItemFactory | None = None) -> None Sets the factory to use for creating header widgets for the popup. .. versionadded:: 1.6 :param factory: the factory to use .. method:: set_list_factory(factory: ~gi.repository.Gtk.ListItemFactory | None = None) -> None Sets the factory for populating list items in the popup. If this is not set, :obj:`~gi.repository.Adw.ComboRow.props.factory` is used. :param factory: the factory to use .. method:: set_model(model: ~gi.repository.Gio.ListModel | None = None) -> None Sets the model that provides the displayed items. :param model: the model to use .. method:: set_search_match_mode(search_match_mode: ~gi.repository.Gtk.StringFilterMatchMode) -> None Sets the match mode for the search filter. .. versionadded:: 1.6 :param search_match_mode: the new match mode .. method:: set_selected(position: int) -> None Selects the item at the given position. :param position: the position of the item to select, or :obj:`~gi.repository.Gtk.INVALID_LIST_POSITION` .. method:: 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 :obj:`~gi.repository.Adw.ComboRow.props.expression`\. If set to ``TRUE``\, you should not access :obj:`~gi.repository.Adw.ActionRow.props.subtitle`\. The subtitle is interpreted as Pango markup if :obj:`~gi.repository.Adw.PreferencesRow.props.use_markup` is set to ``TRUE``\. :param use_subtitle: whether to use the current value as the subtitle Properties ---------- .. rst-class:: interim-class .. class:: ComboRow :no-index: .. attribute:: props.enable_search :type: bool The type of the None singleton. .. versionadded:: 1.4 .. attribute:: props.expression :type: ~gi.repository.Gtk.Expression The type of the None singleton. .. attribute:: props.factory :type: ~gi.repository.Gtk.ListItemFactory The type of the None singleton. .. attribute:: props.header_factory :type: ~gi.repository.Gtk.ListItemFactory The type of the None singleton. .. versionadded:: 1.6 .. attribute:: props.list_factory :type: ~gi.repository.Gtk.ListItemFactory The type of the None singleton. .. attribute:: props.model :type: ~gi.repository.Gio.ListModel The type of the None singleton. .. attribute:: props.search_match_mode :type: ~gi.repository.Gtk.StringFilterMatchMode The type of the None singleton. .. versionadded:: 1.6 .. attribute:: props.selected :type: int The type of the None singleton. .. attribute:: props.selected_item :type: ~gi.repository.GObject.Object The type of the None singleton. .. attribute:: props.use_subtitle :type: bool The type of the None singleton. Fields ------ .. rst-class:: interim-class .. class:: ComboRow :no-index: .. attribute:: parent_instance