2024-03-10 11:54:32 +03:00
|
|
|
use crate::{
|
|
|
|
model::model::*,
|
|
|
|
view::components::switch::SwitchExt,
|
|
|
|
gtk::{
|
|
|
|
*,
|
|
|
|
prelude::*
|
|
|
|
},
|
|
|
|
};
|
2024-03-10 11:35:02 +03:00
|
|
|
|
2024-03-10 11:54:32 +03:00
|
|
|
pub trait SwEventHandler{
|
|
|
|
fn on_toggle(self) -> ();
|
|
|
|
}
|
2024-03-10 11:35:02 +03:00
|
|
|
|
2024-03-10 11:54:32 +03:00
|
|
|
impl<F, C> SwEventHandler for EventHandler<F, C>
|
|
|
|
where F: Fn(&C) + FnOnce(&C) + FnMut(&C) + 'static, C: SwitchExt + WidgetExt{
|
|
|
|
fn on_toggle(self) -> () {
|
|
|
|
self.component.connect_state_notify(move |switch| {
|
|
|
|
(self.callback)(switch)
|
|
|
|
});
|
2024-03-10 11:35:02 +03:00
|
|
|
}
|
2024-03-10 11:54:32 +03:00
|
|
|
}
|
2024-03-10 11:35:02 +03:00
|
|
|
|
2024-03-10 11:54:32 +03:00
|
|
|
pub fn clearing(output : &TextView, input: &TextView){
|
|
|
|
input.buffer().set_text("");
|
|
|
|
output.buffer().set_text("");
|
2024-03-10 11:35:02 +03:00
|
|
|
}
|