Skip to content

Commit

Permalink
Add public has_focus to WidgetPod
Browse files Browse the repository at this point in the history
  • Loading branch information
ForLoveOfCats committed Jun 13, 2021
1 parent 0b6e1c3 commit d398ef0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ You can find its changes [documented below](#070---2021-01-01).
- `chrono` feature with `Data` support for [chrono](https://docs.rs/chrono/) types ([#1743] by [@r-ml])
- Text input handles Delete key ([#1746] by [@bjorn])
- `lens` macro can access nested fields ([#1764] by [@Maan2003])
- `has_focus` method on `WidgetPod` ([#????] by [@ForLoveOfCats])

### Changed

Expand Down
5 changes: 5 additions & 0 deletions druid/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ impl<T, W: Widget<T>> WidgetPod<T, W> {
self.old_data.is_some()
}

/// Returns `true` if widget or any descendent is focused
pub fn has_focus(&self) -> bool {
self.state.has_focus
}

/// Query the "active" state of the widget.
pub fn is_active(&self) -> bool {
self.state.is_active
Expand Down

0 comments on commit d398ef0

Please sign in to comment.