feat(context_drawer): add actions to header

This commit is contained in:
Vukašin Vojinović 2024-11-09 20:50:21 +01:00 committed by Michael Murphy
parent d8357d0ea3
commit c310f4ca24
3 changed files with 32 additions and 11 deletions

View file

@ -465,6 +465,11 @@ where
None
}
/// App-specific actions at the start of the context drawer header
fn context_header_actions(&self) -> Vec<Element<Message<Self::Message>>> {
Vec::new()
}
/// Displays a dialog in the center of the application window when `Some`.
fn dialog(&self) -> Option<Element<Self::Message>> {
None
@ -746,6 +751,7 @@ impl<App: Application> ApplicationExt for App {
widgets.push(
context_drawer(
&core.window.context_title,
self.context_header_actions(),
Message::Cosmic(cosmic::Message::ContextDrawer(false)),
main_content,
context.map(Message::App),
@ -779,6 +785,7 @@ impl<App: Application> ApplicationExt for App {
widgets.push(
crate::widget::ContextDrawer::new_inner(
&core.window.context_title,
self.context_header_actions(),
context.map(Message::App),
Message::Cosmic(cosmic::Message::ContextDrawer(false)),
context_width,