Add theme and theme_changes functions to system

This commit is contained in:
Héctor Ramón Jiménez 2025-09-08 14:32:24 +02:00
parent 9518573fce
commit 09c604c92d
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
24 changed files with 186 additions and 102 deletions

View file

@ -266,12 +266,12 @@ pub fn close<T>(id: Id) -> Task<T> {
}
/// Gets the window [`Id`] of the oldest window.
pub fn get_oldest() -> Task<Option<Id>> {
pub fn oldest() -> Task<Option<Id>> {
task::oneshot(|channel| crate::Action::Window(Action::GetOldest(channel)))
}
/// Gets the window [`Id`] of the latest window.
pub fn get_latest() -> Task<Option<Id>> {
pub fn latest() -> Task<Option<Id>> {
task::oneshot(|channel| crate::Action::Window(Action::GetLatest(channel)))
}
@ -315,14 +315,14 @@ pub fn set_resize_increments<T>(id: Id, increments: Option<Size>) -> Task<T> {
}
/// Get the window's size in logical dimensions.
pub fn get_size(id: Id) -> Task<Size> {
pub fn size(id: Id) -> Task<Size> {
task::oneshot(move |channel| {
crate::Action::Window(Action::GetSize(id, channel))
})
}
/// Gets the maximized state of the window with the given [`Id`].
pub fn get_maximized(id: Id) -> Task<bool> {
pub fn is_maximized(id: Id) -> Task<bool> {
task::oneshot(move |channel| {
crate::Action::Window(Action::GetMaximized(id, channel))
})
@ -334,7 +334,7 @@ pub fn maximize<T>(id: Id, maximized: bool) -> Task<T> {
}
/// Gets the minimized state of the window with the given [`Id`].
pub fn get_minimized(id: Id) -> Task<Option<bool>> {
pub fn is_minimized(id: Id) -> Task<Option<bool>> {
task::oneshot(move |channel| {
crate::Action::Window(Action::GetMinimized(id, channel))
})
@ -346,14 +346,14 @@ pub fn minimize<T>(id: Id, minimized: bool) -> Task<T> {
}
/// Gets the position in logical coordinates of the window with the given [`Id`].
pub fn get_position(id: Id) -> Task<Option<Point>> {
pub fn position(id: Id) -> Task<Option<Point>> {
task::oneshot(move |channel| {
crate::Action::Window(Action::GetPosition(id, channel))
})
}
/// Gets the scale factor of the window with the given [`Id`].
pub fn get_scale_factor(id: Id) -> Task<f32> {
pub fn scale_factor(id: Id) -> Task<f32> {
task::oneshot(move |channel| {
crate::Action::Window(Action::GetScaleFactor(id, channel))
})
@ -365,7 +365,7 @@ pub fn move_to<T>(id: Id, position: Point) -> Task<T> {
}
/// Gets the current [`Mode`] of the window.
pub fn get_mode(id: Id) -> Task<Mode> {
pub fn mode(id: Id) -> Task<Mode> {
task::oneshot(move |channel| {
crate::Action::Window(Action::GetMode(id, channel))
})
@ -426,7 +426,7 @@ pub fn show_system_menu<T>(id: Id) -> Task<T> {
/// Gets an identifier unique to the window, provided by the underlying windowing system. This is
/// not to be confused with [`Id`].
pub fn get_raw_id<Message>(id: Id) -> Task<u64> {
pub fn raw_id<Message>(id: Id) -> Task<u64> {
task::oneshot(|channel| {
crate::Action::Window(Action::GetRawId(id, channel))
})