Add new tab.

This commit is contained in:
2025-08-21 16:39:17 +02:00
parent 26940b8d94
commit 69f85bad0d

View File

@@ -37,14 +37,8 @@ struct TabViewer {
show_settings_toggle: Option<bool>,
}
impl egui_dock::TabViewer for TabViewer {
type Tab = String;
fn title(&mut self, tab: &mut Self::Tab) -> egui::WidgetText {
(&*tab).into()
}
fn ui(&mut self, ui: &mut egui::Ui, tab: &mut Self::Tab) {
impl TabViewer {
fn single_tab(&mut self, ui: &mut egui::Ui) {
egui::Frame::default().inner_margin(5).show(ui, |ui| {
let settings = CollapsingHeader::new("Settings")
.open(self.show_settings_toggle)
@@ -110,6 +104,28 @@ impl egui_dock::TabViewer for TabViewer {
);
});
}
fn multi_tab(&mut self, ui: &mut egui::Ui) {
ui.heading("Bode plots!");
}
}
impl egui_dock::TabViewer for TabViewer {
type Tab = String;
fn title(&mut self, tab: &mut Self::Tab) -> egui::WidgetText {
(&*tab).into()
}
fn ui(&mut self, ui: &mut egui::Ui, tab: &mut Self::Tab) {
match tab.as_str() {
"Single" => self.single_tab(ui),
"Multi" => self.multi_tab(ui),
_ => {
let _ = ui.label("Unknown tab");
}
}
}
}
impl App {
@@ -136,7 +152,7 @@ impl App {
// Step 3: Construct App
let app = App {
tree: DockState::new(vec!["Single".to_string()]),
tree: DockState::new(vec!["Single".to_string(), "Multi".to_string()]),
tab_viewer,
run_impedancemeter_tx,
magnitude,