Skip to content

Commit

Permalink
Rename Widget::on_event to update
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Nov 5, 2024
1 parent dcc184b commit f02bfc3
Show file tree
Hide file tree
Showing 37 changed files with 67 additions and 67 deletions.
8 changes: 4 additions & 4 deletions core/src/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ where
self.widget.operate(tree, layout, renderer, operation);
}

fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
Expand All @@ -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,
Expand Down Expand Up @@ -444,7 +444,7 @@ where
.operate(state, layout, renderer, operation);
}

fn on_event(
fn update(
&mut self,
state: &mut Tree,
event: Event,
Expand All @@ -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,
);
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion examples/loading_spinners/src/circular.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ where
layout::atomic(limits, self.size, self.size)
}

fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
Expand Down
2 changes: 1 addition & 1 deletion examples/loading_spinners/src/linear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ where
layout::atomic(limits, self.width, self.height)
}

fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
Expand Down
6 changes: 3 additions & 3 deletions examples/toast/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ mod toast {
});
}

fn on_event(
fn update(
&mut self,
state: &mut Tree,
event: Event,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/user_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions widget/src/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ where
});
}

fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
Expand All @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion widget/src/canvas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion widget/src/checkbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ where
)
}

fn on_event(
fn update(
&mut self,
_tree: &mut Tree,
event: Event,
Expand Down
4 changes: 2 additions & 2 deletions widget/src/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ where
});
}

fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions widget/src/combo_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions widget/src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ where
);
}

fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
Expand All @@ -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(),
Expand Down
10 changes: 5 additions & 5 deletions widget/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ where
.operate(state, layout, renderer, operation);
}

fn on_event(
fn update(
&mut self,
state: &mut Tree,
event: Event,
Expand All @@ -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,
);
Expand Down Expand Up @@ -640,7 +640,7 @@ where
}
}

fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion widget/src/image/viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ where
layout::Node::new(final_size)
}

fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
Expand Down
4 changes: 2 additions & 2 deletions widget/src/keyed/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ where
});
}

fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions widget/src/lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ where
});
}

fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions widget/src/lazy/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ where
})
}

fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: core::Event,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions widget/src/lazy/responsive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ where
);
}

fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions widget/src/mouse_area.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ where
);
}

fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions widget/src/overlay/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Expand Down Expand Up @@ -386,7 +386,7 @@ where
layout::Node::new(size)
}

fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
Expand Down
2 changes: 1 addition & 1 deletion widget/src/pane_grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ where
});
}

fn on_event(
fn update(
&mut self,
tree: &mut Tree,
event: Event,
Expand Down
2 changes: 1 addition & 1 deletion widget/src/pane_grid/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading

0 comments on commit f02bfc3

Please sign in to comment.