Merge pull request #2386 from mtkennerly/feature/check-text-editor-focus
Allow checking whether a `TextEditor` is focused
This commit is contained in:
commit
ba705d63dd
1 changed files with 10 additions and 1 deletions
|
|
@ -319,7 +319,9 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
struct State<Highlighter: text::Highlighter> {
|
||||
/// The state of a [`TextEditor`].
|
||||
#[derive(Debug)]
|
||||
pub struct State<Highlighter: text::Highlighter> {
|
||||
is_focused: bool,
|
||||
last_click: Option<mouse::Click>,
|
||||
drag_click: Option<mouse::click::Kind>,
|
||||
|
|
@ -329,6 +331,13 @@ struct State<Highlighter: text::Highlighter> {
|
|||
highlighter_format_address: usize,
|
||||
}
|
||||
|
||||
impl<Highlighter: text::Highlighter> State<Highlighter> {
|
||||
/// Returns whether the [`TextEditor`] is currently focused or not.
|
||||
pub fn is_focused(&self) -> bool {
|
||||
self.is_focused
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, Highlighter, Message, Theme, Renderer> Widget<Message, Theme, Renderer>
|
||||
for TextEditor<'a, Highlighter, Message, Theme, Renderer>
|
||||
where
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue