40 lines
1.4 KiB
Rust
40 lines
1.4 KiB
Rust
|
use eframe::egui::{self, CollapsingHeader};
|
||
|
|
||
|
use crate::{application::Application, APP_NAME};
|
||
|
|
||
|
pub fn draw_sidebar(ctx: &egui::Context, app: &mut Application) {
|
||
|
egui::SidePanel::left("left_panel")
|
||
|
.exact_width(230.)
|
||
|
.show(ctx, |ui| {
|
||
|
ui.heading(APP_NAME);
|
||
|
CollapsingHeader::new("Gerber")
|
||
|
.default_open(true)
|
||
|
.show(ui, |ui| {
|
||
|
for (key, (name, _)) in app.gerbers.iter() {
|
||
|
ui.selectable_value(&mut app.selection, key.to_string(), name);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
CollapsingHeader::new("Excellon")
|
||
|
.default_open(true)
|
||
|
.show(ui, |ui| {
|
||
|
for (key, (name, _)) in app.excellons.iter() {
|
||
|
ui.selectable_value(&mut app.selection, key.to_string(), name);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
CollapsingHeader::new("Geometry")
|
||
|
.default_open(true)
|
||
|
.show(ui, |ui| {
|
||
|
for (key, _) in app.outlines.iter() {
|
||
|
ui.selectable_value(&mut app.selection, key.to_string(), key);
|
||
|
}
|
||
|
});
|
||
|
let (id, rect) = ui.allocate_space(ui.available_size());
|
||
|
let response = ui.interact(rect, id, egui::Sense::click_and_drag());
|
||
|
if response.clicked() {
|
||
|
app.selection = "".into();
|
||
|
}
|
||
|
});
|
||
|
}
|