added table and it needed to fix

This commit is contained in:
2024-04-19 12:03:16 +04:00
parent b6d0eb0508
commit 7c16964b83
2 changed files with 117 additions and 10 deletions

View File

@@ -2,17 +2,17 @@ use gtk4 as gtk;
use crate::{
controller::event_handlers::button_event_handlers::*,
model::{
builder_traits::Product,
model::{EventHandler, SchemeCharacteristics},
},
model::{builder_traits::Product, model::*},
view::{
components::{input::Input, wrapper::Wrapper},
properties::*,
},
view_utils::signal_reduce_input_utils::start_algorithm,
};
use gtk::{prelude::*, Align, WrapMode, *};
use gtk::{
prelude::{BoxExt, ListBoxRowExt, WidgetExt},
Align, WrapMode, *,
};
pub fn signal_reducing_page(wrapper: &Box) {
let (input_height, monospace, input_alignment, input_wrapping): (i32, bool, Align, WrapMode) =
@@ -125,7 +125,9 @@ pub fn signal_reducing_page(wrapper: &Box) {
let table_header = ColumnView::builder()
.focusable(false)
.reorderable(true)
.reorderable(false)
.show_row_separators(true)
.show_column_separators(true)
.halign(Align::Fill)
.hexpand(true)
.build();
@@ -140,25 +142,70 @@ pub fn signal_reducing_page(wrapper: &Box) {
table_header.append_column(&column);
}
let mut table = ListBox::builder().hexpand(true).halign(Align::Fill).build();
let header = ListBoxRow::builder().child(&table_header).build();
table.append(&header);
for i in (0..=100).step_by(5) {
if i == 0 {
continue;
}
let table_row = ListBoxRow::new();
let columns = ColumnView::builder().reorderable(false).build();
let column = ColumnViewColumn::builder()
.title(format!("{i}"))
.fixed_width(200)
.expand(true)
.build();
columns.append_column(&column);
for table_row_label in 1..=3 {
let column = ColumnViewColumn::builder()
.title(format!("{table_row_label}"))
.fixed_width(200)
.expand(true)
.build();
columns.append_column(&column);
}
table_row.set_child(Some(&columns));
table.append(&table_row);
}
let table_of_calculated_values = Frame::builder()
.height_request(64)
.hexpand(true)
.child(&table_header)
.child(&table)
.halign(Align::Fill)
.set_margin(MarginData::MultipleMargin((10, 5, 0, 0)))
.build();
let table_frame = table_of_calculated_values.clone();
let errors_label: Label = Label::new(Some(""));
let errors_label_for_handler: Label = errors_label.clone();
EventHandler::new(calculate_button.clone(), move |_| {
start_algorithm(&errors_label_for_handler, &all_text_views)
start_algorithm(
&errors_label_for_handler,
&all_text_views,
&table_frame.clone(),
&header,
)
})
.on_click();
main_wrapper.append(&errors_label);
main_wrapper.append(&calculate_button);
main_wrapper.append(&table_of_calculated_values);
main_wrapper.append(&errors_label);
wrapper.append(&main_wrapper);
}