From e65c39b954a96eb7efe6271db13f047c204f1e45 Mon Sep 17 00:00:00 2001 From: Truman Kilen Date: Sat, 12 Aug 2023 23:19:20 -0500 Subject: [PATCH] WIP collapsible mod group UI --- src/gui/mod.rs | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/src/gui/mod.rs b/src/gui/mod.rs index 7b1cb146..7db3c124 100644 --- a/src/gui/mod.rs +++ b/src/gui/mod.rs @@ -521,13 +521,37 @@ impl App { } }; - egui::ScrollArea::vertical().show(ui, |ui| { - if let Some(profile) = profiles.get_mut(profile) { - ui_profile(ui, profile); - } else { - ui.label("no such profile"); - } - }); + egui::Frame::none() + .show(ui, |ui| { + egui::ScrollArea::vertical().show(ui, |ui| { + if let Some(profile) = profiles.get_mut(profile) { + ui_profile(ui, profile); + } else { + ui.label("no such profile"); + } + }); + ui.allocate_space(ui.available_size()); + }) + .response + .context_menu(|ui| { + if let Some(profile) = profiles.get_mut(profile) { + ui.menu_button("add group", |ui| { + for group in groups.keys() { + if ui.button(group).clicked() { + profile.mods.push(ModOrGroup::Group { + group_name: group.clone(), + enabled: true, + }); + ctx.needs_save = true; + ui.close_menu(); + } + } + }); + } + if ui.button("close").clicked() { + ui.close_menu(); + } + }); if let Some(add_deps) = ctx.add_deps { message::ResolveMods::send(self, ui.ctx(), add_deps, true);