pub trait View: Downcast {
Show 16 methods
// Required methods
fn handle_event(
&mut self,
evt: &Event,
hub: &Hub,
bus: &mut Bus,
rq: &mut RenderQueue,
context: &mut Context,
) -> bool;
fn render(
&self,
fb: &mut dyn Framebuffer,
rect: Rectangle,
fonts: &mut Fonts,
);
fn rect(&self) -> &Rectangle;
fn rect_mut(&mut self) -> &mut Rectangle;
fn children(&self) -> &Vec<Box<dyn View>>;
fn children_mut(&mut self) -> &mut Vec<Box<dyn View>>;
fn id(&self) -> Id;
// Provided methods
fn render_rect(&self, _rect: &Rectangle) -> Rectangle { ... }
fn resize(
&mut self,
rect: Rectangle,
_hub: &Hub,
_rq: &mut RenderQueue,
_context: &mut Context,
) { ... }
fn child(&self, index: usize) -> &dyn View { ... }
fn child_mut(&mut self, index: usize) -> &mut dyn View { ... }
fn len(&self) -> usize { ... }
fn might_skip(&self, _evt: &Event) -> bool { ... }
fn might_rotate(&self) -> bool { ... }
fn is_background(&self) -> bool { ... }
fn view_id(&self) -> Option<ViewId> { ... }
}Required Methods§
fn handle_event( &mut self, evt: &Event, hub: &Hub, bus: &mut Bus, rq: &mut RenderQueue, context: &mut Context, ) -> bool
fn render(&self, fb: &mut dyn Framebuffer, rect: Rectangle, fonts: &mut Fonts)
fn rect(&self) -> &Rectangle
fn rect_mut(&mut self) -> &mut Rectangle
fn children(&self) -> &Vec<Box<dyn View>>
fn children_mut(&mut self) -> &mut Vec<Box<dyn View>>
fn id(&self) -> Id
Provided Methods§
fn render_rect(&self, _rect: &Rectangle) -> Rectangle
fn resize( &mut self, rect: Rectangle, _hub: &Hub, _rq: &mut RenderQueue, _context: &mut Context, )
fn child(&self, index: usize) -> &dyn View
fn child_mut(&mut self, index: usize) -> &mut dyn View
fn len(&self) -> usize
fn might_skip(&self, _evt: &Event) -> bool
fn might_rotate(&self) -> bool
fn is_background(&self) -> bool
fn view_id(&self) -> Option<ViewId>
Implementations§
Source§impl dyn View
impl dyn View
Sourcepub fn is<__T: View>(&self) -> bool
pub fn is<__T: View>(&self) -> bool
Returns true if the trait object wraps an object of type __T.
Sourcepub fn downcast<__T: View>(self: Box<Self>) -> Result<Box<__T>, Box<Self>>
pub fn downcast<__T: View>(self: Box<Self>) -> Result<Box<__T>, Box<Self>>
Returns a boxed object from a boxed trait object if the underlying object is of type
__T. Returns the original boxed trait if it isn’t.
Sourcepub fn downcast_rc<__T: View>(self: Rc<Self>) -> Result<Rc<__T>, Rc<Self>>
pub fn downcast_rc<__T: View>(self: Rc<Self>) -> Result<Rc<__T>, Rc<Self>>
Returns an Rc-ed object from an Rc-ed trait object if the underlying object is of
type __T. Returns the original Rc-ed trait if it isn’t.
Sourcepub fn downcast_ref<__T: View>(&self) -> Option<&__T>
pub fn downcast_ref<__T: View>(&self) -> Option<&__T>
Returns a reference to the object within the trait object if it is of type __T, or
None if it isn’t.
Sourcepub fn downcast_mut<__T: View>(&mut self) -> Option<&mut __T>
pub fn downcast_mut<__T: View>(&mut self) -> Option<&mut __T>
Returns a mutable reference to the object within the trait object if it is of type
__T, or None if it isn’t.