mirror of
https://github.com/hubaldv/bioz-host-rs.git
synced 2025-12-05 21:01:18 +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>,
|
||||
}
|
||||
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user