changed inputs for second section and implemented Clone and Copy traits for Alignment data structure
This commit is contained in:
@@ -1,30 +1,29 @@
|
||||
use crate::{
|
||||
model::model::*,
|
||||
gtk::{
|
||||
*,
|
||||
prelude::*
|
||||
},
|
||||
};
|
||||
use crate::{gtk::prelude::*, model::model::*};
|
||||
|
||||
impl<F, C> EventHandler<F, C>
|
||||
where F: Fn(&C) + FnOnce(&C) + FnMut(&C){
|
||||
pub fn new(component: C, callback: F) -> EventHandler<F, C>{
|
||||
Self{
|
||||
where
|
||||
F: Fn(&C) + FnOnce(&C) + FnMut(&C),
|
||||
{
|
||||
pub fn new(component: C, callback: F) -> EventHandler<F, C> {
|
||||
Self {
|
||||
component,
|
||||
callback,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait BtnEventHandler{
|
||||
pub trait BtnEventHandler {
|
||||
fn on_click(self) -> ();
|
||||
}
|
||||
|
||||
impl<F, C> BtnEventHandler for EventHandler<F, C>
|
||||
where F: Fn(&C) + FnOnce(&C) + FnMut(&C) + 'static, C: ButtonExt + WidgetExt{
|
||||
where
|
||||
F: Fn(&C) + FnOnce(&C) + FnMut(&C) + 'static,
|
||||
C: ButtonExt + WidgetExt,
|
||||
{
|
||||
fn on_click(self) -> () {
|
||||
self.component.connect_clicked(move |button| {
|
||||
(self.callback)(button)
|
||||
});
|
||||
self.component
|
||||
.connect_clicked(move |button| (self.callback)(button));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user