Add theme and theme_changes functions to system
This commit is contained in:
parent
9518573fce
commit
09c604c92d
24 changed files with 186 additions and 102 deletions
|
|
@ -37,6 +37,7 @@ where
|
|||
event: Event::Window(window::Event::RedrawRequested(_)),
|
||||
..
|
||||
}
|
||||
| subscription::Event::SystemThemeChanged(_)
|
||||
| subscription::Event::PlatformSpecific(_) => None,
|
||||
subscription::Event::Interaction {
|
||||
window,
|
||||
|
|
@ -66,7 +67,8 @@ where
|
|||
event,
|
||||
status,
|
||||
} => f(event, status, window),
|
||||
subscription::Event::PlatformSpecific(_) => None,
|
||||
subscription::Event::SystemThemeChanged(_)
|
||||
| subscription::Event::PlatformSpecific(_) => None,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ mod tracker;
|
|||
pub use tracker::Tracker;
|
||||
|
||||
use crate::core::event;
|
||||
use crate::core::theme;
|
||||
use crate::core::window;
|
||||
use crate::futures::Stream;
|
||||
use crate::{BoxStream, MaybeSend};
|
||||
|
|
@ -27,6 +28,9 @@ pub enum Event {
|
|||
status: event::Status,
|
||||
},
|
||||
|
||||
/// The system theme has changed.
|
||||
SystemThemeChanged(theme::Mode),
|
||||
|
||||
/// A platform specific event.
|
||||
PlatformSpecific(PlatformSpecific),
|
||||
}
|
||||
|
|
@ -422,7 +426,8 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn filter_map<I, F, T>(id: I, f: F) -> Subscription<T>
|
||||
/// Creatges a [`Subscription`] from a hashable id and a filter function.
|
||||
pub fn filter_map<I, F, T>(id: I, f: F) -> Subscription<T>
|
||||
where
|
||||
I: Hash + 'static,
|
||||
F: Fn(Event) -> Option<T> + MaybeSend + 'static,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue