cosmic/widget/context_drawer/
mod.rs

1// Copyright 2023 System76 <info@system76.com>
2// SPDX-License-Identifier: MPL-2.0
3
4//! An overlayed widget that attaches a toggleable context drawer to the view.
5
6mod overlay;
7
8mod widget;
9use std::borrow::Cow;
10
11pub use widget::ContextDrawer;
12
13use crate::Element;
14
15/// An overlayed widget that attaches a toggleable context drawer to the view.
16pub fn context_drawer<'a, Message: Clone + 'static, Content, Drawer>(
17    title: Option<Cow<'a, str>>,
18    header_actions: Vec<Element<'a, Message>>,
19    header_opt: Option<Element<'a, Message>>,
20    footer_opt: Option<Element<'a, Message>>,
21    on_close: Message,
22    content: Content,
23    drawer: Drawer,
24    max_width: f32,
25) -> ContextDrawer<'a, Message>
26where
27    Content: Into<Element<'a, Message>>,
28    Drawer: Into<Element<'a, Message>>,
29{
30    ContextDrawer::new(
31        title,
32        header_actions,
33        header_opt,
34        footer_opt,
35        content,
36        drawer,
37        on_close,
38        max_width,
39    )
40}