Trait libhandy::prelude::ComboRowExt
source · pub trait ComboRowExt: IsA<ComboRow> + Sealed + 'static {
// Provided methods
fn bind_name_model(
&self,
model: Option<&impl IsA<ListModel>>,
get_name_func: Option<Box_<dyn Fn(&Object) -> String + 'static>>
) { ... }
fn model(&self) -> Option<ListModel> { ... }
fn selected_index(&self) -> i32 { ... }
fn uses_subtitle(&self) -> bool { ... }
fn set_for_enum(
&self,
enum_type: Type,
get_name_func: Option<Box_<dyn Fn(&EnumValueObject) -> String + 'static>>
) { ... }
fn set_get_name_func(
&self,
get_name_func: Option<Box_<dyn Fn(&Object) -> String + 'static>>
) { ... }
fn set_selected_index(&self, selected_index: i32) { ... }
fn set_use_subtitle(&self, use_subtitle: bool) { ... }
fn connect_selected_index_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_use_subtitle_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
}
Expand description
Provided Methods§
sourcefn bind_name_model(
&self,
model: Option<&impl IsA<ListModel>>,
get_name_func: Option<Box_<dyn Fn(&Object) -> String + 'static>>
)
fn bind_name_model( &self, model: Option<&impl IsA<ListModel>>, get_name_func: Option<Box_<dyn Fn(&Object) -> String + 'static>> )
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 ComboRow::bind_model()
if you want
to represent items of the model with names.
model
the [gio::ListModel
][crate::gio::ListModel] to be bound to @self
get_name_func
a function that creates names for items, or
NULL
in case you also passed NULL
as @model
sourcefn selected_index(&self) -> i32
fn selected_index(&self) -> i32
Gets the index of the selected item in its [gio::ListModel
][crate::gio::ListModel].
Returns
the index of the selected item, or -1 if no item is selected
sourcefn uses_subtitle(&self) -> bool
fn uses_subtitle(&self) -> bool
Gets whether the current value of @self should be displayed as its subtitle.
Returns
whether the current value of @self should be displayed as its subtitle
sourcefn set_for_enum(
&self,
enum_type: Type,
get_name_func: Option<Box_<dyn Fn(&EnumValueObject) -> String + 'static>>
)
fn set_for_enum( &self, enum_type: Type, get_name_func: Option<Box_<dyn Fn(&EnumValueObject) -> String + 'static>> )
Creates a model for @enum_type and binds it to @self.
The items of the model will be 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 bind_name_model()
if you
want to represent values of an enumeration with names.
See enum_value_row_name()
.
enum_type
the enumeration alias::GLib.Type
to be bound to @self
get_name_func
a function that creates names for items, or
NULL
in case you also passed NULL
as @model
sourcefn set_get_name_func(
&self,
get_name_func: Option<Box_<dyn Fn(&Object) -> String + 'static>>
)
fn set_get_name_func( &self, get_name_func: Option<Box_<dyn Fn(&Object) -> String + 'static>> )
Sets a closure to convert items into names.
See use-subtitle
.
get_name_func
a function that creates names for items, or
NULL
in case you also passed NULL
as @model
sourcefn set_selected_index(&self, selected_index: i32)
fn set_selected_index(&self, selected_index: i32)
Sets the index of the selected item in its [gio::ListModel
][crate::gio::ListModel].
selected_index
the index of the selected item
sourcefn set_use_subtitle(&self, use_subtitle: bool)
fn set_use_subtitle(&self, use_subtitle: bool)
Sets whether the current value of @self should be displayed as its subtitle.
If TRUE
, you should not access subtitle
.
use_subtitle
TRUE
to set the current value as the subtitle