1use crate::prelude::ButtonExt;
2use crate::utils;
3use qt_core::{QBox, SlotNoArgs, SlotOfBool};
4use qt_widgets::{QAbstractButton, QCheckBox, QPushButton, QRadioButton};
5
6macro_rules! impl_ext {
7 ($name: ident) => {
8 impl ButtonExt for QBox<$name> {
9 unsafe fn connect_clicked<F: FnMut(&Self, bool) + 'static>(&self, mut cb: F) {
10 utils::connect_1a!(self, clicked, SlotOfBool, cb);
11 }
12 unsafe fn connect_pressed<F: FnMut(&Self) + 'static>(&self, mut cb: F) {
13 utils::connect_0a!(self, pressed, cb);
14 }
15 unsafe fn connect_toggled<F: FnMut(&Self, bool) + 'static>(&self, mut cb: F) {
16 utils::connect_1a!(self, toggled, SlotOfBool, cb);
17 }
18 unsafe fn connect_released<F: FnMut(&Self) + 'static>(&self, mut cb: F) {
19 utils::connect_0a!(self, released, cb);
20 }
21 }
22 };
23}
24
25impl_ext!(QCheckBox);
26impl_ext!(QPushButton);
27impl_ext!(QRadioButton);
28impl_ext!(QAbstractButton);