Introduce window::Id to timing::Stage in iced_sentinel
This commit is contained in:
parent
caecbf20ef
commit
8591e5a148
8 changed files with 97 additions and 62 deletions
|
|
@ -1,6 +1,35 @@
|
|||
//! A multi-window application.
|
||||
pub mod program;
|
||||
pub mod state;
|
||||
use crate::core::text;
|
||||
use crate::core::window;
|
||||
use crate::core::{Element, Renderer};
|
||||
use crate::Command;
|
||||
|
||||
pub use program::Program;
|
||||
pub use state::State;
|
||||
/// The core of a user interface for a multi-window application following The Elm Architecture.
|
||||
pub trait Program: Sized {
|
||||
/// The graphics backend to use to draw the [`Program`].
|
||||
type Renderer: Renderer + text::Renderer;
|
||||
|
||||
/// The type of __messages__ your [`Program`] will produce.
|
||||
type Message: std::fmt::Debug + Send;
|
||||
|
||||
/// The theme used to draw the [`Program`].
|
||||
type Theme;
|
||||
|
||||
/// Handles a __message__ and updates the state of the [`Program`].
|
||||
///
|
||||
/// This is where you define your __update logic__. All the __messages__,
|
||||
/// produced by either user interactions or commands, will be handled by
|
||||
/// this method.
|
||||
///
|
||||
/// Any [`Command`] returned will be executed immediately in the
|
||||
/// background by shells.
|
||||
fn update(&mut self, message: Self::Message) -> Command<Self::Message>;
|
||||
|
||||
/// Returns the widgets to display in the [`Program`] for the `window`.
|
||||
///
|
||||
/// These widgets can produce __messages__ based on user interaction.
|
||||
fn view(
|
||||
&self,
|
||||
window: window::Id,
|
||||
) -> Element<'_, Self::Message, Self::Theme, Self::Renderer>;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue