Implement basic cursor availability

This commit is contained in:
Héctor Ramón Jiménez 2023-06-08 20:11:59 +02:00
parent c15f1b5f65
commit 34451bff18
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
55 changed files with 731 additions and 886 deletions

View file

@ -1,10 +1,10 @@
use iced::executor;
use iced::keyboard;
use iced::subscription::{self, Subscription};
use iced::widget::{
self, button, column, container, pick_list, row, slider, text, text_input,
};
use iced::{
executor, keyboard, subscription, Alignment, Application, Command, Element,
Event, Length, Settings, Subscription,
};
use iced::{Alignment, Application, Command, Element, Event, Length, Settings};
use toast::{Status, Toast};
@ -396,7 +396,7 @@ mod toast {
state: &mut Tree,
event: Event,
layout: Layout<'_>,
cursor_position: Point,
cursor: mouse::Cursor,
renderer: &Renderer,
clipboard: &mut dyn Clipboard,
shell: &mut Shell<'_, Message>,
@ -405,7 +405,7 @@ mod toast {
&mut state.children[0],
event,
layout,
cursor_position,
cursor,
renderer,
clipboard,
shell,
@ -419,7 +419,7 @@ mod toast {
theme: &Theme,
style: &renderer::Style,
layout: Layout<'_>,
cursor_position: Point,
cursor: mouse::Cursor,
viewport: &Rectangle,
) {
self.content.as_widget().draw(
@ -428,7 +428,7 @@ mod toast {
theme,
style,
layout,
cursor_position,
cursor,
viewport,
);
}
@ -437,14 +437,14 @@ mod toast {
&self,
state: &Tree,
layout: Layout<'_>,
cursor_position: Point,
cursor: mouse::Cursor,
viewport: &Rectangle,
renderer: &Renderer,
) -> mouse::Interaction {
self.content.as_widget().mouse_interaction(
&state.children[0],
layout,
cursor_position,
cursor,
viewport,
renderer,
)
@ -523,7 +523,7 @@ mod toast {
&mut self,
event: Event,
layout: Layout<'_>,
cursor_position: Point,
cursor: mouse::Cursor,
renderer: &Renderer,
clipboard: &mut dyn Clipboard,
shell: &mut Shell<'_, Message>,
@ -572,7 +572,7 @@ mod toast {
state,
event.clone(),
layout,
cursor_position,
cursor,
renderer,
clipboard,
&mut local_shell,
@ -595,7 +595,7 @@ mod toast {
theme: &<Renderer as advanced::Renderer>::Theme,
style: &renderer::Style,
layout: Layout<'_>,
cursor_position: Point,
cursor: mouse::Cursor,
) {
let viewport = layout.bounds();
@ -606,13 +606,7 @@ mod toast {
.zip(layout.children())
{
child.as_widget().draw(
state,
renderer,
theme,
style,
layout,
cursor_position,
&viewport,
state, renderer, theme, style, layout, cursor, &viewport,
);
}
}
@ -639,7 +633,7 @@ mod toast {
fn mouse_interaction(
&self,
layout: Layout<'_>,
cursor_position: Point,
cursor: mouse::Cursor,
viewport: &Rectangle,
renderer: &Renderer,
) -> mouse::Interaction {
@ -649,11 +643,7 @@ mod toast {
.zip(layout.children())
.map(|((child, state), layout)| {
child.as_widget().mouse_interaction(
state,
layout,
cursor_position,
viewport,
renderer,
state, layout, cursor, viewport, renderer,
)
})
.max()