feat(info bar): add info bar for warnings

This commit is contained in:
doryan 2024-07-19 23:12:42 +04:00
parent 7264b704d0
commit 682682eb13

View File

@ -1,7 +1,8 @@
use crate::model::builder_traits::*; use crate::model::builder_traits::*;
use builders::{BoxBuilder, RevealerBuilder};
use gtk4 as gtk; use gtk4 as gtk;
use gtk::{prelude::*, StackTransitionType::SlideLeftRight, *}; use gtk::{prelude::*, Revealer, StackTransitionType::SlideLeftRight, *};
use crate::view::components::pages::Pages; use crate::view::components::pages::Pages;
@ -12,14 +13,26 @@ use crate::view::{
properties::*, properties::*,
}; };
use super::styles::load_css;
pub fn ui(application: &adw::Application) { pub fn ui(application: &adw::Application) {
load_css();
let hamming_code = Wrapper::row_builder() let hamming_code = Wrapper::row_builder()
.set_align(Alignment::new(Align::Fill, Align::Fill)) .set_align(Alignment::new(Align::Fill, Align::Fill))
.set_margin(MarginData::EqualsMargin(15)) .set_margin(MarginData::EqualsMargin(15))
.spacing(10) .spacing(10)
.build(); .build();
hamming_code::hamming_code_page(&hamming_code); let info_bar_label = Label::builder().label("test").build();
let info_bar: Revealer = Revealer::builder()
.child(&info_bar_label)
.transition_type(RevealerTransitionType::SlideUp)
.transition_duration(200)
.build();
hamming_code::hamming_code_page(&hamming_code, info_bar.clone());
let signal_reducing = Wrapper::row_builder() let signal_reducing = Wrapper::row_builder()
.set_align(Alignment::new(Align::Fill, Align::Fill)) .set_align(Alignment::new(Align::Fill, Align::Fill))
@ -27,7 +40,7 @@ pub fn ui(application: &adw::Application) {
.spacing(10) .spacing(10)
.build(); .build();
signal_reducing::signal_reducing_page(&signal_reducing); signal_reducing::signal_reducing_page(&signal_reducing, info_bar.clone());
let pages = Pages::builder() let pages = Pages::builder()
.set_transition(SlideLeftRight, 200) .set_transition(SlideLeftRight, 200)
@ -38,12 +51,17 @@ pub fn ui(application: &adw::Application) {
.build(5) .build(5)
.get(); .get();
let application_box = Box::new(Orientation::Vertical, 0);
application_box.append(&info_bar);
application_box.append(&pages);
let window = ApplicationWindow::builder() let window = ApplicationWindow::builder()
.title("Комплексная программа для лаб. работ") .title("Комплексная программа для лаб. работ")
.width_request(700) .width_request(700)
.height_request(400) .height_request(400)
.application(application) .application(application)
.child(&pages) .child(&application_box)
.build(); .build();
window.show(); window.show();