use view::View; use vec::Vec2; use view::ViewWrapper; /// Wrapper around a view that remembers its size. pub struct SizedView { pub view: T, pub size: Vec2, } impl SizedView { /// Wraps the given view. pub fn new(view: T) -> Self { SizedView { view: view, size: Vec2::zero(), } } } impl ViewWrapper for SizedView { wrap_impl!(self.view); fn wrap_layout(&mut self, size: Vec2) { self.view.layout(size); self.size = size; } }