feat(title): add header button
This commit is contained in:
parent
d8d9311841
commit
17098e6e88
|
@ -6,12 +6,17 @@ use gtk4 as gtk;
|
||||||
use gtk::{prelude::*, StackTransitionType::SlideLeftRight, *};
|
use gtk::{prelude::*, StackTransitionType::SlideLeftRight, *};
|
||||||
|
|
||||||
use crate::view::{
|
use crate::view::{
|
||||||
components::{about::open_about_dialogue, info_bar::InfoBar, menu::HeaderMenu, pages::Pages},
|
components::{
|
||||||
|
dialogues::{open_about_dialogue, open_help_dialogue},
|
||||||
|
info_bar::InfoBar,
|
||||||
|
menu::HeaderMenu,
|
||||||
|
pages::Pages,
|
||||||
|
},
|
||||||
pages::*,
|
pages::*,
|
||||||
properties::*,
|
properties::*,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::styles::load_css;
|
use super::{components::MenuActions, styles::load_css};
|
||||||
|
|
||||||
pub fn ui(application: &adw::Application) {
|
pub fn ui(application: &adw::Application) {
|
||||||
load_css();
|
load_css();
|
||||||
|
@ -56,8 +61,13 @@ pub fn ui(application: &adw::Application) {
|
||||||
|
|
||||||
let mut menu_button = HeaderMenu::<&str>::new();
|
let mut menu_button = HeaderMenu::<&str>::new();
|
||||||
|
|
||||||
|
let actions: &[MenuActions] = &[
|
||||||
|
(open_about_dialogue, "about_software", "О программе"),
|
||||||
|
(open_help_dialogue, "help", "Помощь"),
|
||||||
|
];
|
||||||
|
|
||||||
menu_button.set_action_group_name(Some("menu_group_action"));
|
menu_button.set_action_group_name(Some("menu_group_action"));
|
||||||
menu_button.append_items([(open_about_dialogue, "about_software", "О программе")]);
|
menu_button.append_items(actions);
|
||||||
|
|
||||||
title_bar.append(
|
title_bar.append(
|
||||||
&Label::builder()
|
&Label::builder()
|
||||||
|
@ -65,7 +75,8 @@ pub fn ui(application: &adw::Application) {
|
||||||
.set_align(Alignment::new(Align::Center, Align::Center))
|
.set_align(Alignment::new(Align::Center, Align::Center))
|
||||||
.hexpand(true)
|
.hexpand(true)
|
||||||
.vexpand(true)
|
.vexpand(true)
|
||||||
.label("Комплексная программа для лаб. работ")
|
.use_markup(true)
|
||||||
|
.label("<b>Комплексная программа для лаб. работ</b>")
|
||||||
.build(),
|
.build(),
|
||||||
);
|
);
|
||||||
title_bar.append(menu_button.get_button());
|
title_bar.append(menu_button.get_button());
|
||||||
|
|
Loading…
Reference in New Issue