diff options
| author | 2024-03-19 22:09:36 +0900 | |
|---|---|---|
| committer | 2024-03-19 22:09:36 +0900 | |
| commit | f3a1c785b2743e9c48c3d28df0c6772ce579d7c8 (patch) | |
| tree | 1b39799f45878d89b4f9e2f9bea8fa8a7ed07150 /examples/checkbox/src | |
| parent | c9453cd55d84f0dd2ad0050208863d036c98843f (diff) | |
| parent | 8ce16aba6204cb5c02a709cdf79c309f7b7e0196 (diff) | |
| download | iced-f3a1c785b2743e9c48c3d28df0c6772ce579d7c8.tar.gz iced-f3a1c785b2743e9c48c3d28df0c6772ce579d7c8.tar.bz2 iced-f3a1c785b2743e9c48c3d28df0c6772ce579d7c8.zip | |
Merge branch 'iced-rs:master' into viewer_content_fit
Diffstat (limited to '')
| -rw-r--r-- | examples/checkbox/src/main.rs | 33 | 
1 files changed, 6 insertions, 27 deletions
| diff --git a/examples/checkbox/src/main.rs b/examples/checkbox/src/main.rs index ee745c03..38949336 100644 --- a/examples/checkbox/src/main.rs +++ b/examples/checkbox/src/main.rs @@ -1,12 +1,12 @@ -use iced::executor; -use iced::font::{self, Font};  use iced::widget::{checkbox, column, container, row, text}; -use iced::{Application, Command, Element, Length, Settings, Theme}; +use iced::{Element, Font, Length};  const ICON_FONT: Font = Font::with_name("icons");  pub fn main() -> iced::Result { -    Example::run(Settings::default()) +    iced::program("Checkbox - Iced", Example::update, Example::view) +        .font(include_bytes!("../fonts/icons.ttf").as_slice()) +        .run()  }  #[derive(Default)] @@ -21,28 +21,10 @@ enum Message {      DefaultToggled(bool),      CustomToggled(bool),      StyledToggled(bool), -    FontLoaded(Result<(), font::Error>),  } -impl Application for Example { -    type Message = Message; -    type Flags = (); -    type Executor = executor::Default; -    type Theme = Theme; - -    fn new(_flags: Self::Flags) -> (Self, Command<Message>) { -        ( -            Self::default(), -            font::load(include_bytes!("../fonts/icons.ttf").as_slice()) -                .map(Message::FontLoaded), -        ) -    } - -    fn title(&self) -> String { -        String::from("Checkbox - Iced") -    } - -    fn update(&mut self, message: Message) -> Command<Message> { +impl Example { +    fn update(&mut self, message: Message) {          match message {              Message::DefaultToggled(default) => {                  self.default = default; @@ -53,10 +35,7 @@ impl Application for Example {              Message::CustomToggled(custom) => {                  self.custom = custom;              } -            Message::FontLoaded(_) => (),          } - -        Command::none()      }      fn view(&self) -> Element<Message> { | 
