Skip to main content

zintl_ui_view/
view.rs

1use crate::context::Context;
2use crate::storage::Storage;
3
4use zintl_ui_render::RenderObject;
5
6// A renderable component that has context.
7pub trait View: Sized {
8    fn get_context(&self) -> &Context;
9
10    fn render(&mut self, storage: &mut Storage) -> RenderObject {
11        self.get_context().render(storage)
12    }
13
14    // TODO
15    #[allow(unused)]
16    fn padding(self, top: f32, bottom: f32, left: f32, right: f32) -> Self {
17        self.get_context().set_style_property();
18        self
19    }
20}