Use inner_getters for rest of ViewWrappers (except on_event_view)

This commit is contained in:
Tymoteusz Jankowski 2018-01-26 12:06:14 +01:00
parent 84ea73617f
commit 9510d92736
8 changed files with 20 additions and 2 deletions

View File

@ -119,7 +119,6 @@ where
{ {
Some(f(self.deref_mut())) Some(f(self.deref_mut()))
} }
} }
// The main point of implementing ViewWrapper is to have View for free. // The main point of implementing ViewWrapper is to have View for free.

View File

@ -99,5 +99,4 @@ impl<T: View + 'static> ViewWrapper for IdView<T> {
.and_then(|mut v| v.deref_mut().focus_view(s)), .and_then(|mut v| v.deref_mut().focus_view(s)),
} }
} }
} }

View File

@ -16,6 +16,8 @@ impl<T: View> Layer<T> {
pub fn new(view: T) -> Self { pub fn new(view: T) -> Self {
Layer { view: view } Layer { view: view }
} }
inner_getters!(T);
} }
impl<T: View> ViewWrapper for Layer<T> { impl<T: View> ViewWrapper for Layer<T> {

View File

@ -203,6 +203,16 @@ impl<T: View> OnEventView<T> {
}, },
); );
} }
/// 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<T: View> ViewWrapper for OnEventView<T> { impl<T: View> ViewWrapper for OnEventView<T> {

View File

@ -14,6 +14,8 @@ impl<V: View> Panel<V> {
pub fn new(view: V) -> Self { pub fn new(view: V) -> Self {
Panel { view: view } Panel { view: view }
} }
inner_getters!(V);
} }
impl<V: View> ViewWrapper for Panel<V> { impl<V: View> ViewWrapper for Panel<V> {

View File

@ -46,6 +46,8 @@ impl<T: View> ShadowView<T> {
self.top_padding = value; self.top_padding = value;
self self
} }
inner_getters!(T);
} }
impl<T: View> ViewWrapper for ShadowView<T> { impl<T: View> ViewWrapper for ShadowView<T> {

View File

@ -18,6 +18,8 @@ impl<T: View> SizedView<T> {
size: Vec2::zero(), size: Vec2::zero(),
} }
} }
inner_getters!(T);
} }
impl<T: View> ViewWrapper for SizedView<T> { impl<T: View> ViewWrapper for SizedView<T> {

View File

@ -17,6 +17,8 @@ impl<T: View> TrackedView<T> {
pub fn offset(&self) -> Vec2 { pub fn offset(&self) -> Vec2 {
self.offset.get() self.offset.get()
} }
inner_getters!(T);
} }
impl<T: View> TrackedView<T> { impl<T: View> TrackedView<T> {