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