feat(app): integrate ContextDrawer with context_drawer method

This commit is contained in:
Michael Aaron Murphy 2023-10-12 13:23:59 +02:00 committed by Michael Murphy
parent 3127de3296
commit d620531e7e
3 changed files with 36 additions and 8 deletions

View file

@ -24,6 +24,8 @@ pub enum Message {
AppThemeChange(Theme),
/// Requests to close the window.
Close,
/// Closes or shows the context drawer.
ContextDrawer(bool),
/// Requests to drag the window.
Drag,
/// Keyboard shortcuts managed by libcosmic.
@ -166,6 +168,7 @@ where
if id != window::Id(0) {
return self.app.view_window(id).map(super::Message::App);
}
if self.app.core().window.use_template {
self.app.view_main()
} else {
@ -242,13 +245,12 @@ impl<T: Application> Cosmic<T> {
keyboard_nav::Message::Fullscreen => return command::toggle_fullscreen(),
},
Message::Drag => return command::drag(),
Message::Close => {
self.app.on_app_exit();
return self.close();
Message::ContextDrawer(show) => {
self.app.core_mut().window.show_context = show;
}
Message::Drag => return command::drag(),
Message::Minimize => return command::minimize(),
Message::Maximize => {
@ -303,6 +305,11 @@ impl<T: Application> Cosmic<T> {
Message::ScaleFactor(factor) => {
self.app.core_mut().set_scale_factor(factor);
}
Message::Close => {
self.app.on_app_exit();
return self.close();
}
}
iced::Command::none()