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 duplicate 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>
impl<E> Component for SimpleComboBox<E>
Source§type CommandOutput = ()
type CommandOutput = ()
Messages which are received from commands executing in the background.
Source§type Input = SimpleComboBoxMsg<E>
type Input = SimpleComboBoxMsg<E>
The message type that the component accepts as inputs.
Source§type Init = SimpleComboBox<E>
type Init = SimpleComboBox<E>
The parameter used to initialize the component.
Source§type Root = ComboBoxText
type Root = ComboBoxText
The top-level widget of the component.
Source§type Widgets = ComboBoxText
type Widgets = ComboBoxText
The type that’s used for storing widgets created for this component.
Source§fn init(
model: Self::Init,
widgets: Self::Root,
sender: ComponentSender<Self>,
) -> ComponentParts<Self>
fn init( model: Self::Init, widgets: 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.
impl<E: Eq + ToString> Eq for SimpleComboBox<E>
impl<E: ToString> StructuralPartialEq for SimpleComboBox<E>
Auto Trait Implementations§
impl<E> Freeze for SimpleComboBox<E>
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<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.