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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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