diff options
Diffstat (limited to '')
-rw-r--r-- | src/application.rs | 65 | ||||
-rw-r--r-- | src/element.rs | 4 | ||||
-rw-r--r-- | src/lib.rs | 5 | ||||
-rw-r--r-- | src/pure.rs | 6 | ||||
-rw-r--r-- | src/pure/application.rs | 45 | ||||
-rw-r--r-- | src/pure/sandbox.rs | 26 | ||||
-rw-r--r-- | src/pure/widget.rs | 73 | ||||
-rw-r--r-- | src/sandbox.rs | 40 | ||||
-rw-r--r-- | src/widget.rs | 73 |
9 files changed, 191 insertions, 146 deletions
diff --git a/src/application.rs b/src/application.rs index 11735b93..e8d8e982 100644 --- a/src/application.rs +++ b/src/application.rs @@ -1,5 +1,8 @@ +//! Build interactive cross-platform applications. use crate::window; -use crate::{Color, Command, Element, Executor, Settings, Subscription}; +use crate::{Command, Element, Executor, Settings, Subscription}; + +pub use iced_native::application::{Appearance, StyleSheet}; /// An interactive cross-platform application. /// @@ -57,7 +60,7 @@ use crate::{Color, Command, Element, Executor, Settings, Subscription}; /// says "Hello, world!": /// /// ```no_run -/// use iced::{executor, Application, Command, Element, Settings, Text}; +/// use iced::{executor, Application, Command, Element, Settings, Text, Theme}; /// /// pub fn main() -> iced::Result { /// Hello::run(Settings::default()) @@ -67,8 +70,9 @@ use crate::{Color, Command, Element, Executor, Settings, Subscription}; /// /// impl Application for Hello { /// type Executor = executor::Default; -/// type Message = (); /// type Flags = (); +/// type Message = (); +/// type Theme = Theme; /// /// fn new(_flags: ()) -> (Hello, Command<Self::Message>) { /// (Hello, Command::none()) @@ -99,6 +103,9 @@ pub trait Application: Sized { /// The type of __messages__ your [`Application`] will produce. type Message: std::fmt::Debug + Send; + /// The theme of your [`Application`]. + type Theme: Default + StyleSheet; + /// The data needed to initialize your [`Application`]. type Flags; @@ -129,6 +136,28 @@ pub trait Application: Sized { /// Any [`Command`] returned will be executed immediately in the background. fn update(&mut self, message: Self::Message) -> Command<Self::Message>; + /// Returns the widgets to display in the [`Application`]. + /// + /// These widgets can produce __messages__ based on user interaction. + fn view( + &mut self, + ) -> Element<'_, Self::Message, crate::Renderer<Self::Theme>>; + + /// Returns the current [`Theme`] of the [`Application`]. + /// + /// [`Theme`]: Self::Theme + fn theme(&self) -> Self::Theme { + Self::Theme::default() + } + + /// Returns the current [`Style`] of the [`Theme`]. + /// + /// [`Style`]: <Self::Theme as StyleSheet>::Style + /// [`Theme`]: Self::Theme + fn style(&self) -> <Self::Theme as StyleSheet>::Style { + <Self::Theme as StyleSheet>::Style::default() + } + /// Returns the event [`Subscription`] for the current state of the /// application. /// @@ -141,11 +170,6 @@ pub trait Application: Sized { Subscription::none() } - /// Returns the widgets to display in the [`Application`]. - /// - /// These widgets can produce __messages__ based on user interaction. - fn view(&mut self) -> Element<'_, Self::Message>; - /// Returns the current [`Application`] mode. /// /// The runtime will automatically transition your application if a new mode @@ -158,13 +182,6 @@ pub trait Application: Sized { window::Mode::Windowed } - /// Returns the background color of the [`Application`]. - /// - /// By default, it returns [`Color::WHITE`]. - fn background_color(&self) -> Color { - Color::WHITE - } - /// Returns the scale factor of the [`Application`]. /// /// It can be used to dynamically control the size of the UI at runtime @@ -213,7 +230,7 @@ pub trait Application: Sized { Ok(crate::runtime::application::run::< Instance<Self>, Self::Executor, - crate::renderer::window::Compositor, + crate::renderer::window::Compositor<Self::Theme>, >(settings.into(), renderer_settings)?) } } @@ -224,14 +241,14 @@ impl<A> iced_winit::Program for Instance<A> where A: Application, { - type Renderer = crate::renderer::Renderer; + type Renderer = crate::Renderer<A::Theme>; type Message = A::Message; fn update(&mut self, message: Self::Message) -> Command<Self::Message> { self.0.update(message) } - fn view(&mut self) -> Element<'_, Self::Message> { + fn view(&mut self) -> Element<'_, Self::Message, Self::Renderer> { self.0.view() } } @@ -252,6 +269,14 @@ where self.0.title() } + fn theme(&self) -> A::Theme { + self.0.theme() + } + + fn style(&self) -> <A::Theme as StyleSheet>::Style { + self.0.style() + } + fn mode(&self) -> iced_winit::Mode { match self.0.mode() { window::Mode::Windowed => iced_winit::Mode::Windowed, @@ -264,10 +289,6 @@ where self.0.subscription() } - fn background_color(&self) -> Color { - self.0.background_color() - } - fn scale_factor(&self) -> f64 { self.0.scale_factor() } diff --git a/src/element.rs b/src/element.rs index 8bad18c1..2eb1bb4d 100644 --- a/src/element.rs +++ b/src/element.rs @@ -1,5 +1,5 @@ /// A generic widget. /// /// This is an alias of an `iced_native` element with a default `Renderer`. -pub type Element<'a, Message> = - crate::runtime::Element<'a, Message, crate::renderer::Renderer>; +pub type Element<'a, Message, Renderer = crate::Renderer> = + crate::runtime::Element<'a, Message, Renderer>; @@ -180,12 +180,12 @@ #![forbid(unsafe_code)] #![forbid(rust_2018_idioms)] #![cfg_attr(docsrs, feature(doc_cfg))] -mod application; mod element; mod error; mod result; mod sandbox; +pub mod application; pub mod clipboard; pub mod executor; pub mod keyboard; @@ -211,6 +211,8 @@ use iced_wgpu as renderer; #[cfg(feature = "glow")] use iced_glow as renderer; +pub use iced_native::theme; + #[doc(no_inline)] pub use widget::*; @@ -222,6 +224,7 @@ pub use renderer::Renderer; pub use result::Result; pub use sandbox::Sandbox; pub use settings::Settings; +pub use theme::Theme; pub use runtime::alignment; pub use runtime::futures; diff --git a/src/pure.rs b/src/pure.rs index 7785a104..23f56570 100644 --- a/src/pure.rs +++ b/src/pure.rs @@ -95,9 +95,9 @@ //! [the original widgets]: crate::widget //! [`button::State`]: crate::widget::button::State //! [impure `Application`]: crate::Application +pub mod application; pub mod widget; -mod application; mod sandbox; pub use application::Application; @@ -108,5 +108,5 @@ pub use iced_pure::Widget; pub use iced_pure::{Pure, State}; /// A generic, pure [`Widget`]. -pub type Element<'a, Message> = - iced_pure::Element<'a, Message, crate::Renderer>; +pub type Element<'a, Message, Renderer = crate::Renderer> = + iced_pure::Element<'a, Message, Renderer>; diff --git a/src/pure/application.rs b/src/pure/application.rs index 5f400bea..396854ad 100644 --- a/src/pure/application.rs +++ b/src/pure/application.rs @@ -1,6 +1,9 @@ +//! Build interactive cross-platform applications. use crate::pure::{self, Pure}; use crate::window; -use crate::{Color, Command, Executor, Settings, Subscription}; +use crate::{Command, Executor, Settings, Subscription}; + +pub use iced_native::application::StyleSheet; /// A pure version of [`Application`]. /// @@ -21,6 +24,9 @@ pub trait Application: Sized { /// The type of __messages__ your [`Application`] will produce. type Message: std::fmt::Debug + Send; + /// The theme of your [`Application`]. + type Theme: Default + StyleSheet; + /// The data needed to initialize your [`Application`]. type Flags; @@ -51,6 +57,18 @@ pub trait Application: Sized { /// Any [`Command`] returned will be executed immediately in the background. fn update(&mut self, message: Self::Message) -> Command<Self::Message>; + /// Returns the widgets to display in the [`Application`]. + /// + /// These widgets can produce __messages__ based on user interaction. + fn view( + &self, + ) -> pure::Element<'_, Self::Message, crate::Renderer<Self::Theme>>; + + /// Returns the current [`Theme`] of the [`Application`]. + fn theme(&self) -> Self::Theme { + Self::Theme::default() + } + /// Returns the event [`Subscription`] for the current state of the /// application. /// @@ -63,11 +81,6 @@ pub trait Application: Sized { Subscription::none() } - /// Returns the widgets to display in the [`Application`]. - /// - /// These widgets can produce __messages__ based on user interaction. - fn view(&self) -> pure::Element<'_, Self::Message>; - /// Returns the current [`Application`] mode. /// /// The runtime will automatically transition your application if a new mode @@ -80,13 +93,6 @@ pub trait Application: Sized { window::Mode::Windowed } - /// Returns the background color of the [`Application`]. - /// - /// By default, it returns [`Color::WHITE`]. - fn background_color(&self) -> Color { - Color::WHITE - } - /// Returns the scale factor of the [`Application`]. /// /// It can be used to dynamically control the size of the UI at runtime @@ -137,6 +143,7 @@ where type Executor = A::Executor; type Message = A::Message; type Flags = A::Flags; + type Theme = A::Theme; fn new(flags: Self::Flags) -> (Self, Command<Self::Message>) { let (application, command) = A::new(flags); @@ -162,18 +169,20 @@ where A::subscription(&self.application) } - fn view(&mut self) -> crate::Element<'_, Self::Message> { + fn view( + &mut self, + ) -> crate::Element<'_, Self::Message, crate::Renderer<Self::Theme>> { let content = A::view(&self.application); Pure::new(&mut self.state, content).into() } - fn mode(&self) -> window::Mode { - A::mode(&self.application) + fn theme(&self) -> Self::Theme { + A::theme(&self.application) } - fn background_color(&self) -> Color { - A::background_color(&self.application) + fn mode(&self) -> window::Mode { + A::mode(&self.application) } fn scale_factor(&self) -> f64 { diff --git a/src/pure/sandbox.rs b/src/pure/sandbox.rs index fbd1d7a8..a58cace7 100644 --- a/src/pure/sandbox.rs +++ b/src/pure/sandbox.rs @@ -1,5 +1,5 @@ use crate::pure; -use crate::{Color, Command, Error, Settings, Subscription}; +use crate::{Command, Error, Settings, Subscription, Theme}; /// A pure version of [`Sandbox`]. /// @@ -34,11 +34,14 @@ pub trait Sandbox { /// These widgets can produce __messages__ based on user interaction. fn view(&self) -> pure::Element<'_, Self::Message>; - /// Returns the background color of the [`Sandbox`]. + /// Returns the current [`Theme`] of the [`Sandbox`]. /// - /// By default, it returns [`Color::WHITE`]. - fn background_color(&self) -> Color { - Color::WHITE + /// If you want to use your own custom theme type, you will have to use an + /// [`Application`]. + /// + /// By default, it returns [`Theme::default`]. + fn theme(&self) -> Theme { + Theme::default() } /// Returns the scale factor of the [`Sandbox`]. @@ -82,6 +85,7 @@ where type Executor = iced_futures::backend::null::Executor; type Flags = (); type Message = T::Message; + type Theme = Theme; fn new(_flags: ()) -> (Self, Command<T::Message>) { (T::new(), Command::none()) @@ -97,16 +101,16 @@ where Command::none() } - fn subscription(&self) -> Subscription<T::Message> { - Subscription::none() - } - fn view(&self) -> pure::Element<'_, T::Message> { T::view(self) } - fn background_color(&self) -> Color { - T::background_color(self) + fn theme(&self) -> Self::Theme { + T::theme(self) + } + + fn subscription(&self) -> Subscription<T::Message> { + Subscription::none() } fn scale_factor(&self) -> f64 { diff --git a/src/pure/widget.rs b/src/pure/widget.rs index c84edde3..336f498f 100644 --- a/src/pure/widget.rs +++ b/src/pure/widget.rs @@ -1,41 +1,41 @@ //! Pure versions of the widgets. /// A container that distributes its contents vertically. -pub type Column<'a, Message> = - iced_pure::widget::Column<'a, Message, crate::Renderer>; +pub type Column<'a, Message, Renderer = crate::Renderer> = + iced_pure::widget::Column<'a, Message, Renderer>; /// A container that distributes its contents horizontally. -pub type Row<'a, Message> = - iced_pure::widget::Row<'a, Message, crate::Renderer>; +pub type Row<'a, Message, Renderer = crate::Renderer> = + iced_pure::widget::Row<'a, Message, Renderer>; /// A paragraph of text. -pub type Text = iced_pure::widget::Text<crate::Renderer>; +pub type Text<Renderer = crate::Renderer> = iced_pure::widget::Text<Renderer>; pub mod button { //! Allow your users to perform actions by pressing a button. - pub use iced_pure::widget::button::{Style, StyleSheet}; + pub use iced_pure::widget::button::{Appearance, StyleSheet}; /// A widget that produces a message when clicked. - pub type Button<'a, Message> = - iced_pure::widget::Button<'a, Message, crate::Renderer>; + pub type Button<'a, Message, Renderer = crate::Renderer> = + iced_pure::widget::Button<'a, Message, Renderer>; } pub mod checkbox { //! Show toggle controls using checkboxes. - pub use iced_pure::widget::checkbox::{Style, StyleSheet}; + pub use iced_pure::widget::checkbox::{Appearance, StyleSheet}; /// A box that can be checked. - pub type Checkbox<'a, Message> = - iced_native::widget::Checkbox<'a, Message, crate::Renderer>; + pub type Checkbox<'a, Message, Renderer = crate::Renderer> = + iced_native::widget::Checkbox<'a, Message, Renderer>; } pub mod container { //! Decorate content and apply alignment. - pub use iced_pure::widget::container::{Style, StyleSheet}; + pub use iced_pure::widget::container::{Appearance, StyleSheet}; /// An element decorating some content. - pub type Container<'a, Message> = - iced_pure::widget::Container<'a, Message, crate::Renderer>; + pub type Container<'a, Message, Renderer = crate::Renderer> = + iced_pure::widget::Container<'a, Message, Renderer>; } pub mod pane_grid { @@ -57,35 +57,34 @@ pub mod pane_grid { /// to completely fill the space available. /// /// [](https://gfycat.com/mixedflatjellyfish) - pub type PaneGrid<'a, Message> = - iced_pure::widget::PaneGrid<'a, Message, crate::Renderer>; + pub type PaneGrid<'a, Message, Renderer = crate::Renderer> = + iced_pure::widget::PaneGrid<'a, Message, Renderer>; /// The content of a [`Pane`]. - pub type Content<'a, Message> = - iced_pure::widget::pane_grid::Content<'a, Message, crate::Renderer>; + pub type Content<'a, Message, Renderer = crate::Renderer> = + iced_pure::widget::pane_grid::Content<'a, Message, Renderer>; /// The title bar of a [`Pane`]. - pub type TitleBar<'a, Message> = - iced_pure::widget::pane_grid::TitleBar<'a, Message, crate::Renderer>; + pub type TitleBar<'a, Message, Renderer = crate::Renderer> = + iced_pure::widget::pane_grid::TitleBar<'a, Message, Renderer>; } pub mod pick_list { //! Display a dropdown list of selectable values. - pub use iced_pure::overlay::menu::Style as Menu; - pub use iced_pure::widget::pick_list::{Style, StyleSheet}; + pub use iced_pure::widget::pick_list::{Appearance, StyleSheet}; /// A widget allowing the selection of a single value from a list of options. - pub type PickList<'a, T, Message> = - iced_pure::widget::PickList<'a, T, Message, crate::Renderer>; + pub type PickList<'a, T, Message, Renderer = crate::Renderer> = + iced_pure::widget::PickList<'a, T, Message, Renderer>; } pub mod radio { //! Create choices using radio buttons. - pub use iced_pure::widget::radio::{Style, StyleSheet}; + pub use iced_pure::widget::radio::{Appearance, StyleSheet}; /// A circular button representing a choice. - pub type Radio<'a, Message> = - iced_pure::widget::Radio<'a, Message, crate::Renderer>; + pub type Radio<Message, Renderer = crate::Renderer> = + iced_pure::widget::Radio<Message, Renderer>; } pub mod scrollable { @@ -94,27 +93,25 @@ pub mod scrollable { /// A widget that can vertically display an infinite amount of content /// with a scrollbar. - pub type Scrollable<'a, Message> = - iced_pure::widget::Scrollable<'a, Message, crate::Renderer>; + pub type Scrollable<'a, Message, Renderer = crate::Renderer> = + iced_pure::widget::Scrollable<'a, Message, Renderer>; } pub mod toggler { //! Show toggle controls using togglers. - pub use iced_pure::widget::toggler::{Style, StyleSheet}; + pub use iced_pure::widget::toggler::{Appearance, StyleSheet}; /// A toggler widget. - pub type Toggler<'a, Message> = - iced_pure::widget::Toggler<'a, Message, crate::Renderer>; + pub type Toggler<'a, Message, Renderer = crate::Renderer> = + iced_pure::widget::Toggler<'a, Message, Renderer>; } pub mod text_input { //! Display fields that can be filled with text. - use crate::Renderer; - - pub use iced_pure::widget::text_input::{Style, StyleSheet}; + pub use iced_pure::widget::text_input::{Appearance, StyleSheet}; /// A field that can be filled with text. - pub type TextInput<'a, Message> = + pub type TextInput<'a, Message, Renderer = crate::Renderer> = iced_pure::widget::TextInput<'a, Message, Renderer>; } @@ -123,8 +120,8 @@ pub mod tooltip { pub use iced_pure::widget::tooltip::Position; /// A widget allowing the selection of a single value from a list of options. - pub type Tooltip<'a, Message> = - iced_pure::widget::Tooltip<'a, Message, crate::Renderer>; + pub type Tooltip<'a, Message, Renderer = crate::Renderer> = + iced_pure::widget::Tooltip<'a, Message, Renderer>; } pub use iced_pure::widget::progress_bar; diff --git a/src/sandbox.rs b/src/sandbox.rs index e7e97920..3ca3fe8f 100644 --- a/src/sandbox.rs +++ b/src/sandbox.rs @@ -1,6 +1,5 @@ -use crate::{ - Application, Color, Command, Element, Error, Settings, Subscription, -}; +use crate::theme::{self, Theme}; +use crate::{Application, Command, Element, Error, Settings, Subscription}; /// A sandboxed [`Application`]. /// @@ -111,11 +110,21 @@ pub trait Sandbox { /// These widgets can produce __messages__ based on user interaction. fn view(&mut self) -> Element<'_, Self::Message>; - /// Returns the background color of the [`Sandbox`]. + /// Returns the current [`Theme`] of the [`Sandbox`]. /// - /// By default, it returns [`Color::WHITE`]. - fn background_color(&self) -> Color { - Color::WHITE + /// If you want to use your own custom theme type, you will have to use an + /// [`Application`]. + /// + /// By default, it returns [`Theme::default`]. + fn theme(&self) -> Theme { + Theme::default() + } + + /// Returns the current style variant of [`theme::Application`]. + /// + /// By default, it returns [`theme::Application::default`]. + fn style(&self) -> theme::Application { + theme::Application::default() } /// Returns the scale factor of the [`Sandbox`]. @@ -159,6 +168,7 @@ where type Executor = iced_futures::backend::null::Executor; type Flags = (); type Message = T::Message; + type Theme = Theme; fn new(_flags: ()) -> (Self, Command<T::Message>) { (T::new(), Command::none()) @@ -174,16 +184,20 @@ where Command::none() } - fn subscription(&self) -> Subscription<T::Message> { - Subscription::none() - } - fn view(&mut self) -> Element<'_, T::Message> { T::view(self) } - fn background_color(&self) -> Color { - T::background_color(self) + fn theme(&self) -> Self::Theme { + T::theme(self) + } + + fn style(&self) -> theme::Application { + T::style(self) + } + + fn subscription(&self) -> Subscription<T::Message> { + Subscription::none() } fn scale_factor(&self) -> f64 { diff --git a/src/widget.rs b/src/widget.rs index 5e2b63fc..b8b5c493 100644 --- a/src/widget.rs +++ b/src/widget.rs @@ -15,43 +15,43 @@ //! [`TextInput`] has some [`text_input::State`]. /// A container that distributes its contents vertically. -pub type Column<'a, Message> = - iced_native::widget::Column<'a, Message, crate::Renderer>; +pub type Column<'a, Message, Renderer = crate::Renderer> = + iced_native::widget::Column<'a, Message, Renderer>; /// A container that distributes its contents horizontally. -pub type Row<'a, Message> = - iced_native::widget::Row<'a, Message, crate::Renderer>; +pub type Row<'a, Message, Renderer = crate::Renderer> = + iced_native::widget::Row<'a, Message, Renderer>; /// A paragraph of text. -pub type Text = iced_native::widget::Text<crate::Renderer>; +pub type Text<Renderer = crate::Renderer> = iced_native::widget::Text<Renderer>; pub mod button { //! Allow your users to perform actions by pressing a button. //! //! A [`Button`] has some local [`State`]. - pub use iced_native::widget::button::{State, Style, StyleSheet}; + pub use iced_native::widget::button::{Appearance, State, StyleSheet}; /// A widget that produces a message when clicked. - pub type Button<'a, Message> = - iced_native::widget::Button<'a, Message, crate::Renderer>; + pub type Button<'a, Message, Renderer = crate::Renderer> = + iced_native::widget::Button<'a, Message, Renderer>; } pub mod checkbox { //! Show toggle controls using checkboxes. - pub use iced_native::widget::checkbox::{Style, StyleSheet}; + pub use iced_native::widget::checkbox::{Appearance, StyleSheet}; /// A box that can be checked. - pub type Checkbox<'a, Message> = - iced_native::widget::Checkbox<'a, Message, crate::Renderer>; + pub type Checkbox<'a, Message, Renderer = crate::Renderer> = + iced_native::widget::Checkbox<'a, Message, Renderer>; } pub mod container { //! Decorate content and apply alignment. - pub use iced_native::widget::container::{Style, StyleSheet}; + pub use iced_native::widget::container::{Appearance, StyleSheet}; /// An element decorating some content. - pub type Container<'a, Message> = - iced_native::widget::Container<'a, Message, crate::Renderer>; + pub type Container<'a, Message, Renderer = crate::Renderer> = + iced_native::widget::Container<'a, Message, Renderer>; } pub mod pane_grid { @@ -73,35 +73,34 @@ pub mod pane_grid { /// to completely fill the space available. /// /// [](https://gfycat.com/mixedflatjellyfish) - pub type PaneGrid<'a, Message> = - iced_native::widget::PaneGrid<'a, Message, crate::Renderer>; + pub type PaneGrid<'a, Message, Renderer = crate::Renderer> = + iced_native::widget::PaneGrid<'a, Message, Renderer>; /// The content of a [`Pane`]. - pub type Content<'a, Message> = - iced_native::widget::pane_grid::Content<'a, Message, crate::Renderer>; + pub type Content<'a, Message, Renderer = crate::Renderer> = + iced_native::widget::pane_grid::Content<'a, Message, Renderer>; /// The title bar of a [`Pane`]. - pub type TitleBar<'a, Message> = - iced_native::widget::pane_grid::TitleBar<'a, Message, crate::Renderer>; + pub type TitleBar<'a, Message, Renderer = crate::Renderer> = + iced_native::widget::pane_grid::TitleBar<'a, Message, Renderer>; } pub mod pick_list { //! Display a dropdown list of selectable values. - pub use iced_native::overlay::menu::Style as Menu; - pub use iced_native::widget::pick_list::{State, Style, StyleSheet}; + pub use iced_native::widget::pick_list::{Appearance, State, StyleSheet}; /// A widget allowing the selection of a single value from a list of options. - pub type PickList<'a, T, Message> = - iced_native::widget::PickList<'a, T, Message, crate::Renderer>; + pub type PickList<'a, T, Message, Renderer = crate::Renderer> = + iced_native::widget::PickList<'a, T, Message, Renderer>; } pub mod radio { //! Create choices using radio buttons. - pub use iced_native::widget::radio::{Style, StyleSheet}; + pub use iced_native::widget::radio::{Appearance, StyleSheet}; /// A circular button representing a choice. - pub type Radio<'a, Message> = - iced_native::widget::Radio<'a, Message, crate::Renderer>; + pub type Radio<Message, Renderer = crate::Renderer> = + iced_native::widget::Radio<Message, Renderer>; } pub mod scrollable { @@ -112,29 +111,27 @@ pub mod scrollable { /// A widget that can vertically display an infinite amount of content /// with a scrollbar. - pub type Scrollable<'a, Message> = - iced_native::widget::Scrollable<'a, Message, crate::Renderer>; + pub type Scrollable<'a, Message, Renderer = crate::Renderer> = + iced_native::widget::Scrollable<'a, Message, Renderer>; } pub mod toggler { //! Show toggle controls using togglers. - pub use iced_native::widget::toggler::{Style, StyleSheet}; + pub use iced_native::widget::toggler::{Appearance, StyleSheet}; /// A toggler widget. - pub type Toggler<'a, Message> = - iced_native::widget::Toggler<'a, Message, crate::Renderer>; + pub type Toggler<'a, Message, Renderer = crate::Renderer> = + iced_native::widget::Toggler<'a, Message, Renderer>; } pub mod text_input { //! Display fields that can be filled with text. //! //! A [`TextInput`] has some local [`State`]. - use crate::Renderer; - - pub use iced_native::widget::text_input::{State, Style, StyleSheet}; + pub use iced_native::widget::text_input::{Appearance, State, StyleSheet}; /// A field that can be filled with text. - pub type TextInput<'a, Message> = + pub type TextInput<'a, Message, Renderer = crate::Renderer> = iced_native::widget::TextInput<'a, Message, Renderer>; } @@ -143,8 +140,8 @@ pub mod tooltip { pub use iced_native::widget::tooltip::Position; /// A widget allowing the selection of a single value from a list of options. - pub type Tooltip<'a, Message> = - iced_native::widget::Tooltip<'a, Message, crate::Renderer>; + pub type Tooltip<'a, Message, Renderer = crate::Renderer> = + iced_native::widget::Tooltip<'a, Message, Renderer>; } pub use iced_native::widget::progress_bar; |