Trait gui::Renderable
source · pub trait Renderable: 'static + Debug {
// Required methods
fn type_id(&self) -> TypeId;
fn render(&self, cap: &dyn Cap, renderer: &dyn Renderer, bbox: BBox) -> BBox;
// Provided method
fn render_done(&self, cap: &dyn Cap, renderer: &dyn Renderer, bbox: BBox) { ... }
}
Expand description
A trait representing a renderable object.
Required Methods§
sourcefn render(&self, cap: &dyn Cap, renderer: &dyn Renderer, bbox: BBox) -> BBox
fn render(&self, cap: &dyn Cap, renderer: &dyn Renderer, bbox: BBox) -> BBox
Render the renderable object.
This method should just forward the call to the given
Renderer
, supplying a trait object of the actual widget. The
renderer is advised to honor the given BBox
and is free to
inquire additional state using the supplied Cap
.
This method is invoked before all the widget’s children are rendered (“pre-order”).
Provided Methods§
sourcefn render_done(&self, cap: &dyn Cap, renderer: &dyn Renderer, bbox: BBox)
fn render_done(&self, cap: &dyn Cap, renderer: &dyn Renderer, bbox: BBox)
A method invoked once rendering of this widget and all its children concluded (“post-order”).
By default, this method does nothing, but it can be useful for rendering an overlay or for certain renderer related state adjustments.
Implementations§
source§impl dyn Renderable
impl dyn Renderable
sourcepub fn is<T>(&self) -> boolwhere
T: Renderable,
pub fn is<T>(&self) -> boolwhere
T: Renderable,
Check if the widget is of type T
.
sourcepub fn downcast_ref<T>(&self) -> Option<&T>where
T: Renderable,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: Renderable,
Downcast the widget reference to type T
.
sourcepub fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: Renderable,
pub fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: Renderable,
Downcast the widget reference to type T
.