mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-09 10:50:40 +00:00
Unify wrap_impl macros
Use a different pattern rather than different macro
This commit is contained in:
parent
191c2899ea
commit
ecd3c96d20
@ -27,7 +27,7 @@ impl BoxView {
|
||||
|
||||
impl ViewWrapper for BoxView {
|
||||
|
||||
wrap_impl_box!(self.content);
|
||||
wrap_impl!(self.content);
|
||||
|
||||
fn wrap_get_min_size(&self, _: SizeRequest) -> Vec2 {
|
||||
self.size
|
||||
|
@ -34,7 +34,7 @@ impl KeyEventView {
|
||||
|
||||
impl ViewWrapper for KeyEventView {
|
||||
|
||||
wrap_impl_box!(self.content);
|
||||
wrap_impl!(self.content);
|
||||
|
||||
fn wrap_on_key_event(&mut self, ch: i32) -> EventResult {
|
||||
match self.content.on_key_event(ch) {
|
||||
|
@ -19,7 +19,7 @@ impl<T: View> SizedView<T> {
|
||||
}
|
||||
|
||||
impl <T: View> ViewWrapper for SizedView<T> {
|
||||
wrap_impl!(self.view);
|
||||
wrap_impl!(&self.view);
|
||||
|
||||
fn wrap_layout(&mut self, size: Vec2) {
|
||||
self.view.layout(size);
|
||||
|
@ -44,7 +44,7 @@ impl <T: ViewWrapper> View for T {
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! wrap_impl {
|
||||
(self.$v:ident) => {
|
||||
(&self.$v:ident) => {
|
||||
|
||||
fn get_view(&self) -> &View {
|
||||
&self.$v
|
||||
@ -54,10 +54,6 @@ macro_rules! wrap_impl {
|
||||
&mut self.$v
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! wrap_impl_box {
|
||||
(self.$v:ident) => {
|
||||
|
||||
fn get_view(&self) -> &View {
|
||||
|
Loading…
Reference in New Issue
Block a user