Introduce Program API

This commit is contained in:
Héctor Ramón Jiménez 2024-03-16 05:33:47 +01:00
parent 0524e9b457
commit c22269bff3
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
43 changed files with 1141 additions and 831 deletions

View file

@ -1,8 +1,8 @@
use iced::widget::{column, pick_list, scrollable, vertical_space};
use iced::{Alignment, Element, Length, Sandbox, Settings};
use iced::{Alignment, Element, Length};
pub fn main() -> iced::Result {
Example::run(Settings::default())
iced::run("Pick List - Iced", Example::update, Example::view)
}
#[derive(Default)]
@ -15,17 +15,7 @@ enum Message {
LanguageSelected(Language),
}
impl Sandbox for Example {
type Message = Message;
fn new() -> Self {
Self::default()
}
fn title(&self) -> String {
String::from("Pick list - Iced")
}
impl Example {
fn update(&mut self, message: Message) {
match message {
Message::LanguageSelected(language) => {