feat(dialogues): add for menu button a dialogue window
This commit is contained in:
parent
1aa393345b
commit
3a605854c1
|
@ -0,0 +1,65 @@
|
||||||
|
use adw::HeaderBar;
|
||||||
|
use gio::{glib::Variant, SimpleAction};
|
||||||
|
use gtk4 as gtk;
|
||||||
|
|
||||||
|
use gtk::{
|
||||||
|
prelude::{BoxExt, GtkWindowExt},
|
||||||
|
AboutDialog, Box, Image, Label, Orientation, ScrolledWindow, Window,
|
||||||
|
};
|
||||||
|
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
use crate::view::properties::Setters;
|
||||||
|
|
||||||
|
pub fn open_about_dialogue(_action: &SimpleAction, _var: Option<&Variant>) {
|
||||||
|
let logo = Image::from_file(Path::new("./src/view/resources/logo.png"))
|
||||||
|
.paintable()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
AboutDialog::builder()
|
||||||
|
.authors(vec!["Сагиев А.Д.", "Ефимов И.П."])
|
||||||
|
.version("1.0-beta")
|
||||||
|
.program_name("Прикладная теория информаций")
|
||||||
|
.license_type(gtk4::License::Apache20)
|
||||||
|
.logo(&logo)
|
||||||
|
.website("https://gitea.doryan04.ru/doryan/AIT")
|
||||||
|
.build()
|
||||||
|
.present();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn open_help_dialogue(_action: &SimpleAction, _var: Option<&Variant>) {
|
||||||
|
let help = Box::builder()
|
||||||
|
.width_request(400)
|
||||||
|
.orientation(Orientation::Vertical)
|
||||||
|
.set_margin(crate::view::properties::MarginData::EqualsMargin(15))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let label = Label::builder()
|
||||||
|
.use_markup(true)
|
||||||
|
.wrap(true)
|
||||||
|
.width_request(400)
|
||||||
|
.max_width_chars(50)
|
||||||
|
.single_line_mode(false)
|
||||||
|
.natural_wrap_mode(gtk4::NaturalWrapMode::Word)
|
||||||
|
.label(crate::view::resources::HELP)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
help.append(&label);
|
||||||
|
|
||||||
|
let scrollable = ScrolledWindow::builder()
|
||||||
|
.child(&help)
|
||||||
|
.hscrollbar_policy(gtk4::PolicyType::Never)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let custom_header = HeaderBar::new();
|
||||||
|
|
||||||
|
Window::builder()
|
||||||
|
.width_request(400)
|
||||||
|
.height_request(300)
|
||||||
|
.name("help")
|
||||||
|
.title("Помощь")
|
||||||
|
.titlebar(&custom_header)
|
||||||
|
.child(&scrollable)
|
||||||
|
.build()
|
||||||
|
.present();
|
||||||
|
}
|
Loading…
Reference in New Issue