pub struct ChildView<'a, ViewId> {
pub id: ViewId,
pub kind: ViewKind,
pub frame: Rectangle,
pub properties: ViewProperties<'a>,
}Expand description
A child view registered by a parent crate::UiView.
Fields§
§id: ViewIdApplication-defined child identifier.
kind: ViewKindSemantic type used by higher-level tooling or presenters.
frame: RectangleChild frame in parent coordinates.
properties: ViewProperties<'a>Child properties advertised by the parent.
Implementations§
Source§impl<'a, ViewId> ChildView<'a, ViewId>
impl<'a, ViewId> ChildView<'a, ViewId>
Sourcepub const fn new(id: ViewId, frame: Rectangle) -> Self
pub const fn new(id: ViewId, frame: Rectangle) -> Self
Creates a custom child view registration.
Examples found in repository?
More examples
examples/uikit_root.rs (line 47)
42 fn configure(&mut self, registration: &mut ViewRegistration<'static, DemoViewId, 2>) {
43 registration.set_title(Localized::new("root.title", "Devices"));
44 registration.set_clips_to_bounds(true);
45 let list_frame = registration.frame();
46 let _ = registration.add_child(
47 ChildView::new(DemoViewId::DevicesList, list_frame)
48 .with_kind(ViewKind::List)
49 .with_title(Localized::new("devices.title", "Devices")),
50 );
51 let _ = registration.add_child(
52 ChildView::new(
53 DemoViewId::AlertOverlay,
54 Rectangle::new(Point::new(16, 16), Size::new(0, 0)),
55 )
56 .with_kind(ViewKind::AlertHost)
57 .with_hidden(true)
58 .with_alpha(0),
59 );
60 }Sourcepub const fn with_kind(self, kind: ViewKind) -> Self
pub const fn with_kind(self, kind: ViewKind) -> Self
Marks the child as a specific view kind.
Examples found in repository?
More examples
examples/uikit_root.rs (line 48)
42 fn configure(&mut self, registration: &mut ViewRegistration<'static, DemoViewId, 2>) {
43 registration.set_title(Localized::new("root.title", "Devices"));
44 registration.set_clips_to_bounds(true);
45 let list_frame = registration.frame();
46 let _ = registration.add_child(
47 ChildView::new(DemoViewId::DevicesList, list_frame)
48 .with_kind(ViewKind::List)
49 .with_title(Localized::new("devices.title", "Devices")),
50 );
51 let _ = registration.add_child(
52 ChildView::new(
53 DemoViewId::AlertOverlay,
54 Rectangle::new(Point::new(16, 16), Size::new(0, 0)),
55 )
56 .with_kind(ViewKind::AlertHost)
57 .with_hidden(true)
58 .with_alpha(0),
59 );
60 }Sourcepub const fn with_title(self, title: Localized<'a>) -> Self
pub const fn with_title(self, title: Localized<'a>) -> Self
Sets the child title.
Examples found in repository?
examples/uikit_root.rs (line 49)
42 fn configure(&mut self, registration: &mut ViewRegistration<'static, DemoViewId, 2>) {
43 registration.set_title(Localized::new("root.title", "Devices"));
44 registration.set_clips_to_bounds(true);
45 let list_frame = registration.frame();
46 let _ = registration.add_child(
47 ChildView::new(DemoViewId::DevicesList, list_frame)
48 .with_kind(ViewKind::List)
49 .with_title(Localized::new("devices.title", "Devices")),
50 );
51 let _ = registration.add_child(
52 ChildView::new(
53 DemoViewId::AlertOverlay,
54 Rectangle::new(Point::new(16, 16), Size::new(0, 0)),
55 )
56 .with_kind(ViewKind::AlertHost)
57 .with_hidden(true)
58 .with_alpha(0),
59 );
60 }Sourcepub const fn with_alpha(self, alpha: u8) -> Self
pub const fn with_alpha(self, alpha: u8) -> Self
Sets the child alpha.
Examples found in repository?
examples/uikit_root.rs (line 58)
42 fn configure(&mut self, registration: &mut ViewRegistration<'static, DemoViewId, 2>) {
43 registration.set_title(Localized::new("root.title", "Devices"));
44 registration.set_clips_to_bounds(true);
45 let list_frame = registration.frame();
46 let _ = registration.add_child(
47 ChildView::new(DemoViewId::DevicesList, list_frame)
48 .with_kind(ViewKind::List)
49 .with_title(Localized::new("devices.title", "Devices")),
50 );
51 let _ = registration.add_child(
52 ChildView::new(
53 DemoViewId::AlertOverlay,
54 Rectangle::new(Point::new(16, 16), Size::new(0, 0)),
55 )
56 .with_kind(ViewKind::AlertHost)
57 .with_hidden(true)
58 .with_alpha(0),
59 );
60 }Marks the child as hidden or visible.
Examples found in repository?
examples/uikit_root.rs (line 57)
42 fn configure(&mut self, registration: &mut ViewRegistration<'static, DemoViewId, 2>) {
43 registration.set_title(Localized::new("root.title", "Devices"));
44 registration.set_clips_to_bounds(true);
45 let list_frame = registration.frame();
46 let _ = registration.add_child(
47 ChildView::new(DemoViewId::DevicesList, list_frame)
48 .with_kind(ViewKind::List)
49 .with_title(Localized::new("devices.title", "Devices")),
50 );
51 let _ = registration.add_child(
52 ChildView::new(
53 DemoViewId::AlertOverlay,
54 Rectangle::new(Point::new(16, 16), Size::new(0, 0)),
55 )
56 .with_kind(ViewKind::AlertHost)
57 .with_hidden(true)
58 .with_alpha(0),
59 );
60 }Sourcepub const fn with_clipping(self, clips_to_bounds: bool) -> Self
pub const fn with_clipping(self, clips_to_bounds: bool) -> Self
Enables or disables clipping for this child.
Trait Implementations§
impl<'a, ViewId: Copy> Copy for ChildView<'a, ViewId>
impl<'a, ViewId: Eq> Eq for ChildView<'a, ViewId>
impl<'a, ViewId> StructuralPartialEq for ChildView<'a, ViewId>
Auto Trait Implementations§
impl<'a, ViewId> Freeze for ChildView<'a, ViewId>where
ViewId: Freeze,
impl<'a, ViewId> RefUnwindSafe for ChildView<'a, ViewId>where
ViewId: RefUnwindSafe,
impl<'a, ViewId> Send for ChildView<'a, ViewId>where
ViewId: Send,
impl<'a, ViewId> Sync for ChildView<'a, ViewId>where
ViewId: Sync,
impl<'a, ViewId> Unpin for ChildView<'a, ViewId>where
ViewId: Unpin,
impl<'a, ViewId> UnsafeUnpin for ChildView<'a, ViewId>where
ViewId: UnsafeUnpin,
impl<'a, ViewId> UnwindSafe for ChildView<'a, ViewId>where
ViewId: UnwindSafe,
Blanket Implementations§
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.