Skip to main content

WindowUID

Struct WindowUID 

Source
pub struct WindowUID(/* private fields */);
Expand description

Helper struct for generating the UID

Implementations§

Source§

impl WindowUID

Source

pub fn new() -> Self

Generates a new Window’s UID

Examples found in repository?
examples/datagrid.rs (line 117)
107	fn default() -> Self {
108		let datagrid = WindowFactory::create::<DataGrid>();
109		{
110			let mut brw = datagrid.borrow_mut();
111			brw.set_data_source(Box::new(ExampleDataSource::default()));
112			//brw.set_radix(Radix::Hexadecimal);
113			brw.set_selection_color(Some(Color::Cyan));
114		}
115
116		Self {
117			uid: WindowUID::new(),
118			datagrid,
119			running: true,
120		}
121	}
More examples
Hide additional examples
examples/scrollviewer.rs (line 80)
53	fn default() -> Self {
54		let values = [
55			"Tomatoes",
56			"Tofu",
57			"Flatbread",
58			"Olive oil",
59			"Salt",
60			"Oregano",
61			"Butter",
62		];
63
64		let scrollviewer = WindowFactory::create::<ScrollViewer>();
65		scrollviewer
66			.borrow_mut()
67			.set_border(BorderStyle::new(BorderKind::Solid, None, None));
68		let stackpanel = WindowFactory::create::<Stackpanel>();
69		for v in values {
70			let cbx = WindowFactory::create::<TextCheckbox>();
71			cbx.borrow_mut().set_text(v);
72			stackpanel.borrow_mut().add_item(cbx);
73		}
74		ScrollViewer::set_content(
75			&scrollviewer,
76			Some(&(stackpanel as Rc<RefCell<dyn Scrollable>>)),
77		);
78
79		Self {
80			uid: WindowUID::new(),
81			scrollviewer,
82			running: true,
83		}
84	}
examples/tabview.rs (line 54)
31	fn default() -> Self {
32		let label = WindowFactory::create::<Label>();
33		label.borrow_mut().set_text("Lorem ipsum");
34		let label2 = WindowFactory::create::<Label>();
35		label2.borrow_mut().set_text("Bibsum loram");
36		let label3 = WindowFactory::create::<Label>();
37		label3.borrow_mut().set_text("Epsum larel");
38		let label4 = WindowFactory::create::<Label>();
39		label4.borrow_mut().set_text("Ipsel Aarel");
40
41		let tabview = WindowFactory::create::<TabView>();
42		{
43			let mut brw = tabview.borrow_mut();
44			brw.enable_tab_enumeration();
45			brw.set_highlight_fg_color(Some(Color::Grey));
46			brw.set_highlight_bg_color(Some(Color::Blue));
47			brw.add_item(Tab::new("WIP Tab Number. 1", label));
48			brw.add_item(Tab::new("WIP Tab Number. 2", label2));
49			brw.add_item(Tab::new("WIP Tab Number. 3", label3));
50			brw.add_item(Tab::new("WIP Tab Number. 4", label4));
51		}
52
53		Self {
54			uid: WindowUID::new(),
55			tabview,
56			running: true,
57		}
58	}
examples/dockpanel.rs (line 54)
30	fn default() -> Self {
31		let label = WindowFactory::create::<Label>();
32		label.borrow_mut().set_text("Lorem ipsum");
33		let label2 = WindowFactory::create::<Label>();
34		label2.borrow_mut().set_text("Bibsum loram");
35		let label3 = WindowFactory::create::<Label>();
36		label3.borrow_mut().set_text("Epsum larel");
37		let label4 = WindowFactory::create::<Label>();
38		label4.borrow_mut().set_text("Ipsel Aarel");
39		let input = WindowFactory::create::<Textbox>();
40
41		let dockpanel = WindowFactory::create::<DockPanel>();
42		{
43			let mut brw = dockpanel.borrow_mut();
44			brw.set_child(DockAlignment::Center, Some(input));
45			brw.set_child(DockAlignment::Top, Some(label));
46			brw.set_child(DockAlignment::Right, Some(label2));
47			brw.set_child(DockAlignment::Left, Some(label3));
48			brw.set_child(DockAlignment::Bottom, Some(label4));
49			brw.set_border(BorderStyle::new(BorderKind::Dashed, None, None));
50			brw.set_inner_border(true);
51		}
52
53		Self {
54			uid: WindowUID::new(),
55			dockpanel,
56			running: true,
57		}
58	}
examples/stackpanel.rs (line 86)
52	fn default() -> Self {
53		let label = WindowFactory::create::<Label>();
54		label
55			.borrow_mut()
56			.set_text("Please enter a valid number (x ∈ ℕ):");
57		let button = WindowFactory::create::<Button>();
58		button.borrow_mut().set_text("Press to increment:");
59		button.borrow_mut().set_border(BorderKind::Solid.into());
60		let mut cb: Combobox<u8> = Combobox::default();
61		for v in [1, 2, 4] {
62			cb.add_item(DisplayValue::new(v, format!("Increment by {}", v)));
63		}
64		let cb = Rc::new(RefCell::new(cb));
65		let combobox = cb.clone();
66		let numeric = WindowFactory::create::<Numeric>();
67		numeric.borrow_mut().set_base(Radix::Hexadecimal);
68		numeric.borrow_mut().set_min_range(8);
69		numeric.borrow_mut().set_max_range(64);
70		numeric.borrow_mut().set_focus_color(Some(Color::Cyan));
71		let nc = numeric.clone();
72		combobox
73			.borrow_mut()
74			.set_selection_changed_callback(move |cb| {
75				let mut brw = nc.borrow_mut();
76				brw.set_stepcount(*cb.get_value().unwrap().value())
77			});
78
79		let stackpanel = WindowFactory::create::<Stackpanel>();
80		stackpanel.borrow_mut().set_border(BorderKind::Solid.into());
81		stackpanel.borrow_mut().add_item(label);
82		stackpanel.borrow_mut().add_item(numeric);
83		stackpanel.borrow_mut().add_item(cb);
84
85		Self {
86			uid: WindowUID::new(),
87			stackpanel,
88			running: true,
89		}
90	}

Trait Implementations§

Source§

impl Clone for WindowUID

Source§

fn clone(&self) -> WindowUID

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for WindowUID

Source§

impl Debug for WindowUID

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for WindowUID

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for WindowUID

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for WindowUID

Source§

impl Hash for WindowUID

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for WindowUID

Source§

fn cmp(&self, other: &WindowUID) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for WindowUID

Source§

fn eq(&self, other: &WindowUID) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for WindowUID

Source§

fn partial_cmp(&self, other: &WindowUID) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for WindowUID

Auto Trait Implementations§

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> AsAny for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Source§

fn type_name(&self) -> &'static str

Gets the type name of self
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: AsAny + ?Sized,

Source§

fn is<T>(&self) -> bool
where T: AsAny,

Returns true if the boxed type is the same as T. Read more
Source§

fn downcast_ref<T>(&self) -> Option<&T>
where T: AsAny,

Forward to the method defined on the type Any.
Source§

fn downcast_mut<T>(&mut self) -> Option<&mut T>
where T: AsAny,

Forward to the method defined on the type Any.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

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

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.