Skip to main content

iced_cube/application/
mod.rs

1//! Application chrome: the menubar, toolbar, status bar and command palette.
2
3#[cfg(feature = "command-palette")]
4pub mod command_palette;
5#[cfg(feature = "menubar")]
6pub mod menubar;
7#[cfg(feature = "status-bar")]
8pub mod status_bar;
9#[cfg(feature = "toolbar")]
10pub mod toolbar;
11
12#[cfg(feature = "command-palette")]
13pub use command_palette::{CommandPalette, command_palette};
14#[cfg(feature = "menubar")]
15pub use menubar::{Menubar, menubar};
16#[cfg(feature = "status-bar")]
17pub use status_bar::{StatusBar, status_bar};
18#[cfg(feature = "toolbar")]
19pub use toolbar::{Toolbar, toolbar};
20
21/// The one pixel line along the inner edge of a bar, in the border colour.
22#[cfg(any(feature = "menubar", feature = "status-bar", feature = "toolbar"))]
23pub(crate) fn edge<'a, Message: 'a>() -> iced::Element<'a, Message> {
24    use iced::widget::{container, space};
25
26    container(space())
27        .width(iced::Length::Fill)
28        .height(1)
29        .style(|theme| edge_style(&crate::theme::Tokens::of(theme)))
30        .into()
31}
32
33/// The style of a bar's edge line.
34#[cfg(any(feature = "menubar", feature = "status-bar", feature = "toolbar"))]
35pub(crate) fn edge_style(tokens: &crate::theme::Tokens) -> iced::widget::container::Style {
36    iced::widget::container::Style {
37        background: Some(iced::Background::Color(tokens.border)),
38        ..iced::widget::container::Style::default()
39    }
40}