1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! Widget-agnostic focus operations.
//!
//! This module provides sweetened versions of focus operations that return
//! the [`widget::Id`] of the newly focused widget.
//!
//! # Example
//! ```no_run
//! # use iced_core::widget;
//! use sweeten::widget::operation;
//!
//! # #[derive(Debug, Clone)]
//! # enum Message { FocusedId(widget::Id), FocusNext }
//! # fn update(message: Message) -> iced_runtime::Task<Message> {
//! // Focus the next widget and get its ID:
//! operation::focus_next().map(Message::FocusedId)
//! # }
//! ```
use cratewidget;
use crateoperation;
use Task;
/// Produces a [`Task`] that focuses the next focusable widget
/// and returns the [`widget::Id`] of the newly focused widget.
///
/// This is a sweetened version of [`iced_runtime::widget::operation::focus_next`]
/// that tells you which widget received focus.
///
/// Use `.discard()` if you don't need the ID, or `.map(|id| ...)` to use it.
/// Produces a [`Task`] that focuses the previous focusable widget
/// and returns the [`widget::Id`] of the newly focused widget.
///
/// This is a sweetened version of [`iced_runtime::widget::operation::focus_previous`]
/// that tells you which widget received focus.
///
/// Use `.discard()` if you don't need the ID, or `.map(|id| ...)` to use it.
/// Produces a [`Task`] that focuses the widget with the given [`widget::Id`].
///
/// Re-exported from [`iced_runtime::widget::operation::focus`].
pub use focus;