[−][src]Trait gelatin::Widget
Required methods
pub fn draw(
&self,
target: &mut Frame,
context: &DrawContext<'_>
) -> Result<NextUpdate, WidgetError>
[src]
&self,
target: &mut Frame,
context: &DrawContext<'_>
) -> Result<NextUpdate, WidgetError>
This function is called when the window is being re-rendered.
WARNING: The window may not be modified from this function. See the before_draw
function
to do that.
The widget is responsible for setting the correct transformation.
A widget should get information for finding a proper
transformation from its own drawn_bounds
field.
On success this furnction may return an instant indicating the time when it would like to be redrawn. Otherwise it can return Ok(None) to indicate that it should only be redrawn when a window event causes a change.
pub fn layout(&self, available_space: LogicalRect)
[src]
pub fn handle_event(&self, event: &Event)
[src]
pub fn children(&self, children: &mut Vec<Rc<dyn Widget>>)
[src]
The implementer is expected to push
its children into the provided vector.
pub fn placement(&self) -> WidgetPlacement
[src]
pub fn visible(&self) -> bool
[src]
pub fn set_valid_ref(&self, rendered_valid: RenderValidity)
[src]
Implementer of this trait must store the provided object
and call invalidate
on it whenever a change happens on them
that requires a re-draw.
Containers must call this function for all of their children immediately and pass a clone of the provided object.
Provided methods
pub fn before_draw(&self, _window: &Window) -> NextUpdate
[src]
This function is called before calling the draw function.
Widgets may use this function to mutate the window. This is however not allowed in the
draw
method.
Note that the Window
uses inner mutability so all window related functions take a
reference to a seemingly immutable window.
Implementors
impl Widget for Button
[src]
pub fn draw(
&self,
target: &mut Frame,
context: &DrawContext<'_>
) -> Result<NextUpdate, WidgetError>
[src]
&self,
target: &mut Frame,
context: &DrawContext<'_>
) -> Result<NextUpdate, WidgetError>
pub fn layout(&self, available_space: LogicalRect)
[src]
pub fn handle_event(&self, event: &Event)
[src]
pub fn children(&self, _children: &mut Vec<Rc<dyn Widget>>)
[src]
pub fn placement(&self) -> WidgetPlacement
[src]
pub fn visible(&self) -> bool
[src]
pub fn set_valid_ref(&self, render_validity: RenderValidity)
[src]
impl Widget for Label
[src]
pub fn draw(
&self,
target: &mut Frame,
context: &DrawContext<'_>
) -> Result<NextUpdate, WidgetError>
[src]
&self,
target: &mut Frame,
context: &DrawContext<'_>
) -> Result<NextUpdate, WidgetError>
pub fn layout(&self, available_space: LogicalRect)
[src]
pub fn handle_event(&self, _event: &Event)
[src]
pub fn children(&self, _children: &mut Vec<Rc<dyn Widget>>)
[src]
pub fn placement(&self) -> WidgetPlacement
[src]
pub fn visible(&self) -> bool
[src]
pub fn set_valid_ref(&self, render_validity: RenderValidity)
[src]
impl Widget for Slider
[src]
pub fn draw(
&self,
target: &mut Frame,
context: &DrawContext<'_>
) -> Result<NextUpdate, WidgetError>
[src]
&self,
target: &mut Frame,
context: &DrawContext<'_>
) -> Result<NextUpdate, WidgetError>
pub fn layout(&self, available_space: LogicalRect)
[src]
pub fn handle_event(&self, event: &Event)
[src]
pub fn children(&self, _children: &mut Vec<Rc<dyn Widget>>)
[src]
pub fn placement(&self) -> WidgetPlacement
[src]
pub fn visible(&self) -> bool
[src]
pub fn set_valid_ref(&self, render_validity: RenderValidity)
[src]
impl<Dim: PickDimension + 'static> Widget for LineLayoutContainer<Dim>
[src]
pub fn before_draw(&self, window: &Window) -> NextUpdate
[src]
pub fn draw(
&self,
target: &mut Frame,
context: &DrawContext<'_>
) -> Result<NextUpdate, WidgetError>
[src]
&self,
target: &mut Frame,
context: &DrawContext<'_>
) -> Result<NextUpdate, WidgetError>