Handy.ComboRow¶
- Subclasses:
None
Methods¶
- Inherited:
Handy.ActionRow (15), Handy.PreferencesRow (5), Gtk.ListBoxRow (10), Gtk.Bin (1), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Actionable (5)
- Structs:
Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
Properties¶
- Inherited:
Handy.ActionRow (5), Handy.PreferencesRow (2), Gtk.ListBoxRow (2), Gtk.Container (3), Gtk.Widget (39), Gtk.Actionable (2)
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w/en |
The index of the selected item |
||
r/w/en |
Set the current value as the subtitle |
Style Properties¶
- Inherited:
Signals¶
Fields¶
- Inherited:
Handy.ActionRow (1), Gtk.ListBoxRow (1), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)
Name |
Type |
Access |
Description |
|---|---|---|---|
parent_instance |
r |
Class Details¶
- class Handy.ComboRow(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A [class`Gtk`.ListBoxRow] used to choose from a list of items.
The
HdyComboRowwidget 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.The [class`ComboRow`] uses the model-view pattern; the list of valid choices is specified in the form of a [iface`Gio`.ListModel], and the display of the choices can be adapted to the data in the model via widget creation functions.
HdyComboRowis [property`Gtk`.ListBoxRow:activatable] if a model is set.- CSS nodes
HdyComboRowhas a main CSS node with namerow.Its popover has the node name popover with the
.combostyle class, it contains a [class`Gtk`.ScrolledWindow], which in turn contains a [class`Gtk`.ListBox], both are accessible via their regular nodes.A checkmark of node and style class
image.checkmarkin the popover denotes the current item.New in version 1.0.
- classmethod new()¶
- Returns:
the newly created
HdyComboRow- Return type:
Creates a new
HdyComboRow.New in version 1.0.
- bind_model(model, create_list_widget_func, create_current_widget_func, *user_data)¶
- Parameters:
model (
Gio.ListModelorNone) – the [iface`Gio`.ListModel] to be bound to selfcreate_list_widget_func (
Gtk.ListBoxCreateWidgetFuncorNone) – a function that creates widgets for items to display in the list, orNULLin case you also passedNULLas modelcreate_current_widget_func (
Gtk.ListBoxCreateWidgetFuncorNone) – a function that creates widgets for items to display as the selected item, orNULLin case you also passedNULLas modeluser_data (
objectorNone) – user data passed to create_list_widget_func and create_current_widget_func
Binds model to self.
If self was already bound to a model, that previous binding is destroyed.
The contents of self are cleared and then filled with widgets that represent items from model. self is updated whenever model changes. If model is
NULL, self is left empty.New in version 1.0.
- bind_name_model(model, get_name_func, *user_data)¶
- Parameters:
model (
Gio.ListModelorNone) – the [iface`Gio`.ListModel] to be bound to selfget_name_func (
Handy.ComboRowGetNameFuncorNone) – a function that creates names for items, orNULLin case you also passedNULLas modeluser_data (
objectorNone) – user data passed to get_name_func
Binds model to self.
If self was already bound to a model, that previous binding is destroyed.
The contents of self are cleared and then filled with widgets that represent items from model. self is updated whenever model changes. If model is
NULL, self is left empty.This is more convenient to use than [method`ComboRow`.bind_model] if you want to represent items of the model with names.
New in version 1.0.
- get_model()¶
- Returns:
the [iface`Gio`.ListModel] bound to self
- Return type:
Gets the model bound to self.
New in version 1.0.
- get_selected_index()¶
- Returns:
the index of the selected item, or -1 if no item is selected
- Return type:
Gets the index of the selected item in its [iface`Gio`.ListModel].
New in version 1.0.
- get_use_subtitle()¶
- Returns:
whether the current value of self should be displayed as its subtitle
- Return type:
Gets whether the current value of self should be displayed as its subtitle.
New in version 1.0.
- set_for_enum(enum_type, get_name_func, *user_data)¶
- Parameters:
enum_type (
GObject.GType) – the enumeration [alias`GLib`.Type] to be bound to selfget_name_func (
Handy.ComboRowGetEnumValueNameFuncorNone) – a function that creates names for items, orNULLin case you also passedNULLas modeluser_data (
objectorNone) – user data passed to get_name_func
Creates a model for enum_type and binds it to self.
The items of the model will be [class`EnumValueObject`] objects.
If self was already bound to a model, that previous binding is destroyed.
The contents of self are cleared and then filled with widgets that represent items from model. self is updated whenever model changes. If model is
NULL, self is left empty.This is more convenient to use than [method`ComboRow`.bind_name_model] if you want to represent values of an enumeration with names.
See [func`enum_value_row_name`].
New in version 1.0.
- set_get_name_func(get_name_func, *user_data)¶
- Parameters:
get_name_func (
Handy.ComboRowGetNameFuncorNone) – a function that creates names for items, orNULLin case you also passedNULLas modeluser_data (
objectorNone) – user data passed to get_name_func
Sets a closure to convert items into names.
See [property`ComboRow`:py:data::use-subtitle<Handy.ComboRow.props.use_subtitle>].
New in version 1.0.
- set_selected_index(selected_index)¶
- Parameters:
selected_index (
int) – the index of the selected item
Sets the index of the selected item in its [iface`Gio`.ListModel].
New in version 1.0.
- set_use_subtitle(use_subtitle)¶
- Parameters:
use_subtitle (
bool) –TRUEto set the current value as the subtitle
Sets whether the current value of self should be displayed as its subtitle.
If
TRUE, you should not access [property`ActionRow`:py:data::subtitle<Handy.ComboRow.props.subtitle>].New in version 1.0.
Property Details¶
- Handy.ComboRow.props.selected_index¶
- Name:
selected-index- Type:
- Default Value:
-1- Flags:
The index of the selected item in its [iface`Gio`.ListModel].
New in version 1.0.
- Handy.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 widget creation function, you will need to give the row a name conversion closure with [method`ComboRow`.set_get_name_func].
If
TRUE, you should not access [property`ActionRow`:py:data::subtitle<Handy.ComboRow.props.subtitle>].New in version 1.0.