ui/layout/
toolbar.rs

1//! Renders the toolbar at the top of the screen.
2
3use crate::dialogs::Dialogs;
4use egui::{Align, Context, Layout, TopBottomPanel};
5
6/// Handles the rendering of the toolbar.
7pub(super) fn render(context: &mut Context, dialogs: &mut Dialogs) {
8    TopBottomPanel::top("Toolbar").show(context, |ui| {
9        ui.with_layout(Layout::left_to_right(Align::LEFT), |ui| {
10            ui.style_mut().visuals.button_frame = false;
11
12            if ui.button("New").clicked() {
13                dialogs.show_new_project();
14            }
15
16            if ui.button("Open").clicked() {
17                dialogs.show_open_project();
18            }
19
20            ui.add_enabled_ui(false, |ui| ui.button("Save"));
21        });
22    });
23}