Introduce daemon API and unify shell runtimes
This commit is contained in:
parent
368b15f708
commit
341c9a3c12
54 changed files with 1352 additions and 2677 deletions
|
|
@ -7,7 +7,7 @@ use iced::widget::canvas::{
|
|||
use iced::{Element, Length, Point, Rectangle, Renderer, Subscription, Theme};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program("Arc - Iced", Arc::update, Arc::view)
|
||||
iced::application("Arc - Iced", Arc::update, Arc::view)
|
||||
.subscription(Arc::subscription)
|
||||
.theme(|_| Theme::Dark)
|
||||
.antialiasing(true)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use iced::widget::{button, container, horizontal_space, hover};
|
|||
use iced::{Element, Length, Theme};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program("Bezier Tool - Iced", Example::update, Example::view)
|
||||
iced::application("Bezier Tool - Iced", Example::update, Example::view)
|
||||
.theme(|_| Theme::CatppuccinMocha)
|
||||
.antialiasing(true)
|
||||
.run()
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use iced::{Element, Font};
|
|||
const ICON_FONT: Font = Font::with_name("icons");
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program("Checkbox - Iced", Example::update, Example::view)
|
||||
iced::application("Checkbox - Iced", Example::update, Example::view)
|
||||
.font(include_bytes!("../fonts/icons.ttf").as_slice())
|
||||
.run()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use iced::{
|
|||
pub fn main() -> iced::Result {
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
iced::program("Clock - Iced", Clock::update, Clock::view)
|
||||
iced::application("Clock - Iced", Clock::update, Clock::view)
|
||||
.subscription(Clock::subscription)
|
||||
.theme(Clock::theme)
|
||||
.antialiasing(true)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use std::marker::PhantomData;
|
|||
use std::ops::RangeInclusive;
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program(
|
||||
iced::application(
|
||||
"Color Palette - Iced",
|
||||
ColorPalette::update,
|
||||
ColorPalette::view,
|
||||
|
|
|
|||
|
|
@ -9,9 +9,13 @@ use iced::window;
|
|||
use iced::{Alignment, Color, Element, Length, Subscription};
|
||||
|
||||
fn main() -> iced::Result {
|
||||
iced::program("Custom Shader - Iced", IcedCubes::update, IcedCubes::view)
|
||||
.subscription(IcedCubes::subscription)
|
||||
.run()
|
||||
iced::application(
|
||||
"Custom Shader - Iced",
|
||||
IcedCubes::update,
|
||||
IcedCubes::view,
|
||||
)
|
||||
.subscription(IcedCubes::subscription)
|
||||
.run()
|
||||
}
|
||||
|
||||
struct IcedCubes {
|
||||
|
|
|
|||
|
|
@ -4,9 +4,13 @@ use iced::widget::{button, center, column, progress_bar, text, Column};
|
|||
use iced::{Alignment, Element, Subscription};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program("Download Progress - Iced", Example::update, Example::view)
|
||||
.subscription(Example::subscription)
|
||||
.run()
|
||||
iced::application(
|
||||
"Download Progress - Iced",
|
||||
Example::update,
|
||||
Example::view,
|
||||
)
|
||||
.subscription(Example::subscription)
|
||||
.run()
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use std::path::{Path, PathBuf};
|
|||
use std::sync::Arc;
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program("Editor - Iced", Editor::update, Editor::view)
|
||||
iced::application("Editor - Iced", Editor::update, Editor::view)
|
||||
.load(Editor::load)
|
||||
.subscription(Editor::subscription)
|
||||
.theme(Editor::theme)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use iced::window;
|
|||
use iced::{Alignment, Element, Length, Subscription, Task};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program("Events - Iced", Events::update, Events::view)
|
||||
iced::application("Events - Iced", Events::update, Events::view)
|
||||
.subscription(Events::subscription)
|
||||
.exit_on_close_request(false)
|
||||
.run()
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use iced::window;
|
|||
use iced::{Alignment, Element, Task};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program("Exit - Iced", Exit::update, Exit::view).run()
|
||||
iced::application("Exit - Iced", Exit::update, Exit::view).run()
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use iced::{
|
|||
};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program("Ferris - Iced", Image::update, Image::view)
|
||||
iced::application("Ferris - Iced", Image::update, Image::view)
|
||||
.subscription(Image::subscription)
|
||||
.theme(|_| Theme::TokyoNight)
|
||||
.run()
|
||||
|
|
|
|||
|
|
@ -15,12 +15,16 @@ use std::time::Duration;
|
|||
pub fn main() -> iced::Result {
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
iced::program("Game of Life - Iced", GameOfLife::update, GameOfLife::view)
|
||||
.subscription(GameOfLife::subscription)
|
||||
.theme(|_| Theme::Dark)
|
||||
.antialiasing(true)
|
||||
.centered()
|
||||
.run()
|
||||
iced::application(
|
||||
"Game of Life - Iced",
|
||||
GameOfLife::update,
|
||||
GameOfLife::view,
|
||||
)
|
||||
.subscription(GameOfLife::subscription)
|
||||
.theme(|_| Theme::Dark)
|
||||
.antialiasing(true)
|
||||
.centered()
|
||||
.run()
|
||||
}
|
||||
|
||||
struct GameOfLife {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use iced::application;
|
||||
use iced::gradient;
|
||||
use iced::program;
|
||||
use iced::widget::{
|
||||
checkbox, column, container, horizontal_space, row, slider, text,
|
||||
};
|
||||
|
|
@ -8,7 +8,7 @@ use iced::{Alignment, Color, Element, Length, Radians, Theme};
|
|||
pub fn main() -> iced::Result {
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
iced::program("Gradient - Iced", Gradient::update, Gradient::view)
|
||||
iced::application("Gradient - Iced", Gradient::update, Gradient::view)
|
||||
.style(Gradient::style)
|
||||
.transparent(true)
|
||||
.run()
|
||||
|
|
@ -95,11 +95,11 @@ impl Gradient {
|
|||
.into()
|
||||
}
|
||||
|
||||
fn style(&self, theme: &Theme) -> program::Appearance {
|
||||
use program::DefaultStyle;
|
||||
fn style(&self, theme: &Theme) -> application::Appearance {
|
||||
use application::DefaultStyle;
|
||||
|
||||
if self.transparent {
|
||||
program::Appearance {
|
||||
application::Appearance {
|
||||
background_color: Color::TRANSPARENT,
|
||||
text_color: theme.palette().text,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use iced::{
|
|||
};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program(Layout::title, Layout::update, Layout::view)
|
||||
iced::application(Layout::title, Layout::update, Layout::view)
|
||||
.subscription(Layout::subscription)
|
||||
.theme(Layout::theme)
|
||||
.run()
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use circular::Circular;
|
|||
use linear::Linear;
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program(
|
||||
iced::application(
|
||||
"Loading Spinners - Iced",
|
||||
LoadingSpinners::update,
|
||||
LoadingSpinners::view,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use iced::{Alignment, Color, Element, Length, Subscription, Task};
|
|||
use std::fmt;
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program("Modal - Iced", App::update, App::view)
|
||||
iced::application("Modal - Iced", App::update, App::view)
|
||||
.subscription(App::subscription)
|
||||
.run()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,21 @@
|
|||
use iced::executor;
|
||||
use iced::multi_window::{self, Application};
|
||||
use iced::widget::{
|
||||
button, center, column, container, horizontal_space, scrollable, text,
|
||||
text_input,
|
||||
};
|
||||
use iced::window;
|
||||
use iced::{
|
||||
Alignment, Element, Length, Settings, Subscription, Task, Theme, Vector,
|
||||
};
|
||||
use iced::{Alignment, Element, Length, Subscription, Task, Theme, Vector};
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
fn main() -> iced::Result {
|
||||
Example::run(Settings::default())
|
||||
iced::daemon(Example::title, Example::update, Example::view)
|
||||
.load(|| {
|
||||
window::open(window::Settings::default()).map(Message::WindowOpened)
|
||||
})
|
||||
.subscription(Example::subscription)
|
||||
.theme(Example::theme)
|
||||
.scale_factor(Example::scale_factor)
|
||||
.run()
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
@ -39,21 +42,7 @@ enum Message {
|
|||
TitleChanged(window::Id, String),
|
||||
}
|
||||
|
||||
impl multi_window::Application for Example {
|
||||
type Executor = executor::Default;
|
||||
type Message = Message;
|
||||
type Theme = Theme;
|
||||
type Flags = ();
|
||||
|
||||
fn new(_flags: ()) -> (Self, Task<Message>) {
|
||||
(
|
||||
Example {
|
||||
windows: BTreeMap::from([(window::Id::MAIN, Window::new(1))]),
|
||||
},
|
||||
Task::none(),
|
||||
)
|
||||
}
|
||||
|
||||
impl Example {
|
||||
fn title(&self, window: window::Id) -> String {
|
||||
self.windows
|
||||
.get(&window)
|
||||
|
|
@ -97,7 +86,11 @@ impl multi_window::Application for Example {
|
|||
Message::WindowClosed(id) => {
|
||||
self.windows.remove(&id);
|
||||
|
||||
Task::none()
|
||||
if self.windows.is_empty() {
|
||||
iced::exit()
|
||||
} else {
|
||||
Task::none()
|
||||
}
|
||||
}
|
||||
Message::ScaleInputChanged(id, scale) => {
|
||||
if let Some(window) = self.windows.get_mut(&id) {
|
||||
|
|
@ -149,7 +142,7 @@ impl multi_window::Application for Example {
|
|||
.unwrap_or(1.0)
|
||||
}
|
||||
|
||||
fn subscription(&self) -> Subscription<Self::Message> {
|
||||
fn subscription(&self) -> Subscription<Message> {
|
||||
window::close_events().map(Message::WindowClosed)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use std::collections::HashMap;
|
|||
pub fn main() -> iced::Result {
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
iced::program("Multitouch - Iced", Multitouch::update, Multitouch::view)
|
||||
iced::application("Multitouch - Iced", Multitouch::update, Multitouch::view)
|
||||
.antialiasing(true)
|
||||
.centered()
|
||||
.run()
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use iced::widget::{
|
|||
use iced::{Color, Element, Length, Size, Subscription};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program("Pane Grid - Iced", Example::update, Example::view)
|
||||
iced::application("Pane Grid - Iced", Example::update, Example::view)
|
||||
.subscription(Example::subscription)
|
||||
.run()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use iced::widget::{self, center, column, image, row, text};
|
|||
use iced::{Alignment, Element, Length, Task};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program(Pokedex::title, Pokedex::update, Pokedex::view)
|
||||
iced::application(Pokedex::title, Pokedex::update, Pokedex::view)
|
||||
.load(Pokedex::search)
|
||||
.run()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use iced::widget::{center, column, pick_list, qr_code, row, text, text_input};
|
|||
use iced::{Alignment, Element, Theme};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program(
|
||||
iced::application(
|
||||
"QR Code Generator - Iced",
|
||||
QRGenerator::update,
|
||||
QRGenerator::view,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use ::image::ColorType;
|
|||
fn main() -> iced::Result {
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
iced::program("Screenshot - Iced", Example::update, Example::view)
|
||||
iced::application("Screenshot - Iced", Example::update, Example::view)
|
||||
.subscription(Example::subscription)
|
||||
.run()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use once_cell::sync::Lazy;
|
|||
static SCROLLABLE_ID: Lazy<scrollable::Id> = Lazy::new(scrollable::Id::unique);
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program(
|
||||
iced::application(
|
||||
"Scrollable - Iced",
|
||||
ScrollableDemo::update,
|
||||
ScrollableDemo::view,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use rand::Rng;
|
|||
use std::fmt::Debug;
|
||||
|
||||
fn main() -> iced::Result {
|
||||
iced::program(
|
||||
iced::application(
|
||||
"Sierpinski Triangle - Iced",
|
||||
SierpinskiEmulator::update,
|
||||
SierpinskiEmulator::view,
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use std::time::Instant;
|
|||
pub fn main() -> iced::Result {
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
iced::program(
|
||||
iced::application(
|
||||
"Solar System - Iced",
|
||||
SolarSystem::update,
|
||||
SolarSystem::view,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use iced::{Alignment, Element, Subscription, Theme};
|
|||
use std::time::{Duration, Instant};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program("Stopwatch - Iced", Stopwatch::update, Stopwatch::view)
|
||||
iced::application("Stopwatch - Iced", Stopwatch::update, Stopwatch::view)
|
||||
.subscription(Stopwatch::subscription)
|
||||
.theme(Stopwatch::theme)
|
||||
.run()
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use iced::widget::{
|
|||
use iced::{Alignment, Element, Length, Theme};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program("Styling - Iced", Styling::update, Styling::view)
|
||||
iced::application("Styling - Iced", Styling::update, Styling::view)
|
||||
.theme(Styling::theme)
|
||||
.run()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,12 @@ use iced::widget::{button, center, column, text};
|
|||
use iced::{system, Element, Task};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program("System Information - Iced", Example::update, Example::view)
|
||||
.run()
|
||||
iced::application(
|
||||
"System Information - Iced",
|
||||
Example::update,
|
||||
Example::view,
|
||||
)
|
||||
.run()
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use std::cell::RefCell;
|
|||
pub fn main() -> iced::Result {
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
iced::program("The Matrix - Iced", TheMatrix::update, TheMatrix::view)
|
||||
iced::application("The Matrix - Iced", TheMatrix::update, TheMatrix::view)
|
||||
.subscription(TheMatrix::subscription)
|
||||
.antialiasing(true)
|
||||
.run()
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use iced::{Alignment, Element, Length, Subscription, Task};
|
|||
use toast::{Status, Toast};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program("Toast - Iced", App::update, App::view)
|
||||
iced::application("Toast - Iced", App::update, App::view)
|
||||
.subscription(App::subscription)
|
||||
.run()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ pub fn main() -> iced::Result {
|
|||
#[cfg(not(target_arch = "wasm32"))]
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
iced::program(Todos::title, Todos::update, Todos::view)
|
||||
iced::application(Todos::title, Todos::update, Todos::view)
|
||||
.load(Todos::load)
|
||||
.subscription(Todos::subscription)
|
||||
.font(include_bytes!("../fonts/icons.ttf").as_slice())
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ pub fn main() -> iced::Result {
|
|||
#[cfg(not(target_arch = "wasm32"))]
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
iced::program(Tour::title, Tour::update, Tour::view)
|
||||
iced::application(Tour::title, Tour::update, Tour::view)
|
||||
.centered()
|
||||
.run()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use iced::widget::{center, text};
|
|||
use iced::{Element, Subscription};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program("URL Handler - Iced", App::update, App::view)
|
||||
iced::application("URL Handler - Iced", App::update, App::view)
|
||||
.subscription(App::subscription)
|
||||
.run()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use iced::widget::{
|
|||
use iced::{Element, Length, Point, Rectangle, Renderer, Theme, Vector};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program(
|
||||
iced::application(
|
||||
"Vectorial Text - Iced",
|
||||
VectorialText::update,
|
||||
VectorialText::view,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use iced::{
|
|||
};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program("Visible Bounds - Iced", Example::update, Example::view)
|
||||
iced::application("Visible Bounds - Iced", Example::update, Example::view)
|
||||
.subscription(Example::subscription)
|
||||
.theme(|_| Theme::Dark)
|
||||
.run()
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use iced::{color, Element, Length, Subscription, Task};
|
|||
use once_cell::sync::Lazy;
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::program("WebSocket - Iced", WebSocket::update, WebSocket::view)
|
||||
iced::application("WebSocket - Iced", WebSocket::update, WebSocket::view)
|
||||
.load(WebSocket::load)
|
||||
.subscription(WebSocket::subscription)
|
||||
.run()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue