Rename Widget::on_event to update

This commit is contained in:
Héctor Ramón Jiménez 2024-10-25 22:06:06 +02:00
parent dcc184b01b
commit f02bfc3f68
No known key found for this signature in database
GPG key ID: 4C07CEC81AFA161F
37 changed files with 67 additions and 67 deletions

View file

@ -308,7 +308,7 @@ where
self.widget.operate(tree, layout, renderer, operation);
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
@ -322,7 +322,7 @@ where
let mut local_messages = Vec::new();
let mut local_shell = Shell::new(&mut local_messages);
self.widget.on_event(
self.widget.update(
tree,
event,
layout,
@ -444,7 +444,7 @@ where
.operate(state, layout, renderer, operation);
}
fn on_event(
fn update(
&mut self,
state: &mut Tree,
event: Event,
@ -455,7 +455,7 @@ where
shell: &mut Shell<'_, Message>,
viewport: &Rectangle,
) {
self.element.widget.on_event(
self.element.widget.update(
state, event, layout, cursor, renderer, clipboard, shell, viewport,
);
}

View file

@ -111,7 +111,7 @@ where
/// Processes a runtime [`Event`].
///
/// By default, it does nothing.
fn on_event(
fn update(
&mut self,
_state: &mut Tree,
_event: Event,

View file

@ -261,7 +261,7 @@ where
layout::atomic(limits, self.size, self.size)
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,

View file

@ -175,7 +175,7 @@ where
layout::atomic(limits, self.width, self.height)
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,

View file

@ -358,7 +358,7 @@ mod toast {
});
}
fn on_event(
fn update(
&mut self,
state: &mut Tree,
event: Event,
@ -369,7 +369,7 @@ mod toast {
shell: &mut Shell<'_, Message>,
viewport: &Rectangle,
) {
self.content.as_widget_mut().on_event(
self.content.as_widget_mut().update(
&mut state.children[0],
event,
layout,
@ -529,7 +529,7 @@ mod toast {
let mut local_messages = vec![];
let mut local_shell = Shell::new(&mut local_messages);
child.as_widget_mut().on_event(
child.as_widget_mut().update(
state,
event.clone(),
layout,

View file

@ -308,7 +308,7 @@ where
let mut shell = Shell::new(messages);
self.root.as_widget_mut().on_event(
self.root.as_widget_mut().update(
&mut self.state,
event,
Layout::new(&self.base),

View file

@ -273,7 +273,7 @@ where
});
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
@ -284,7 +284,7 @@ where
shell: &mut Shell<'_, Message>,
viewport: &Rectangle,
) {
self.content.as_widget_mut().on_event(
self.content.as_widget_mut().update(
&mut tree.children[0],
event.clone(),
layout.children().next().unwrap(),

View file

@ -213,7 +213,7 @@ where
layout::atomic(limits, self.width, self.height)
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: core::Event,

View file

@ -302,7 +302,7 @@ where
)
}
fn on_event(
fn update(
&mut self,
_tree: &mut Tree,
event: Event,

View file

@ -257,7 +257,7 @@ where
});
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
@ -274,7 +274,7 @@ where
.zip(&mut tree.children)
.zip(layout.children())
{
child.as_widget_mut().on_event(
child.as_widget_mut().update(
state,
event.clone(),
layout,

View file

@ -510,7 +510,7 @@ where
vec![widget::Tree::new(&self.text_input as &dyn Widget<_, _, _>)]
}
fn on_event(
fn update(
&mut self,
tree: &mut widget::Tree,
event: Event,
@ -539,7 +539,7 @@ where
let mut local_shell = Shell::new(&mut local_messages);
// Provide it to the widget
self.text_input.on_event(
self.text_input.update(
&mut tree.children[0],
event.clone(),
layout,
@ -728,7 +728,7 @@ where
published_message_to_shell = true;
// Unfocus the input
self.text_input.on_event(
self.text_input.update(
&mut tree.children[0],
Event::Mouse(mouse::Event::ButtonPressed(
mouse::Button::Left,

View file

@ -297,7 +297,7 @@ where
);
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
@ -308,7 +308,7 @@ where
shell: &mut Shell<'_, Message>,
viewport: &Rectangle,
) {
self.content.as_widget_mut().on_event(
self.content.as_widget_mut().update(
tree,
event,
layout.children().next().unwrap(),

View file

@ -438,7 +438,7 @@ where
.operate(state, layout, renderer, operation);
}
fn on_event(
fn update(
&mut self,
state: &mut Tree,
event: Event,
@ -454,7 +454,7 @@ where
core::Event::Mouse(mouse::Event::ButtonPressed(_))
);
self.content.as_widget_mut().on_event(
self.content.as_widget_mut().update(
state, event, layout, cursor, renderer, clipboard, shell,
viewport,
);
@ -640,7 +640,7 @@ where
}
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
@ -682,7 +682,7 @@ where
|| self.is_top_focused
|| self.is_top_overlay_active
{
self.top.as_widget_mut().on_event(
self.top.as_widget_mut().update(
top_tree,
event.clone(),
top_layout,
@ -698,7 +698,7 @@ where
return;
}
self.base.as_widget_mut().on_event(
self.base.as_widget_mut().update(
base_tree,
event.clone(),
base_layout,

View file

@ -148,7 +148,7 @@ where
layout::Node::new(final_size)
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,

View file

@ -297,7 +297,7 @@ where
});
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
@ -314,7 +314,7 @@ where
.zip(&mut tree.children)
.zip(layout.children())
{
child.as_widget_mut().on_event(
child.as_widget_mut().update(
state,
event.clone(),
layout,

View file

@ -195,7 +195,7 @@ where
});
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
@ -207,7 +207,7 @@ where
viewport: &Rectangle,
) {
self.with_element_mut(|element| {
element.as_widget_mut().on_event(
element.as_widget_mut().update(
&mut tree.children[0],
event,
layout,

View file

@ -311,7 +311,7 @@ where
})
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: core::Event,
@ -327,7 +327,7 @@ where
let t = tree.state.downcast_mut::<Rc<RefCell<Option<Tree>>>>();
self.with_element_mut(|element| {
element.as_widget_mut().on_event(
element.as_widget_mut().update(
&mut t.borrow_mut().as_mut().unwrap().children[0],
event,
layout,

View file

@ -182,7 +182,7 @@ where
);
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
@ -205,7 +205,7 @@ where
layout,
&self.view,
|tree, renderer, layout, element| {
element.as_widget_mut().on_event(
element.as_widget_mut().update(
tree,
event,
layout,

View file

@ -215,7 +215,7 @@ where
);
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
@ -226,7 +226,7 @@ where
shell: &mut Shell<'_, Message>,
viewport: &Rectangle,
) {
self.content.as_widget_mut().on_event(
self.content.as_widget_mut().update(
&mut tree.children[0],
event.clone(),
layout,

View file

@ -273,7 +273,7 @@ where
) {
let bounds = layout.bounds();
self.list.on_event(
self.list.update(
self.state, event, layout, cursor, renderer, clipboard, shell,
&bounds,
);
@ -386,7 +386,7 @@ where
layout::Node::new(size)
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,

View file

@ -422,7 +422,7 @@ where
});
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,

View file

@ -271,7 +271,7 @@ where
};
if !is_picked {
self.body.as_widget_mut().on_event(
self.body.as_widget_mut().update(
&mut tree.children[0],
event,
body_layout,

View file

@ -454,7 +454,7 @@ where
if let Some(compact) = controls.compact.as_mut() {
let compact_layout = children.next().unwrap();
compact.as_widget_mut().on_event(
compact.as_widget_mut().update(
&mut tree.children[2],
event.clone(),
compact_layout,
@ -467,7 +467,7 @@ where
} else {
show_title = false;
controls.full.as_widget_mut().on_event(
controls.full.as_widget_mut().update(
&mut tree.children[1],
event.clone(),
controls_layout,
@ -479,7 +479,7 @@ where
);
}
} else {
controls.full.as_widget_mut().on_event(
controls.full.as_widget_mut().update(
&mut tree.children[1],
event.clone(),
controls_layout,
@ -493,7 +493,7 @@ where
}
if show_title {
self.content.as_widget_mut().on_event(
self.content.as_widget_mut().update(
&mut tree.children[0],
event,
title_layout,

View file

@ -427,7 +427,7 @@ where
layout::Node::new(size)
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,

View file

@ -323,7 +323,7 @@ where
)
}
fn on_event(
fn update(
&mut self,
_state: &mut Tree,
event: Event,

View file

@ -253,7 +253,7 @@ where
});
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
@ -270,7 +270,7 @@ where
.zip(&mut tree.children)
.zip(layout.children())
{
child.as_widget_mut().on_event(
child.as_widget_mut().update(
state,
event.clone(),
layout,
@ -492,7 +492,7 @@ where
self.row.operate(tree, layout, renderer, operation);
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
@ -503,7 +503,7 @@ where
shell: &mut Shell<'_, Message>,
viewport: &Rectangle,
) {
self.row.on_event(
self.row.update(
tree, event, layout, cursor, renderer, clipboard, shell, viewport,
);
}

View file

@ -508,7 +508,7 @@ where
);
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
@ -724,7 +724,7 @@ where
let translation =
state.translation(self.direction, bounds, content_bounds);
self.content.as_widget_mut().on_event(
self.content.as_widget_mut().update(
&mut tree.children[0],
event.clone(),
content,

View file

@ -87,7 +87,7 @@ where
layout::atomic(limits, self.width, self.height)
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: crate::core::Event,

View file

@ -242,7 +242,7 @@ where
layout::atomic(limits, self.width, self.height)
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,

View file

@ -204,7 +204,7 @@ where
});
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
@ -224,7 +224,7 @@ where
.zip(tree.children.iter_mut().rev())
.zip(layout.children().rev())
{
child.as_widget_mut().on_event(
child.as_widget_mut().update(
state,
event.clone(),
layout,

View file

@ -354,7 +354,7 @@ where
);
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,

View file

@ -595,7 +595,7 @@ where
}
}
fn on_event(
fn update(
&mut self,
tree: &mut widget::Tree,
event: Event,

View file

@ -627,7 +627,7 @@ where
operation.text_input(state, self.id.as_ref().map(|id| &id.0));
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,

View file

@ -110,7 +110,7 @@ where
.operate(tree, layout, renderer, operation);
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
@ -121,7 +121,7 @@ where
shell: &mut Shell<'_, Message>,
viewport: &Rectangle,
) {
self.content.as_widget_mut().on_event(
self.content.as_widget_mut().update(
tree, event, layout, cursor, renderer, clipboard, shell, viewport,
);
}

View file

@ -306,7 +306,7 @@ where
)
}
fn on_event(
fn update(
&mut self,
_state: &mut Tree,
event: Event,

View file

@ -189,7 +189,7 @@ where
.layout(&mut tree.children[0], renderer, limits)
}
fn on_event(
fn update(
&mut self,
tree: &mut widget::Tree,
event: Event,
@ -215,7 +215,7 @@ where
shell.invalidate_layout();
}
self.content.as_widget_mut().on_event(
self.content.as_widget_mut().update(
&mut tree.children[0],
event,
layout,

View file

@ -243,7 +243,7 @@ where
layout::atomic(limits, self.width, self.height)
}
fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,