mirror of
https://github.com/hubaldv/bioz-host-rs.git
synced 2025-12-06 05:11:17 +00:00
Add new tab.
This commit is contained in:
34
src/app.rs
34
src/app.rs
@@ -37,14 +37,8 @@ struct TabViewer {
|
|||||||
show_settings_toggle: Option<bool>,
|
show_settings_toggle: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl egui_dock::TabViewer for TabViewer {
|
impl TabViewer {
|
||||||
type Tab = String;
|
fn single_tab(&mut self, ui: &mut egui::Ui) {
|
||||||
|
|
||||||
fn title(&mut self, tab: &mut Self::Tab) -> egui::WidgetText {
|
|
||||||
(&*tab).into()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn ui(&mut self, ui: &mut egui::Ui, tab: &mut Self::Tab) {
|
|
||||||
egui::Frame::default().inner_margin(5).show(ui, |ui| {
|
egui::Frame::default().inner_margin(5).show(ui, |ui| {
|
||||||
let settings = CollapsingHeader::new("Settings")
|
let settings = CollapsingHeader::new("Settings")
|
||||||
.open(self.show_settings_toggle)
|
.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 {
|
impl App {
|
||||||
@@ -136,7 +152,7 @@ impl App {
|
|||||||
|
|
||||||
// Step 3: Construct App
|
// Step 3: Construct App
|
||||||
let app = App {
|
let app = App {
|
||||||
tree: DockState::new(vec!["Single".to_string()]),
|
tree: DockState::new(vec!["Single".to_string(), "Multi".to_string()]),
|
||||||
tab_viewer,
|
tab_viewer,
|
||||||
run_impedancemeter_tx,
|
run_impedancemeter_tx,
|
||||||
magnitude,
|
magnitude,
|
||||||
|
|||||||
Reference in New Issue
Block a user