merge stable version #2

Merged
doryan merged 97 commits from experimental into main 2024-08-28 18:54:00 +03:00
3 changed files with 0 additions and 46 deletions
Showing only changes of commit 56357c4697 - Show all commits

View File

@ -1,28 +0,0 @@
use crate::{gtk::prelude::*, model::models::*};
impl<F, C> EventHandler<F, C>
where
F: Fn(&C) + FnOnce(&C) + FnMut(&C),
{
pub fn new(component: C, callback: F) -> Self {
Self {
component,
callback,
}
}
}
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,
{
fn on_click(self) {
self.component
.connect_clicked(move |button| (self.callback)(button));
}
}

View File

@ -1,2 +0,0 @@
pub mod button_event_handlers;
pub mod switch_event_handlers;

View File

@ -1,16 +0,0 @@
use crate::{gtk::prelude::*, model::models::*, view::components::switch::SwitchExt};
pub trait SwEventHandler {
fn on_toggle(self);
}
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));
}
}