// GENERATED — DO NOT EDIT
///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/class.ToggleButton.html).
pub type ToggleButton
///|
pub(open) trait IToggleButton {
fn as_toggle_button(Self) -> ToggleButton
fn get_active(Self) -> Bool = _
fn set_active(Self, Bool) -> Unit = _
fn set_group(Self, &IToggleButton?) -> Unit = _
fn connect_toggled(Self, (ToggleButton) -> Unit) -> UInt64 = _
}
///|
pub impl IToggleButton for ToggleButton with fn as_toggle_button(self) {
self
}
///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/ctor.ToggleButton.new.html).
pub extern "c" fn ToggleButton::new() -> ToggleButton = "moonbit_gtk_toggle_button_new"
///|
#borrow(label)
extern "c" fn moonbit_gtk_toggle_button_new_with_label(
label : Bytes,
) -> ToggleButton = "moonbit_gtk_toggle_button_new_with_label"
///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/ctor.ToggleButton.new_with_label.html).
pub fn ToggleButton::new_with_label(label : String) -> ToggleButton {
moonbit_gtk_toggle_button_new_with_label(@encoding/utf8.encode(label))
}
///|
#borrow(label)
extern "c" fn moonbit_gtk_toggle_button_new_with_mnemonic(
label : Bytes,
) -> ToggleButton = "moonbit_gtk_toggle_button_new_with_mnemonic"
///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/ctor.ToggleButton.new_with_mnemonic.html).
pub fn ToggleButton::new_with_mnemonic(label : String) -> ToggleButton {
moonbit_gtk_toggle_button_new_with_mnemonic(@encoding/utf8.encode(label))
}
///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.ToggleButton.get_active.html).
#borrow(self)
pub extern "c" fn ToggleButton::get_active(self : ToggleButton) -> Bool = "moonbit_gtk_toggle_button_get_active"
///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.ToggleButton.set_active.html).
#borrow(self)
pub extern "c" fn ToggleButton::set_active(
self : ToggleButton,
is_active : Bool,
) = "moonbit_gtk_toggle_button_set_active"
///|
#borrow(self_, group)
extern "c" fn moonbit_gtk_toggle_button_set_group(
self_ : ToggleButton,
group : @glib.Nullable[ToggleButton],
) = "moonbit_gtk_toggle_button_set_group"
///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.ToggleButton.set_group.html).
pub fn ToggleButton::set_group(
self : ToggleButton,
group : &IToggleButton?,
) -> Unit {
moonbit_gtk_toggle_button_set_group(
self,
match group {
Some(v) => @glib.Nullable::some(v.as_toggle_button())
None => @glib.Nullable::null()
},
)
}
///|
#borrow(instance)
extern "c" fn gtk_toggle_button_connect_toggled(
instance : ToggleButton,
function : FuncRef[(ToggleButton, (ToggleButton) -> Unit) -> Unit],
closure : (ToggleButton) -> Unit,
) -> UInt64 = "moonbit_gtk_toggle_button_connect_toggled"
///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.ToggleButton.toggled.html).
pub fn ToggleButton::connect_toggled(
self : ToggleButton,
f : (ToggleButton) -> Unit,
) -> UInt64 {
gtk_toggle_button_connect_toggled(self, fn(instance_, f) { f(instance_) }, f)
}
///|
impl IToggleButton with fn get_active(self) -> Bool {
self.as_toggle_button().get_active()
}
///|
impl IToggleButton with fn set_active(self, is_active) -> Unit {
self.as_toggle_button().set_active(is_active)
}
///|
impl IToggleButton with fn set_group(self, group) -> Unit {
self.as_toggle_button().set_group(group)
}
///|
impl IToggleButton with fn connect_toggled(self, f) -> UInt64 {
self.as_toggle_button().connect_toggled(f)
}
///|
pub fn ToggleButton::as_button(self : ToggleButton) -> Button = "%identity"
///|
pub impl IButton for ToggleButton with fn as_button(self) {
self.as_button()
}
///|
pub fn ToggleButton::as_widget(self : ToggleButton) -> Widget = "%identity"
///|
pub impl IWidget for ToggleButton with fn as_widget(self) {
self.as_widget()
}
///|
pub fn ToggleButton::as_gobject_object(self : ToggleButton) -> @gobject.Object = "%identity"
///|
pub impl @gobject.IObject for ToggleButton with fn as_object(self) {
self.as_gobject_object()
}