Тралалело Тралала

modified:   code/src/app.rs
master
Алексей Алексей 2026-05-12 09:17:11 +10:00
parent 38bf469539
commit 15b9c76b30
1 changed files with 7 additions and 6 deletions

View File

@ -16,7 +16,6 @@ enum TabTypes{
struct Tab{ struct Tab{
tab_type: TabTypes, tab_type: TabTypes,
title: String, title: String,
content: String,
} }
pub struct App{ pub struct App{
@ -29,17 +28,14 @@ impl Default for App{
Tab{ Tab{
tab_type: TabTypes::Equipment, tab_type: TabTypes::Equipment,
title:"Оборудование".to_owned(), title:"Оборудование".to_owned(),
content:"Вкладка с оборудованием".to_owned()
}, },
Tab{ Tab{
tab_type: TabTypes::Material, tab_type: TabTypes::Material,
title: "Сырьё".to_owned(), title: "Сырьё".to_owned(),
content:"Вкладка с сырьём".to_owned()
}, },
Tab{ Tab{
tab_type: TabTypes::Worker, tab_type: TabTypes::Worker,
title: "Сотрудники".to_owned(), title: "Сотрудники".to_owned(),
content:"Сотрудники".to_owned()
} }
]); ]);
@ -61,6 +57,7 @@ impl App{
Default::default() Default::default()
} }
} }
impl eframe::App for App{ impl eframe::App for App{
@ -72,6 +69,11 @@ impl eframe::App for App{
} }
struct TabViewer {} struct TabViewer {}
impl TabViewer{
fn show_equipment(&mut self, ui: &mut egui::Ui){
ui.label("Equipment");
}
}
impl egui_dock::TabViewer for TabViewer{ impl egui_dock::TabViewer for TabViewer{
type Tab = Tab; type Tab = Tab;
@ -80,10 +82,9 @@ impl egui_dock::TabViewer for TabViewer{
(&*tab.title).into() (&*tab.title).into()
} }
fn ui(&mut self, ui: &mut egui::Ui, tab: &mut Self::Tab){ fn ui(&mut self, ui: &mut egui::Ui, tab: &mut Self::Tab){
ui.label(&tab.content);
match &tab.tab_type{ match &tab.tab_type{
TabTypes::Equipment => { TabTypes::Equipment => {
ui.label("This is Equipment"); &self.show_equipment(ui);
}, },
_ =>{ _ =>{
ui.label("This is not"); ui.label("This is not");