Skip to main content

gtk4/auto/
gl_area.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4#![allow(deprecated)]
5
6#[cfg(feature = "v4_10")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
8use crate::Accessible;
9use crate::{
10    AccessibleRole, Align, Buildable, ConstraintTarget, LayoutManager, Overflow, Widget, ffi,
11};
12use glib::{
13    object::ObjectType as _,
14    prelude::*,
15    signal::{SignalHandlerId, connect_raw},
16    translate::*,
17};
18use std::boxed::Box as Box_;
19
20#[cfg(feature = "v4_10")]
21#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
22glib::wrapper! {
23    #[doc(alias = "GtkGLArea")]
24    pub struct GLArea(Object<ffi::GtkGLArea, ffi::GtkGLAreaClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget;
25
26    match fn {
27        type_ => || ffi::gtk_gl_area_get_type(),
28    }
29}
30
31#[cfg(not(feature = "v4_10"))]
32glib::wrapper! {
33    #[doc(alias = "GtkGLArea")]
34    pub struct GLArea(Object<ffi::GtkGLArea, ffi::GtkGLAreaClass>) @extends Widget, @implements Buildable, ConstraintTarget;
35
36    match fn {
37        type_ => || ffi::gtk_gl_area_get_type(),
38    }
39}
40
41impl GLArea {
42    pub const NONE: Option<&'static GLArea> = None;
43
44    #[doc(alias = "gtk_gl_area_new")]
45    pub fn new() -> GLArea {
46        assert_initialized_main_thread!();
47        unsafe { Widget::from_glib_none(ffi::gtk_gl_area_new()).unsafe_cast() }
48    }
49
50    // rustdoc-stripper-ignore-next
51    /// Creates a new builder-pattern struct instance to construct [`GLArea`] objects.
52    ///
53    /// This method returns an instance of [`GLAreaBuilder`](crate::builders::GLAreaBuilder) which can be used to create [`GLArea`] objects.
54    pub fn builder() -> GLAreaBuilder {
55        GLAreaBuilder::new()
56    }
57}
58
59impl Default for GLArea {
60    fn default() -> Self {
61        Self::new()
62    }
63}
64
65// rustdoc-stripper-ignore-next
66/// A [builder-pattern] type to construct [`GLArea`] objects.
67///
68/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
69#[must_use = "The builder must be built to be used"]
70pub struct GLAreaBuilder {
71    builder: glib::object::ObjectBuilder<'static, GLArea>,
72}
73
74impl GLAreaBuilder {
75    fn new() -> Self {
76        Self {
77            builder: glib::object::Object::builder(),
78        }
79    }
80
81    #[cfg(feature = "v4_12")]
82    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
83    pub fn allowed_apis(self, allowed_apis: gdk::GLAPI) -> Self {
84        Self {
85            builder: self.builder.property("allowed-apis", allowed_apis),
86        }
87    }
88
89    pub fn auto_render(self, auto_render: bool) -> Self {
90        Self {
91            builder: self.builder.property("auto-render", auto_render),
92        }
93    }
94
95    pub fn has_depth_buffer(self, has_depth_buffer: bool) -> Self {
96        Self {
97            builder: self.builder.property("has-depth-buffer", has_depth_buffer),
98        }
99    }
100
101    pub fn has_stencil_buffer(self, has_stencil_buffer: bool) -> Self {
102        Self {
103            builder: self
104                .builder
105                .property("has-stencil-buffer", has_stencil_buffer),
106        }
107    }
108
109    #[cfg_attr(feature = "v4_12", deprecated = "Since 4.12")]
110    pub fn use_es(self, use_es: bool) -> Self {
111        Self {
112            builder: self.builder.property("use-es", use_es),
113        }
114    }
115
116    pub fn can_focus(self, can_focus: bool) -> Self {
117        Self {
118            builder: self.builder.property("can-focus", can_focus),
119        }
120    }
121
122    pub fn can_target(self, can_target: bool) -> Self {
123        Self {
124            builder: self.builder.property("can-target", can_target),
125        }
126    }
127
128    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
129        Self {
130            builder: self.builder.property("css-classes", css_classes.into()),
131        }
132    }
133
134    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
135        Self {
136            builder: self.builder.property("css-name", css_name.into()),
137        }
138    }
139
140    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
141        Self {
142            builder: self.builder.property("cursor", cursor.clone()),
143        }
144    }
145
146    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
147        Self {
148            builder: self.builder.property("focus-on-click", focus_on_click),
149        }
150    }
151
152    pub fn focusable(self, focusable: bool) -> Self {
153        Self {
154            builder: self.builder.property("focusable", focusable),
155        }
156    }
157
158    pub fn halign(self, halign: Align) -> Self {
159        Self {
160            builder: self.builder.property("halign", halign),
161        }
162    }
163
164    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
165        Self {
166            builder: self.builder.property("has-tooltip", has_tooltip),
167        }
168    }
169
170    pub fn height_request(self, height_request: i32) -> Self {
171        Self {
172            builder: self.builder.property("height-request", height_request),
173        }
174    }
175
176    pub fn hexpand(self, hexpand: bool) -> Self {
177        Self {
178            builder: self.builder.property("hexpand", hexpand),
179        }
180    }
181
182    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
183        Self {
184            builder: self.builder.property("hexpand-set", hexpand_set),
185        }
186    }
187
188    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
189        Self {
190            builder: self
191                .builder
192                .property("layout-manager", layout_manager.clone().upcast()),
193        }
194    }
195
196    #[cfg(feature = "v4_18")]
197    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
198    pub fn limit_events(self, limit_events: bool) -> Self {
199        Self {
200            builder: self.builder.property("limit-events", limit_events),
201        }
202    }
203
204    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
205        Self {
206            builder: self.builder.property("margin-bottom", margin_bottom),
207        }
208    }
209
210    pub fn margin_end(self, margin_end: i32) -> Self {
211        Self {
212            builder: self.builder.property("margin-end", margin_end),
213        }
214    }
215
216    pub fn margin_start(self, margin_start: i32) -> Self {
217        Self {
218            builder: self.builder.property("margin-start", margin_start),
219        }
220    }
221
222    pub fn margin_top(self, margin_top: i32) -> Self {
223        Self {
224            builder: self.builder.property("margin-top", margin_top),
225        }
226    }
227
228    pub fn name(self, name: impl Into<glib::GString>) -> Self {
229        Self {
230            builder: self.builder.property("name", name.into()),
231        }
232    }
233
234    pub fn opacity(self, opacity: f64) -> Self {
235        Self {
236            builder: self.builder.property("opacity", opacity),
237        }
238    }
239
240    pub fn overflow(self, overflow: Overflow) -> Self {
241        Self {
242            builder: self.builder.property("overflow", overflow),
243        }
244    }
245
246    pub fn receives_default(self, receives_default: bool) -> Self {
247        Self {
248            builder: self.builder.property("receives-default", receives_default),
249        }
250    }
251
252    pub fn sensitive(self, sensitive: bool) -> Self {
253        Self {
254            builder: self.builder.property("sensitive", sensitive),
255        }
256    }
257
258    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
259        Self {
260            builder: self
261                .builder
262                .property("tooltip-markup", tooltip_markup.into()),
263        }
264    }
265
266    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
267        Self {
268            builder: self.builder.property("tooltip-text", tooltip_text.into()),
269        }
270    }
271
272    pub fn valign(self, valign: Align) -> Self {
273        Self {
274            builder: self.builder.property("valign", valign),
275        }
276    }
277
278    pub fn vexpand(self, vexpand: bool) -> Self {
279        Self {
280            builder: self.builder.property("vexpand", vexpand),
281        }
282    }
283
284    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
285        Self {
286            builder: self.builder.property("vexpand-set", vexpand_set),
287        }
288    }
289
290    pub fn visible(self, visible: bool) -> Self {
291        Self {
292            builder: self.builder.property("visible", visible),
293        }
294    }
295
296    pub fn width_request(self, width_request: i32) -> Self {
297        Self {
298            builder: self.builder.property("width-request", width_request),
299        }
300    }
301
302    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
303        Self {
304            builder: self.builder.property("accessible-role", accessible_role),
305        }
306    }
307
308    // rustdoc-stripper-ignore-next
309    /// Build the [`GLArea`].
310    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
311    pub fn build(self) -> GLArea {
312        assert_initialized_main_thread!();
313        self.builder.build()
314    }
315}
316
317pub trait GLAreaExt: IsA<GLArea> + 'static {
318    #[doc(alias = "gtk_gl_area_attach_buffers")]
319    fn attach_buffers(&self) {
320        unsafe {
321            ffi::gtk_gl_area_attach_buffers(self.as_ref().to_glib_none().0);
322        }
323    }
324
325    #[cfg(feature = "v4_12")]
326    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
327    #[doc(alias = "gtk_gl_area_get_allowed_apis")]
328    #[doc(alias = "get_allowed_apis")]
329    #[doc(alias = "allowed-apis")]
330    fn allowed_apis(&self) -> gdk::GLAPI {
331        unsafe {
332            from_glib(ffi::gtk_gl_area_get_allowed_apis(
333                self.as_ref().to_glib_none().0,
334            ))
335        }
336    }
337
338    #[cfg(feature = "v4_12")]
339    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
340    #[doc(alias = "gtk_gl_area_get_api")]
341    #[doc(alias = "get_api")]
342    fn api(&self) -> gdk::GLAPI {
343        unsafe { from_glib(ffi::gtk_gl_area_get_api(self.as_ref().to_glib_none().0)) }
344    }
345
346    #[doc(alias = "gtk_gl_area_get_auto_render")]
347    #[doc(alias = "get_auto_render")]
348    #[doc(alias = "auto-render")]
349    fn is_auto_render(&self) -> bool {
350        unsafe {
351            from_glib(ffi::gtk_gl_area_get_auto_render(
352                self.as_ref().to_glib_none().0,
353            ))
354        }
355    }
356
357    #[doc(alias = "gtk_gl_area_get_context")]
358    #[doc(alias = "get_context")]
359    fn context(&self) -> Option<gdk::GLContext> {
360        unsafe { from_glib_none(ffi::gtk_gl_area_get_context(self.as_ref().to_glib_none().0)) }
361    }
362
363    #[doc(alias = "gtk_gl_area_get_error")]
364    #[doc(alias = "get_error")]
365    fn error(&self) -> Option<glib::Error> {
366        unsafe { from_glib_none(ffi::gtk_gl_area_get_error(self.as_ref().to_glib_none().0)) }
367    }
368
369    #[doc(alias = "gtk_gl_area_get_has_depth_buffer")]
370    #[doc(alias = "get_has_depth_buffer")]
371    #[doc(alias = "has-depth-buffer")]
372    fn has_depth_buffer(&self) -> bool {
373        unsafe {
374            from_glib(ffi::gtk_gl_area_get_has_depth_buffer(
375                self.as_ref().to_glib_none().0,
376            ))
377        }
378    }
379
380    #[doc(alias = "gtk_gl_area_get_has_stencil_buffer")]
381    #[doc(alias = "get_has_stencil_buffer")]
382    #[doc(alias = "has-stencil-buffer")]
383    fn has_stencil_buffer(&self) -> bool {
384        unsafe {
385            from_glib(ffi::gtk_gl_area_get_has_stencil_buffer(
386                self.as_ref().to_glib_none().0,
387            ))
388        }
389    }
390
391    #[doc(alias = "gtk_gl_area_get_required_version")]
392    #[doc(alias = "get_required_version")]
393    fn required_version(&self) -> (i32, i32) {
394        unsafe {
395            let mut major = std::mem::MaybeUninit::uninit();
396            let mut minor = std::mem::MaybeUninit::uninit();
397            ffi::gtk_gl_area_get_required_version(
398                self.as_ref().to_glib_none().0,
399                major.as_mut_ptr(),
400                minor.as_mut_ptr(),
401            );
402            (major.assume_init(), minor.assume_init())
403        }
404    }
405
406    #[cfg_attr(feature = "v4_12", deprecated = "Since 4.12")]
407    #[allow(deprecated)]
408    #[doc(alias = "gtk_gl_area_get_use_es")]
409    #[doc(alias = "get_use_es")]
410    #[doc(alias = "use-es")]
411    fn uses_es(&self) -> bool {
412        unsafe { from_glib(ffi::gtk_gl_area_get_use_es(self.as_ref().to_glib_none().0)) }
413    }
414
415    #[doc(alias = "gtk_gl_area_make_current")]
416    fn make_current(&self) {
417        unsafe {
418            ffi::gtk_gl_area_make_current(self.as_ref().to_glib_none().0);
419        }
420    }
421
422    #[doc(alias = "gtk_gl_area_queue_render")]
423    fn queue_render(&self) {
424        unsafe {
425            ffi::gtk_gl_area_queue_render(self.as_ref().to_glib_none().0);
426        }
427    }
428
429    #[cfg(feature = "v4_12")]
430    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
431    #[doc(alias = "gtk_gl_area_set_allowed_apis")]
432    #[doc(alias = "allowed-apis")]
433    fn set_allowed_apis(&self, apis: gdk::GLAPI) {
434        unsafe {
435            ffi::gtk_gl_area_set_allowed_apis(self.as_ref().to_glib_none().0, apis.into_glib());
436        }
437    }
438
439    #[doc(alias = "gtk_gl_area_set_auto_render")]
440    #[doc(alias = "auto-render")]
441    fn set_auto_render(&self, auto_render: bool) {
442        unsafe {
443            ffi::gtk_gl_area_set_auto_render(
444                self.as_ref().to_glib_none().0,
445                auto_render.into_glib(),
446            );
447        }
448    }
449
450    #[doc(alias = "gtk_gl_area_set_error")]
451    fn set_error(&self, error: Option<&glib::Error>) {
452        unsafe {
453            ffi::gtk_gl_area_set_error(self.as_ref().to_glib_none().0, error.to_glib_none().0);
454        }
455    }
456
457    #[doc(alias = "gtk_gl_area_set_has_depth_buffer")]
458    #[doc(alias = "has-depth-buffer")]
459    fn set_has_depth_buffer(&self, has_depth_buffer: bool) {
460        unsafe {
461            ffi::gtk_gl_area_set_has_depth_buffer(
462                self.as_ref().to_glib_none().0,
463                has_depth_buffer.into_glib(),
464            );
465        }
466    }
467
468    #[doc(alias = "gtk_gl_area_set_has_stencil_buffer")]
469    #[doc(alias = "has-stencil-buffer")]
470    fn set_has_stencil_buffer(&self, has_stencil_buffer: bool) {
471        unsafe {
472            ffi::gtk_gl_area_set_has_stencil_buffer(
473                self.as_ref().to_glib_none().0,
474                has_stencil_buffer.into_glib(),
475            );
476        }
477    }
478
479    #[doc(alias = "gtk_gl_area_set_required_version")]
480    fn set_required_version(&self, major: i32, minor: i32) {
481        unsafe {
482            ffi::gtk_gl_area_set_required_version(self.as_ref().to_glib_none().0, major, minor);
483        }
484    }
485
486    #[cfg_attr(feature = "v4_12", deprecated = "Since 4.12")]
487    #[allow(deprecated)]
488    #[doc(alias = "gtk_gl_area_set_use_es")]
489    #[doc(alias = "use-es")]
490    fn set_use_es(&self, use_es: bool) {
491        unsafe {
492            ffi::gtk_gl_area_set_use_es(self.as_ref().to_glib_none().0, use_es.into_glib());
493        }
494    }
495
496    #[doc(alias = "create-context")]
497    fn connect_create_context<F: Fn(&Self) -> Option<gdk::GLContext> + 'static>(
498        &self,
499        f: F,
500    ) -> SignalHandlerId {
501        unsafe extern "C" fn create_context_trampoline<
502            P: IsA<GLArea>,
503            F: Fn(&P) -> Option<gdk::GLContext> + 'static,
504        >(
505            this: *mut ffi::GtkGLArea,
506            f: glib::ffi::gpointer,
507        ) -> *mut gdk::ffi::GdkGLContext {
508            unsafe {
509                let f: &F = &*(f as *const F);
510                f(GLArea::from_glib_borrow(this).unsafe_cast_ref()).to_glib_full()
511            }
512        }
513        unsafe {
514            let f: Box_<F> = Box_::new(f);
515            connect_raw(
516                self.as_ptr() as *mut _,
517                c"create-context".as_ptr(),
518                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
519                    create_context_trampoline::<Self, F> as *const (),
520                )),
521                Box_::into_raw(f),
522            )
523        }
524    }
525
526    #[doc(alias = "render")]
527    fn connect_render<F: Fn(&Self, &gdk::GLContext) -> glib::Propagation + 'static>(
528        &self,
529        f: F,
530    ) -> SignalHandlerId {
531        unsafe extern "C" fn render_trampoline<
532            P: IsA<GLArea>,
533            F: Fn(&P, &gdk::GLContext) -> glib::Propagation + 'static,
534        >(
535            this: *mut ffi::GtkGLArea,
536            context: *mut gdk::ffi::GdkGLContext,
537            f: glib::ffi::gpointer,
538        ) -> glib::ffi::gboolean {
539            unsafe {
540                let f: &F = &*(f as *const F);
541                f(
542                    GLArea::from_glib_borrow(this).unsafe_cast_ref(),
543                    &from_glib_borrow(context),
544                )
545                .into_glib()
546            }
547        }
548        unsafe {
549            let f: Box_<F> = Box_::new(f);
550            connect_raw(
551                self.as_ptr() as *mut _,
552                c"render".as_ptr(),
553                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
554                    render_trampoline::<Self, F> as *const (),
555                )),
556                Box_::into_raw(f),
557            )
558        }
559    }
560
561    #[doc(alias = "resize")]
562    fn connect_resize<F: Fn(&Self, i32, i32) + 'static>(&self, f: F) -> SignalHandlerId {
563        unsafe extern "C" fn resize_trampoline<P: IsA<GLArea>, F: Fn(&P, i32, i32) + 'static>(
564            this: *mut ffi::GtkGLArea,
565            width: std::ffi::c_int,
566            height: std::ffi::c_int,
567            f: glib::ffi::gpointer,
568        ) {
569            unsafe {
570                let f: &F = &*(f as *const F);
571                f(
572                    GLArea::from_glib_borrow(this).unsafe_cast_ref(),
573                    width,
574                    height,
575                )
576            }
577        }
578        unsafe {
579            let f: Box_<F> = Box_::new(f);
580            connect_raw(
581                self.as_ptr() as *mut _,
582                c"resize".as_ptr(),
583                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
584                    resize_trampoline::<Self, F> as *const (),
585                )),
586                Box_::into_raw(f),
587            )
588        }
589    }
590
591    #[cfg(feature = "v4_12")]
592    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
593    #[doc(alias = "allowed-apis")]
594    fn connect_allowed_apis_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
595        unsafe extern "C" fn notify_allowed_apis_trampoline<P: IsA<GLArea>, F: Fn(&P) + 'static>(
596            this: *mut ffi::GtkGLArea,
597            _param_spec: glib::ffi::gpointer,
598            f: glib::ffi::gpointer,
599        ) {
600            unsafe {
601                let f: &F = &*(f as *const F);
602                f(GLArea::from_glib_borrow(this).unsafe_cast_ref())
603            }
604        }
605        unsafe {
606            let f: Box_<F> = Box_::new(f);
607            connect_raw(
608                self.as_ptr() as *mut _,
609                c"notify::allowed-apis".as_ptr(),
610                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
611                    notify_allowed_apis_trampoline::<Self, F> as *const (),
612                )),
613                Box_::into_raw(f),
614            )
615        }
616    }
617
618    #[cfg(feature = "v4_12")]
619    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
620    #[doc(alias = "api")]
621    fn connect_api_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
622        unsafe extern "C" fn notify_api_trampoline<P: IsA<GLArea>, F: Fn(&P) + 'static>(
623            this: *mut ffi::GtkGLArea,
624            _param_spec: glib::ffi::gpointer,
625            f: glib::ffi::gpointer,
626        ) {
627            unsafe {
628                let f: &F = &*(f as *const F);
629                f(GLArea::from_glib_borrow(this).unsafe_cast_ref())
630            }
631        }
632        unsafe {
633            let f: Box_<F> = Box_::new(f);
634            connect_raw(
635                self.as_ptr() as *mut _,
636                c"notify::api".as_ptr(),
637                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
638                    notify_api_trampoline::<Self, F> as *const (),
639                )),
640                Box_::into_raw(f),
641            )
642        }
643    }
644
645    #[doc(alias = "auto-render")]
646    fn connect_auto_render_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
647        unsafe extern "C" fn notify_auto_render_trampoline<P: IsA<GLArea>, F: Fn(&P) + 'static>(
648            this: *mut ffi::GtkGLArea,
649            _param_spec: glib::ffi::gpointer,
650            f: glib::ffi::gpointer,
651        ) {
652            unsafe {
653                let f: &F = &*(f as *const F);
654                f(GLArea::from_glib_borrow(this).unsafe_cast_ref())
655            }
656        }
657        unsafe {
658            let f: Box_<F> = Box_::new(f);
659            connect_raw(
660                self.as_ptr() as *mut _,
661                c"notify::auto-render".as_ptr(),
662                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
663                    notify_auto_render_trampoline::<Self, F> as *const (),
664                )),
665                Box_::into_raw(f),
666            )
667        }
668    }
669
670    #[doc(alias = "context")]
671    fn connect_context_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
672        unsafe extern "C" fn notify_context_trampoline<P: IsA<GLArea>, F: Fn(&P) + 'static>(
673            this: *mut ffi::GtkGLArea,
674            _param_spec: glib::ffi::gpointer,
675            f: glib::ffi::gpointer,
676        ) {
677            unsafe {
678                let f: &F = &*(f as *const F);
679                f(GLArea::from_glib_borrow(this).unsafe_cast_ref())
680            }
681        }
682        unsafe {
683            let f: Box_<F> = Box_::new(f);
684            connect_raw(
685                self.as_ptr() as *mut _,
686                c"notify::context".as_ptr(),
687                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
688                    notify_context_trampoline::<Self, F> as *const (),
689                )),
690                Box_::into_raw(f),
691            )
692        }
693    }
694
695    #[doc(alias = "has-depth-buffer")]
696    fn connect_has_depth_buffer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
697        unsafe extern "C" fn notify_has_depth_buffer_trampoline<
698            P: IsA<GLArea>,
699            F: Fn(&P) + 'static,
700        >(
701            this: *mut ffi::GtkGLArea,
702            _param_spec: glib::ffi::gpointer,
703            f: glib::ffi::gpointer,
704        ) {
705            unsafe {
706                let f: &F = &*(f as *const F);
707                f(GLArea::from_glib_borrow(this).unsafe_cast_ref())
708            }
709        }
710        unsafe {
711            let f: Box_<F> = Box_::new(f);
712            connect_raw(
713                self.as_ptr() as *mut _,
714                c"notify::has-depth-buffer".as_ptr(),
715                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
716                    notify_has_depth_buffer_trampoline::<Self, F> as *const (),
717                )),
718                Box_::into_raw(f),
719            )
720        }
721    }
722
723    #[doc(alias = "has-stencil-buffer")]
724    fn connect_has_stencil_buffer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
725        unsafe extern "C" fn notify_has_stencil_buffer_trampoline<
726            P: IsA<GLArea>,
727            F: Fn(&P) + 'static,
728        >(
729            this: *mut ffi::GtkGLArea,
730            _param_spec: glib::ffi::gpointer,
731            f: glib::ffi::gpointer,
732        ) {
733            unsafe {
734                let f: &F = &*(f as *const F);
735                f(GLArea::from_glib_borrow(this).unsafe_cast_ref())
736            }
737        }
738        unsafe {
739            let f: Box_<F> = Box_::new(f);
740            connect_raw(
741                self.as_ptr() as *mut _,
742                c"notify::has-stencil-buffer".as_ptr(),
743                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
744                    notify_has_stencil_buffer_trampoline::<Self, F> as *const (),
745                )),
746                Box_::into_raw(f),
747            )
748        }
749    }
750
751    #[cfg_attr(feature = "v4_12", deprecated = "Since 4.12")]
752    #[doc(alias = "use-es")]
753    fn connect_use_es_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
754        unsafe extern "C" fn notify_use_es_trampoline<P: IsA<GLArea>, F: Fn(&P) + 'static>(
755            this: *mut ffi::GtkGLArea,
756            _param_spec: glib::ffi::gpointer,
757            f: glib::ffi::gpointer,
758        ) {
759            unsafe {
760                let f: &F = &*(f as *const F);
761                f(GLArea::from_glib_borrow(this).unsafe_cast_ref())
762            }
763        }
764        unsafe {
765            let f: Box_<F> = Box_::new(f);
766            connect_raw(
767                self.as_ptr() as *mut _,
768                c"notify::use-es".as_ptr(),
769                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
770                    notify_use_es_trampoline::<Self, F> as *const (),
771                )),
772                Box_::into_raw(f),
773            )
774        }
775    }
776}
777
778impl<O: IsA<GLArea>> GLAreaExt for O {}