diff --git a/src/view/view_wrapper.rs b/src/view/view_wrapper.rs index 6e3d8a9..53731d2 100644 --- a/src/view/view_wrapper.rs +++ b/src/view/view_wrapper.rs @@ -119,7 +119,6 @@ where { Some(f(self.deref_mut())) } - } // The main point of implementing ViewWrapper is to have View for free. diff --git a/src/views/id_view.rs b/src/views/id_view.rs index a925ff8..5b957da 100644 --- a/src/views/id_view.rs +++ b/src/views/id_view.rs @@ -99,5 +99,4 @@ impl ViewWrapper for IdView { .and_then(|mut v| v.deref_mut().focus_view(s)), } } - } diff --git a/src/views/layer.rs b/src/views/layer.rs index 46e202b..2152479 100644 --- a/src/views/layer.rs +++ b/src/views/layer.rs @@ -16,6 +16,8 @@ impl Layer { pub fn new(view: T) -> Self { Layer { view: view } } + + inner_getters!(T); } impl ViewWrapper for Layer { diff --git a/src/views/on_event_view.rs b/src/views/on_event_view.rs index c5a5510..90d1515 100644 --- a/src/views/on_event_view.rs +++ b/src/views/on_event_view.rs @@ -203,6 +203,16 @@ impl OnEventView { }, ); } + + /// Gets access to the inner view. + pub fn get_inner(&self) -> &T { + &self.inner + } + + /// Gets mutable access to the inner view. + pub fn get_inner_mut(&mut self) -> &mut T { + &mut self.inner + } } impl ViewWrapper for OnEventView { diff --git a/src/views/panel.rs b/src/views/panel.rs index 8ef9b04..243665d 100644 --- a/src/views/panel.rs +++ b/src/views/panel.rs @@ -14,6 +14,8 @@ impl Panel { pub fn new(view: V) -> Self { Panel { view: view } } + + inner_getters!(V); } impl ViewWrapper for Panel { diff --git a/src/views/shadow_view.rs b/src/views/shadow_view.rs index c6cab18..24bf9e5 100644 --- a/src/views/shadow_view.rs +++ b/src/views/shadow_view.rs @@ -46,6 +46,8 @@ impl ShadowView { self.top_padding = value; self } + + inner_getters!(T); } impl ViewWrapper for ShadowView { diff --git a/src/views/sized_view.rs b/src/views/sized_view.rs index a7f8b39..287e01d 100644 --- a/src/views/sized_view.rs +++ b/src/views/sized_view.rs @@ -18,6 +18,8 @@ impl SizedView { size: Vec2::zero(), } } + + inner_getters!(T); } impl ViewWrapper for SizedView { diff --git a/src/views/tracked_view.rs b/src/views/tracked_view.rs index 581406a..2f9e01f 100644 --- a/src/views/tracked_view.rs +++ b/src/views/tracked_view.rs @@ -17,6 +17,8 @@ impl TrackedView { pub fn offset(&self) -> Vec2 { self.offset.get() } + + inner_getters!(T); } impl TrackedView {