libcosmic/src/widget/mod.rs

148 lines
3.6 KiB
Rust
Raw Normal View History

// Copyright 2022 System76 <info@system76.com>
// SPDX-License-Identifier: MPL-2.0
//! Cosmic-themed widget implementations.
// Re-exports from Iced
pub use iced::widget::{checkbox, Checkbox};
pub use iced::widget::{container, Container};
pub use iced::widget::{horizontal_space, space, vertical_space, Space};
pub use iced::widget::{image, Image};
pub use iced::widget::{mouse_area, MouseArea};
pub use iced::widget::{pick_list, PickList};
pub use iced::widget::{radio, Radio};
pub use iced::widget::{slider, Slider};
pub use iced::widget::{svg, Svg};
2023-01-26 22:16:13 +01:00
pub mod aspect_ratio;
pub mod button;
pub use button::{button, Button, IconButton, LinkButton, TextButton};
2023-07-17 11:44:57 -04:00
pub mod card;
pub use card::*;
pub use column::{column, Column};
pub mod column {
pub type Column<'a, Message> = iced::widget::Column<'a, Message, crate::Renderer>;
#[must_use]
pub fn column<'a, Message>() -> Column<'a, Message> {
Column::new()
}
#[must_use]
pub fn with_capacity<'a, Message>(capacity: usize) -> Column<'a, Message> {
Column::with_children(Vec::with_capacity(capacity))
}
#[must_use]
pub fn with_children<Message>(children: Vec<crate::Element<Message>>) -> Column<Message> {
Column::with_children(children)
}
}
pub mod cosmic_container;
pub use cosmic_container::LayerContainer;
/// An element to distinguish a boundary between two elements.
pub mod divider {
/// Horizontal variant of a divider.
pub mod horizontal {
use iced::widget::{horizontal_rule, Rule};
/// Horizontal divider with default thickness
#[must_use]
pub fn default() -> Rule<crate::Renderer> {
horizontal_rule(1).style(crate::theme::Rule::Default)
}
/// Horizontal divider with light thickness
#[must_use]
pub fn light() -> Rule<crate::Renderer> {
horizontal_rule(4).style(crate::theme::Rule::LightDivider)
}
/// Horizontal divider with heavy thickness.
#[must_use]
pub fn heavy() -> Rule<crate::Renderer> {
horizontal_rule(10).style(crate::theme::Rule::HeavyDivider)
}
}
}
2023-06-23 23:39:48 +02:00
pub mod flex_row;
pub use flex_row::{flex_row, FlexRow};
2022-10-09 02:35:03 -07:00
mod header_bar;
2023-01-03 21:35:35 +01:00
pub use header_bar::{header_bar, HeaderBar};
2022-10-07 05:23:26 +02:00
pub mod icon;
pub use icon::{icon, Icon};
2023-07-26 16:32:23 -04:00
#[cfg(feature = "animated-image")]
pub mod frames;
pub mod list;
pub use list::*;
pub mod nav_bar;
pub use nav_bar::nav_bar;
pub mod nav_bar_toggle;
pub use nav_bar_toggle::{nav_bar_toggle, NavBarToggle};
pub mod popover;
pub use popover::{popover, Popover};
2023-01-26 22:16:13 +01:00
pub mod rectangle_tracker;
pub use row::{row, Row};
pub mod row {
pub type Row<'a, Message> = iced::widget::Row<'a, Message, crate::Renderer>;
#[must_use]
pub fn row<'a, Message>() -> Row<'a, Message> {
Row::new()
}
#[must_use]
pub fn with_capacity<'a, Message>(capacity: usize) -> Row<'a, Message> {
Row::with_children(Vec::with_capacity(capacity))
}
#[must_use]
pub fn with_children<Message>(children: Vec<crate::Element<Message>>) -> Row<Message> {
Row::with_children(children)
}
}
mod scrollable;
pub use scrollable::*;
2023-01-26 22:16:13 +01:00
pub mod search;
2022-12-28 12:42:28 +01:00
pub mod segmented_button;
pub mod segmented_selection;
2022-12-28 12:42:28 +01:00
pub mod settings;
pub mod spin_button;
2023-01-03 21:35:35 +01:00
pub use spin_button::{spin_button, SpinButton};
2022-12-14 16:51:22 -05:00
pub mod text;
2023-01-26 22:16:13 +01:00
pub use text::{text, Text};
2022-12-17 18:17:13 -05:00
pub mod text_input;
pub use text_input::*;
2023-01-26 22:16:13 +01:00
mod toggler;
pub use toggler::toggler;
2023-01-16 12:04:39 -07:00
pub mod view_switcher;
pub use view_switcher::horizontal as horiontal_view_switcher;
pub use view_switcher::vertical as vertical_view_switcher;
2023-01-16 12:04:39 -07:00
pub mod warning;
pub use warning::*;