diff options
author | 2021-03-11 03:38:20 +0100 | |
---|---|---|
committer | 2021-03-11 03:38:20 +0100 | |
commit | ae517b9fa033ba75df5fc6ce766698fab22504fa (patch) | |
tree | 52301933e60b12eb58885ef6671869ada84dcaca /examples | |
parent | 7eb512774862d44772c43f9843f586bfcfa2aa89 (diff) | |
download | iced-ae517b9fa033ba75df5fc6ce766698fab22504fa.tar.gz iced-ae517b9fa033ba75df5fc6ce766698fab22504fa.tar.bz2 iced-ae517b9fa033ba75df5fc6ce766698fab22504fa.zip |
Add `clipboard` argument to `Application::update`
Diffstat (limited to 'examples')
-rw-r--r-- | examples/clock/src/main.rs | 10 | ||||
-rw-r--r-- | examples/download_progress/src/main.rs | 10 | ||||
-rw-r--r-- | examples/events/src/main.rs | 10 | ||||
-rw-r--r-- | examples/game_of_life/src/main.rs | 10 | ||||
-rw-r--r-- | examples/integration/src/controls.rs | 11 | ||||
-rw-r--r-- | examples/pane_grid/src/main.rs | 11 | ||||
-rw-r--r-- | examples/pokedex/src/main.rs | 10 | ||||
-rw-r--r-- | examples/solar_system/src/main.rs | 10 | ||||
-rw-r--r-- | examples/stopwatch/src/main.rs | 10 | ||||
-rw-r--r-- | examples/todos/src/main.rs | 10 |
10 files changed, 72 insertions, 30 deletions
diff --git a/examples/clock/src/main.rs b/examples/clock/src/main.rs index b317ac00..9bcc827b 100644 --- a/examples/clock/src/main.rs +++ b/examples/clock/src/main.rs @@ -1,7 +1,7 @@ use iced::{ canvas::{self, Cache, Canvas, Cursor, Geometry, LineCap, Path, Stroke}, - executor, time, Application, Color, Command, Container, Element, Length, - Point, Rectangle, Settings, Subscription, Vector, + executor, time, Application, Clipboard, Color, Command, Container, Element, + Length, Point, Rectangle, Settings, Subscription, Vector, }; pub fn main() -> iced::Result { @@ -40,7 +40,11 @@ impl Application for Clock { String::from("Clock - Iced") } - fn update(&mut self, message: Message) -> Command<Message> { + fn update( + &mut self, + message: Message, + _clipboard: &mut Clipboard, + ) -> Command<Message> { match message { Message::Tick(local_time) => { let now = local_time; diff --git a/examples/download_progress/src/main.rs b/examples/download_progress/src/main.rs index cd024926..6f844e66 100644 --- a/examples/download_progress/src/main.rs +++ b/examples/download_progress/src/main.rs @@ -1,6 +1,6 @@ use iced::{ - button, executor, Align, Application, Button, Column, Command, Container, - Element, Length, ProgressBar, Settings, Subscription, Text, + button, executor, Align, Application, Button, Clipboard, Column, Command, + Container, Element, Length, ProgressBar, Settings, Subscription, Text, }; mod download; @@ -43,7 +43,11 @@ impl Application for Example { String::from("Download progress - Iced") } - fn update(&mut self, message: Message) -> Command<Message> { + fn update( + &mut self, + message: Message, + _clipboard: &mut Clipboard, + ) -> Command<Message> { match message { Message::Add => { self.last_id = self.last_id + 1; diff --git a/examples/events/src/main.rs b/examples/events/src/main.rs index 6eba6aad..18e6364b 100644 --- a/examples/events/src/main.rs +++ b/examples/events/src/main.rs @@ -1,6 +1,6 @@ use iced::{ - executor, Align, Application, Checkbox, Column, Command, Container, - Element, Length, Settings, Subscription, Text, + executor, Align, Application, Checkbox, Clipboard, Column, Command, + Container, Element, Length, Settings, Subscription, Text, }; pub fn main() -> iced::Result { @@ -32,7 +32,11 @@ impl Application for Events { String::from("Events - Iced") } - fn update(&mut self, message: Message) -> Command<Message> { + fn update( + &mut self, + message: Message, + _clipboard: &mut Clipboard, + ) -> Command<Message> { match message { Message::EventOccurred(event) => { self.last.push(event); diff --git a/examples/game_of_life/src/main.rs b/examples/game_of_life/src/main.rs index e18bd6e0..64599163 100644 --- a/examples/game_of_life/src/main.rs +++ b/examples/game_of_life/src/main.rs @@ -10,8 +10,8 @@ use iced::pick_list::{self, PickList}; use iced::slider::{self, Slider}; use iced::time; use iced::{ - Align, Application, Checkbox, Column, Command, Container, Element, Length, - Row, Settings, Subscription, Text, + Align, Application, Checkbox, Clipboard, Column, Command, Container, + Element, Length, Row, Settings, Subscription, Text, }; use preset::Preset; use std::time::{Duration, Instant}; @@ -65,7 +65,11 @@ impl Application for GameOfLife { String::from("Game of Life - Iced") } - fn update(&mut self, message: Message) -> Command<Message> { + fn update( + &mut self, + message: Message, + _clipboard: &mut Clipboard, + ) -> Command<Message> { match message { Message::Grid(message, version) => { if version == self.version { diff --git a/examples/integration/src/controls.rs b/examples/integration/src/controls.rs index 824f9f53..36ee9b7e 100644 --- a/examples/integration/src/controls.rs +++ b/examples/integration/src/controls.rs @@ -1,7 +1,7 @@ use iced_wgpu::Renderer; use iced_winit::{ - slider, Align, Color, Column, Command, Element, Length, Program, Row, - Slider, Text, + slider, Align, Clipboard, Color, Column, Command, Element, Length, Program, + Row, Slider, Text, }; pub struct Controls { @@ -30,8 +30,13 @@ impl Controls { impl Program for Controls { type Renderer = Renderer; type Message = Message; + type Clipboard = Clipboard; - fn update(&mut self, message: Message) -> Command<Message> { + fn update( + &mut self, + message: Message, + _clipboard: &mut Clipboard, + ) -> Command<Message> { match message { Message::BackgroundColorChanged(color) => { self.background_color = color; diff --git a/examples/pane_grid/src/main.rs b/examples/pane_grid/src/main.rs index c44d24fd..4b87a568 100644 --- a/examples/pane_grid/src/main.rs +++ b/examples/pane_grid/src/main.rs @@ -1,7 +1,8 @@ use iced::{ button, executor, keyboard, pane_grid, scrollable, Align, Application, - Button, Color, Column, Command, Container, Element, HorizontalAlignment, - Length, PaneGrid, Row, Scrollable, Settings, Subscription, Text, + Button, Clipboard, Color, Column, Command, Container, Element, + HorizontalAlignment, Length, PaneGrid, Row, Scrollable, Settings, + Subscription, Text, }; use iced_native::{event, subscription, Event}; @@ -49,7 +50,11 @@ impl Application for Example { String::from("Pane grid - Iced") } - fn update(&mut self, message: Message) -> Command<Message> { + fn update( + &mut self, + message: Message, + _clipboard: &mut Clipboard, + ) -> Command<Message> { match message { Message::Split(axis, pane) => { let result = self.panes.split( diff --git a/examples/pokedex/src/main.rs b/examples/pokedex/src/main.rs index f432f0fc..d2f1bb62 100644 --- a/examples/pokedex/src/main.rs +++ b/examples/pokedex/src/main.rs @@ -1,6 +1,6 @@ use iced::{ - button, futures, image, Align, Application, Button, Column, Command, - Container, Element, Length, Row, Settings, Text, + button, futures, image, Align, Application, Button, Clipboard, Column, + Command, Container, Element, Length, Row, Settings, Text, }; pub fn main() -> iced::Result { @@ -48,7 +48,11 @@ impl Application for Pokedex { format!("{} - Pokédex", subtitle) } - fn update(&mut self, message: Message) -> Command<Message> { + fn update( + &mut self, + message: Message, + _clipboard: &mut Clipboard, + ) -> Command<Message> { match message { Message::PokemonFound(Ok(pokemon)) => { *self = Pokedex::Loaded { diff --git a/examples/solar_system/src/main.rs b/examples/solar_system/src/main.rs index c8f74978..8f844828 100644 --- a/examples/solar_system/src/main.rs +++ b/examples/solar_system/src/main.rs @@ -8,8 +8,8 @@ //! [1]: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Basic_animations#An_animated_solar_system use iced::{ canvas::{self, Cursor, Path, Stroke}, - executor, time, window, Application, Canvas, Color, Command, Element, - Length, Point, Rectangle, Settings, Size, Subscription, Vector, + executor, time, window, Application, Canvas, Clipboard, Color, Command, + Element, Length, Point, Rectangle, Settings, Size, Subscription, Vector, }; use std::time::Instant; @@ -48,7 +48,11 @@ impl Application for SolarSystem { String::from("Solar system - Iced") } - fn update(&mut self, message: Message) -> Command<Message> { + fn update( + &mut self, + message: Message, + _clipboard: &mut Clipboard, + ) -> Command<Message> { match message { Message::Tick(instant) => { self.state.update(instant); diff --git a/examples/stopwatch/src/main.rs b/examples/stopwatch/src/main.rs index 983cf3e6..51972e01 100644 --- a/examples/stopwatch/src/main.rs +++ b/examples/stopwatch/src/main.rs @@ -1,6 +1,6 @@ use iced::{ - button, executor, time, Align, Application, Button, Column, Command, - Container, Element, HorizontalAlignment, Length, Row, Settings, + button, executor, time, Align, Application, Button, Clipboard, Column, + Command, Container, Element, HorizontalAlignment, Length, Row, Settings, Subscription, Text, }; use std::time::{Duration, Instant}; @@ -49,7 +49,11 @@ impl Application for Stopwatch { String::from("Stopwatch - Iced") } - fn update(&mut self, message: Message) -> Command<Message> { + fn update( + &mut self, + message: Message, + _clipboard: &mut Clipboard, + ) -> Command<Message> { match message { Message::Toggle => match self.state { State::Idle => { diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs index b47df5df..7186b950 100644 --- a/examples/todos/src/main.rs +++ b/examples/todos/src/main.rs @@ -1,7 +1,7 @@ use iced::{ button, scrollable, text_input, Align, Application, Button, Checkbox, - Column, Command, Container, Element, Font, HorizontalAlignment, Length, - Row, Scrollable, Settings, Text, TextInput, + Clipboard, Column, Command, Container, Element, Font, HorizontalAlignment, + Length, Row, Scrollable, Settings, Text, TextInput, }; use serde::{Deserialize, Serialize}; @@ -58,7 +58,11 @@ impl Application for Todos { format!("Todos{} - Iced", if dirty { "*" } else { "" }) } - fn update(&mut self, message: Message) -> Command<Message> { + fn update( + &mut self, + message: Message, + _clipboard: &mut Clipboard, + ) -> Command<Message> { match self { Todos::Loading => { match message { |