2023-10-23 16:57:37 +02:00
|
|
|
// Copyright 2023 System76 <info@system76.com>
|
|
|
|
|
// Copyright 2019 Héctor Ramón, Iced contributors
|
|
|
|
|
// SPDX-License-Identifier: MPL-2.0 AND MIT
|
|
|
|
|
|
2024-05-20 20:01:47 +02:00
|
|
|
//! Displays a list of options in a popover menu on select.
|
|
|
|
|
|
2023-10-23 16:57:37 +02:00
|
|
|
pub mod menu;
|
|
|
|
|
pub use menu::Menu;
|
|
|
|
|
|
2023-11-20 17:04:37 +01:00
|
|
|
pub mod multi;
|
|
|
|
|
|
2023-10-23 16:57:37 +02:00
|
|
|
mod widget;
|
|
|
|
|
pub use widget::*;
|
|
|
|
|
|
2024-05-20 20:01:47 +02:00
|
|
|
/// Displays a list of options in a popover menu on select.
|
2025-01-22 16:31:51 -05:00
|
|
|
pub fn dropdown<
|
|
|
|
|
S: AsRef<str> + std::clone::Clone + Send + Sync + 'static,
|
|
|
|
|
Message: 'static + Clone,
|
|
|
|
|
>(
|
2025-02-28 12:06:24 -05:00
|
|
|
selections: &[S],
|
2023-10-23 16:57:37 +02:00
|
|
|
selected: Option<usize>,
|
2025-01-22 16:31:51 -05:00
|
|
|
on_selected: impl Fn(usize) -> Message + Send + Sync + 'static,
|
2025-02-28 12:06:24 -05:00
|
|
|
) -> Dropdown<'_, S, Message> {
|
2023-10-23 16:57:37 +02:00
|
|
|
Dropdown::new(selections, selected, on_selected)
|
|
|
|
|
}
|