mirror of
https://github.com/danbulant/cushy
synced 2026-06-20 23:11:12 +00:00
parent
0e0c26fa3b
commit
0fe7f78969
4 changed files with 22 additions and 7 deletions
|
|
@ -128,6 +128,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- `GraphicsContext::fill` now properly fills the entire region of the widget.
|
||||
- `Slider` now correctly calculates its width when in a fully `SizeToFit`
|
||||
layout.
|
||||
- `ThemedMode` is now properly applied consistently. Previously sometimes the
|
||||
window's theme mode would be used instead of the overridden mode.
|
||||
|
||||
### Added
|
||||
|
||||
|
|
|
|||
|
|
@ -913,7 +913,10 @@ impl<'context> WidgetContext<'context> {
|
|||
) -> Self {
|
||||
let enabled = current_node.enabled(&window.handle());
|
||||
let tree = current_node.tree();
|
||||
Self {
|
||||
|
||||
let (effective_styles, overridden_theme, overridden_theme_mode) =
|
||||
current_node.overridden_theme();
|
||||
let mut context = Self {
|
||||
pending_state: PendingState::Owned(PendingWidgetState {
|
||||
focus: tree
|
||||
.focused_widget()
|
||||
|
|
@ -926,7 +929,7 @@ impl<'context> WidgetContext<'context> {
|
|||
unmounting: false,
|
||||
}),
|
||||
tree,
|
||||
effective_styles: current_node.effective_styles(),
|
||||
effective_styles,
|
||||
cache: WidgetCacheKey {
|
||||
kludgine_id: Some(window.kludgine_id()),
|
||||
theme_mode,
|
||||
|
|
@ -937,7 +940,16 @@ impl<'context> WidgetContext<'context> {
|
|||
font_state,
|
||||
theme: Cow::Borrowed(theme),
|
||||
window,
|
||||
};
|
||||
|
||||
if let Some(theme) = overridden_theme {
|
||||
context.theme = Cow::Owned(theme.get_tracking_redraw(&context));
|
||||
}
|
||||
if let Some(mode) = overridden_theme_mode {
|
||||
context.cache.theme_mode = mode.get_tracking_redraw(&context);
|
||||
}
|
||||
|
||||
context
|
||||
}
|
||||
|
||||
/// Returns a new instance that borrows from `self`.
|
||||
|
|
@ -965,7 +977,7 @@ impl<'context> WidgetContext<'context> {
|
|||
Widget::Managed: MapManagedWidget<WidgetContext<'child>>,
|
||||
{
|
||||
widget.manage(self).map(|current_node| {
|
||||
let (effective_styles, theme, theme_mode) = current_node.overidden_theme();
|
||||
let (effective_styles, theme, theme_mode) = current_node.overridden_theme();
|
||||
let theme = if let Some(theme) = theme {
|
||||
Cow::Owned(theme.get_tracking_redraw(self))
|
||||
} else {
|
||||
|
|
@ -1171,7 +1183,8 @@ impl<'context> WidgetContext<'context> {
|
|||
/// Attaches `theme_mode` to the widget hierarchy for this widget.
|
||||
///
|
||||
/// All children nodes will use this theme mode.
|
||||
pub fn attach_theme_mode(&self, theme_mode: Value<ThemeMode>) {
|
||||
pub fn attach_theme_mode(&mut self, theme_mode: Value<ThemeMode>) {
|
||||
self.cache.theme_mode = theme_mode.get();
|
||||
self.current_node.attach_theme_mode(theme_mode);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -384,7 +384,7 @@ impl Tree {
|
|||
data.nodes.get_mut(id).expect("missing widget").theme_mode = Some(theme);
|
||||
}
|
||||
|
||||
pub(crate) fn overriden_theme(
|
||||
pub(crate) fn overridden_theme(
|
||||
&self,
|
||||
id: LotId,
|
||||
) -> (Styles, Option<Value<ThemePair>>, Option<Value<ThemeMode>>) {
|
||||
|
|
|
|||
|
|
@ -1991,10 +1991,10 @@ impl MountedWidget {
|
|||
self.tree().attach_theme_mode(self.node_id, theme);
|
||||
}
|
||||
|
||||
pub(crate) fn overidden_theme(
|
||||
pub(crate) fn overridden_theme(
|
||||
&self,
|
||||
) -> (Styles, Option<Value<ThemePair>>, Option<Value<ThemeMode>>) {
|
||||
self.tree().overriden_theme(self.node_id)
|
||||
self.tree().overridden_theme(self.node_id)
|
||||
}
|
||||
|
||||
pub(crate) fn begin_layout(&self, constraints: Size<ConstraintLimit>) -> Option<Size<UPx>> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue