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 364)
331        fn build_partial<W: Into<ControlHandle>>(data: &mut AnimalUi, parent: Option<W>) -> Result<(), NwgError> {
332            let parent = parent.unwrap().into();
333
334            nwg::Label::builder()
335                .text("Name:")
336                .h_align(nwg::HTextAlign::Right)
337                .parent(&parent)
338                .build(&mut data.label1)?;
339
340            nwg::Label::builder()
341                .text("Race:")
342                .h_align(nwg::HTextAlign::Right)
343                .parent(&parent)
344                .build(&mut data.label2)?;
345
346            nwg::Label::builder()
347                .text("Is fluffy:")
348                .h_align(nwg::HTextAlign::Right)
349                .parent(&parent)
350                .build(&mut data.label3)?;
351
352            nwg::TextInput::builder()
353                .text("Mittens")
354                .parent(&parent)
355                .build(&mut data.name_input)?;
356
357            nwg::ComboBox::builder()
358                .collection(vec!["Cat", "Dog", "Pidgeon", "Monkey"])
359                .selected_index(Some(0))
360                .parent(&parent)
361                .build(&mut data.race_input)?;
362
363            nwg::CheckBox::builder()
364                .text("")
365                .check_state(nwg::CheckBoxState::Checked)
366                .parent(&parent)
367                .build(&mut data.is_soft_input)?;
368
369            nwg::Button::builder()
370                .text("Save")
371                .parent(&parent)
372                .build(&mut data.save_btn)?;
373
374            nwg::GridLayout::builder()
375                .parent(&parent)
376                .max_size([1000, 150])
377                .min_size([100, 120])
378                .child(0, 0, &data.label1)
379                .child(0, 1, &data.label2)
380                .child(0, 2, &data.label3)
381                .child(1, 0, &data.name_input)
382                .child(1, 1, &data.race_input)
383                .child(1, 2, &data.is_soft_input)
384                .build(&data.layout)?;
385
386            nwg::GridLayout::builder()
387                .min_size([100, 200])
388                .max_column(Some(2))
389                .max_row(Some(6))
390                .child(1, 5, &data.save_btn)
391                .parent(&parent)
392                .build(&data.layout2)?;
393
394            Ok(())
395        }
396
397        fn process_event<'a>(&self, _evt: nwg::Event, _evt_data: &nwg::EventData, _handle: ControlHandle) {
398        }
399
400        fn handles(&self) -> Vec<&ControlHandle> {
401            Vec::new()
402        }
403    }
404}
405
406mod partial_food_ui {
407    use native_windows_gui as nwg;
408    use self::nwg::{PartialUi, NwgError, ControlHandle};
409    use super::*;
410
411    impl PartialUi for FoodUi {
412        fn build_partial<W: Into<ControlHandle>>(data: &mut FoodUi, parent: Option<W>) -> Result<(), NwgError> {
413            let parent = parent.unwrap().into();
414
415            nwg::Label::builder()
416                .text("Name:")
417                .h_align(nwg::HTextAlign::Right)
418                .parent(&parent)
419                .build(&mut data.label1)?;
420
421            nwg::Label::builder()
422                .text("Tasty:")
423                .h_align(nwg::HTextAlign::Right)
424                .parent(&parent)
425                .build(&mut data.label2)?;
426
427            nwg::TextInput::builder()
428                .text("Banana")
429                .parent(&parent)
430                .build(&mut data.name_input)?;
431
432            nwg::CheckBox::builder()
433                .text("")
434                .check_state(nwg::CheckBoxState::Checked)
435                .parent(&parent)
436                .build(&mut data.tasty_input)?;
437
438            nwg::Button::builder()
439                .text("Save")
440                .parent(&parent)
441                .build(&mut data.save_btn)?;
442
443            nwg::GridLayout::builder()
444                .parent(&parent)
445                .max_size([1000, 90])
446                .min_size([100, 80])
447                .child(0, 0, &data.label1)
448                .child(0, 1, &data.label2)
449                .child(1, 0, &data.name_input)
450                .child(1, 1, &data.tasty_input)
451                .build(&data.layout)?;
452
453            nwg::GridLayout::builder()
454                .min_size([100, 200])
455                .max_column(Some(2))
456                .max_row(Some(6))
457                .child(1, 5, &data.save_btn)
458                .parent(&parent)
459                .build(&data.layout2)?;
460
461            Ok(())
462        }
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 365)
331        fn build_partial<W: Into<ControlHandle>>(data: &mut AnimalUi, parent: Option<W>) -> Result<(), NwgError> {
332            let parent = parent.unwrap().into();
333
334            nwg::Label::builder()
335                .text("Name:")
336                .h_align(nwg::HTextAlign::Right)
337                .parent(&parent)
338                .build(&mut data.label1)?;
339
340            nwg::Label::builder()
341                .text("Race:")
342                .h_align(nwg::HTextAlign::Right)
343                .parent(&parent)
344                .build(&mut data.label2)?;
345
346            nwg::Label::builder()
347                .text("Is fluffy:")
348                .h_align(nwg::HTextAlign::Right)
349                .parent(&parent)
350                .build(&mut data.label3)?;
351
352            nwg::TextInput::builder()
353                .text("Mittens")
354                .parent(&parent)
355                .build(&mut data.name_input)?;
356
357            nwg::ComboBox::builder()
358                .collection(vec!["Cat", "Dog", "Pidgeon", "Monkey"])
359                .selected_index(Some(0))
360                .parent(&parent)
361                .build(&mut data.race_input)?;
362
363            nwg::CheckBox::builder()
364                .text("")
365                .check_state(nwg::CheckBoxState::Checked)
366                .parent(&parent)
367                .build(&mut data.is_soft_input)?;
368
369            nwg::Button::builder()
370                .text("Save")
371                .parent(&parent)
372                .build(&mut data.save_btn)?;
373
374            nwg::GridLayout::builder()
375                .parent(&parent)
376                .max_size([1000, 150])
377                .min_size([100, 120])
378                .child(0, 0, &data.label1)
379                .child(0, 1, &data.label2)
380                .child(0, 2, &data.label3)
381                .child(1, 0, &data.name_input)
382                .child(1, 1, &data.race_input)
383                .child(1, 2, &data.is_soft_input)
384                .build(&data.layout)?;
385
386            nwg::GridLayout::builder()
387                .min_size([100, 200])
388                .max_column(Some(2))
389                .max_row(Some(6))
390                .child(1, 5, &data.save_btn)
391                .parent(&parent)
392                .build(&data.layout2)?;
393
394            Ok(())
395        }
396
397        fn process_event<'a>(&self, _evt: nwg::Event, _evt_data: &nwg::EventData, _handle: ControlHandle) {
398        }
399
400        fn handles(&self) -> Vec<&ControlHandle> {
401            Vec::new()
402        }
403    }
404}
405
406mod partial_food_ui {
407    use native_windows_gui as nwg;
408    use self::nwg::{PartialUi, NwgError, ControlHandle};
409    use super::*;
410
411    impl PartialUi for FoodUi {
412        fn build_partial<W: Into<ControlHandle>>(data: &mut FoodUi, parent: Option<W>) -> Result<(), NwgError> {
413            let parent = parent.unwrap().into();
414
415            nwg::Label::builder()
416                .text("Name:")
417                .h_align(nwg::HTextAlign::Right)
418                .parent(&parent)
419                .build(&mut data.label1)?;
420
421            nwg::Label::builder()
422                .text("Tasty:")
423                .h_align(nwg::HTextAlign::Right)
424                .parent(&parent)
425                .build(&mut data.label2)?;
426
427            nwg::TextInput::builder()
428                .text("Banana")
429                .parent(&parent)
430                .build(&mut data.name_input)?;
431
432            nwg::CheckBox::builder()
433                .text("")
434                .check_state(nwg::CheckBoxState::Checked)
435                .parent(&parent)
436                .build(&mut data.tasty_input)?;
437
438            nwg::Button::builder()
439                .text("Save")
440                .parent(&parent)
441                .build(&mut data.save_btn)?;
442
443            nwg::GridLayout::builder()
444                .parent(&parent)
445                .max_size([1000, 90])
446                .min_size([100, 80])
447                .child(0, 0, &data.label1)
448                .child(0, 1, &data.label2)
449                .child(1, 0, &data.name_input)
450                .child(1, 1, &data.tasty_input)
451                .build(&data.layout)?;
452
453            nwg::GridLayout::builder()
454                .min_size([100, 200])
455                .max_column(Some(2))
456                .max_row(Some(6))
457                .child(1, 5, &data.save_btn)
458                .parent(&parent)
459                .build(&data.layout2)?;
460
461            Ok(())
462        }
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 366)
331        fn build_partial<W: Into<ControlHandle>>(data: &mut AnimalUi, parent: Option<W>) -> Result<(), NwgError> {
332            let parent = parent.unwrap().into();
333
334            nwg::Label::builder()
335                .text("Name:")
336                .h_align(nwg::HTextAlign::Right)
337                .parent(&parent)
338                .build(&mut data.label1)?;
339
340            nwg::Label::builder()
341                .text("Race:")
342                .h_align(nwg::HTextAlign::Right)
343                .parent(&parent)
344                .build(&mut data.label2)?;
345
346            nwg::Label::builder()
347                .text("Is fluffy:")
348                .h_align(nwg::HTextAlign::Right)
349                .parent(&parent)
350                .build(&mut data.label3)?;
351
352            nwg::TextInput::builder()
353                .text("Mittens")
354                .parent(&parent)
355                .build(&mut data.name_input)?;
356
357            nwg::ComboBox::builder()
358                .collection(vec!["Cat", "Dog", "Pidgeon", "Monkey"])
359                .selected_index(Some(0))
360                .parent(&parent)
361                .build(&mut data.race_input)?;
362
363            nwg::CheckBox::builder()
364                .text("")
365                .check_state(nwg::CheckBoxState::Checked)
366                .parent(&parent)
367                .build(&mut data.is_soft_input)?;
368
369            nwg::Button::builder()
370                .text("Save")
371                .parent(&parent)
372                .build(&mut data.save_btn)?;
373
374            nwg::GridLayout::builder()
375                .parent(&parent)
376                .max_size([1000, 150])
377                .min_size([100, 120])
378                .child(0, 0, &data.label1)
379                .child(0, 1, &data.label2)
380                .child(0, 2, &data.label3)
381                .child(1, 0, &data.name_input)
382                .child(1, 1, &data.race_input)
383                .child(1, 2, &data.is_soft_input)
384                .build(&data.layout)?;
385
386            nwg::GridLayout::builder()
387                .min_size([100, 200])
388                .max_column(Some(2))
389                .max_row(Some(6))
390                .child(1, 5, &data.save_btn)
391                .parent(&parent)
392                .build(&data.layout2)?;
393
394            Ok(())
395        }
396
397        fn process_event<'a>(&self, _evt: nwg::Event, _evt_data: &nwg::EventData, _handle: ControlHandle) {
398        }
399
400        fn handles(&self) -> Vec<&ControlHandle> {
401            Vec::new()
402        }
403    }
404}
405
406mod partial_food_ui {
407    use native_windows_gui as nwg;
408    use self::nwg::{PartialUi, NwgError, ControlHandle};
409    use super::*;
410
411    impl PartialUi for FoodUi {
412        fn build_partial<W: Into<ControlHandle>>(data: &mut FoodUi, parent: Option<W>) -> Result<(), NwgError> {
413            let parent = parent.unwrap().into();
414
415            nwg::Label::builder()
416                .text("Name:")
417                .h_align(nwg::HTextAlign::Right)
418                .parent(&parent)
419                .build(&mut data.label1)?;
420
421            nwg::Label::builder()
422                .text("Tasty:")
423                .h_align(nwg::HTextAlign::Right)
424                .parent(&parent)
425                .build(&mut data.label2)?;
426
427            nwg::TextInput::builder()
428                .text("Banana")
429                .parent(&parent)
430                .build(&mut data.name_input)?;
431
432            nwg::CheckBox::builder()
433                .text("")
434                .check_state(nwg::CheckBoxState::Checked)
435                .parent(&parent)
436                .build(&mut data.tasty_input)?;
437
438            nwg::Button::builder()
439                .text("Save")
440                .parent(&parent)
441                .build(&mut data.save_btn)?;
442
443            nwg::GridLayout::builder()
444                .parent(&parent)
445                .max_size([1000, 90])
446                .min_size([100, 80])
447                .child(0, 0, &data.label1)
448                .child(0, 1, &data.label2)
449                .child(1, 0, &data.name_input)
450                .child(1, 1, &data.tasty_input)
451                .build(&data.layout)?;
452
453            nwg::GridLayout::builder()
454                .min_size([100, 200])
455                .max_column(Some(2))
456                .max_row(Some(6))
457                .child(1, 5, &data.save_btn)
458                .parent(&parent)
459                .build(&data.layout2)?;
460
461            Ok(())
462        }
Source

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

Examples found in repository?
examples/partials.rs (line 367)
331        fn build_partial<W: Into<ControlHandle>>(data: &mut AnimalUi, parent: Option<W>) -> Result<(), NwgError> {
332            let parent = parent.unwrap().into();
333
334            nwg::Label::builder()
335                .text("Name:")
336                .h_align(nwg::HTextAlign::Right)
337                .parent(&parent)
338                .build(&mut data.label1)?;
339
340            nwg::Label::builder()
341                .text("Race:")
342                .h_align(nwg::HTextAlign::Right)
343                .parent(&parent)
344                .build(&mut data.label2)?;
345
346            nwg::Label::builder()
347                .text("Is fluffy:")
348                .h_align(nwg::HTextAlign::Right)
349                .parent(&parent)
350                .build(&mut data.label3)?;
351
352            nwg::TextInput::builder()
353                .text("Mittens")
354                .parent(&parent)
355                .build(&mut data.name_input)?;
356
357            nwg::ComboBox::builder()
358                .collection(vec!["Cat", "Dog", "Pidgeon", "Monkey"])
359                .selected_index(Some(0))
360                .parent(&parent)
361                .build(&mut data.race_input)?;
362
363            nwg::CheckBox::builder()
364                .text("")
365                .check_state(nwg::CheckBoxState::Checked)
366                .parent(&parent)
367                .build(&mut data.is_soft_input)?;
368
369            nwg::Button::builder()
370                .text("Save")
371                .parent(&parent)
372                .build(&mut data.save_btn)?;
373
374            nwg::GridLayout::builder()
375                .parent(&parent)
376                .max_size([1000, 150])
377                .min_size([100, 120])
378                .child(0, 0, &data.label1)
379                .child(0, 1, &data.label2)
380                .child(0, 2, &data.label3)
381                .child(1, 0, &data.name_input)
382                .child(1, 1, &data.race_input)
383                .child(1, 2, &data.is_soft_input)
384                .build(&data.layout)?;
385
386            nwg::GridLayout::builder()
387                .min_size([100, 200])
388                .max_column(Some(2))
389                .max_row(Some(6))
390                .child(1, 5, &data.save_btn)
391                .parent(&parent)
392                .build(&data.layout2)?;
393
394            Ok(())
395        }
396
397        fn process_event<'a>(&self, _evt: nwg::Event, _evt_data: &nwg::EventData, _handle: ControlHandle) {
398        }
399
400        fn handles(&self) -> Vec<&ControlHandle> {
401            Vec::new()
402        }
403    }
404}
405
406mod partial_food_ui {
407    use native_windows_gui as nwg;
408    use self::nwg::{PartialUi, NwgError, ControlHandle};
409    use super::*;
410
411    impl PartialUi for FoodUi {
412        fn build_partial<W: Into<ControlHandle>>(data: &mut FoodUi, parent: Option<W>) -> Result<(), NwgError> {
413            let parent = parent.unwrap().into();
414
415            nwg::Label::builder()
416                .text("Name:")
417                .h_align(nwg::HTextAlign::Right)
418                .parent(&parent)
419                .build(&mut data.label1)?;
420
421            nwg::Label::builder()
422                .text("Tasty:")
423                .h_align(nwg::HTextAlign::Right)
424                .parent(&parent)
425                .build(&mut data.label2)?;
426
427            nwg::TextInput::builder()
428                .text("Banana")
429                .parent(&parent)
430                .build(&mut data.name_input)?;
431
432            nwg::CheckBox::builder()
433                .text("")
434                .check_state(nwg::CheckBoxState::Checked)
435                .parent(&parent)
436                .build(&mut data.tasty_input)?;
437
438            nwg::Button::builder()
439                .text("Save")
440                .parent(&parent)
441                .build(&mut data.save_btn)?;
442
443            nwg::GridLayout::builder()
444                .parent(&parent)
445                .max_size([1000, 90])
446                .min_size([100, 80])
447                .child(0, 0, &data.label1)
448                .child(0, 1, &data.label2)
449                .child(1, 0, &data.name_input)
450                .child(1, 1, &data.tasty_input)
451                .build(&data.layout)?;
452
453            nwg::GridLayout::builder()
454                .min_size([100, 200])
455                .max_column(Some(2))
456                .max_row(Some(6))
457                .child(1, 5, &data.save_btn)
458                .parent(&parent)
459                .build(&data.layout2)?;
460
461            Ok(())
462        }

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

impl<'a> Unpin 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.