-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor GUI components and create separate header
and body modules
- Loading branch information
1 parent
c176bc7
commit 4a814c6
Showing
4 changed files
with
53 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use crate::gui::tabs::GuiTab; | ||
use crate::gui::Sam; | ||
|
||
use egui::Context; | ||
|
||
pub fn create_body(sam: &mut Sam, ctx: &Context) { | ||
egui::CentralPanel::default().show(ctx, |ui| { | ||
ui.set_width(ui.available_width()); | ||
ui.set_height(ui.available_height()); | ||
ui.set_enabled(!sam.archive_window_open); | ||
|
||
match sam.tab { | ||
GuiTab::Launch => {} | ||
GuiTab::Plot => sam.plot_tab.main_ui(ui, sam.data_source.as_mut()), | ||
GuiTab::Configure => { | ||
let changed = sam.configure_tab.main_ui(ui, sam.data_source.as_mut(), &mut sam.settings); | ||
if changed { | ||
sam.data_source.apply_settings(&sam.settings); | ||
sam.plot_tab.apply_settings(&sam.settings); | ||
} | ||
} | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use crate::gui::Sam; | ||
|
||
use egui::{CollapsingHeader, Context}; | ||
|
||
pub fn create_header(sam: &mut Sam, ctx: &Context) { | ||
if ctx.screen_rect().width() > 1000.0 { | ||
egui::TopBottomPanel::top("topbar").min_height(60.0).max_height(60.0).show(ctx, |ui| { | ||
ui.set_enabled(!sam.archive_window_open); | ||
ui.horizontal_centered(|ui| { | ||
sam.top_bar(ui, false); | ||
}); | ||
}); | ||
} else { | ||
egui::TopBottomPanel::top("topbar").min_height(20.0).max_height(300.0).show(ctx, |ui| { | ||
ui.set_enabled(!sam.archive_window_open); | ||
CollapsingHeader::new("Status & Controls").default_open(false).show(ui, |ui| { | ||
sam.top_bar(ui, true); | ||
ui.add_space(10.0); | ||
}); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
pub mod body; | ||
pub mod bottom_status_bar; | ||
pub mod header; | ||
pub mod top_menu_bar; |