Added a delete symbol
Just testing it out
This commit is contained in:
29
src/main.rs
29
src/main.rs
@@ -213,7 +213,9 @@ impl eframe::App for RustDoomLauncher {
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.vertical(|ui| {
|
||||
ui.label("Launchers");
|
||||
let mut remove_pos: Option<usize> = None;
|
||||
for (pos, launcher) in self.all_launchers.iter().enumerate() {
|
||||
ui.horizontal(|ui| {
|
||||
if ui
|
||||
.add(egui::SelectableLabel::new(
|
||||
self.selected_launcher.is_some()
|
||||
@@ -224,6 +226,13 @@ impl eframe::App for RustDoomLauncher {
|
||||
{
|
||||
self.selected_launcher = Some(pos);
|
||||
}
|
||||
if ui.button("❌").clicked() {
|
||||
remove_pos = Some(pos);
|
||||
}
|
||||
});
|
||||
}
|
||||
if let Some(rp) = remove_pos {
|
||||
self.all_launchers.remove(rp);
|
||||
}
|
||||
});
|
||||
ui.separator();
|
||||
@@ -248,15 +257,25 @@ impl eframe::App for RustDoomLauncher {
|
||||
ui.set_min_width(100.0);
|
||||
ui.label("PWADs");
|
||||
for (pos, pwad) in self.all_pwads.iter().enumerate() {
|
||||
if ui
|
||||
.add(egui::SelectableLabel::new(
|
||||
let pwad_label = egui::SelectableLabel::new(
|
||||
self.selected_pwads.contains(&pos),
|
||||
&pwad.name,
|
||||
))
|
||||
.clicked()
|
||||
{
|
||||
);
|
||||
/*
|
||||
let tmp = ui.add(pwad_label);
|
||||
let click_response = tmp.interact(egui::Sense::click());
|
||||
let right_click_response = tmp.interact(egui::Sense::secondary_click());
|
||||
*/
|
||||
if ui.add(pwad_label).clicked() {
|
||||
self.selected_pwads.push(pos);
|
||||
}
|
||||
/*
|
||||
TODO - no idea how this works
|
||||
if ui.add(pwad_label).secondary_clicked() {
|
||||
self.all_pwads.remove(pos);
|
||||
continue;
|
||||
}
|
||||
*/
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user