Added close button

This commit is contained in:
Piyush मिश्रः 2022-01-26 16:39:27 +05:30
parent 0e54bfdffa
commit 93c085fffd
1 changed files with 22 additions and 1 deletions

View File

@ -15,7 +15,9 @@
//! About Window //! About Window
use crate::{config, globals}; use crate::{config, globals};
use fltk::{ use fltk::{
app, dialog, app,
button::Button,
dialog,
enums::{self, Align, Event}, enums::{self, Align, Event},
frame::Frame, frame::Frame,
group::Flex, group::Flex,
@ -29,6 +31,7 @@ pub(crate) struct About {
pub(crate) repo_link: Frame, pub(crate) repo_link: Frame,
pub(crate) dev_link: Frame, pub(crate) dev_link: Frame,
pub(crate) license_link: Frame, pub(crate) license_link: Frame,
pub(crate) close_btn: Button,
} }
impl About { impl About {
@ -109,6 +112,17 @@ impl About {
license.set_label_size(13); license.set_label_size(13);
main_flex.set_size(&license, 25); main_flex.set_size(&license, 25);
// Panel
let mut panel_flex = Flex::default().row();
Frame::default();
let close_btn = Button::default().with_label("Close");
Frame::default();
panel_flex.set_size(&close_btn, 100);
panel_flex.end();
main_flex.set_size(&panel_flex, 30);
main_flex.set_size(&Frame::default(), 5);
main_flex.end(); main_flex.end();
win.end(); win.end();
@ -119,6 +133,7 @@ impl About {
repo_link, repo_link,
dev_link, dev_link,
license_link, license_link,
close_btn,
}; };
about.event(); about.event();
@ -166,5 +181,11 @@ impl About {
} }
true true
}); });
// Close Button
let mut win = self.win.clone();
self.close_btn.set_callback(move |_| {
win.hide();
});
} }
} }