Adw.ComboRow¶
- Subclasses:
None
Methods¶
- Inherited:
Adw.ActionRow (17), Adw.PreferencesRow (9), Gtk.ListBoxRow (12), Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1), Gtk.Actionable (5)
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
Properties¶
- Inherited:
Adw.ActionRow (6), Adw.PreferencesRow (4), Gtk.ListBoxRow (3), Gtk.Widget (34), Gtk.Accessible (1), Gtk.Actionable (2)
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
|||
r/w/en |
Expression to determine strings to search for |
||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r |
|||
r/w/en |
Signals¶
- Inherited:
Adw.ActionRow (1), Gtk.ListBoxRow (1), Gtk.Widget (13), GObject.Object (1)
Fields¶
- Inherited:
Adw.ActionRow (1), Gtk.ListBoxRow (1), Gtk.Widget (13), GObject.Object (1)
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Adw.ComboRow(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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`:py:data::selected<Adw.ComboRow.props.selected>] and [property`ComboRow`:py:data::selected-item<Adw.ComboRow.props.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 namerow
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 theGTK_ACCESSIBLE_ROLE_COMBO_BOX
role.- classmethod new()¶
- Returns:
the newly created
AdwComboRow
- Return type:
Creates a new
AdwComboRow
.
- get_enable_search()¶
- Returns:
whether the popup includes a search entry
- Return type:
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 [property`ComboRow`:py:data::expression<Adw.ComboRow.props.expression>] to be set.
New in version 1.4.
- get_expression()¶
- Returns:
the expression used to obtain strings from items
- Return type:
Gets the expression used to obtain strings from items.
- get_factory()¶
- Returns:
the factory in use
- Return type:
Gets the factory for populating list items.
- get_list_factory()¶
- Returns:
the factory in use
- Return type:
Gets the factory for populating list items in the popup.
- get_model()¶
- Returns:
The model in use
- Return type:
Gets the model that provides the displayed items.
- get_selected()¶
- Returns:
the position of the selected item, or [const`Gtk`.INVALID_LIST_POSITION] if no item is selected
- Return type:
Gets the position of the selected item.
- get_selected_item()¶
- Returns:
the selected item
- Return type:
Gets the selected item.
- get_use_subtitle()¶
- Returns:
whether to use the current value as the subtitle
- Return type:
Gets whether to use the current value as the subtitle.
- set_enable_search(enable_search)¶
- Parameters:
enable_search (
bool
) – whether to enable search
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 [property`ComboRow`:py:data::expression<Adw.ComboRow.props.expression>] to be set.
New in version 1.4.
- set_expression(expression)¶
- Parameters:
expression (
Gtk.Expression
orNone
) – an 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`:py:data::factory<Adw.ComboRow.props.factory>] is not set, or when [property`ComboRow`:py:data::use-subtitle<Adw.ComboRow.props.use_subtitle>] is set to
TRUE
.
- set_factory(factory)¶
- Parameters:
factory (
Gtk.ListItemFactory
orNone
) – the factory to use
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`:py:data::list-factory<Adw.ComboRow.props.list_factory>] is set.
- set_list_factory(factory)¶
- Parameters:
factory (
Gtk.ListItemFactory
orNone
) – the factory to use
Sets the factory for populating list items in the popup.
If this is not set, [property`ComboRow`:py:data::factory<Adw.ComboRow.props.factory>] is used.
- set_model(model)¶
- Parameters:
model (
Gio.ListModel
orNone
) – the model to use
Sets the model that provides the displayed items.
- set_selected(position)¶
- Parameters:
position (
int
) – the position of the item to select, or [const`Gtk`.INVALID_LIST_POSITION]
Selects the item at the given position.
- set_use_subtitle(use_subtitle)¶
- Parameters:
use_subtitle (
bool
) – whether to use the current value as the 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`:py:data::expression<Adw.ComboRow.props.expression>].
If set to
TRUE
, you should not access [property`ActionRow`:py:data::subtitle<Adw.ComboRow.props.subtitle>].The subtitle is interpreted as Pango markup if [property`PreferencesRow`:py:data::use-markup<Adw.ComboRow.props.use_markup>] is set to
TRUE
.
Property Details¶
- Adw.ComboRow.props.enable_search¶
- Name:
enable-search
- Type:
- Default Value:
- Flags:
Whether to show a search entry in the popup.
If set to
TRUE
, a search entry will be shown in the popup that allows to search for items in the list.Search requires [property`ComboRow`:py:data::expression<Adw.ComboRow.props.expression>] to be set.
New in version 1.4.
- Adw.ComboRow.props.expression¶
- Name:
expression
- Type:
- Default Value:
- Flags:
An 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`:py:data::factory<Adw.ComboRow.props.factory>] is not set, or when [property`ComboRow`:py:data::use-subtitle<Adw.ComboRow.props.use_subtitle>] is set to
TRUE
.
- Adw.ComboRow.props.factory¶
- Name:
factory
- Type:
- Default Value:
- Flags:
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`:py:data::list-factory<Adw.ComboRow.props.list_factory>] is set.
- Adw.ComboRow.props.list_factory¶
- Name:
list-factory
- Type:
- Default Value:
- Flags:
The factory for populating list items in the popup.
If this is not set, [property`ComboRow`:py:data::factory<Adw.ComboRow.props.factory>] is used.
- Adw.ComboRow.props.model¶
- Name:
model
- Type:
- Default Value:
- Flags:
The model that provides the displayed items.
- Adw.ComboRow.props.selected¶
- Name:
selected
- Type:
- Default Value:
4294967295
- Flags:
The position of the selected item.
If no item is selected, the property has the value [const`Gtk`.INVALID_LIST_POSITION]
- Adw.ComboRow.props.selected_item¶
- Name:
selected-item
- Type:
- Default Value:
- Flags:
The selected item.
- Adw.ComboRow.props.use_subtitle¶
- Name:
use-subtitle
- Type:
- Default Value:
- Flags:
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`:py:data::expression<Adw.ComboRow.props.expression>].
If set to
TRUE
, you should not access [property`ActionRow`:py:data::subtitle<Adw.ComboRow.props.subtitle>].The subtitle is interpreted as Pango markup if [property`PreferencesRow`:py:data::use-markup<Adw.ComboRow.props.use_markup>] is set to
TRUE
.