use crate::ffi;
use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::boxed::Box as Box_;
glib::wrapper! {
#[doc(alias = "HeTextField")]
pub struct TextField(Object<ffi::HeTextField, ffi::HeTextFieldClass>) @extends gtk::ListBoxRow, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Actionable;
match fn {
type_ => || ffi::he_text_field_get_type(),
}
}
impl TextField {
pub const NONE: Option<&'static TextField> = None;
#[doc(alias = "he_text_field_new_from_regex")]
pub fn from_regex(regex_arg: &glib::Regex) -> TextField {
assert_initialized_main_thread!();
unsafe {
from_glib_none(ffi::he_text_field_new_from_regex(
regex_arg.to_glib_none().0,
))
}
}
#[doc(alias = "he_text_field_new")]
pub fn new() -> TextField {
assert_initialized_main_thread!();
unsafe { from_glib_none(ffi::he_text_field_new()) }
}
pub fn builder() -> TextFieldBuilder {
TextFieldBuilder::new()
}
}
impl Default for TextField {
fn default() -> Self {
Self::new()
}
}
#[must_use = "The builder must be built to be used"]
pub struct TextFieldBuilder {
builder: glib::object::ObjectBuilder<'static, TextField>,
}
impl TextFieldBuilder {
fn new() -> Self {
Self {
builder: glib::object::Object::builder(),
}
}
pub fn is_valid(self, is_valid: bool) -> Self {
Self {
builder: self.builder.property("is-valid", is_valid),
}
}
pub fn needs_validation(self, needs_validation: bool) -> Self {
Self {
builder: self.builder.property("needs-validation", needs_validation),
}
}
pub fn min_length(self, min_length: i32) -> Self {
Self {
builder: self.builder.property("min-length", min_length),
}
}
pub fn regex(self, regex: &glib::Regex) -> Self {
Self {
builder: self.builder.property("regex", regex.clone()),
}
}
pub fn is_search(self, is_search: bool) -> Self {
Self {
builder: self.builder.property("is-search", is_search),
}
}
pub fn is_outline(self, is_outline: bool) -> Self {
Self {
builder: self.builder.property("is-outline", is_outline),
}
}
pub fn text(self, text: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("text", text.into()),
}
}
pub fn suffix_icon(self, suffix_icon: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("suffix-icon", suffix_icon.into()),
}
}
pub fn prefix_icon(self, prefix_icon: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("prefix-icon", prefix_icon.into()),
}
}
pub fn support_text(self, support_text: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("support-text", support_text.into()),
}
}
pub fn placeholder_text(self, placeholder_text: impl Into<glib::GString>) -> Self {
Self {
builder: self
.builder
.property("placeholder-text", placeholder_text.into()),
}
}
pub fn max_length(self, max_length: i32) -> Self {
Self {
builder: self.builder.property("max-length", max_length),
}
}
pub fn visibility(self, visibility: bool) -> Self {
Self {
builder: self.builder.property("visibility", visibility),
}
}
pub fn activatable(self, activatable: bool) -> Self {
Self {
builder: self.builder.property("activatable", activatable),
}
}
pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
Self {
builder: self.builder.property("child", child.clone().upcast()),
}
}
pub fn selectable(self, selectable: bool) -> Self {
Self {
builder: self.builder.property("selectable", selectable),
}
}
pub fn can_focus(self, can_focus: bool) -> Self {
Self {
builder: self.builder.property("can-focus", can_focus),
}
}
pub fn can_target(self, can_target: bool) -> Self {
Self {
builder: self.builder.property("can-target", can_target),
}
}
pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
Self {
builder: self.builder.property("css-classes", css_classes.into()),
}
}
pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("css-name", css_name.into()),
}
}
pub fn focus_on_click(self, focus_on_click: bool) -> Self {
Self {
builder: self.builder.property("focus-on-click", focus_on_click),
}
}
pub fn focusable(self, focusable: bool) -> Self {
Self {
builder: self.builder.property("focusable", focusable),
}
}
pub fn halign(self, halign: gtk::Align) -> Self {
Self {
builder: self.builder.property("halign", halign),
}
}
pub fn has_tooltip(self, has_tooltip: bool) -> Self {
Self {
builder: self.builder.property("has-tooltip", has_tooltip),
}
}
pub fn height_request(self, height_request: i32) -> Self {
Self {
builder: self.builder.property("height-request", height_request),
}
}
pub fn hexpand(self, hexpand: bool) -> Self {
Self {
builder: self.builder.property("hexpand", hexpand),
}
}
pub fn hexpand_set(self, hexpand_set: bool) -> Self {
Self {
builder: self.builder.property("hexpand-set", hexpand_set),
}
}
#[cfg(feature = "gtk_v4_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
pub fn limit_events(self, limit_events: bool) -> Self {
Self {
builder: self.builder.property("limit-events", limit_events),
}
}
pub fn margin_bottom(self, margin_bottom: i32) -> Self {
Self {
builder: self.builder.property("margin-bottom", margin_bottom),
}
}
pub fn margin_end(self, margin_end: i32) -> Self {
Self {
builder: self.builder.property("margin-end", margin_end),
}
}
pub fn margin_start(self, margin_start: i32) -> Self {
Self {
builder: self.builder.property("margin-start", margin_start),
}
}
pub fn margin_top(self, margin_top: i32) -> Self {
Self {
builder: self.builder.property("margin-top", margin_top),
}
}
pub fn name(self, name: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("name", name.into()),
}
}
pub fn opacity(self, opacity: f64) -> Self {
Self {
builder: self.builder.property("opacity", opacity),
}
}
pub fn receives_default(self, receives_default: bool) -> Self {
Self {
builder: self.builder.property("receives-default", receives_default),
}
}
pub fn sensitive(self, sensitive: bool) -> Self {
Self {
builder: self.builder.property("sensitive", sensitive),
}
}
pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
Self {
builder: self
.builder
.property("tooltip-markup", tooltip_markup.into()),
}
}
pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("tooltip-text", tooltip_text.into()),
}
}
pub fn valign(self, valign: gtk::Align) -> Self {
Self {
builder: self.builder.property("valign", valign),
}
}
pub fn vexpand(self, vexpand: bool) -> Self {
Self {
builder: self.builder.property("vexpand", vexpand),
}
}
pub fn vexpand_set(self, vexpand_set: bool) -> Self {
Self {
builder: self.builder.property("vexpand-set", vexpand_set),
}
}
pub fn visible(self, visible: bool) -> Self {
Self {
builder: self.builder.property("visible", visible),
}
}
pub fn width_request(self, width_request: i32) -> Self {
Self {
builder: self.builder.property("width-request", width_request),
}
}
pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("action-name", action_name.into()),
}
}
pub fn action_target(self, action_target: &glib::Variant) -> Self {
Self {
builder: self
.builder
.property("action-target", action_target.clone()),
}
}
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
pub fn build(self) -> TextField {
assert_initialized_main_thread!();
self.builder.build()
}
}
pub trait TextFieldExt: IsA<TextField> + 'static {
#[doc(alias = "he_text_field_get_internal_entry")]
#[doc(alias = "get_internal_entry")]
fn internal_entry(&self) -> gtk::Text {
unsafe {
from_glib_full(ffi::he_text_field_get_internal_entry(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "he_text_field_get_is_valid")]
#[doc(alias = "get_is_valid")]
fn is_valid(&self) -> bool {
unsafe {
from_glib(ffi::he_text_field_get_is_valid(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "he_text_field_set_is_valid")]
fn set_is_valid(&self, value: bool) {
unsafe {
ffi::he_text_field_set_is_valid(self.as_ref().to_glib_none().0, value.into_glib());
}
}
#[doc(alias = "he_text_field_get_needs_validation")]
#[doc(alias = "get_needs_validation")]
fn needs_validation(&self) -> bool {
unsafe {
from_glib(ffi::he_text_field_get_needs_validation(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "he_text_field_set_needs_validation")]
fn set_needs_validation(&self, value: bool) {
unsafe {
ffi::he_text_field_set_needs_validation(
self.as_ref().to_glib_none().0,
value.into_glib(),
);
}
}
#[doc(alias = "he_text_field_get_min_length")]
#[doc(alias = "get_min_length")]
fn min_length(&self) -> i32 {
unsafe { ffi::he_text_field_get_min_length(self.as_ref().to_glib_none().0) }
}
#[doc(alias = "he_text_field_set_min_length")]
fn set_min_length(&self, value: i32) {
unsafe {
ffi::he_text_field_set_min_length(self.as_ref().to_glib_none().0, value);
}
}
#[doc(alias = "he_text_field_get_regex")]
#[doc(alias = "get_regex")]
fn regex(&self) -> glib::Regex {
unsafe { from_glib_none(ffi::he_text_field_get_regex(self.as_ref().to_glib_none().0)) }
}
#[doc(alias = "he_text_field_set_regex")]
fn set_regex(&self, value: &glib::Regex) {
unsafe {
ffi::he_text_field_set_regex(self.as_ref().to_glib_none().0, value.to_glib_none().0);
}
}
#[doc(alias = "he_text_field_get_is_search")]
#[doc(alias = "get_is_search")]
fn is_search(&self) -> bool {
unsafe {
from_glib(ffi::he_text_field_get_is_search(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "he_text_field_set_is_search")]
fn set_is_search(&self, value: bool) {
unsafe {
ffi::he_text_field_set_is_search(self.as_ref().to_glib_none().0, value.into_glib());
}
}
#[doc(alias = "he_text_field_get_is_outline")]
#[doc(alias = "get_is_outline")]
fn is_outline(&self) -> bool {
unsafe {
from_glib(ffi::he_text_field_get_is_outline(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "he_text_field_set_is_outline")]
fn set_is_outline(&self, value: bool) {
unsafe {
ffi::he_text_field_set_is_outline(self.as_ref().to_glib_none().0, value.into_glib());
}
}
#[doc(alias = "he_text_field_get_entry")]
#[doc(alias = "get_entry")]
fn entry(&self) -> gtk::Text {
unsafe { from_glib_none(ffi::he_text_field_get_entry(self.as_ref().to_glib_none().0)) }
}
#[doc(alias = "he_text_field_get_text")]
#[doc(alias = "get_text")]
fn text(&self) -> Option<glib::GString> {
unsafe { from_glib_none(ffi::he_text_field_get_text(self.as_ref().to_glib_none().0)) }
}
#[doc(alias = "he_text_field_set_text")]
fn set_text(&self, value: Option<&str>) {
unsafe {
ffi::he_text_field_set_text(self.as_ref().to_glib_none().0, value.to_glib_none().0);
}
}
#[doc(alias = "he_text_field_get_suffix_icon")]
#[doc(alias = "get_suffix_icon")]
fn suffix_icon(&self) -> Option<glib::GString> {
unsafe {
from_glib_none(ffi::he_text_field_get_suffix_icon(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "he_text_field_set_suffix_icon")]
fn set_suffix_icon(&self, value: Option<&str>) {
unsafe {
ffi::he_text_field_set_suffix_icon(
self.as_ref().to_glib_none().0,
value.to_glib_none().0,
);
}
}
#[doc(alias = "he_text_field_get_prefix_icon")]
#[doc(alias = "get_prefix_icon")]
fn prefix_icon(&self) -> Option<glib::GString> {
unsafe {
from_glib_none(ffi::he_text_field_get_prefix_icon(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "he_text_field_set_prefix_icon")]
fn set_prefix_icon(&self, value: Option<&str>) {
unsafe {
ffi::he_text_field_set_prefix_icon(
self.as_ref().to_glib_none().0,
value.to_glib_none().0,
);
}
}
#[doc(alias = "he_text_field_get_support_text")]
#[doc(alias = "get_support_text")]
fn support_text(&self) -> Option<glib::GString> {
unsafe {
from_glib_none(ffi::he_text_field_get_support_text(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "he_text_field_set_support_text")]
fn set_support_text(&self, value: Option<&str>) {
unsafe {
ffi::he_text_field_set_support_text(
self.as_ref().to_glib_none().0,
value.to_glib_none().0,
);
}
}
#[doc(alias = "he_text_field_get_placeholder_text")]
#[doc(alias = "get_placeholder_text")]
fn placeholder_text(&self) -> Option<glib::GString> {
unsafe {
from_glib_none(ffi::he_text_field_get_placeholder_text(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "he_text_field_set_placeholder_text")]
fn set_placeholder_text(&self, value: Option<&str>) {
unsafe {
ffi::he_text_field_set_placeholder_text(
self.as_ref().to_glib_none().0,
value.to_glib_none().0,
);
}
}
#[doc(alias = "he_text_field_get_max_length")]
#[doc(alias = "get_max_length")]
fn max_length(&self) -> i32 {
unsafe { ffi::he_text_field_get_max_length(self.as_ref().to_glib_none().0) }
}
#[doc(alias = "he_text_field_set_max_length")]
fn set_max_length(&self, value: i32) {
unsafe {
ffi::he_text_field_set_max_length(self.as_ref().to_glib_none().0, value);
}
}
#[doc(alias = "he_text_field_get_visibility")]
#[doc(alias = "get_visibility")]
fn is_visible(&self) -> bool {
unsafe {
from_glib(ffi::he_text_field_get_visibility(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "he_text_field_set_visibility")]
fn set_visibility(&self, value: bool) {
unsafe {
ffi::he_text_field_set_visibility(self.as_ref().to_glib_none().0, value.into_glib());
}
}
#[doc(alias = "is-valid")]
fn connect_is_valid_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_is_valid_trampoline<P: IsA<TextField>, F: Fn(&P) + 'static>(
this: *mut ffi::HeTextField,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TextField::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::is-valid".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_is_valid_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "needs-validation")]
fn connect_needs_validation_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_needs_validation_trampoline<
P: IsA<TextField>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::HeTextField,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TextField::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::needs-validation".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_needs_validation_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "min-length")]
fn connect_min_length_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_min_length_trampoline<
P: IsA<TextField>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::HeTextField,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TextField::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::min-length".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_min_length_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "regex")]
fn connect_regex_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_regex_trampoline<P: IsA<TextField>, F: Fn(&P) + 'static>(
this: *mut ffi::HeTextField,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TextField::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::regex".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_regex_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "is-search")]
fn connect_is_search_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_is_search_trampoline<P: IsA<TextField>, F: Fn(&P) + 'static>(
this: *mut ffi::HeTextField,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TextField::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::is-search".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_is_search_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "is-outline")]
fn connect_is_outline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_is_outline_trampoline<
P: IsA<TextField>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::HeTextField,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TextField::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::is-outline".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_is_outline_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "entry")]
fn connect_entry_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_entry_trampoline<P: IsA<TextField>, F: Fn(&P) + 'static>(
this: *mut ffi::HeTextField,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TextField::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::entry".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_entry_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "text")]
fn connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_text_trampoline<P: IsA<TextField>, F: Fn(&P) + 'static>(
this: *mut ffi::HeTextField,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TextField::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::text".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_text_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "suffix-icon")]
fn connect_suffix_icon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_suffix_icon_trampoline<
P: IsA<TextField>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::HeTextField,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TextField::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::suffix-icon".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_suffix_icon_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "prefix-icon")]
fn connect_prefix_icon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_prefix_icon_trampoline<
P: IsA<TextField>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::HeTextField,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TextField::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::prefix-icon".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_prefix_icon_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "support-text")]
fn connect_support_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_support_text_trampoline<
P: IsA<TextField>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::HeTextField,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TextField::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::support-text".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_support_text_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "placeholder-text")]
fn connect_placeholder_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_placeholder_text_trampoline<
P: IsA<TextField>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::HeTextField,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TextField::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::placeholder-text".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_placeholder_text_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "max-length")]
fn connect_max_length_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_max_length_trampoline<
P: IsA<TextField>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::HeTextField,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TextField::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::max-length".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_max_length_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "visibility")]
fn connect_visibility_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_visibility_trampoline<
P: IsA<TextField>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::HeTextField,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TextField::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::visibility".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_visibility_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}
impl<O: IsA<TextField>> TextFieldExt for O {}