fix: docs
This commit is contained in:
parent
51b370ef48
commit
16f14793c7
9 changed files with 30 additions and 122 deletions
|
|
@ -37,7 +37,7 @@ where
|
|||
cursor: mouse::Cursor,
|
||||
);
|
||||
|
||||
/// Applies an [`Operation`] to the [`Overlay`].
|
||||
/// Applies an [`crate::widget::Operation`] to the [`Overlay`].
|
||||
fn operate(
|
||||
&mut self,
|
||||
_layout: Layout<'_>,
|
||||
|
|
|
|||
|
|
@ -143,14 +143,14 @@ pub fn exit<T>() -> Task<T> {
|
|||
/// The appearance of a program.
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub struct Appearance {
|
||||
/// The background [`Color`] of the application.
|
||||
pub background_color: Color,
|
||||
/// The background [`iced_core::Color`] of the application.
|
||||
pub background_color: iced_core::Color,
|
||||
|
||||
/// The default text [`Color`] of the application.
|
||||
pub text_color: Color,
|
||||
/// The default text [`iced_core::Color`] of the application.
|
||||
pub text_color: iced_core::Color,
|
||||
|
||||
/// The default icon [`Color`] of the application.
|
||||
pub icon_color: Color,
|
||||
/// The default icon [`iced_core::Color`] of the application.
|
||||
pub icon_color: iced_core::Color,
|
||||
}
|
||||
|
||||
/// The default style of a [`Program`].
|
||||
|
|
|
|||
|
|
@ -268,14 +268,14 @@ where
|
|||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the name of the [`Button`].
|
||||
/// Sets the name of the [`Checkbox`].
|
||||
pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self {
|
||||
self.name = Some(name.into());
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the description of the [`Button`].
|
||||
/// Sets the description of the [`Checkbox`].
|
||||
pub fn description_widget<T: iced_accessibility::Describes>(
|
||||
mut self,
|
||||
description: &T,
|
||||
|
|
@ -287,7 +287,7 @@ where
|
|||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the description of the [`Button`].
|
||||
/// Sets the description of the [`Checkbox`].
|
||||
pub fn description(mut self, description: impl Into<Cow<'a, str>>) -> Self {
|
||||
self.description =
|
||||
Some(iced_accessibility::Description::Text(description.into()));
|
||||
|
|
|
|||
|
|
@ -200,14 +200,14 @@ impl<'a, Handle> Image<'a, Handle> {
|
|||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the name of the [`Button`].
|
||||
/// Sets the name of the [`Image`].
|
||||
pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self {
|
||||
self.name = Some(name.into());
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the description of the [`Button`].
|
||||
/// Sets the description of the [`Image`].
|
||||
pub fn description_widget<T: iced_accessibility::Describes>(
|
||||
mut self,
|
||||
description: &T,
|
||||
|
|
@ -219,7 +219,7 @@ impl<'a, Handle> Image<'a, Handle> {
|
|||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the description of the [`Button`].
|
||||
/// Sets the description of the [`Image`].
|
||||
pub fn description(mut self, description: impl Into<Cow<'a, str>>) -> Self {
|
||||
self.description =
|
||||
Some(iced_accessibility::Description::Text(description.into()));
|
||||
|
|
@ -227,7 +227,7 @@ impl<'a, Handle> Image<'a, Handle> {
|
|||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the label of the [`Button`].
|
||||
/// Sets the label of the [`Image`].
|
||||
pub fn label(mut self, label: &dyn iced_accessibility::Labels) -> Self {
|
||||
self.label =
|
||||
Some(label.label().into_iter().map(|l| l.into()).collect());
|
||||
|
|
|
|||
|
|
@ -276,14 +276,14 @@ where
|
|||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the name of the [`Button`].
|
||||
/// Sets the name of the [`Scrollable`].
|
||||
pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self {
|
||||
self.name = Some(name.into());
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the description of the [`Button`].
|
||||
/// Sets the description of the [`Scrollable`].
|
||||
pub fn description_widget(
|
||||
mut self,
|
||||
description: &impl iced_accessibility::Describes,
|
||||
|
|
@ -295,7 +295,7 @@ where
|
|||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the description of the [`Button`].
|
||||
/// Sets the description of the [`Scrollable`].
|
||||
pub fn description(mut self, description: impl Into<Cow<'a, str>>) -> Self {
|
||||
self.description =
|
||||
Some(iced_accessibility::Description::Text(description.into()));
|
||||
|
|
@ -303,7 +303,7 @@ where
|
|||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the label of the [`Button`].
|
||||
/// Sets the label of the [`Scrollable`].
|
||||
pub fn label(mut self, label: &dyn iced_accessibility::Labels) -> Self {
|
||||
self.label =
|
||||
Some(label.label().into_iter().map(|l| l.into()).collect());
|
||||
|
|
|
|||
|
|
@ -240,14 +240,14 @@ where
|
|||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the name of the [`Button`].
|
||||
/// Sets the name of the [`Slider`].
|
||||
pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self {
|
||||
self.name = Some(name.into());
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the description of the [`Button`].
|
||||
/// Sets the description of the [`Slider`].
|
||||
pub fn description_widget(
|
||||
mut self,
|
||||
description: &impl iced_accessibility::Describes,
|
||||
|
|
@ -259,7 +259,7 @@ where
|
|||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the description of the [`Button`].
|
||||
/// Sets the description of the [`Slider`].
|
||||
pub fn description(mut self, description: impl Into<Cow<'a, str>>) -> Self {
|
||||
self.description =
|
||||
Some(iced_accessibility::Description::Text(description.into()));
|
||||
|
|
@ -267,7 +267,7 @@ where
|
|||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the label of the [`Button`].
|
||||
/// Sets the label of the [`Slider`].
|
||||
pub fn label(mut self, label: &dyn iced_accessibility::Labels) -> Self {
|
||||
self.label =
|
||||
Some(label.label().into_iter().map(|l| l.into()).collect());
|
||||
|
|
|
|||
|
|
@ -179,14 +179,14 @@ where
|
|||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the name of the [`Button`].
|
||||
/// Sets the name of the [`Svg`].
|
||||
pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self {
|
||||
self.name = Some(name.into());
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the description of the [`Button`].
|
||||
/// Sets the description of the [`Svg`].
|
||||
pub fn description_widget<T: iced_accessibility::Describes>(
|
||||
mut self,
|
||||
description: &T,
|
||||
|
|
@ -198,7 +198,7 @@ where
|
|||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the description of the [`Button`].
|
||||
/// Sets the description of the [`Svg`].
|
||||
pub fn description(mut self, description: impl Into<Cow<'a, str>>) -> Self {
|
||||
self.description =
|
||||
Some(iced_accessibility::Description::Text(description.into()));
|
||||
|
|
@ -206,7 +206,7 @@ where
|
|||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the label of the [`Button`].
|
||||
/// Sets the label of the [`Svg`].
|
||||
pub fn label(mut self, label: &dyn iced_accessibility::Labels) -> Self {
|
||||
self.label =
|
||||
Some(label.label().into_iter().map(|l| l.into()).collect());
|
||||
|
|
|
|||
|
|
@ -270,14 +270,14 @@ where
|
|||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the name of the [`Button`].
|
||||
/// Sets the name of the [`Toggler`].
|
||||
pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self {
|
||||
self.name = Some(name.into());
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the description of the [`Button`].
|
||||
/// Sets the description of the [`Toggler`].
|
||||
pub fn description_widget<T: iced_accessibility::Describes>(
|
||||
mut self,
|
||||
description: &T,
|
||||
|
|
@ -289,7 +289,7 @@ where
|
|||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the description of the [`Button`].
|
||||
/// Sets the description of the [`Toggler`].
|
||||
pub fn description(mut self, description: impl Into<Cow<'a, str>>) -> Self {
|
||||
self.description =
|
||||
Some(iced_accessibility::Description::Text(description.into()));
|
||||
|
|
@ -297,7 +297,7 @@ where
|
|||
}
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
/// Sets the label of the [`Button`] using another widget.
|
||||
/// Sets the label of the [`Toggler`] using another widget.
|
||||
pub fn labeled_by_widget(
|
||||
mut self,
|
||||
label: &dyn iced_accessibility::Labels,
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ use std::{
|
|||
collections::HashMap,
|
||||
num::NonZeroU32,
|
||||
sync::{Arc, Mutex},
|
||||
time::Instant,
|
||||
};
|
||||
use wayland_protocols::wp::viewporter::client::wp_viewport::WpViewport;
|
||||
use winit::{
|
||||
|
|
@ -82,67 +81,6 @@ use super::{
|
|||
winit_window::SctkWinitWindow,
|
||||
};
|
||||
|
||||
pub enum IcedSctkEvent {
|
||||
/// Emitted when new events arrive from the OS to be processed.
|
||||
///
|
||||
/// This event type is useful as a place to put code that should be done before you start
|
||||
/// processing events, such as updating frame timing information for benchmarking or checking
|
||||
/// the [`StartCause`] to see if a timer set by
|
||||
/// [`ControlFlow::WaitUntil`](crate::platform_specific::wayland::event_loop::control_flow::ControlFlow::WaitUntil)
|
||||
/// has elapsed.
|
||||
NewEvents(StartCause),
|
||||
|
||||
/// An event produced by sctk
|
||||
SctkEvent(SctkEvent),
|
||||
|
||||
/// Emitted when all of the event loop's input events have been processed and redraw processing
|
||||
/// is about to begin.
|
||||
///
|
||||
/// This event is useful as a place to put your code that should be run after all
|
||||
/// state-changing events have been handled and you want to do stuff (updating state, performing
|
||||
/// calculations, etc) that happens as the "main body" of your event loop. If your program only draws
|
||||
/// graphics when something changes, it's usually better to do it in response to
|
||||
/// [`window::RedrawRequest`], which gets emitted
|
||||
/// immediately after this event. Programs that draw graphics continuously, like most games,
|
||||
/// can render here unconditionally for simplicity.
|
||||
MainEventsCleared,
|
||||
|
||||
/// Emitted after [`MainEventsCleared`] when a window should be redrawn.
|
||||
///
|
||||
/// This gets triggered in two scenarios:
|
||||
/// - The OS has performed an operation that's invalidated the window's contents (such as
|
||||
/// resizing the window).
|
||||
/// - The application has explicitly requested a redraw via [`iced_runtime::core::Shell::request_redraw`].
|
||||
///
|
||||
/// During each iteration of the event loop, Winit will aggregate duplicate redraw requests
|
||||
/// into a single event, to help avoid duplicating rendering work.
|
||||
///
|
||||
/// Mainly of interest to applications with mostly-static graphics that avoid redrawing unless
|
||||
/// something changes, like most non-game GUIs.
|
||||
///
|
||||
/// [`MainEventsCleared`]: Self::MainEventsCleared
|
||||
RedrawRequested(ObjectId),
|
||||
|
||||
/// Emitted after all [`RedrawRequested`] events have been processed and control flow is about to
|
||||
/// be taken away from the program. If there are no `RedrawRequested` events, it is emitted
|
||||
/// immediately after `MainEventsCleared`.
|
||||
///
|
||||
/// This event is useful for doing any cleanup or bookkeeping work after all the rendering
|
||||
/// tasks have been completed.
|
||||
///
|
||||
/// [`RedrawRequested`]: Self::RedrawRequested
|
||||
RedrawEventsCleared,
|
||||
|
||||
/// Emitted when the event loop is being shut down.
|
||||
///
|
||||
/// This is irreversible - if this event is emitted, it is guaranteed to be the last event that
|
||||
/// gets emitted. You generally want to treat this as an "do on quit" event.
|
||||
LoopDestroyed,
|
||||
|
||||
/// Frame callback event
|
||||
Frame(WlSurface, u32),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum SctkEvent {
|
||||
//
|
||||
|
|
@ -324,36 +262,6 @@ pub enum LayerSurfaceEventVariant {
|
|||
ScaleFactorChanged(f64, Option<WpViewport>),
|
||||
}
|
||||
|
||||
/// Describes the reason the event loop is resuming.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum StartCause {
|
||||
/// Sent if the time specified by [`ControlFlow::WaitUntil`] has been reached. Contains the
|
||||
/// moment the timeout was requested and the requested resume time. The actual resume time is
|
||||
/// guaranteed to be equal to or after the requested resume time.
|
||||
///
|
||||
/// [`ControlFlow::WaitUntil`]: crate::platform_specific::wayland::event_loop::control_flow::ControlFlow::WaitUntil
|
||||
ResumeTimeReached {
|
||||
start: Instant,
|
||||
requested_resume: Instant,
|
||||
},
|
||||
|
||||
/// Sent if the OS has new events to send to the window, after a wait was requested. Contains
|
||||
/// the moment the wait was requested and the resume time, if requested.
|
||||
WaitCancelled {
|
||||
start: Instant,
|
||||
requested_resume: Option<Instant>,
|
||||
},
|
||||
|
||||
/// Sent if the event loop is being resumed after the loop's control flow was set to
|
||||
/// [`ControlFlow::Poll`].
|
||||
///
|
||||
/// [`ControlFlow::Poll`]: crate::platform_specific::wayland::event_loop::control_flow::ControlFlow::Poll
|
||||
Poll,
|
||||
|
||||
/// Sent once, immediately after `run` is called. Indicates that the loop was just initialized.
|
||||
Init,
|
||||
}
|
||||
|
||||
/// Pending update to a window requested by the user.
|
||||
#[derive(Default, Debug, Clone, Copy)]
|
||||
pub struct SurfaceUserRequest {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue