From 22fffc1793b144fb061ed8e3269e493ab03da77f Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Fri, 25 Sep 2020 14:43:16 +0200 Subject: [PATCH] [widgets] combo box (drop down menu) --- CHANGELOG.md | 1 + egui/src/containers/combo_box.rs | 124 +++++++++++++++++++++++++++++++ egui/src/containers/mod.rs | 5 +- egui/src/containers/window.rs | 3 +- egui/src/demos/widgets.rs | 30 ++++++-- egui/src/memory.rs | 28 ++++++- egui/src/ui.rs | 27 +++++++ egui/src/widgets/color_picker.rs | 10 +-- 8 files changed, 213 insertions(+), 15 deletions(-) create mode 100644 egui/src/containers/combo_box.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 035ec83a..c9c92c01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Color picker * Unicode characters in labels (limited by [what the default font supports](https://fonts.google.com/specimen/Comfortaa#glyphs)) +* Simple drop-down combo box menu ## 0.1.4 - 2020-09-08 diff --git a/egui/src/containers/combo_box.rs b/egui/src/containers/combo_box.rs new file mode 100644 index 00000000..92b967b9 --- /dev/null +++ b/egui/src/containers/combo_box.rs @@ -0,0 +1,124 @@ +use crate::{paint::PaintCmd, style::WidgetVisuals, *}; + +pub fn combo_box_with_label( + ui: &mut Ui, + label: impl Into