Skip to main content

CheckBoxBuilder

Struct CheckBoxBuilder 

Source
pub struct CheckBoxBuilder<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> CheckBoxBuilder<'a>

Source

pub fn flags(self, flags: CheckBoxFlags) -> CheckBoxBuilder<'a>

Source

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

Source

pub fn text(self, text: &'a str) -> CheckBoxBuilder<'a>

Examples found in repository?
examples/partials.rs (line 393)
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        }
425
426        fn process_event<'a>(
427            &self,
428            _evt: nwg::Event,
429            _evt_data: &nwg::EventData,
430            _handle: ControlHandle,
431        ) {
432        }
433
434        fn handles(&self) -> Vec<&ControlHandle> {
435            Vec::new()
436        }
437    }
438}
439
440mod partial_food_ui {
441    use self::nwg::{ControlHandle, NwgError, PartialUi};
442    use super::*;
443    use native_windows_gui2 as nwg;
444
445    impl PartialUi for FoodUi {
446        fn build_partial<W: Into<ControlHandle>>(
447            data: &mut FoodUi,
448            parent: Option<W>,
449        ) -> Result<(), NwgError> {
450            let parent = parent.unwrap().into();
451
452            nwg::Label::builder()
453                .text("Name:")
454                .h_align(nwg::HTextAlign::Right)
455                .parent(&parent)
456                .build(&mut data.label1)?;
457
458            nwg::Label::builder()
459                .text("Tasty:")
460                .h_align(nwg::HTextAlign::Right)
461                .parent(&parent)
462                .build(&mut data.label2)?;
463
464            nwg::TextInput::builder()
465                .text("Banana")
466                .parent(&parent)
467                .build(&mut data.name_input)?;
468
469            nwg::CheckBox::builder()
470                .text("")
471                .check_state(nwg::CheckBoxState::Checked)
472                .parent(&parent)
473                .build(&mut data.tasty_input)?;
474
475            nwg::Button::builder()
476                .text("Save")
477                .parent(&parent)
478                .build(&mut data.save_btn)?;
479
480            nwg::GridLayout::builder()
481                .parent(&parent)
482                .max_size([1000, 90])
483                .min_size([100, 80])
484                .child(0, 0, &data.label1)
485                .child(0, 1, &data.label2)
486                .child(1, 0, &data.name_input)
487                .child(1, 1, &data.tasty_input)
488                .build(&data.layout)?;
489
490            nwg::GridLayout::builder()
491                .min_size([100, 200])
492                .max_column(Some(2))
493                .max_row(Some(6))
494                .child(1, 5, &data.save_btn)
495                .parent(&parent)
496                .build(&data.layout2)?;
497
498            Ok(())
499        }
Source

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

Source

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

Source

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

Source

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

Source

pub fn check_state(self, check: CheckBoxState) -> CheckBoxBuilder<'a>

Examples found in repository?
examples/partials.rs (line 394)
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        }
425
426        fn process_event<'a>(
427            &self,
428            _evt: nwg::Event,
429            _evt_data: &nwg::EventData,
430            _handle: ControlHandle,
431        ) {
432        }
433
434        fn handles(&self) -> Vec<&ControlHandle> {
435            Vec::new()
436        }
437    }
438}
439
440mod partial_food_ui {
441    use self::nwg::{ControlHandle, NwgError, PartialUi};
442    use super::*;
443    use native_windows_gui2 as nwg;
444
445    impl PartialUi for FoodUi {
446        fn build_partial<W: Into<ControlHandle>>(
447            data: &mut FoodUi,
448            parent: Option<W>,
449        ) -> Result<(), NwgError> {
450            let parent = parent.unwrap().into();
451
452            nwg::Label::builder()
453                .text("Name:")
454                .h_align(nwg::HTextAlign::Right)
455                .parent(&parent)
456                .build(&mut data.label1)?;
457
458            nwg::Label::builder()
459                .text("Tasty:")
460                .h_align(nwg::HTextAlign::Right)
461                .parent(&parent)
462                .build(&mut data.label2)?;
463
464            nwg::TextInput::builder()
465                .text("Banana")
466                .parent(&parent)
467                .build(&mut data.name_input)?;
468
469            nwg::CheckBox::builder()
470                .text("")
471                .check_state(nwg::CheckBoxState::Checked)
472                .parent(&parent)
473                .build(&mut data.tasty_input)?;
474
475            nwg::Button::builder()
476                .text("Save")
477                .parent(&parent)
478                .build(&mut data.save_btn)?;
479
480            nwg::GridLayout::builder()
481                .parent(&parent)
482                .max_size([1000, 90])
483                .min_size([100, 80])
484                .child(0, 0, &data.label1)
485                .child(0, 1, &data.label2)
486                .child(1, 0, &data.name_input)
487                .child(1, 1, &data.tasty_input)
488                .build(&data.layout)?;
489
490            nwg::GridLayout::builder()
491                .min_size([100, 200])
492                .max_column(Some(2))
493                .max_row(Some(6))
494                .child(1, 5, &data.save_btn)
495                .parent(&parent)
496                .build(&data.layout2)?;
497
498            Ok(())
499        }
Source

pub fn background_color(self, color: Option<[u8; 3]>) -> CheckBoxBuilder<'a>

Source

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

Source

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

Examples found in repository?
examples/partials.rs (line 395)
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        }
425
426        fn process_event<'a>(
427            &self,
428            _evt: nwg::Event,
429            _evt_data: &nwg::EventData,
430            _handle: ControlHandle,
431        ) {
432        }
433
434        fn handles(&self) -> Vec<&ControlHandle> {
435            Vec::new()
436        }
437    }
438}
439
440mod partial_food_ui {
441    use self::nwg::{ControlHandle, NwgError, PartialUi};
442    use super::*;
443    use native_windows_gui2 as nwg;
444
445    impl PartialUi for FoodUi {
446        fn build_partial<W: Into<ControlHandle>>(
447            data: &mut FoodUi,
448            parent: Option<W>,
449        ) -> Result<(), NwgError> {
450            let parent = parent.unwrap().into();
451
452            nwg::Label::builder()
453                .text("Name:")
454                .h_align(nwg::HTextAlign::Right)
455                .parent(&parent)
456                .build(&mut data.label1)?;
457
458            nwg::Label::builder()
459                .text("Tasty:")
460                .h_align(nwg::HTextAlign::Right)
461                .parent(&parent)
462                .build(&mut data.label2)?;
463
464            nwg::TextInput::builder()
465                .text("Banana")
466                .parent(&parent)
467                .build(&mut data.name_input)?;
468
469            nwg::CheckBox::builder()
470                .text("")
471                .check_state(nwg::CheckBoxState::Checked)
472                .parent(&parent)
473                .build(&mut data.tasty_input)?;
474
475            nwg::Button::builder()
476                .text("Save")
477                .parent(&parent)
478                .build(&mut data.save_btn)?;
479
480            nwg::GridLayout::builder()
481                .parent(&parent)
482                .max_size([1000, 90])
483                .min_size([100, 80])
484                .child(0, 0, &data.label1)
485                .child(0, 1, &data.label2)
486                .child(1, 0, &data.name_input)
487                .child(1, 1, &data.tasty_input)
488                .build(&data.layout)?;
489
490            nwg::GridLayout::builder()
491                .min_size([100, 200])
492                .max_column(Some(2))
493                .max_row(Some(6))
494                .child(1, 5, &data.save_btn)
495                .parent(&parent)
496                .build(&data.layout2)?;
497
498            Ok(())
499        }
Source

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

Examples found in repository?
examples/partials.rs (line 396)
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        }
425
426        fn process_event<'a>(
427            &self,
428            _evt: nwg::Event,
429            _evt_data: &nwg::EventData,
430            _handle: ControlHandle,
431        ) {
432        }
433
434        fn handles(&self) -> Vec<&ControlHandle> {
435            Vec::new()
436        }
437    }
438}
439
440mod partial_food_ui {
441    use self::nwg::{ControlHandle, NwgError, PartialUi};
442    use super::*;
443    use native_windows_gui2 as nwg;
444
445    impl PartialUi for FoodUi {
446        fn build_partial<W: Into<ControlHandle>>(
447            data: &mut FoodUi,
448            parent: Option<W>,
449        ) -> Result<(), NwgError> {
450            let parent = parent.unwrap().into();
451
452            nwg::Label::builder()
453                .text("Name:")
454                .h_align(nwg::HTextAlign::Right)
455                .parent(&parent)
456                .build(&mut data.label1)?;
457
458            nwg::Label::builder()
459                .text("Tasty:")
460                .h_align(nwg::HTextAlign::Right)
461                .parent(&parent)
462                .build(&mut data.label2)?;
463
464            nwg::TextInput::builder()
465                .text("Banana")
466                .parent(&parent)
467                .build(&mut data.name_input)?;
468
469            nwg::CheckBox::builder()
470                .text("")
471                .check_state(nwg::CheckBoxState::Checked)
472                .parent(&parent)
473                .build(&mut data.tasty_input)?;
474
475            nwg::Button::builder()
476                .text("Save")
477                .parent(&parent)
478                .build(&mut data.save_btn)?;
479
480            nwg::GridLayout::builder()
481                .parent(&parent)
482                .max_size([1000, 90])
483                .min_size([100, 80])
484                .child(0, 0, &data.label1)
485                .child(0, 1, &data.label2)
486                .child(1, 0, &data.name_input)
487                .child(1, 1, &data.tasty_input)
488                .build(&data.layout)?;
489
490            nwg::GridLayout::builder()
491                .min_size([100, 200])
492                .max_column(Some(2))
493                .max_row(Some(6))
494                .child(1, 5, &data.save_btn)
495                .parent(&parent)
496                .build(&data.layout2)?;
497
498            Ok(())
499        }

Auto Trait Implementations§

§

impl<'a> !Send for CheckBoxBuilder<'a>

§

impl<'a> !Sync for CheckBoxBuilder<'a>

§

impl<'a> Freeze for CheckBoxBuilder<'a>

§

impl<'a> RefUnwindSafe for CheckBoxBuilder<'a>

§

impl<'a> Unpin for CheckBoxBuilder<'a>

§

impl<'a> UnsafeUnpin for CheckBoxBuilder<'a>

§

impl<'a> UnwindSafe for CheckBoxBuilder<'a>

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.