TO DO: will done table in signal reducing page and write controller for that page
This commit is contained in:
parent
37a8dfb66b
commit
6e315907bc
|
@ -1,17 +1,13 @@
|
||||||
pub trait Product<B, T> {
|
pub trait Product<B, T> {
|
||||||
|
|
||||||
fn builder() -> B;
|
fn builder() -> B;
|
||||||
|
|
||||||
fn get(self) -> T;
|
fn get(self) -> T;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Builder<T, I, P> {
|
pub trait Builder<T, I, P> {
|
||||||
|
|
||||||
fn build(&self, build_arg: P) -> T;
|
fn build(&self, build_arg: P) -> T;
|
||||||
|
|
||||||
fn append_item(self, item: I) -> Self;
|
fn append_item(self, item: I) -> Self;
|
||||||
|
|
||||||
fn append_items(self, items: Vec<I>) -> Self;
|
fn append_items(self, items: Vec<I>) -> Self;
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,7 +1,8 @@
|
||||||
use gtk4 as gtk;
|
use gtk4 as gtk;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
model::builder_traits::Product,
|
controller::event_handlers::button_event_handlers::*,
|
||||||
|
model::{builder_traits::Product, model::EventHandler},
|
||||||
view::{
|
view::{
|
||||||
components::{input::Input, wrapper::Wrapper},
|
components::{input::Input, wrapper::Wrapper},
|
||||||
properties::*,
|
properties::*,
|
||||||
|
@ -98,10 +99,50 @@ pub fn signal_reducing_page(wrapper: &Box) {
|
||||||
wrapper_second_row.append(elem);
|
wrapper_second_row.append(elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
let main_wpapper = Wrapper::row_builder().spacing(5).build();
|
let main_wrapper = Wrapper::row_builder().spacing(5).build();
|
||||||
|
|
||||||
main_wpapper.append(&wrapper_first_row);
|
main_wrapper.append(&wrapper_first_row);
|
||||||
main_wpapper.append(&wrapper_second_row);
|
main_wrapper.append(&wrapper_second_row);
|
||||||
|
|
||||||
wrapper.append(&main_wpapper);
|
let calculate_button = Button::builder()
|
||||||
|
.label("Расчитать")
|
||||||
|
.halign(Align::End)
|
||||||
|
.set_margin(MarginData::MultipleMargin((10, 5, 0, 0)))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let table_header_labels = vec!["f, Гц", "Xc, пФ", "Vп, мВ", "ζ"];
|
||||||
|
|
||||||
|
let table_header = Wrapper::col_builder()
|
||||||
|
.height_request(24)
|
||||||
|
.spacing(5)
|
||||||
|
.halign(Align::Center)
|
||||||
|
.hexpand(true)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
for header_label in table_header_labels {
|
||||||
|
let label = Label::builder()
|
||||||
|
.label(header_label)
|
||||||
|
.halign(Align::Fill)
|
||||||
|
.hexpand(true)
|
||||||
|
.build();
|
||||||
|
table_header.append(&label);
|
||||||
|
}
|
||||||
|
|
||||||
|
let table_of_calculated_values = Frame::builder()
|
||||||
|
.height_request(64)
|
||||||
|
.hexpand(true)
|
||||||
|
.child(&table_header)
|
||||||
|
.halign(Align::Fill)
|
||||||
|
.set_margin(MarginData::MultipleMargin((10, 5, 0, 0)))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
EventHandler::new(calculate_button.clone(), move |_| {
|
||||||
|
println!("button taped");
|
||||||
|
})
|
||||||
|
.on_click();
|
||||||
|
|
||||||
|
main_wrapper.append(&calculate_button);
|
||||||
|
main_wrapper.append(&table_of_calculated_values);
|
||||||
|
|
||||||
|
wrapper.append(&main_wrapper);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue