mirror of
https://github.com/danbulant/cushy
synced 2026-07-06 11:40:37 +00:00
WrapperWidget::activate passthrough
This commit is contained in:
parent
e178c088c0
commit
fb1888d53f
4 changed files with 16 additions and 2 deletions
|
|
@ -65,6 +65,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
apps.
|
apps.
|
||||||
- The default logging output has been trimmed to only show errors for wgpu,
|
- The default logging output has been trimmed to only show errors for wgpu,
|
||||||
winit, and naga. Thanks to @bluenote10 for the feedback!
|
winit, and naga. Thanks to @bluenote10 for the feedback!
|
||||||
|
- `WrapperWidget::activate`'s default implementation now activates the wrapped
|
||||||
|
widget.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|
@ -82,6 +84,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- `Resize` now performs a second layout pass, if necessary, to ensure that
|
- `Resize` now performs a second layout pass, if necessary, to ensure that
|
||||||
children widgets have an opportunity to fill the resized area. Additionally,
|
children widgets have an opportunity to fill the resized area. Additionally,
|
||||||
the first SizeToFit measurement will be performed with the minimum dimension.
|
the first SizeToFit measurement will be performed with the minimum dimension.
|
||||||
|
- When a keyboard-activated widget activates another widget during its callback,
|
||||||
|
the key-up event now sends the deactivate event to the finally-activated
|
||||||
|
widget.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -306,6 +306,12 @@ impl Tree {
|
||||||
self.data.lock().active
|
self.data.lock().active
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn active_widget_id(&self) -> Option<WidgetId> {
|
||||||
|
let data = self.data.lock();
|
||||||
|
|
||||||
|
data.active.map(|node| data.nodes[node].widget.id())
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn hovered_widget(&self) -> Option<LotId> {
|
pub(crate) fn hovered_widget(&self) -> Option<LotId> {
|
||||||
self.data.lock().hover
|
self.data.lock().hover
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -674,7 +674,10 @@ pub trait WrapperWidget: Debug + Send + 'static {
|
||||||
|
|
||||||
/// The widget has become the active widget.
|
/// The widget has become the active widget.
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
fn activate(&mut self, context: &mut EventContext<'_>) {}
|
fn activate(&mut self, context: &mut EventContext<'_>) {
|
||||||
|
let child = self.child_mut().mounted(context);
|
||||||
|
context.for_other(&child).activate();
|
||||||
|
}
|
||||||
|
|
||||||
/// The widget is no longer active.
|
/// The widget is no longer active.
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
|
|
|
||||||
|
|
@ -1430,7 +1430,7 @@ where
|
||||||
kludgine,
|
kludgine,
|
||||||
)
|
)
|
||||||
.activate();
|
.activate();
|
||||||
self.keyboard_activated = Some(default.id());
|
self.keyboard_activated = self.tree.active_widget_id();
|
||||||
}
|
}
|
||||||
} else if let Some(keyboard_activated) = self
|
} else if let Some(keyboard_activated) = self
|
||||||
.keyboard_activated
|
.keyboard_activated
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue