Started work on adding tabs to main window

This commit is contained in:
Luke Else 2024-07-29 19:21:42 +01:00
parent 1e1d3bf0b1
commit 983a2eb7a4
4 changed files with 31 additions and 9 deletions

View File

@ -3,7 +3,7 @@ mod ui;
/// Stuct to store the state of the running application
pub struct App<'a> {
name: &'a str,
icao: Vec<&'a str>,
icaos: Vec<&'a str>,
metars: Vec<&'a str>,
tafs: Vec<&'a str>
}
@ -13,7 +13,7 @@ impl <'a> Default for App<'a> {
fn default() -> Self {
Self {
name: "AvBag - Welcome",
icao: vec![],
icaos: vec![],
metars: vec![],
tafs: vec![]
}

View File

@ -1,14 +1,25 @@
use crate::app::App;
use crate::theme::onedark::ONE_DARK;
impl <'a>eframe::App for App<'a> {
pub mod tabs;
impl<'a> eframe::App for App<'a> {
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
let background_frame = egui::Frame::default().fill(ONE_DARK.bg);
egui::CentralPanel::default()
.frame(background_frame)
.show(ctx, |ui| {
ui.heading(self.name);
});
.frame(background_frame)
.show(ctx, |ui| {
ui.heading(self.name);
egui::TopBottomPanel::top("wrap_app_top_bar").show(ctx, |ui| {
ui.horizontal_wrapped(|ui| {
ui.visuals_mut().button_frame = false;
// Insert Tabs
ui.selectable_label(false, format!("{:#?}", tabs::CURRENT_TAB))
});
});
});
}
}
}

View File

11
src/app/ui/tabs/mod.rs Normal file
View File

@ -0,0 +1,11 @@
pub mod metar_tab;
#[derive(Debug)]
pub enum Tabs {
METAR,
TAF,
NOTAMS,
Routing,
}
pub static CURRENT_TAB: Tabs = Tabs::METAR;