Introduce Program API
This commit is contained in:
parent
0524e9b457
commit
c22269bff3
43 changed files with 1141 additions and 831 deletions
|
|
@ -1,10 +1,11 @@
|
|||
use iced::executor;
|
||||
use iced::widget::{button, column, container};
|
||||
use iced::window;
|
||||
use iced::{Alignment, Application, Command, Element, Length, Settings, Theme};
|
||||
use iced::{Alignment, Command, Element, Length};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
Exit::run(Settings::default())
|
||||
iced::application(Exit::new, Exit::update, Exit::view)
|
||||
.title("Exit - Iced")
|
||||
.run()
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
@ -18,20 +19,11 @@ enum Message {
|
|||
Exit,
|
||||
}
|
||||
|
||||
impl Application for Exit {
|
||||
type Executor = executor::Default;
|
||||
type Message = Message;
|
||||
type Theme = Theme;
|
||||
type Flags = ();
|
||||
|
||||
fn new(_flags: ()) -> (Self, Command<Message>) {
|
||||
impl Exit {
|
||||
fn new() -> (Self, Command<Message>) {
|
||||
(Self::default(), Command::none())
|
||||
}
|
||||
|
||||
fn title(&self) -> String {
|
||||
String::from("Exit - Iced")
|
||||
}
|
||||
|
||||
fn update(&mut self, message: Message) -> Command<Message> {
|
||||
match message {
|
||||
Message::Confirm => window::close(window::Id::MAIN),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue