Struct relm4_components::simple_combo_box::SimpleComboBox
source · pub struct SimpleComboBox<E: ToString> {
pub variants: Vec<E>,
pub active_index: Option<usize>,
}Expand description
A simple wrapper around gtk::ComboBox.
This can be used with enums, Strings or any custom type you want.
The only requirement is that the inner type implements ToString and Debug.
To get notified when the selection changed, you can use
Connector::forward()
after launching the component.
Fields§
§variants: Vec<E>The variants that can be selected.
active_index: Option<usize>The index of the active element or None is nothing is selected.
Implementations§
source§impl<E> SimpleComboBox<E>where
E: ToString,
impl<E> SimpleComboBox<E>where E: ToString,
sourcepub fn get_active_elem(&self) -> Option<&E>
pub fn get_active_elem(&self) -> Option<&E>
Return the value of the currently selected element or None if nothing is selected.
Trait Implementations§
source§impl<E: Clone + ToString> Clone for SimpleComboBox<E>
impl<E: Clone + ToString> Clone for SimpleComboBox<E>
source§fn clone(&self) -> SimpleComboBox<E>
fn clone(&self) -> SimpleComboBox<E>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl<E> Component for SimpleComboBox<E>where
E: ToString + 'static + Debug,
impl<E> Component for SimpleComboBox<E>where E: ToString + 'static + Debug,
§type CommandOutput = ()
type CommandOutput = ()
Messages which are received from commands executing in the background.
§type Input = SimpleComboBoxMsg<E>
type Input = SimpleComboBoxMsg<E>
The message type that the component accepts as inputs.
§type Init = SimpleComboBox<E>
type Init = SimpleComboBox<E>
The parameter used to initialize the component.
§type Root = ComboBoxText
type Root = ComboBoxText
The widget that was constructed by the component.
§type Widgets = ComboBoxText
type Widgets = ComboBoxText
The type that’s used for storing widgets created for this component.
source§fn init(
model: Self::Init,
root: &Self::Root,
sender: ComponentSender<Self>
) -> ComponentParts<Self>
fn init( model: Self::Init, root: &Self::Root, sender: ComponentSender<Self> ) -> ComponentParts<Self>
Creates the initial model and view, docking it into the component.
source§fn update_with_view(
&mut self,
widgets: &mut Self::Widgets,
input: Self::Input,
sender: ComponentSender<Self>,
_root: &Self::Root
)
fn update_with_view( &mut self, widgets: &mut Self::Widgets, input: Self::Input, sender: ComponentSender<Self>, _root: &Self::Root )
Updates the model and view when a new input is received. Read more
source§fn builder() -> ComponentBuilder<Self>
fn builder() -> ComponentBuilder<Self>
Create a builder for this component.
source§fn update(
&mut self,
message: Self::Input,
sender: ComponentSender<Self>,
root: &Self::Root
)
fn update( &mut self, message: Self::Input, sender: ComponentSender<Self>, root: &Self::Root )
Processes inputs received by the component.
source§fn update_cmd(
&mut self,
message: Self::CommandOutput,
sender: ComponentSender<Self>,
root: &Self::Root
)
fn update_cmd( &mut self, message: Self::CommandOutput, sender: ComponentSender<Self>, root: &Self::Root )
Defines how the component should respond to command updates.
source§fn update_cmd_with_view(
&mut self,
widgets: &mut Self::Widgets,
message: Self::CommandOutput,
sender: ComponentSender<Self>,
root: &Self::Root
)
fn update_cmd_with_view( &mut self, widgets: &mut Self::Widgets, message: Self::CommandOutput, sender: ComponentSender<Self>, root: &Self::Root )
Updates the model and view upon completion of a command. Read more
source§fn update_view(
&self,
widgets: &mut Self::Widgets,
sender: ComponentSender<Self>
)
fn update_view( &self, widgets: &mut Self::Widgets, sender: ComponentSender<Self> )
Updates the view after the model has been updated.
source§impl<E: PartialEq + ToString> PartialEq<SimpleComboBox<E>> for SimpleComboBox<E>
impl<E: PartialEq + ToString> PartialEq<SimpleComboBox<E>> for SimpleComboBox<E>
source§fn eq(&self, other: &SimpleComboBox<E>) -> bool
fn eq(&self, other: &SimpleComboBox<E>) -> bool
This method tests for
self and other values to be equal, and is used
by ==.impl<E: Eq + ToString> Eq for SimpleComboBox<E>
impl<E: ToString> StructuralEq for SimpleComboBox<E>
impl<E: ToString> StructuralPartialEq for SimpleComboBox<E>
Auto Trait Implementations§
impl<E> RefUnwindSafe for SimpleComboBox<E>where E: RefUnwindSafe,
impl<E> Send for SimpleComboBox<E>where E: Send,
impl<E> Sync for SimpleComboBox<E>where E: Sync,
impl<E> Unpin for SimpleComboBox<E>where E: Unpin,
impl<E> UnwindSafe for SimpleComboBox<E>where E: UnwindSafe,
Blanket Implementations§
source§impl<C> AsyncPosition<()> for C
impl<C> AsyncPosition<()> for C
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.