diff options
| author | 2023-01-18 15:01:17 -0800 | |
|---|---|---|
| committer | 2023-01-18 15:01:17 -0800 | |
| commit | 70d487ba20a50c06c73f0ffcd8198f1a7eac7f37 (patch) | |
| tree | afb8e161b18236d4440cba8bb0e0ce896858d653 /examples/exit | |
| parent | 790fa3e7a01a790aa3f07083fe9abf6b68fa7ba1 (diff) | |
| parent | 5ef0648bf447aaca8b96782643401e54a2bf7759 (diff) | |
| download | iced-70d487ba20a50c06c73f0ffcd8198f1a7eac7f37.tar.gz iced-70d487ba20a50c06c73f0ffcd8198f1a7eac7f37.tar.bz2 iced-70d487ba20a50c06c73f0ffcd8198f1a7eac7f37.zip | |
Merge remote-tracking branch 'origin/master' into feat/multi-window-support
# Conflicts:
#	examples/events/src/main.rs
#	glutin/src/application.rs
#	native/src/window.rs
#	winit/src/window.rs
Diffstat (limited to '')
| -rw-r--r-- | examples/exit/src/main.rs | 26 | 
1 files changed, 13 insertions, 13 deletions
| diff --git a/examples/exit/src/main.rs b/examples/exit/src/main.rs index 5d518d2f..6152f627 100644 --- a/examples/exit/src/main.rs +++ b/examples/exit/src/main.rs @@ -1,5 +1,7 @@ +use iced::executor;  use iced::widget::{button, column, container}; -use iced::{Alignment, Element, Length, Sandbox, Settings}; +use iced::window; +use iced::{Alignment, Application, Command, Element, Length, Settings, Theme};  pub fn main() -> iced::Result {      Exit::run(Settings::default()) @@ -8,7 +10,6 @@ pub fn main() -> iced::Result {  #[derive(Default)]  struct Exit {      show_confirm: bool, -    exit: bool,  }  #[derive(Debug, Clone, Copy)] @@ -17,28 +18,27 @@ enum Message {      Exit,  } -impl Sandbox for Exit { +impl Application for Exit { +    type Executor = executor::Default;      type Message = Message; +    type Theme = Theme; +    type Flags = (); -    fn new() -> Self { -        Self::default() +    fn new(_flags: ()) -> (Self, Command<Message>) { +        (Self::default(), Command::none())      }      fn title(&self) -> String {          String::from("Exit - Iced")      } -    fn should_exit(&self) -> bool { -        self.exit -    } - -    fn update(&mut self, message: Message) { +    fn update(&mut self, message: Message) -> Command<Message> {          match message { -            Message::Confirm => { -                self.exit = true; -            } +            Message::Confirm => window::close(),              Message::Exit => {                  self.show_confirm = true; + +                Command::none()              }          }      } | 
