Skip to main content

ComboBoxBuilder

Struct ComboBoxBuilder 

Source
pub struct ComboBoxBuilder<'a, D: Display + Default> { /* private fields */ }

Implementations§

Source§

impl<'a, D: Display + Default> ComboBoxBuilder<'a, D>

Source

pub fn flags(self, flags: ComboBoxFlags) -> ComboBoxBuilder<'a, D>

Source

pub fn ex_flags(self, flags: u32) -> ComboBoxBuilder<'a, D>

Source

pub fn size(self, size: (i32, i32)) -> ComboBoxBuilder<'a, D>

Source

pub fn position(self, pos: (i32, i32)) -> ComboBoxBuilder<'a, D>

Source

pub fn font(self, font: Option<&'a Font>) -> ComboBoxBuilder<'a, D>

Source

pub fn parent<C: Into<ControlHandle>>(self, p: C) -> ComboBoxBuilder<'a, D>

Examples found in repository?
examples/partials.rs (line 389)
357        fn build_partial<W: Into<ControlHandle>>(
358            data: &mut AnimalUi,
359            parent: Option<W>,
360        ) -> Result<(), NwgError> {
361            let parent = parent.unwrap().into();
362
363            nwg::Label::builder()
364                .text("Name:")
365                .h_align(nwg::HTextAlign::Right)
366                .parent(&parent)
367                .build(&mut data.label1)?;
368
369            nwg::Label::builder()
370                .text("Race:")
371                .h_align(nwg::HTextAlign::Right)
372                .parent(&parent)
373                .build(&mut data.label2)?;
374
375            nwg::Label::builder()
376                .text("Is fluffy:")
377                .h_align(nwg::HTextAlign::Right)
378                .parent(&parent)
379                .build(&mut data.label3)?;
380
381            nwg::TextInput::builder()
382                .text("Mittens")
383                .parent(&parent)
384                .build(&mut data.name_input)?;
385
386            nwg::ComboBox::builder()
387                .collection(vec!["Cat", "Dog", "Pidgeon", "Monkey"])
388                .selected_index(Some(0))
389                .parent(&parent)
390                .build(&mut data.race_input)?;
391
392            nwg::CheckBox::builder()
393                .text("")
394                .check_state(nwg::CheckBoxState::Checked)
395                .parent(&parent)
396                .build(&mut data.is_soft_input)?;
397
398            nwg::Button::builder()
399                .text("Save")
400                .parent(&parent)
401                .build(&mut data.save_btn)?;
402
403            nwg::GridLayout::builder()
404                .parent(&parent)
405                .max_size([1000, 150])
406                .min_size([100, 120])
407                .child(0, 0, &data.label1)
408                .child(0, 1, &data.label2)
409                .child(0, 2, &data.label3)
410                .child(1, 0, &data.name_input)
411                .child(1, 1, &data.race_input)
412                .child(1, 2, &data.is_soft_input)
413                .build(&data.layout)?;
414
415            nwg::GridLayout::builder()
416                .min_size([100, 200])
417                .max_column(Some(2))
418                .max_row(Some(6))
419                .child(1, 5, &data.save_btn)
420                .parent(&parent)
421                .build(&data.layout2)?;
422
423            Ok(())
424        }
Source

pub fn collection(self, collection: Vec<D>) -> ComboBoxBuilder<'a, D>

Examples found in repository?
examples/partials.rs (line 387)
357        fn build_partial<W: Into<ControlHandle>>(
358            data: &mut AnimalUi,
359            parent: Option<W>,
360        ) -> Result<(), NwgError> {
361            let parent = parent.unwrap().into();
362
363            nwg::Label::builder()
364                .text("Name:")
365                .h_align(nwg::HTextAlign::Right)
366                .parent(&parent)
367                .build(&mut data.label1)?;
368
369            nwg::Label::builder()
370                .text("Race:")
371                .h_align(nwg::HTextAlign::Right)
372                .parent(&parent)
373                .build(&mut data.label2)?;
374
375            nwg::Label::builder()
376                .text("Is fluffy:")
377                .h_align(nwg::HTextAlign::Right)
378                .parent(&parent)
379                .build(&mut data.label3)?;
380
381            nwg::TextInput::builder()
382                .text("Mittens")
383                .parent(&parent)
384                .build(&mut data.name_input)?;
385
386            nwg::ComboBox::builder()
387                .collection(vec!["Cat", "Dog", "Pidgeon", "Monkey"])
388                .selected_index(Some(0))
389                .parent(&parent)
390                .build(&mut data.race_input)?;
391
392            nwg::CheckBox::builder()
393                .text("")
394                .check_state(nwg::CheckBoxState::Checked)
395                .parent(&parent)
396                .build(&mut data.is_soft_input)?;
397
398            nwg::Button::builder()
399                .text("Save")
400                .parent(&parent)
401                .build(&mut data.save_btn)?;
402
403            nwg::GridLayout::builder()
404                .parent(&parent)
405                .max_size([1000, 150])
406                .min_size([100, 120])
407                .child(0, 0, &data.label1)
408                .child(0, 1, &data.label2)
409                .child(0, 2, &data.label3)
410                .child(1, 0, &data.name_input)
411                .child(1, 1, &data.race_input)
412                .child(1, 2, &data.is_soft_input)
413                .build(&data.layout)?;
414
415            nwg::GridLayout::builder()
416                .min_size([100, 200])
417                .max_column(Some(2))
418                .max_row(Some(6))
419                .child(1, 5, &data.save_btn)
420                .parent(&parent)
421                .build(&data.layout2)?;
422
423            Ok(())
424        }
Source

pub fn selected_index(self, index: Option<usize>) -> ComboBoxBuilder<'a, D>

Examples found in repository?
examples/partials.rs (line 388)
357        fn build_partial<W: Into<ControlHandle>>(
358            data: &mut AnimalUi,
359            parent: Option<W>,
360        ) -> Result<(), NwgError> {
361            let parent = parent.unwrap().into();
362
363            nwg::Label::builder()
364                .text("Name:")
365                .h_align(nwg::HTextAlign::Right)
366                .parent(&parent)
367                .build(&mut data.label1)?;
368
369            nwg::Label::builder()
370                .text("Race:")
371                .h_align(nwg::HTextAlign::Right)
372                .parent(&parent)
373                .build(&mut data.label2)?;
374
375            nwg::Label::builder()
376                .text("Is fluffy:")
377                .h_align(nwg::HTextAlign::Right)
378                .parent(&parent)
379                .build(&mut data.label3)?;
380
381            nwg::TextInput::builder()
382                .text("Mittens")
383                .parent(&parent)
384                .build(&mut data.name_input)?;
385
386            nwg::ComboBox::builder()
387                .collection(vec!["Cat", "Dog", "Pidgeon", "Monkey"])
388                .selected_index(Some(0))
389                .parent(&parent)
390                .build(&mut data.race_input)?;
391
392            nwg::CheckBox::builder()
393                .text("")
394                .check_state(nwg::CheckBoxState::Checked)
395                .parent(&parent)
396                .build(&mut data.is_soft_input)?;
397
398            nwg::Button::builder()
399                .text("Save")
400                .parent(&parent)
401                .build(&mut data.save_btn)?;
402
403            nwg::GridLayout::builder()
404                .parent(&parent)
405                .max_size([1000, 150])
406                .min_size([100, 120])
407                .child(0, 0, &data.label1)
408                .child(0, 1, &data.label2)
409                .child(0, 2, &data.label3)
410                .child(1, 0, &data.name_input)
411                .child(1, 1, &data.race_input)
412                .child(1, 2, &data.is_soft_input)
413                .build(&data.layout)?;
414
415            nwg::GridLayout::builder()
416                .min_size([100, 200])
417                .max_column(Some(2))
418                .max_row(Some(6))
419                .child(1, 5, &data.save_btn)
420                .parent(&parent)
421                .build(&data.layout2)?;
422
423            Ok(())
424        }
Source

pub fn enabled(self, e: bool) -> ComboBoxBuilder<'a, D>

Source

pub fn focus(self, focus: bool) -> ComboBoxBuilder<'a, D>

Source

pub fn v_align(self, _align: VTextAlign) -> ComboBoxBuilder<'a, D>

Source

pub fn build(self, out: &mut ComboBox<D>) -> Result<(), NwgError>

Examples found in repository?
examples/partials.rs (line 390)
357        fn build_partial<W: Into<ControlHandle>>(
358            data: &mut AnimalUi,
359            parent: Option<W>,
360        ) -> Result<(), NwgError> {
361            let parent = parent.unwrap().into();
362
363            nwg::Label::builder()
364                .text("Name:")
365                .h_align(nwg::HTextAlign::Right)
366                .parent(&parent)
367                .build(&mut data.label1)?;
368
369            nwg::Label::builder()
370                .text("Race:")
371                .h_align(nwg::HTextAlign::Right)
372                .parent(&parent)
373                .build(&mut data.label2)?;
374
375            nwg::Label::builder()
376                .text("Is fluffy:")
377                .h_align(nwg::HTextAlign::Right)
378                .parent(&parent)
379                .build(&mut data.label3)?;
380
381            nwg::TextInput::builder()
382                .text("Mittens")
383                .parent(&parent)
384                .build(&mut data.name_input)?;
385
386            nwg::ComboBox::builder()
387                .collection(vec!["Cat", "Dog", "Pidgeon", "Monkey"])
388                .selected_index(Some(0))
389                .parent(&parent)
390                .build(&mut data.race_input)?;
391
392            nwg::CheckBox::builder()
393                .text("")
394                .check_state(nwg::CheckBoxState::Checked)
395                .parent(&parent)
396                .build(&mut data.is_soft_input)?;
397
398            nwg::Button::builder()
399                .text("Save")
400                .parent(&parent)
401                .build(&mut data.save_btn)?;
402
403            nwg::GridLayout::builder()
404                .parent(&parent)
405                .max_size([1000, 150])
406                .min_size([100, 120])
407                .child(0, 0, &data.label1)
408                .child(0, 1, &data.label2)
409                .child(0, 2, &data.label3)
410                .child(1, 0, &data.name_input)
411                .child(1, 1, &data.race_input)
412                .child(1, 2, &data.is_soft_input)
413                .build(&data.layout)?;
414
415            nwg::GridLayout::builder()
416                .min_size([100, 200])
417                .max_column(Some(2))
418                .max_row(Some(6))
419                .child(1, 5, &data.save_btn)
420                .parent(&parent)
421                .build(&data.layout2)?;
422
423            Ok(())
424        }

Auto Trait Implementations§

§

impl<'a, D> !Send for ComboBoxBuilder<'a, D>

§

impl<'a, D> !Sync for ComboBoxBuilder<'a, D>

§

impl<'a, D> Freeze for ComboBoxBuilder<'a, D>

§

impl<'a, D> RefUnwindSafe for ComboBoxBuilder<'a, D>
where D: RefUnwindSafe,

§

impl<'a, D> Unpin for ComboBoxBuilder<'a, D>
where D: Unpin,

§

impl<'a, D> UnsafeUnpin for ComboBoxBuilder<'a, D>

§

impl<'a, D> UnwindSafe for ComboBoxBuilder<'a, D>
where D: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.