mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Use inner_getters for rest of ViewWrappers (except on_event_view)
This commit is contained in:
parent
84ea73617f
commit
9510d92736
@ -119,7 +119,6 @@ where
|
||||
{
|
||||
Some(f(self.deref_mut()))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// The main point of implementing ViewWrapper is to have View for free.
|
||||
|
@ -99,5 +99,4 @@ impl<T: View + 'static> ViewWrapper for IdView<T> {
|
||||
.and_then(|mut v| v.deref_mut().focus_view(s)),
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ impl<T: View> Layer<T> {
|
||||
pub fn new(view: T) -> Self {
|
||||
Layer { view: view }
|
||||
}
|
||||
|
||||
inner_getters!(T);
|
||||
}
|
||||
|
||||
impl<T: View> ViewWrapper for Layer<T> {
|
||||
|
@ -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> {
|
||||
|
@ -14,6 +14,8 @@ impl<V: View> Panel<V> {
|
||||
pub fn new(view: V) -> Self {
|
||||
Panel { view: view }
|
||||
}
|
||||
|
||||
inner_getters!(V);
|
||||
}
|
||||
|
||||
impl<V: View> ViewWrapper for Panel<V> {
|
||||
|
@ -46,6 +46,8 @@ impl<T: View> ShadowView<T> {
|
||||
self.top_padding = value;
|
||||
self
|
||||
}
|
||||
|
||||
inner_getters!(T);
|
||||
}
|
||||
|
||||
impl<T: View> ViewWrapper for ShadowView<T> {
|
||||
|
@ -18,6 +18,8 @@ impl<T: View> SizedView<T> {
|
||||
size: Vec2::zero(),
|
||||
}
|
||||
}
|
||||
|
||||
inner_getters!(T);
|
||||
}
|
||||
|
||||
impl<T: View> ViewWrapper for SizedView<T> {
|
||||
|
@ -17,6 +17,8 @@ impl<T: View> TrackedView<T> {
|
||||
pub fn offset(&self) -> Vec2 {
|
||||
self.offset.get()
|
||||
}
|
||||
|
||||
inner_getters!(T);
|
||||
}
|
||||
|
||||
impl<T: View> TrackedView<T> {
|
||||
|
Loading…
Reference in New Issue
Block a user