generated from luke-else/egui-template
Started work on adding tabs to main window
This commit is contained in:
parent
1e1d3bf0b1
commit
983a2eb7a4
@ -3,7 +3,7 @@ mod ui;
|
|||||||
/// Stuct to store the state of the running application
|
/// Stuct to store the state of the running application
|
||||||
pub struct App<'a> {
|
pub struct App<'a> {
|
||||||
name: &'a str,
|
name: &'a str,
|
||||||
icao: Vec<&'a str>,
|
icaos: Vec<&'a str>,
|
||||||
metars: Vec<&'a str>,
|
metars: Vec<&'a str>,
|
||||||
tafs: Vec<&'a str>
|
tafs: Vec<&'a str>
|
||||||
}
|
}
|
||||||
@ -13,7 +13,7 @@ impl <'a> Default for App<'a> {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
name: "AvBag - Welcome",
|
name: "AvBag - Welcome",
|
||||||
icao: vec![],
|
icaos: vec![],
|
||||||
metars: vec![],
|
metars: vec![],
|
||||||
tafs: vec![]
|
tafs: vec![]
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
use crate::app::App;
|
use crate::app::App;
|
||||||
use crate::theme::onedark::ONE_DARK;
|
use crate::theme::onedark::ONE_DARK;
|
||||||
|
|
||||||
|
pub mod tabs;
|
||||||
|
|
||||||
impl<'a> eframe::App for App<'a> {
|
impl<'a> eframe::App for App<'a> {
|
||||||
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
|
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
|
||||||
let background_frame = egui::Frame::default().fill(ONE_DARK.bg);
|
let background_frame = egui::Frame::default().fill(ONE_DARK.bg);
|
||||||
@ -9,6 +11,15 @@ impl <'a>eframe::App for App<'a> {
|
|||||||
.frame(background_frame)
|
.frame(background_frame)
|
||||||
.show(ctx, |ui| {
|
.show(ctx, |ui| {
|
||||||
ui.heading(self.name);
|
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;
|
Loading…
Reference in New Issue
Block a user