add Task and Action for changing a window title
This commit is contained in:
parent
717b296cdb
commit
ca8aaf9b8d
2 changed files with 13 additions and 0 deletions
|
|
@ -73,6 +73,9 @@ pub enum Action {
|
||||||
/// Get the current [`Mode`] of the window.
|
/// Get the current [`Mode`] of the window.
|
||||||
GetMode(Id, oneshot::Sender<Mode>),
|
GetMode(Id, oneshot::Sender<Mode>),
|
||||||
|
|
||||||
|
/// Change the title of the window.
|
||||||
|
ChangeTitle(Id, String),
|
||||||
|
|
||||||
/// Toggle the window to maximized or back
|
/// Toggle the window to maximized or back
|
||||||
ToggleMaximize(Id),
|
ToggleMaximize(Id),
|
||||||
|
|
||||||
|
|
@ -368,6 +371,11 @@ pub fn change_level<T>(id: Id, level: Level) -> Task<T> {
|
||||||
task::effect(crate::Action::Window(Action::ChangeLevel(id, level)))
|
task::effect(crate::Action::Window(Action::ChangeLevel(id, level)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Changes the title of the window.
|
||||||
|
pub fn change_title<T>(id: Id, title: String) -> Task<T> {
|
||||||
|
task::effect(crate::Action::Window(Action::ChangeTitle(id, title)))
|
||||||
|
}
|
||||||
|
|
||||||
/// Show the [system menu] at cursor position.
|
/// Show the [system menu] at cursor position.
|
||||||
///
|
///
|
||||||
/// [system menu]: https://en.wikipedia.org/wiki/Common_menus_in_Microsoft_Windows#System_menu
|
/// [system menu]: https://en.wikipedia.org/wiki/Common_menus_in_Microsoft_Windows#System_menu
|
||||||
|
|
|
||||||
|
|
@ -1291,6 +1291,11 @@ fn run_action<P, C>(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
window::Action::ChangeTitle(id, title) => {
|
||||||
|
if let Some(window) = window_manager.get_mut(id) {
|
||||||
|
window.raw.set_title(&title);
|
||||||
|
}
|
||||||
|
}
|
||||||
window::Action::GetSize(id, channel) => {
|
window::Action::GetSize(id, channel) => {
|
||||||
if let Some(window) = window_manager.get_mut(id) {
|
if let Some(window) = window_manager.get_mut(id) {
|
||||||
let size = window
|
let size = window
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue