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 a886766 commit ec254df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ You can find its changes [documented below](#070---2021-01-01).
- Text input handles Delete key ([#1746] by [@bjorn])
- `lens` macro can access nested fields ([#1764] by [@Maan2003])
- X11: Add support for transparent windows ([#1803] by [@psychon])
- `has_focus` method on `WidgetPod` ([#1825] by [@ForLoveOfCats])

### Changed

Expand Down Expand Up @@ -730,6 +731,7 @@ Last release without a changelog :(
[#1802]: https://github.com/linebender/druid/pull/1802
[#1803]: https://github.com/linebender/druid/pull/1803
[#1820]: https://github.com/linebender/druid/pull/1820
[#1825]: https://github.com/linebender/druid/pull/1825

[Unreleased]: https://github.com/linebender/druid/compare/v0.7.0...master
[0.7.0]: https://github.com/linebender/druid/compare/v0.6.0...v0.7.0
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 ec254df

Please sign in to comment.