summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-04-30 08:16:38 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-04-30 08:16:38 +0200
commit98bc8cf2a7c4944d762a0148ca9f615d6ccc0d6e (patch)
tree9e22665e41793517b7ba0b48d7315d3283dfde91 /examples
parentd4c4198f7242f168de65146e0ca339e0c1cbfe9b (diff)
downloadiced-98bc8cf2a7c4944d762a0148ca9f615d6ccc0d6e.tar.gz
iced-98bc8cf2a7c4944d762a0148ca9f615d6ccc0d6e.tar.bz2
iced-98bc8cf2a7c4944d762a0148ca9f615d6ccc0d6e.zip
Rename `MouseCursor` to `mouse::Interaction`
Diffstat (limited to '')
-rw-r--r--examples/bezier_tool/src/main.rs10
-rw-r--r--examples/custom_widget/src/main.rs8
-rw-r--r--examples/game_of_life/src/main.rs19
-rw-r--r--examples/geometry/src/main.rs8
-rw-r--r--examples/integration/src/main.rs14
5 files changed, 32 insertions, 27 deletions
diff --git a/examples/bezier_tool/src/main.rs b/examples/bezier_tool/src/main.rs
index fe4136b4..fe41e1b2 100644
--- a/examples/bezier_tool/src/main.rs
+++ b/examples/bezier_tool/src/main.rs
@@ -70,7 +70,7 @@ impl Sandbox for Example {
mod bezier {
use iced::{
canvas::{self, Canvas, Cursor, Event, Frame, Geometry, Path, Stroke},
- mouse, Element, Length, MouseCursor, Point, Rectangle,
+ mouse, Element, Length, Point, Rectangle,
};
#[derive(Default)]
@@ -166,15 +166,15 @@ mod bezier {
}
}
- fn mouse_cursor(
+ fn mouse_interaction(
&self,
bounds: Rectangle,
cursor: Cursor,
- ) -> MouseCursor {
+ ) -> mouse::Interaction {
if cursor.is_over(&bounds) {
- MouseCursor::Crosshair
+ mouse::Interaction::Crosshair
} else {
- MouseCursor::default()
+ mouse::Interaction::default()
}
}
}
diff --git a/examples/custom_widget/src/main.rs b/examples/custom_widget/src/main.rs
index d0bceb73..f096fb54 100644
--- a/examples/custom_widget/src/main.rs
+++ b/examples/custom_widget/src/main.rs
@@ -10,8 +10,8 @@ mod circle {
// if you wish to, by creating your own `Renderer` trait, which could be
// implemented by `iced_wgpu` and other renderers.
use iced_native::{
- layout, Background, Color, Element, Hasher, Layout, Length,
- MouseCursor, Point, Size, Widget,
+ layout, mouse, Background, Color, Element, Hasher, Layout, Length,
+ Point, Size, Widget,
};
use iced_wgpu::{Defaults, Primitive, Renderer};
@@ -57,7 +57,7 @@ mod circle {
_defaults: &Defaults,
layout: Layout<'_>,
_cursor_position: Point,
- ) -> (Primitive, MouseCursor) {
+ ) -> (Primitive, mouse::Interaction) {
(
Primitive::Quad {
bounds: layout.bounds(),
@@ -66,7 +66,7 @@ mod circle {
border_width: 0,
border_color: Color::TRANSPARENT,
},
- MouseCursor::default(),
+ mouse::Interaction::default(),
)
}
}
diff --git a/examples/game_of_life/src/main.rs b/examples/game_of_life/src/main.rs
index 5a58a8cb..f0891db1 100644
--- a/examples/game_of_life/src/main.rs
+++ b/examples/game_of_life/src/main.rs
@@ -157,8 +157,7 @@ impl Application for GameOfLife {
mod grid {
use iced::{
canvas::{self, Canvas, Cursor, Event, Frame, Geometry, Path},
- mouse, Color, Element, Length, MouseCursor, Point, Rectangle, Size,
- Vector,
+ mouse, Color, Element, Length, Point, Rectangle, Size, Vector,
};
use std::collections::{HashMap, HashSet};
@@ -397,16 +396,20 @@ mod grid {
vec![life, hovered_cell]
}
- fn mouse_cursor(
+ fn mouse_interaction(
&self,
bounds: Rectangle,
cursor: Cursor,
- ) -> MouseCursor {
+ ) -> mouse::Interaction {
match self.interaction {
- Some(Interaction::Drawing) => MouseCursor::Crosshair,
- Some(Interaction::Panning { .. }) => MouseCursor::Grabbing,
- None if cursor.is_over(&bounds) => MouseCursor::Crosshair,
- _ => MouseCursor::default(),
+ Some(Interaction::Drawing) => mouse::Interaction::Crosshair,
+ Some(Interaction::Panning { .. }) => {
+ mouse::Interaction::Grabbing
+ }
+ None if cursor.is_over(&bounds) => {
+ mouse::Interaction::Crosshair
+ }
+ _ => mouse::Interaction::default(),
}
}
}
diff --git a/examples/geometry/src/main.rs b/examples/geometry/src/main.rs
index 2a3efd4a..aabe6b21 100644
--- a/examples/geometry/src/main.rs
+++ b/examples/geometry/src/main.rs
@@ -11,8 +11,8 @@ mod rainbow {
// if you wish to, by creating your own `Renderer` trait, which could be
// implemented by `iced_wgpu` and other renderers.
use iced_native::{
- layout, Element, Hasher, Layout, Length, MouseCursor, Point, Size,
- Vector, Widget,
+ layout, mouse, Element, Hasher, Layout, Length, Point, Size, Vector,
+ Widget,
};
use iced_wgpu::{
triangle::{Mesh2D, Vertex2D},
@@ -54,7 +54,7 @@ mod rainbow {
_defaults: &Defaults,
layout: Layout<'_>,
cursor_position: Point,
- ) -> (Primitive, MouseCursor) {
+ ) -> (Primitive, mouse::Interaction) {
let b = layout.bounds();
// R O Y G B I V
@@ -141,7 +141,7 @@ mod rainbow {
},
}),
},
- MouseCursor::default(),
+ mouse::Interaction::default(),
)
}
}
diff --git a/examples/integration/src/main.rs b/examples/integration/src/main.rs
index da571ed1..92d2fa8d 100644
--- a/examples/integration/src/main.rs
+++ b/examples/integration/src/main.rs
@@ -8,7 +8,7 @@ use iced_wgpu::{
wgpu, window::SwapChain, Primitive, Renderer, Settings, Target,
};
use iced_winit::{
- futures, winit, Cache, Clipboard, MouseCursor, Size, UserInterface,
+ futures, mouse, winit, Cache, Clipboard, Size, UserInterface,
};
use winit::{
@@ -63,7 +63,7 @@ pub fn main() {
let mut events = Vec::new();
let mut cache = Some(Cache::default());
let mut renderer = Renderer::new(&mut device, Settings::default());
- let mut output = (Primitive::None, MouseCursor::default());
+ let mut output = (Primitive::None, mouse::Interaction::default());
let clipboard = Clipboard::new(&window);
// Initialize scene and GUI controls
@@ -189,7 +189,7 @@ pub fn main() {
scene.draw(&mut encoder, &frame.view);
// And then iced on top
- let mouse_cursor = renderer.draw(
+ let mouse_interaction = renderer.draw(
&mut device,
&mut encoder,
Target {
@@ -205,9 +205,11 @@ pub fn main() {
queue.submit(&[encoder.finish()]);
// And update the mouse cursor
- window.set_cursor_icon(iced_winit::conversion::mouse_cursor(
- mouse_cursor,
- ));
+ window.set_cursor_icon(
+ iced_winit::conversion::mouse_interaction(
+ mouse_interaction,
+ ),
+ );
}
_ => {}
}