Class: Handy::ComboRow

Inherits:
ActionRow show all
Defined in:
(unknown)

Instance Method Summary collapse

Methods inherited from ActionRow

#activatable_widget, #activatable_widget=, #activate, #add_prefix, #icon_name, #icon_name=, #subtitle, #subtitle=, #subtitle_lines, #subtitle_lines=, #title_lines, #title_lines=, #use_underline, #use_underline=, #use_underline?

Methods inherited from PreferencesRow

#title, #title=, #use_underline, #use_underline=, #use_underline?

Constructor Details

#initializeGtk::Widget

Creates a new HdyComboRow.

Instance Method Details

#bind_model(model, create_list_widget_func, create_current_widget_func, user_data, user_data_free_func) ⇒ nil

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.

Parameters:

  • model (Gio::ListModel)

    the [ifaceGio.ListModel] to be bound to self

  • create_list_widget_func (Gtk::ListBoxCreateWidgetFunc)

    a function that creates widgets for items to display in the list, or NULL in case you also passed NULL as model

  • create_current_widget_func (Gtk::ListBoxCreateWidgetFunc)

    a function that creates widgets for items to display as the selected item, or NULL in case you also passed NULL as model

  • user_data (GObject)

    user data passed to create_list_widget_func and create_current_widget_func

  • user_data_free_func (GLib::DestroyNotify)

    function for freeing user_data

Returns:

  • (nil)

#bind_name_model(model, get_name_func, user_data, user_data_free_func) ⇒ nil

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 [methodComboRow.bind_model] if you want to represent items of the model with names.

Parameters:

  • model (Gio::ListModel)

    the [ifaceGio.ListModel] to be bound to self

  • get_name_func (Handy::ComboRowGetNameFunc)

    a function that creates names for items, or NULL in case you also passed NULL as model

  • user_data (GObject)

    user data passed to get_name_func

  • user_data_free_func (GLib::DestroyNotify)

    function for freeing user_data

Returns:

  • (nil)

#modelGio::ListModel

Gets the model bound to self.

Returns:

  • (Gio::ListModel)

    the [ifaceGio.ListModel] bound to self

#selected_indexInteger

The index of the selected item in its [ifaceGio.ListModel].

Returns:

  • (Integer)

    selected-index

#selected_index=(selected_index) ⇒ Integer

The index of the selected item in its [ifaceGio.ListModel].

Parameters:

  • selected_index (Integer)

Returns:

  • (Integer)

    selected-index

  • (Integer)

    selected-index

#set_for_enum(enum_type, get_name_func, user_data, user_data_free_func) ⇒ nil

Creates a model for enum_type and binds it to self.

The items of the model will be [classEnumValueObject] 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 [methodComboRow.bind_name_model] if you want to represent values of an enumeration with names.

See [funcenum_value_row_name].

Parameters:

  • enum_type (GLib::Type)

    the enumeration [aliasGLib.Type] to be bound to self

  • get_name_func (Handy::ComboRowGetEnumValueNameFunc)

    a function that creates names for items, or NULL in case you also passed NULL as model

  • user_data (GObject)

    user data passed to get_name_func

  • user_data_free_func (GLib::DestroyNotify)

    function for freeing user_data

Returns:

  • (nil)

#set_get_name_func(get_name_func, user_data, user_data_free_func) ⇒ nil

Sets a closure to convert items into names.

See [propertyComboRow:use-subtitle].

Parameters:

  • get_name_func (Handy::ComboRowGetNameFunc)

    a function that creates names for items, or NULL in case you also passed NULL as model

  • user_data (GObject)

    user data passed to get_name_func

  • user_data_free_func (GLib::DestroyNotify)

    function for freeing user_data

Returns:

  • (nil)

#use_subtitleBoolean

Gets whether the current value of self should be displayed as its subtitle.

Returns:

  • (Boolean)

    whether the current value of self should be displayed as its subtitle

#use_subtitle=(use_subtitle) ⇒ Boolean

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 [methodComboRow.set_get_name_func].

If TRUE, you should not access [propertyActionRow:subtitle].

Parameters:

  • use_subtitle (Boolean)

Returns:

  • (Boolean)

    use-subtitle

  • (Boolean)

    use-subtitle

#use_subtitle?Boolean

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 [methodComboRow.set_get_name_func].

If TRUE, you should not access [propertyActionRow:subtitle].

Returns:

  • (Boolean)

    use-subtitle