generated from luke-else/egui-template
	Started work on adding tabs to main window
This commit is contained in:
		@@ -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![]
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -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))
 | 
			
		||||
                    });
 | 
			
		||||
                });
 | 
			
		||||
            });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										0
									
								
								src/app/ui/tabs/metar_tab.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								src/app/ui/tabs/metar_tab.rs
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										11
									
								
								src/app/ui/tabs/mod.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								src/app/ui/tabs/mod.rs
									
									
									
									
									
										Normal 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;
 | 
			
		||||
		Reference in New Issue
	
	Block a user