about_dialog.rs - icy_draw - icy_draw is the successor to mystic draw. fork / mirror
 (HTM) git clone https://git.drkhsh.at/icy_draw.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       about_dialog.rs (1317B)
       ---
            1 use eframe::egui;
            2 use egui_modal::Modal;
            3 use i18n_embed_fl::fl;
            4 
            5 #[derive(Default)]
            6 pub struct AboutDialog {
            7     pub create: bool,
            8 }
            9 
           10 impl crate::ModalDialog for AboutDialog {
           11     fn show(&mut self, ctx: &egui::Context) -> bool {
           12         let mut result = false;
           13         let modal = Modal::new(ctx, "help_dialog");
           14 
           15         modal.show(|ui| {
           16             ui.set_height(280.0);
           17             ui.set_width(600.0);
           18 
           19             modal.title(ui, fl!(crate::LANGUAGE_LOADER, "about-dialog-title"));
           20 
           21             modal.frame(ui, |ui| {
           22                 ui.vertical_centered(|ui| {
           23                     ui.heading(fl!(crate::LANGUAGE_LOADER, "about-dialog-heading"));
           24                 });
           25 
           26                 ui.label(fl!(crate::LANGUAGE_LOADER, "about-dialog-description"));
           27                 ui.add_space(12.0); // ui.separator();
           28                 ui.label(fl!(crate::LANGUAGE_LOADER, "about-dialog-created_by", authors = env!("CARGO_PKG_AUTHORS")));
           29 
           30                 ui.add_space(8.0); // ui.separator();
           31             });
           32 
           33             modal.buttons(ui, |ui| {
           34                 if ui.button(fl!(crate::LANGUAGE_LOADER, "new-file-ok")).clicked() {
           35                     result = true;
           36                 }
           37             });
           38         });
           39         modal.open();
           40         result
           41     }
           42 
           43     fn should_commit(&self) -> bool {
           44         self.create
           45     }
           46 }