diff --git a/egui/src/containers/combo_box.rs b/egui/src/containers/combo_box.rs index c4498fbb..7e64f076 100644 --- a/egui/src/containers/combo_box.rs +++ b/egui/src/containers/combo_box.rs @@ -1,9 +1,139 @@ use crate::{style::WidgetVisuals, *}; use epaint::Shape; +// TODO: this should be builder struct so we can set options like width. + /// A drop-down selection menu with a descriptive label. /// -/// See also [`combo_box`]. +/// ``` +/// # #[derive(Debug, PartialEq)] +/// # enum Enum { First, Second, Third } +/// # let mut selected = Enum::First; +/// # let mut ui = &mut egui::Ui::__test(); +/// egui::ComboBox::from_label( "Select one!") +/// .selected_text(format!("{:?}", selected)) +/// .show_ui(ui, |ui| { +/// ui.selectable_value(&mut selected, Enum::First, "First"); +/// ui.selectable_value(&mut selected, Enum::Second, "Second"); +/// ui.selectable_value(&mut selected, Enum::Third, "Third"); +/// } +/// ); +/// ``` +pub struct ComboBox { + id_source: Id, + label: Option