changed inputs for second section and implemented Clone and Copy traits for Alignment data structure
This commit is contained in:
@@ -1,29 +1,18 @@
|
||||
use gtk4 as gtk;
|
||||
|
||||
use crate::{
|
||||
model::model::*,
|
||||
view::{
|
||||
properties::*,
|
||||
components::{
|
||||
*,
|
||||
switch::*,
|
||||
wrapper::*,
|
||||
}
|
||||
},
|
||||
controller::{
|
||||
controller::*,
|
||||
event_handlers::{button_event_handlers::*, switch_event_handlers::*},
|
||||
view_utils::input_utils::*,
|
||||
event_handlers::{
|
||||
button_event_handlers::*,
|
||||
switch_event_handlers::*,
|
||||
},
|
||||
}
|
||||
},
|
||||
model::model::*,
|
||||
view::{components::wrapper::*, properties::*},
|
||||
};
|
||||
|
||||
use gtk::{*, prelude::*};
|
||||
|
||||
pub fn hamming_code_page(wrapper: &Box) -> (){
|
||||
use gtk::{prelude::*, *};
|
||||
|
||||
pub fn hamming_code_page(wrapper: &Box) -> () {
|
||||
// input
|
||||
|
||||
let hamming_text_view_input_label = Label::builder()
|
||||
@@ -67,11 +56,10 @@ pub fn hamming_code_page(wrapper: &Box) -> (){
|
||||
|
||||
// interactive panel
|
||||
|
||||
let clear_input_button =
|
||||
Button::builder()
|
||||
.set_align(Alignment::new(Align::Fill, Align::Fill))
|
||||
.label("Очистка полей")
|
||||
.build();
|
||||
let clear_input_button = Button::builder()
|
||||
.set_align(Alignment::new(Align::Fill, Align::Fill))
|
||||
.label("Очистка полей")
|
||||
.build();
|
||||
|
||||
let hamming_crypt_button = Button::builder()
|
||||
.set_align(Alignment::new(Align::Fill, Align::Fill))
|
||||
@@ -80,9 +68,7 @@ pub fn hamming_code_page(wrapper: &Box) -> (){
|
||||
|
||||
let crypt_mode_switch = Switch::new();
|
||||
|
||||
let crypt_mode_label = Label::builder()
|
||||
.label("Режим: кодирование")
|
||||
.build();
|
||||
let crypt_mode_label = Label::builder().label("Режим: кодирование").build();
|
||||
|
||||
// references for binding actions
|
||||
|
||||
@@ -99,28 +85,27 @@ pub fn hamming_code_page(wrapper: &Box) -> (){
|
||||
|
||||
// actions
|
||||
|
||||
EventHandler::new(
|
||||
clear_input_button_to_handle,
|
||||
move |_| {
|
||||
clearing(&text_view_input_for_clearing, &text_view_output_for_clearing);
|
||||
}
|
||||
).on_click();
|
||||
EventHandler::new(clear_input_button_to_handle, move |_| {
|
||||
clearing(
|
||||
&text_view_input_for_clearing,
|
||||
&text_view_output_for_clearing,
|
||||
);
|
||||
})
|
||||
.on_click();
|
||||
|
||||
EventHandler::new(
|
||||
hamming_crypt_button.clone(),
|
||||
move |button: &Button| {
|
||||
parse_input(
|
||||
&text_view_input_for_parse,
|
||||
&text_view_output_for_output,
|
||||
crypt_mode_switch_to_handle.state()
|
||||
)
|
||||
}).on_click();
|
||||
EventHandler::new(hamming_crypt_button.clone(), move |_button: &Button| {
|
||||
parse_input(
|
||||
&text_view_input_for_parse,
|
||||
&text_view_output_for_output,
|
||||
crypt_mode_switch_to_handle.state(),
|
||||
)
|
||||
})
|
||||
.on_click();
|
||||
|
||||
EventHandler::new(
|
||||
crypt_mode_switch.clone(),
|
||||
move |s : &Switch| {
|
||||
state_controller(s, &crypt_mode_label_to_handle);
|
||||
}).on_toggle();
|
||||
EventHandler::new(crypt_mode_switch.clone(), move |s: &Switch| {
|
||||
state_controller(s, &crypt_mode_label_to_handle);
|
||||
})
|
||||
.on_toggle();
|
||||
|
||||
// wrappers
|
||||
|
||||
@@ -148,5 +133,4 @@ pub fn hamming_code_page(wrapper: &Box) -> (){
|
||||
wrapper.append(&interactive_components_wrapper);
|
||||
wrapper.append(&hamming_text_view_output_label);
|
||||
wrapper.append(&hamming_text_view_output_frame);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user