Write documentation for new ThemeFn traits
This commit is contained in:
parent
b5974a23cc
commit
323b17d458
2 changed files with 24 additions and 4 deletions
|
|
@ -530,9 +530,19 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
/// TODO
|
||||
/// The theme logic of some [`Application`].
|
||||
///
|
||||
/// Any implementors of this trait can be provided as an argument to
|
||||
/// [`Application::theme`].
|
||||
///
|
||||
/// `iced` provides two implementors:
|
||||
/// - the built-in [`Theme`] itself
|
||||
/// - and any `Fn(&State) -> impl Into<Option<Theme>>`.
|
||||
pub trait ThemeFn<State, Theme> {
|
||||
/// TODO
|
||||
/// Returns the theme of the [`Application`] for the current state.
|
||||
///
|
||||
/// If `None` is returned, `iced` will try to use a theme that
|
||||
/// matches the system color scheme.
|
||||
fn theme(&self, state: &State) -> Option<Theme>;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -317,9 +317,19 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
/// TODO
|
||||
/// The theme logic of some [`Daemon`].
|
||||
///
|
||||
/// Any implementors of this trait can be provided as an argument to
|
||||
/// [`Daemon::theme`].
|
||||
///
|
||||
/// `iced` provides two implementors:
|
||||
/// - the built-in [`Theme`] itself
|
||||
/// - and any `Fn(&State, window::Id) -> impl Into<Option<Theme>>`.
|
||||
pub trait ThemeFn<State, Theme> {
|
||||
/// TODO
|
||||
/// Returns the theme of the [`Daemon`] for the current state and window.
|
||||
///
|
||||
/// If `None` is returned, `iced` will try to use a theme that
|
||||
/// matches the system color scheme.
|
||||
fn theme(&self, state: &State, window: window::Id) -> Option<Theme>;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue