diff options
author | 2022-08-05 22:31:26 +0200 | |
---|---|---|
committer | 2022-08-05 22:31:26 +0200 | |
commit | f294c2d16249ce8b7989f8af6332678f53d8fb12 (patch) | |
tree | bb8d6f00fe25de9187b1d3b90a88ae95225b7428 /src | |
parent | a003e797e8a1bb5d365c1db5de6af88e61a47329 (diff) | |
parent | ad5bd0970d7106a97d455a164a582ab1d0bff18b (diff) | |
download | iced-f294c2d16249ce8b7989f8af6332678f53d8fb12.tar.gz iced-f294c2d16249ce8b7989f8af6332678f53d8fb12.tar.bz2 iced-f294c2d16249ce8b7989f8af6332678f53d8fb12.zip |
Merge pull request #1399 from iced-rs/widget-operations
Widget Operations
Diffstat (limited to '')
-rw-r--r-- | src/lib.rs | 6 | ||||
-rw-r--r-- | src/widget.rs | 25 |
2 files changed, 28 insertions, 3 deletions
@@ -192,22 +192,26 @@ use iced_wgpu as renderer; use iced_glow as renderer; pub use iced_native::theme; +pub use runtime::event; +pub use runtime::subscription; pub use application::Application; pub use element::Element; pub use error::Error; +pub use event::Event; pub use executor::Executor; pub use renderer::Renderer; pub use result::Result; pub use sandbox::Sandbox; pub use settings::Settings; +pub use subscription::Subscription; pub use theme::Theme; pub use runtime::alignment; pub use runtime::futures; pub use runtime::{ Alignment, Background, Color, Command, ContentFit, Font, Length, Padding, - Point, Rectangle, Size, Subscription, Vector, + Point, Rectangle, Size, Vector, }; #[cfg(feature = "system")] diff --git a/src/widget.rs b/src/widget.rs index 4ddf0566..817d2d33 100644 --- a/src/widget.rs +++ b/src/widget.rs @@ -99,7 +99,7 @@ pub mod radio { pub mod scrollable { //! Navigate an endless amount of content with a scrollbar. pub use iced_native::widget::scrollable::{ - style::Scrollbar, style::Scroller, StyleSheet, + snap_to, style::Scrollbar, style::Scroller, Id, StyleSheet, }; /// A widget that can vertically display an infinite amount of content @@ -119,7 +119,9 @@ pub mod toggler { pub mod text_input { //! Display fields that can be filled with text. - pub use iced_native::widget::text_input::{Appearance, StyleSheet}; + pub use iced_native::widget::text_input::{ + focus, Appearance, Id, StyleSheet, + }; /// A field that can be filled with text. pub type TextInput<'a, Message, Renderer = crate::Renderer> = @@ -209,3 +211,22 @@ pub use qr_code::QRCode; #[cfg(feature = "svg")] #[cfg_attr(docsrs, doc(cfg(feature = "svg")))] pub use svg::Svg; + +use crate::Command; +use iced_native::widget::operation; + +/// Focuses the previous focusable widget. +pub fn focus_previous<Message>() -> Command<Message> +where + Message: 'static, +{ + Command::widget(operation::focusable::focus_previous()) +} + +/// Focuses the next focusable widget. +pub fn focus_next<Message>() -> Command<Message> +where + Message: 'static, +{ + Command::widget(operation::focusable::focus_next()) +} |