gtk/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
5use crate::{Align, Buildable, Container, Widget, ffi};
6use glib::{
7 object::ObjectType as _,
8 prelude::*,
9 signal::{SignalHandlerId, connect_raw},
10 translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15 /// error);
16 /// if (error != NULL)
17 /// {
18 /// gtk_gl_area_set_error (area, error);
19 /// g_error_free (error);
20 /// return;
21 /// }
22 /// }
23 /// ]|
24 ///
25 /// If you need to change the options for creating the [`gdk::GLContext`][crate::gdk::GLContext]
26 /// you should use the [`create-context`][struct@crate::GLArea#create-context] signal.
27 ///
28 /// ## Properties
29 ///
30 ///
31 /// #### `auto-render`
32 /// If set to [`true`] the [`render`][struct@crate::GLArea#render] signal will be emitted every time
33 /// the widget draws. This is the default and is useful if drawing the widget
34 /// is faster.
35 ///
36 /// If set to [`false`] the data from previous rendering is kept around and will
37 /// be used for drawing the widget the next time, unless the window is resized.
38 /// In order to force a rendering [`GLAreaExt::queue_render()`][crate::prelude::GLAreaExt::queue_render()] must be called.
39 /// This mode is useful when the scene changes seldomly, but takes a long time
40 /// to redraw.
41 ///
42 /// Readable | Writable
43 ///
44 ///
45 /// #### `context`
46 /// The [`gdk::GLContext`][crate::gdk::GLContext] used by the [`GLArea`][crate::GLArea] widget.
47 ///
48 /// The [`GLArea`][crate::GLArea] widget is responsible for creating the [`gdk::GLContext`][crate::gdk::GLContext]
49 /// instance. If you need to render with other kinds of buffers (stencil,
50 /// depth, etc), use render buffers.
51 ///
52 /// Readable
53 ///
54 ///
55 /// #### `has-alpha`
56 /// If set to [`true`] the buffer allocated by the widget will have an alpha channel
57 /// component, and when rendering to the window the result will be composited over
58 /// whatever is below the widget.
59 ///
60 /// If set to [`false`] there will be no alpha channel, and the buffer will fully
61 /// replace anything below the widget.
62 ///
63 /// Readable | Writable
64 ///
65 ///
66 /// #### `has-depth-buffer`
67 /// If set to [`true`] the widget will allocate and enable a depth buffer for the
68 /// target framebuffer.
69 ///
70 /// Readable | Writable
71 ///
72 ///
73 /// #### `has-stencil-buffer`
74 /// If set to [`true`] the widget will allocate and enable a stencil buffer for the
75 /// target framebuffer.
76 ///
77 /// Readable | Writable
78 ///
79 ///
80 /// #### `use-es`
81 /// If set to [`true`] the widget will try to create a [`gdk::GLContext`][crate::gdk::GLContext] using
82 /// OpenGL ES instead of OpenGL.
83 ///
84 /// See also: [`GLContext::set_use_es()`][crate::gdk::GLContext::set_use_es()]
85 ///
86 /// Readable | Writable
87 /// <details><summary><h4>Widget</h4></summary>
88 ///
89 ///
90 /// #### `app-paintable`
91 /// Readable | Writable
92 ///
93 ///
94 /// #### `can-default`
95 /// Readable | Writable
96 ///
97 ///
98 /// #### `can-focus`
99 /// Readable | Writable
100 ///
101 ///
102 /// #### `composite-child`
103 /// Readable
104 ///
105 ///
106 /// #### `double-buffered`
107 /// Whether the widget is double buffered.
108 ///
109 /// Readable | Writable
110 ///
111 ///
112 /// #### `events`
113 /// Readable | Writable
114 ///
115 ///
116 /// #### `expand`
117 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
118 ///
119 /// Readable | Writable
120 ///
121 ///
122 /// #### `focus-on-click`
123 /// Whether the widget should grab focus when it is clicked with the mouse.
124 ///
125 /// This property is only relevant for widgets that can take focus.
126 ///
127 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
128 /// GtkComboBox) implemented this property individually.
129 ///
130 /// Readable | Writable
131 ///
132 ///
133 /// #### `halign`
134 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
135 ///
136 /// Readable | Writable
137 ///
138 ///
139 /// #### `has-default`
140 /// Readable | Writable
141 ///
142 ///
143 /// #### `has-focus`
144 /// Readable | Writable
145 ///
146 ///
147 /// #### `has-tooltip`
148 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
149 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
150 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
151 /// whether it will provide a tooltip or not.
152 ///
153 /// Note that setting this property to [`true`] for the first time will change
154 /// the event masks of the GdkWindows of this widget to include leave-notify
155 /// and motion-notify events. This cannot and will not be undone when the
156 /// property is set to [`false`] again.
157 ///
158 /// Readable | Writable
159 ///
160 ///
161 /// #### `height-request`
162 /// Readable | Writable
163 ///
164 ///
165 /// #### `hexpand`
166 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
167 ///
168 /// Readable | Writable
169 ///
170 ///
171 /// #### `hexpand-set`
172 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
173 ///
174 /// Readable | Writable
175 ///
176 ///
177 /// #### `is-focus`
178 /// Readable | Writable
179 ///
180 ///
181 /// #### `margin`
182 /// Sets all four sides' margin at once. If read, returns max
183 /// margin on any side.
184 ///
185 /// Readable | Writable
186 ///
187 ///
188 /// #### `margin-bottom`
189 /// Margin on bottom side of widget.
190 ///
191 /// This property adds margin outside of the widget's normal size
192 /// request, the margin will be added in addition to the size from
193 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
194 ///
195 /// Readable | Writable
196 ///
197 ///
198 /// #### `margin-end`
199 /// Margin on end of widget, horizontally. This property supports
200 /// left-to-right and right-to-left text directions.
201 ///
202 /// This property adds margin outside of the widget's normal size
203 /// request, the margin will be added in addition to the size from
204 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
205 ///
206 /// Readable | Writable
207 ///
208 ///
209 /// #### `margin-left`
210 /// Margin on left side of widget.
211 ///
212 /// This property adds margin outside of the widget's normal size
213 /// request, the margin will be added in addition to the size from
214 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
215 ///
216 /// Readable | Writable
217 ///
218 ///
219 /// #### `margin-right`
220 /// Margin on right side of widget.
221 ///
222 /// This property adds margin outside of the widget's normal size
223 /// request, the margin will be added in addition to the size from
224 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
225 ///
226 /// Readable | Writable
227 ///
228 ///
229 /// #### `margin-start`
230 /// Margin on start of widget, horizontally. This property supports
231 /// left-to-right and right-to-left text directions.
232 ///
233 /// This property adds margin outside of the widget's normal size
234 /// request, the margin will be added in addition to the size from
235 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
236 ///
237 /// Readable | Writable
238 ///
239 ///
240 /// #### `margin-top`
241 /// Margin on top side of widget.
242 ///
243 /// This property adds margin outside of the widget's normal size
244 /// request, the margin will be added in addition to the size from
245 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
246 ///
247 /// Readable | Writable
248 ///
249 ///
250 /// #### `name`
251 /// Readable | Writable
252 ///
253 ///
254 /// #### `no-show-all`
255 /// Readable | Writable
256 ///
257 ///
258 /// #### `opacity`
259 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
260 /// more details about window opacity.
261 ///
262 /// Before 3.8 this was only available in GtkWindow
263 ///
264 /// Readable | Writable
265 ///
266 ///
267 /// #### `parent`
268 /// Readable | Writable
269 ///
270 ///
271 /// #### `receives-default`
272 /// Readable | Writable
273 ///
274 ///
275 /// #### `scale-factor`
276 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
277 /// more details about widget scaling.
278 ///
279 /// Readable
280 ///
281 ///
282 /// #### `sensitive`
283 /// Readable | Writable
284 ///
285 ///
286 /// #### `style`
287 /// The style of the widget, which contains information about how it will look (colors, etc).
288 ///
289 /// Readable | Writable
290 ///
291 ///
292 /// #### `tooltip-markup`
293 /// Sets the text of tooltip to be the given string, which is marked up
294 /// with the [Pango text markup language][PangoMarkupFormat].
295 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
296 ///
297 /// This is a convenience property which will take care of getting the
298 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
299 /// will automatically be set to [`true`] and there will be taken care of
300 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
301 ///
302 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
303 /// are set, the last one wins.
304 ///
305 /// Readable | Writable
306 ///
307 ///
308 /// #### `tooltip-text`
309 /// Sets the text of tooltip to be the given string.
310 ///
311 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
312 ///
313 /// This is a convenience property which will take care of getting the
314 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
315 /// will automatically be set to [`true`] and there will be taken care of
316 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
317 ///
318 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
319 /// are set, the last one wins.
320 ///
321 /// Readable | Writable
322 ///
323 ///
324 /// #### `valign`
325 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
326 ///
327 /// Readable | Writable
328 ///
329 ///
330 /// #### `vexpand`
331 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
332 ///
333 /// Readable | Writable
334 ///
335 ///
336 /// #### `vexpand-set`
337 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
338 ///
339 /// Readable | Writable
340 ///
341 ///
342 /// #### `visible`
343 /// Readable | Writable
344 ///
345 ///
346 /// #### `width-request`
347 /// Readable | Writable
348 ///
349 ///
350 /// #### `window`
351 /// The widget's window if it is realized, [`None`] otherwise.
352 ///
353 /// Readable
354 /// </details>
355 ///
356 /// ## Signals
357 ///
358 ///
359 /// #### `create-context`
360 /// The ::create-context signal is emitted when the widget is being
361 /// realized, and allows you to override how the GL context is
362 /// created. This is useful when you want to reuse an existing GL
363 /// context, or if you want to try creating different kinds of GL
364 /// options.
365 ///
366 /// If context creation fails then the signal handler can use
367 /// [`GLAreaExt::set_error()`][crate::prelude::GLAreaExt::set_error()] to register a more detailed error
368 /// of how the construction failed.
369 ///
370 ///
371 ///
372 ///
373 /// #### `render`
374 /// The ::render signal is emitted every time the contents
375 /// of the [`GLArea`][crate::GLArea] should be redrawn.
376 ///
377 /// The `context` is bound to the `area` prior to emitting this function,
378 /// and the buffers are painted to the window once the emission terminates.
379 ///
380 ///
381 ///
382 ///
383 /// #### `resize`
384 /// The ::resize signal is emitted once when the widget is realized, and
385 /// then each time the widget is changed while realized. This is useful
386 /// in order to keep GL state up to date with the widget size, like for
387 /// instance camera properties which may depend on the width/height ratio.
388 ///
389 /// The GL context for the area is guaranteed to be current when this signal
390 /// is emitted.
391 ///
392 /// The default handler sets up the GL viewport.
393 ///
394 ///
395 /// <details><summary><h4>Widget</h4></summary>
396 ///
397 ///
398 /// #### `accel-closures-changed`
399 ///
400 ///
401 ///
402 /// #### `button-press-event`
403 /// The ::button-press-event signal will be emitted when a button
404 /// (typically from a mouse) is pressed.
405 ///
406 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
407 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
408 ///
409 /// This signal will be sent to the grab widget if there is one.
410 ///
411 ///
412 ///
413 ///
414 /// #### `button-release-event`
415 /// The ::button-release-event signal will be emitted when a button
416 /// (typically from a mouse) is released.
417 ///
418 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
419 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
420 ///
421 /// This signal will be sent to the grab widget if there is one.
422 ///
423 ///
424 ///
425 ///
426 /// #### `can-activate-accel`
427 /// Determines whether an accelerator that activates the signal
428 /// identified by `signal_id` can currently be activated.
429 /// This signal is present to allow applications and derived
430 /// widgets to override the default [`Widget`][crate::Widget] handling
431 /// for determining whether an accelerator can be activated.
432 ///
433 ///
434 ///
435 ///
436 /// #### `child-notify`
437 /// The ::child-notify signal is emitted for each
438 /// [child property][child-properties] that has
439 /// changed on an object. The signal's detail holds the property name.
440 ///
441 /// Detailed
442 ///
443 ///
444 /// #### `composited-changed`
445 /// The ::composited-changed signal is emitted when the composited
446 /// status of `widgets` screen changes.
447 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
448 ///
449 /// Action
450 ///
451 ///
452 /// #### `configure-event`
453 /// The ::configure-event signal will be emitted when the size, position or
454 /// stacking of the `widget`'s window has changed.
455 ///
456 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
457 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
458 /// automatically for all new windows.
459 ///
460 ///
461 ///
462 ///
463 /// #### `damage-event`
464 /// Emitted when a redirected window belonging to `widget` gets drawn into.
465 /// The region/area members of the event shows what area of the redirected
466 /// drawable was drawn into.
467 ///
468 ///
469 ///
470 ///
471 /// #### `delete-event`
472 /// The ::delete-event signal is emitted if a user requests that
473 /// a toplevel window is closed. The default handler for this signal
474 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
475 /// this signal will cause the window to be hidden instead, so that
476 /// it can later be shown again without reconstructing it.
477 ///
478 ///
479 ///
480 ///
481 /// #### `destroy`
482 /// Signals that all holders of a reference to the widget should release
483 /// the reference that they hold. May result in finalization of the widget
484 /// if all references are released.
485 ///
486 /// This signal is not suitable for saving widget state.
487 ///
488 ///
489 ///
490 ///
491 /// #### `destroy-event`
492 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
493 /// You rarely get this signal, because most widgets disconnect themselves
494 /// from their window before they destroy it, so no widget owns the
495 /// window at destroy time.
496 ///
497 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
498 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
499 /// automatically for all new windows.
500 ///
501 ///
502 ///
503 ///
504 /// #### `direction-changed`
505 /// The ::direction-changed signal is emitted when the text direction
506 /// of a widget changes.
507 ///
508 ///
509 ///
510 ///
511 /// #### `drag-begin`
512 /// The ::drag-begin signal is emitted on the drag source when a drag is
513 /// started. A typical reason to connect to this signal is to set up a
514 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
515 ///
516 /// Note that some widgets set up a drag icon in the default handler of
517 /// this signal, so you may have to use `g_signal_connect_after()` to
518 /// override what the default handler did.
519 ///
520 ///
521 ///
522 ///
523 /// #### `drag-data-delete`
524 /// The ::drag-data-delete signal is emitted on the drag source when a drag
525 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
526 /// handler is responsible for deleting the data that has been dropped. What
527 /// "delete" means depends on the context of the drag operation.
528 ///
529 ///
530 ///
531 ///
532 /// #### `drag-data-get`
533 /// The ::drag-data-get signal is emitted on the drag source when the drop
534 /// site requests the data which is dragged. It is the responsibility of
535 /// the signal handler to fill `data` with the data in the format which
536 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
537 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
538 ///
539 ///
540 ///
541 ///
542 /// #### `drag-data-received`
543 /// format == 8))
544 /// {
545 /// GdkDragAction action;
546 ///
547 /// // handle data here
548 ///
549 /// action = gdk_drag_context_get_selected_action (context);
550 /// if (action == GDK_ACTION_ASK)
551 /// {
552 /// GtkWidget *dialog;
553 /// gint response;
554 ///
555 /// dialog = gtk_message_dialog_new (NULL,
556 /// GTK_DIALOG_MODAL |
557 /// GTK_DIALOG_DESTROY_WITH_PARENT,
558 /// GTK_MESSAGE_INFO,
559 /// GTK_BUTTONS_YES_NO,
560 /// "Move the data ?\n");
561 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
562 /// gtk_widget_destroy (dialog);
563 ///
564 /// if (response == GTK_RESPONSE_YES)
565 /// action = GDK_ACTION_MOVE;
566 /// else
567 /// action = GDK_ACTION_COPY;
568 /// }
569 ///
570 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
571 /// }
572 /// else
573 /// gtk_drag_finish (context, FALSE, FALSE, time);
574 /// }
575 /// ]|
576 ///
577 ///
578 ///
579 ///
580 /// #### `drag-drop`
581 /// The ::drag-drop signal is emitted on the drop site when the user drops
582 /// the data onto the widget. The signal handler must determine whether
583 /// the cursor position is in a drop zone or not. If it is not in a drop
584 /// zone, it returns [`false`] and no further processing is necessary.
585 /// Otherwise, the handler returns [`true`]. In this case, the handler must
586 /// ensure that `gtk_drag_finish()` is called to let the source know that
587 /// the drop is done. The call to `gtk_drag_finish()` can be done either
588 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
589 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
590 /// or more of the supported targets.
591 ///
592 ///
593 ///
594 ///
595 /// #### `drag-end`
596 /// The ::drag-end signal is emitted on the drag source when a drag is
597 /// finished. A typical reason to connect to this signal is to undo
598 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
599 ///
600 ///
601 ///
602 ///
603 /// #### `drag-failed`
604 /// The ::drag-failed signal is emitted on the drag source when a drag has
605 /// failed. The signal handler may hook custom code to handle a failed DnD
606 /// operation based on the type of error, it returns [`true`] is the failure has
607 /// been already handled (not showing the default "drag operation failed"
608 /// animation), otherwise it returns [`false`].
609 ///
610 ///
611 ///
612 ///
613 /// #### `drag-leave`
614 /// The ::drag-leave signal is emitted on the drop site when the cursor
615 /// leaves the widget. A typical reason to connect to this signal is to
616 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
617 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
618 ///
619 ///
620 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
621 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
622 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
623 ///
624 ///
625 ///
626 ///
627 /// #### `drag-motion`
628 /// suggested_action,
629 /// time);
630 /// }
631 /// else
632 /// {
633 /// // accept the drop
634 /// }
635 /// }
636 /// ]|
637 ///
638 ///
639 ///
640 ///
641 /// #### `draw`
642 /// This signal is emitted when a widget is supposed to render itself.
643 /// The `widget`'s top left corner must be painted at the origin of
644 /// the passed in context and be sized to the values returned by
645 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
646 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
647 ///
648 /// Signal handlers connected to this signal can modify the cairo
649 /// context passed as `cr` in any way they like and don't need to
650 /// restore it. The signal emission takes care of calling `cairo_save()`
651 /// before and `cairo_restore()` after invoking the handler.
652 ///
653 /// The signal handler will get a `cr` with a clip region already set to the
654 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
655 /// widgets that want to avoid redrawing themselves completely can get the full
656 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
657 /// get a finer-grained representation of the dirty region with
658 /// `cairo_copy_clip_rectangle_list()`.
659 ///
660 ///
661 ///
662 ///
663 /// #### `enter-notify-event`
664 /// The ::enter-notify-event will be emitted when the pointer enters
665 /// the `widget`'s window.
666 ///
667 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
668 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
669 ///
670 /// This signal will be sent to the grab widget if there is one.
671 ///
672 ///
673 ///
674 ///
675 /// #### `event`
676 /// The GTK+ main loop will emit three signals for each GDK event delivered
677 /// to a widget: one generic ::event signal, another, more specific,
678 /// signal that matches the type of event delivered (e.g.
679 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
680 /// [`event-after`][struct@crate::Widget#event-after] signal.
681 ///
682 ///
683 ///
684 ///
685 /// #### `event-after`
686 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
687 /// the second more specific signal, ::event-after will be emitted
688 /// regardless of the previous two signals handlers return values.
689 ///
690 ///
691 ///
692 ///
693 /// #### `focus`
694 ///
695 ///
696 ///
697 /// #### `focus-in-event`
698 /// The ::focus-in-event signal will be emitted when the keyboard focus
699 /// enters the `widget`'s window.
700 ///
701 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
702 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
703 ///
704 ///
705 ///
706 ///
707 /// #### `focus-out-event`
708 /// The ::focus-out-event signal will be emitted when the keyboard focus
709 /// leaves the `widget`'s window.
710 ///
711 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
712 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
713 ///
714 ///
715 ///
716 ///
717 /// #### `grab-broken-event`
718 /// Emitted when a pointer or keyboard grab on a window belonging
719 /// to `widget` gets broken.
720 ///
721 /// On X11, this happens when the grab window becomes unviewable
722 /// (i.e. it or one of its ancestors is unmapped), or if the same
723 /// application grabs the pointer or keyboard again.
724 ///
725 ///
726 ///
727 ///
728 /// #### `grab-focus`
729 /// Action
730 ///
731 ///
732 /// #### `grab-notify`
733 /// The ::grab-notify signal is emitted when a widget becomes
734 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
735 /// another widget, or when it becomes unshadowed due to a grab
736 /// being removed.
737 ///
738 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
739 /// grab widget in the grab stack of its window group is not
740 /// its ancestor.
741 ///
742 ///
743 ///
744 ///
745 /// #### `hide`
746 /// The ::hide signal is emitted when `widget` is hidden, for example with
747 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
748 ///
749 ///
750 ///
751 ///
752 /// #### `hierarchy-changed`
753 /// The ::hierarchy-changed signal is emitted when the
754 /// anchored state of a widget changes. A widget is
755 /// “anchored” when its toplevel
756 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
757 /// a widget changes from un-anchored to anchored or vice-versa.
758 ///
759 ///
760 ///
761 ///
762 /// #### `key-press-event`
763 /// The ::key-press-event signal is emitted when a key is pressed. The signal
764 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
765 ///
766 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
767 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
768 ///
769 /// This signal will be sent to the grab widget if there is one.
770 ///
771 ///
772 ///
773 ///
774 /// #### `key-release-event`
775 /// The ::key-release-event signal is emitted when a key is released.
776 ///
777 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
778 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
779 ///
780 /// This signal will be sent to the grab widget if there is one.
781 ///
782 ///
783 ///
784 ///
785 /// #### `keynav-failed`
786 /// Gets emitted if keyboard navigation fails.
787 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
788 ///
789 ///
790 ///
791 ///
792 /// #### `leave-notify-event`
793 /// The ::leave-notify-event will be emitted when the pointer leaves
794 /// the `widget`'s window.
795 ///
796 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
797 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
798 ///
799 /// This signal will be sent to the grab widget if there is one.
800 ///
801 ///
802 ///
803 ///
804 /// #### `map`
805 /// The ::map signal is emitted when `widget` is going to be mapped, that is
806 /// when the widget is visible (which is controlled with
807 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
808 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
809 /// be emitted.
810 ///
811 /// The ::map signal can be used to determine whether a widget will be drawn,
812 /// for instance it can resume an animation that was stopped during the
813 /// emission of [`unmap`][struct@crate::Widget#unmap].
814 ///
815 ///
816 ///
817 ///
818 /// #### `map-event`
819 /// The ::map-event signal will be emitted when the `widget`'s window is
820 /// mapped. A window is mapped when it becomes visible on the screen.
821 ///
822 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
823 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
824 /// automatically for all new windows.
825 ///
826 ///
827 ///
828 ///
829 /// #### `mnemonic-activate`
830 /// The default handler for this signal activates `widget` if `group_cycling`
831 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
832 ///
833 ///
834 ///
835 ///
836 /// #### `motion-notify-event`
837 /// The ::motion-notify-event signal is emitted when the pointer moves
838 /// over the widget's [`gdk::Window`][crate::gdk::Window].
839 ///
840 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
841 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
842 ///
843 /// This signal will be sent to the grab widget if there is one.
844 ///
845 ///
846 ///
847 ///
848 /// #### `move-focus`
849 /// Action
850 ///
851 ///
852 /// #### `parent-set`
853 /// The ::parent-set signal is emitted when a new parent
854 /// has been set on a widget.
855 ///
856 ///
857 ///
858 ///
859 /// #### `popup-menu`
860 /// This signal gets emitted whenever a widget should pop up a context
861 /// menu. This usually happens through the standard key binding mechanism;
862 /// by pressing a certain key while a widget is focused, the user can cause
863 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
864 /// a menu with clipboard commands. See the
865 /// [Popup Menu Migration Checklist][checklist-popup-menu]
866 /// for an example of how to use this signal.
867 ///
868 /// Action
869 ///
870 ///
871 /// #### `property-notify-event`
872 /// The ::property-notify-event signal will be emitted when a property on
873 /// the `widget`'s window has been changed or deleted.
874 ///
875 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
876 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
877 ///
878 ///
879 ///
880 ///
881 /// #### `proximity-in-event`
882 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
883 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
884 ///
885 /// This signal will be sent to the grab widget if there is one.
886 ///
887 ///
888 ///
889 ///
890 /// #### `proximity-out-event`
891 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
892 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
893 ///
894 /// This signal will be sent to the grab widget if there is one.
895 ///
896 ///
897 ///
898 ///
899 /// #### `query-tooltip`
900 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
901 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
902 /// focus in keyboard mode.
903 ///
904 /// Using the given coordinates, the signal handler should determine
905 /// whether a tooltip should be shown for `widget`. If this is the case
906 /// [`true`] should be returned, [`false`] otherwise. Note that if
907 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
908 /// should not be used.
909 ///
910 /// The signal handler is free to manipulate `tooltip` with the therefore
911 /// destined function calls.
912 ///
913 ///
914 ///
915 ///
916 /// #### `realize`
917 /// The ::realize signal is emitted when `widget` is associated with a
918 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
919 /// widget has been mapped (that is, it is going to be drawn).
920 ///
921 ///
922 ///
923 ///
924 /// #### `screen-changed`
925 /// The ::screen-changed signal gets emitted when the
926 /// screen of a widget has changed.
927 ///
928 ///
929 ///
930 ///
931 /// #### `scroll-event`
932 /// The ::scroll-event signal is emitted when a button in the 4 to 7
933 /// range is pressed. Wheel mice are usually configured to generate
934 /// button press events for buttons 4 and 5 when the wheel is turned.
935 ///
936 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
937 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
938 ///
939 /// This signal will be sent to the grab widget if there is one.
940 ///
941 ///
942 ///
943 ///
944 /// #### `selection-clear-event`
945 /// The ::selection-clear-event signal will be emitted when the
946 /// the `widget`'s window has lost ownership of a selection.
947 ///
948 ///
949 ///
950 ///
951 /// #### `selection-get`
952 ///
953 ///
954 ///
955 /// #### `selection-notify-event`
956 ///
957 ///
958 ///
959 /// #### `selection-received`
960 ///
961 ///
962 ///
963 /// #### `selection-request-event`
964 /// The ::selection-request-event signal will be emitted when
965 /// another client requests ownership of the selection owned by
966 /// the `widget`'s window.
967 ///
968 ///
969 ///
970 ///
971 /// #### `show`
972 /// The ::show signal is emitted when `widget` is shown, for example with
973 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
974 ///
975 ///
976 ///
977 ///
978 /// #### `show-help`
979 /// Action
980 ///
981 ///
982 /// #### `size-allocate`
983 ///
984 ///
985 ///
986 /// #### `state-changed`
987 /// The ::state-changed signal is emitted when the widget state changes.
988 /// See `gtk_widget_get_state()`.
989 ///
990 ///
991 ///
992 ///
993 /// #### `state-flags-changed`
994 /// The ::state-flags-changed signal is emitted when the widget state
995 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
996 ///
997 ///
998 ///
999 ///
1000 /// #### `style-set`
1001 /// The ::style-set signal is emitted when a new style has been set
1002 /// on a widget. Note that style-modifying functions like
1003 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1004 ///
1005 /// Note that this signal is emitted for changes to the deprecated
1006 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1007 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1008 ///
1009 ///
1010 ///
1011 ///
1012 /// #### `style-updated`
1013 /// The ::style-updated signal is a convenience signal that is emitted when the
1014 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1015 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1016 ///
1017 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1018 /// cause this signal to be emitted.
1019 ///
1020 ///
1021 ///
1022 ///
1023 /// #### `touch-event`
1024 ///
1025 ///
1026 ///
1027 /// #### `unmap`
1028 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1029 /// means that either it or any of its parents up to the toplevel widget have
1030 /// been set as hidden.
1031 ///
1032 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1033 /// used to, for example, stop an animation on the widget.
1034 ///
1035 ///
1036 ///
1037 ///
1038 /// #### `unmap-event`
1039 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1040 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1041 ///
1042 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1043 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1044 /// automatically for all new windows.
1045 ///
1046 ///
1047 ///
1048 ///
1049 /// #### `unrealize`
1050 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1051 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1052 /// called or the widget has been unmapped (that is, it is going to be
1053 /// hidden).
1054 ///
1055 ///
1056 ///
1057 ///
1058 /// #### `visibility-notify-event`
1059 /// The ::visibility-notify-event will be emitted when the `widget`'s
1060 /// window is obscured or unobscured.
1061 ///
1062 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1063 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1064 ///
1065 ///
1066 ///
1067 ///
1068 /// #### `window-state-event`
1069 /// The ::window-state-event will be emitted when the state of the
1070 /// toplevel window associated to the `widget` changes.
1071 ///
1072 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1073 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1074 /// this mask automatically for all new windows.
1075 ///
1076 ///
1077 /// </details>
1078 ///
1079 /// # Implements
1080 ///
1081 /// [`GLAreaExt`][trait@crate::prelude::GLAreaExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1082 #[doc(alias = "GtkGLArea")]
1083 pub struct GLArea(Object<ffi::GtkGLArea, ffi::GtkGLAreaClass>) @extends Widget, @implements Buildable;
1084
1085 match fn {
1086 type_ => || ffi::gtk_gl_area_get_type(),
1087 }
1088}
1089
1090impl GLArea {
1091 pub const NONE: Option<&'static GLArea> = None;
1092
1093 /// Creates a new [`GLArea`][crate::GLArea] widget.
1094 ///
1095 /// # Returns
1096 ///
1097 /// a new [`GLArea`][crate::GLArea]
1098 #[doc(alias = "gtk_gl_area_new")]
1099 pub fn new() -> GLArea {
1100 assert_initialized_main_thread!();
1101 unsafe { Widget::from_glib_none(ffi::gtk_gl_area_new()).unsafe_cast() }
1102 }
1103
1104 // rustdoc-stripper-ignore-next
1105 /// Creates a new builder-pattern struct instance to construct [`GLArea`] objects.
1106 ///
1107 /// This method returns an instance of [`GLAreaBuilder`](crate::builders::GLAreaBuilder) which can be used to create [`GLArea`] objects.
1108 pub fn builder() -> GLAreaBuilder {
1109 GLAreaBuilder::new()
1110 }
1111}
1112
1113impl Default for GLArea {
1114 fn default() -> Self {
1115 Self::new()
1116 }
1117}
1118
1119// rustdoc-stripper-ignore-next
1120/// A [builder-pattern] type to construct [`GLArea`] objects.
1121///
1122/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1123#[must_use = "The builder must be built to be used"]
1124pub struct GLAreaBuilder {
1125 builder: glib::object::ObjectBuilder<'static, GLArea>,
1126}
1127
1128impl GLAreaBuilder {
1129 fn new() -> Self {
1130 Self {
1131 builder: glib::object::Object::builder(),
1132 }
1133 }
1134
1135 /// If set to [`true`] the [`render`][struct@crate::GLArea#render] signal will be emitted every time
1136 /// the widget draws. This is the default and is useful if drawing the widget
1137 /// is faster.
1138 ///
1139 /// If set to [`false`] the data from previous rendering is kept around and will
1140 /// be used for drawing the widget the next time, unless the window is resized.
1141 /// In order to force a rendering [`GLAreaExt::queue_render()`][crate::prelude::GLAreaExt::queue_render()] must be called.
1142 /// This mode is useful when the scene changes seldomly, but takes a long time
1143 /// to redraw.
1144 pub fn auto_render(self, auto_render: bool) -> Self {
1145 Self {
1146 builder: self.builder.property("auto-render", auto_render),
1147 }
1148 }
1149
1150 /// If set to [`true`] the buffer allocated by the widget will have an alpha channel
1151 /// component, and when rendering to the window the result will be composited over
1152 /// whatever is below the widget.
1153 ///
1154 /// If set to [`false`] there will be no alpha channel, and the buffer will fully
1155 /// replace anything below the widget.
1156 pub fn has_alpha(self, has_alpha: bool) -> Self {
1157 Self {
1158 builder: self.builder.property("has-alpha", has_alpha),
1159 }
1160 }
1161
1162 /// If set to [`true`] the widget will allocate and enable a depth buffer for the
1163 /// target framebuffer.
1164 pub fn has_depth_buffer(self, has_depth_buffer: bool) -> Self {
1165 Self {
1166 builder: self.builder.property("has-depth-buffer", has_depth_buffer),
1167 }
1168 }
1169
1170 /// If set to [`true`] the widget will allocate and enable a stencil buffer for the
1171 /// target framebuffer.
1172 pub fn has_stencil_buffer(self, has_stencil_buffer: bool) -> Self {
1173 Self {
1174 builder: self
1175 .builder
1176 .property("has-stencil-buffer", has_stencil_buffer),
1177 }
1178 }
1179
1180 /// If set to [`true`] the widget will try to create a [`gdk::GLContext`][crate::gdk::GLContext] using
1181 /// OpenGL ES instead of OpenGL.
1182 ///
1183 /// See also: [`GLContext::set_use_es()`][crate::gdk::GLContext::set_use_es()]
1184 pub fn use_es(self, use_es: bool) -> Self {
1185 Self {
1186 builder: self.builder.property("use-es", use_es),
1187 }
1188 }
1189
1190 pub fn app_paintable(self, app_paintable: bool) -> Self {
1191 Self {
1192 builder: self.builder.property("app-paintable", app_paintable),
1193 }
1194 }
1195
1196 pub fn can_default(self, can_default: bool) -> Self {
1197 Self {
1198 builder: self.builder.property("can-default", can_default),
1199 }
1200 }
1201
1202 pub fn can_focus(self, can_focus: bool) -> Self {
1203 Self {
1204 builder: self.builder.property("can-focus", can_focus),
1205 }
1206 }
1207
1208 pub fn events(self, events: gdk::EventMask) -> Self {
1209 Self {
1210 builder: self.builder.property("events", events),
1211 }
1212 }
1213
1214 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1215 pub fn expand(self, expand: bool) -> Self {
1216 Self {
1217 builder: self.builder.property("expand", expand),
1218 }
1219 }
1220
1221 /// Whether the widget should grab focus when it is clicked with the mouse.
1222 ///
1223 /// This property is only relevant for widgets that can take focus.
1224 ///
1225 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1226 /// GtkComboBox) implemented this property individually.
1227 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1228 Self {
1229 builder: self.builder.property("focus-on-click", focus_on_click),
1230 }
1231 }
1232
1233 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1234 pub fn halign(self, halign: Align) -> Self {
1235 Self {
1236 builder: self.builder.property("halign", halign),
1237 }
1238 }
1239
1240 pub fn has_default(self, has_default: bool) -> Self {
1241 Self {
1242 builder: self.builder.property("has-default", has_default),
1243 }
1244 }
1245
1246 pub fn has_focus(self, has_focus: bool) -> Self {
1247 Self {
1248 builder: self.builder.property("has-focus", has_focus),
1249 }
1250 }
1251
1252 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1253 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1254 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1255 /// whether it will provide a tooltip or not.
1256 ///
1257 /// Note that setting this property to [`true`] for the first time will change
1258 /// the event masks of the GdkWindows of this widget to include leave-notify
1259 /// and motion-notify events. This cannot and will not be undone when the
1260 /// property is set to [`false`] again.
1261 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1262 Self {
1263 builder: self.builder.property("has-tooltip", has_tooltip),
1264 }
1265 }
1266
1267 pub fn height_request(self, height_request: i32) -> Self {
1268 Self {
1269 builder: self.builder.property("height-request", height_request),
1270 }
1271 }
1272
1273 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1274 pub fn hexpand(self, hexpand: bool) -> Self {
1275 Self {
1276 builder: self.builder.property("hexpand", hexpand),
1277 }
1278 }
1279
1280 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1281 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1282 Self {
1283 builder: self.builder.property("hexpand-set", hexpand_set),
1284 }
1285 }
1286
1287 pub fn is_focus(self, is_focus: bool) -> Self {
1288 Self {
1289 builder: self.builder.property("is-focus", is_focus),
1290 }
1291 }
1292
1293 /// Sets all four sides' margin at once. If read, returns max
1294 /// margin on any side.
1295 pub fn margin(self, margin: i32) -> Self {
1296 Self {
1297 builder: self.builder.property("margin", margin),
1298 }
1299 }
1300
1301 /// Margin on bottom side of widget.
1302 ///
1303 /// This property adds margin outside of the widget's normal size
1304 /// request, the margin will be added in addition to the size from
1305 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1306 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1307 Self {
1308 builder: self.builder.property("margin-bottom", margin_bottom),
1309 }
1310 }
1311
1312 /// Margin on end of widget, horizontally. This property supports
1313 /// left-to-right and right-to-left text directions.
1314 ///
1315 /// This property adds margin outside of the widget's normal size
1316 /// request, the margin will be added in addition to the size from
1317 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1318 pub fn margin_end(self, margin_end: i32) -> Self {
1319 Self {
1320 builder: self.builder.property("margin-end", margin_end),
1321 }
1322 }
1323
1324 /// Margin on start of widget, horizontally. This property supports
1325 /// left-to-right and right-to-left text directions.
1326 ///
1327 /// This property adds margin outside of the widget's normal size
1328 /// request, the margin will be added in addition to the size from
1329 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1330 pub fn margin_start(self, margin_start: i32) -> Self {
1331 Self {
1332 builder: self.builder.property("margin-start", margin_start),
1333 }
1334 }
1335
1336 /// Margin on top side of widget.
1337 ///
1338 /// This property adds margin outside of the widget's normal size
1339 /// request, the margin will be added in addition to the size from
1340 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1341 pub fn margin_top(self, margin_top: i32) -> Self {
1342 Self {
1343 builder: self.builder.property("margin-top", margin_top),
1344 }
1345 }
1346
1347 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1348 Self {
1349 builder: self.builder.property("name", name.into()),
1350 }
1351 }
1352
1353 pub fn no_show_all(self, no_show_all: bool) -> Self {
1354 Self {
1355 builder: self.builder.property("no-show-all", no_show_all),
1356 }
1357 }
1358
1359 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1360 /// more details about window opacity.
1361 ///
1362 /// Before 3.8 this was only available in GtkWindow
1363 pub fn opacity(self, opacity: f64) -> Self {
1364 Self {
1365 builder: self.builder.property("opacity", opacity),
1366 }
1367 }
1368
1369 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1370 Self {
1371 builder: self.builder.property("parent", parent.clone().upcast()),
1372 }
1373 }
1374
1375 pub fn receives_default(self, receives_default: bool) -> Self {
1376 Self {
1377 builder: self.builder.property("receives-default", receives_default),
1378 }
1379 }
1380
1381 pub fn sensitive(self, sensitive: bool) -> Self {
1382 Self {
1383 builder: self.builder.property("sensitive", sensitive),
1384 }
1385 }
1386
1387 /// Sets the text of tooltip to be the given string, which is marked up
1388 /// with the [Pango text markup language][PangoMarkupFormat].
1389 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1390 ///
1391 /// This is a convenience property which will take care of getting the
1392 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1393 /// will automatically be set to [`true`] and there will be taken care of
1394 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1395 ///
1396 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1397 /// are set, the last one wins.
1398 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1399 Self {
1400 builder: self
1401 .builder
1402 .property("tooltip-markup", tooltip_markup.into()),
1403 }
1404 }
1405
1406 /// Sets the text of tooltip to be the given string.
1407 ///
1408 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1409 ///
1410 /// This is a convenience property which will take care of getting the
1411 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1412 /// will automatically be set to [`true`] and there will be taken care of
1413 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1414 ///
1415 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1416 /// are set, the last one wins.
1417 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1418 Self {
1419 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1420 }
1421 }
1422
1423 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1424 pub fn valign(self, valign: Align) -> Self {
1425 Self {
1426 builder: self.builder.property("valign", valign),
1427 }
1428 }
1429
1430 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1431 pub fn vexpand(self, vexpand: bool) -> Self {
1432 Self {
1433 builder: self.builder.property("vexpand", vexpand),
1434 }
1435 }
1436
1437 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1438 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1439 Self {
1440 builder: self.builder.property("vexpand-set", vexpand_set),
1441 }
1442 }
1443
1444 pub fn visible(self, visible: bool) -> Self {
1445 Self {
1446 builder: self.builder.property("visible", visible),
1447 }
1448 }
1449
1450 pub fn width_request(self, width_request: i32) -> Self {
1451 Self {
1452 builder: self.builder.property("width-request", width_request),
1453 }
1454 }
1455
1456 // rustdoc-stripper-ignore-next
1457 /// Build the [`GLArea`].
1458 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1459 pub fn build(self) -> GLArea {
1460 assert_initialized_main_thread!();
1461 self.builder.build()
1462 }
1463}
1464
1465/// Trait containing all [`struct@GLArea`] methods.
1466///
1467/// # Implementors
1468///
1469/// [`GLArea`][struct@crate::GLArea]
1470pub trait GLAreaExt: IsA<GLArea> + 'static {
1471 /// Ensures that the `self` framebuffer object is made the current draw
1472 /// and read target, and that all the required buffers for the `self`
1473 /// are created and bound to the frambuffer.
1474 ///
1475 /// This function is automatically called before emitting the
1476 /// [`render`][struct@crate::GLArea#render] signal, and doesn't normally need to be called
1477 /// by application code.
1478 #[doc(alias = "gtk_gl_area_attach_buffers")]
1479 fn attach_buffers(&self) {
1480 unsafe {
1481 ffi::gtk_gl_area_attach_buffers(self.as_ref().to_glib_none().0);
1482 }
1483 }
1484
1485 /// Returns whether the area is in auto render mode or not.
1486 ///
1487 /// # Returns
1488 ///
1489 /// [`true`] if the `self` is auto rendering, [`false`] otherwise
1490 #[doc(alias = "gtk_gl_area_get_auto_render")]
1491 #[doc(alias = "get_auto_render")]
1492 #[doc(alias = "auto-render")]
1493 fn is_auto_render(&self) -> bool {
1494 unsafe {
1495 from_glib(ffi::gtk_gl_area_get_auto_render(
1496 self.as_ref().to_glib_none().0,
1497 ))
1498 }
1499 }
1500
1501 /// Retrieves the [`gdk::GLContext`][crate::gdk::GLContext] used by `self`.
1502 ///
1503 /// # Returns
1504 ///
1505 /// the [`gdk::GLContext`][crate::gdk::GLContext]
1506 #[doc(alias = "gtk_gl_area_get_context")]
1507 #[doc(alias = "get_context")]
1508 fn context(&self) -> Option<gdk::GLContext> {
1509 unsafe { from_glib_none(ffi::gtk_gl_area_get_context(self.as_ref().to_glib_none().0)) }
1510 }
1511
1512 /// Gets the current error set on the `self`.
1513 ///
1514 /// # Returns
1515 ///
1516 /// the [`glib::Error`][crate::glib::Error] or [`None`]
1517 #[doc(alias = "gtk_gl_area_get_error")]
1518 #[doc(alias = "get_error")]
1519 fn error(&self) -> Option<glib::Error> {
1520 unsafe { from_glib_none(ffi::gtk_gl_area_get_error(self.as_ref().to_glib_none().0)) }
1521 }
1522
1523 /// Returns whether the area has an alpha component.
1524 ///
1525 /// # Returns
1526 ///
1527 /// [`true`] if the `self` has an alpha component, [`false`] otherwise
1528 #[doc(alias = "gtk_gl_area_get_has_alpha")]
1529 #[doc(alias = "get_has_alpha")]
1530 #[doc(alias = "has-alpha")]
1531 fn has_alpha(&self) -> bool {
1532 unsafe {
1533 from_glib(ffi::gtk_gl_area_get_has_alpha(
1534 self.as_ref().to_glib_none().0,
1535 ))
1536 }
1537 }
1538
1539 /// Returns whether the area has a depth buffer.
1540 ///
1541 /// # Returns
1542 ///
1543 /// [`true`] if the `self` has a depth buffer, [`false`] otherwise
1544 #[doc(alias = "gtk_gl_area_get_has_depth_buffer")]
1545 #[doc(alias = "get_has_depth_buffer")]
1546 #[doc(alias = "has-depth-buffer")]
1547 fn has_depth_buffer(&self) -> bool {
1548 unsafe {
1549 from_glib(ffi::gtk_gl_area_get_has_depth_buffer(
1550 self.as_ref().to_glib_none().0,
1551 ))
1552 }
1553 }
1554
1555 /// Returns whether the area has a stencil buffer.
1556 ///
1557 /// # Returns
1558 ///
1559 /// [`true`] if the `self` has a stencil buffer, [`false`] otherwise
1560 #[doc(alias = "gtk_gl_area_get_has_stencil_buffer")]
1561 #[doc(alias = "get_has_stencil_buffer")]
1562 #[doc(alias = "has-stencil-buffer")]
1563 fn has_stencil_buffer(&self) -> bool {
1564 unsafe {
1565 from_glib(ffi::gtk_gl_area_get_has_stencil_buffer(
1566 self.as_ref().to_glib_none().0,
1567 ))
1568 }
1569 }
1570
1571 /// Retrieves the required version of OpenGL set
1572 /// using [`set_required_version()`][Self::set_required_version()].
1573 ///
1574 /// # Returns
1575 ///
1576 ///
1577 /// ## `major`
1578 /// return location for the required major version
1579 ///
1580 /// ## `minor`
1581 /// return location for the required minor version
1582 #[doc(alias = "gtk_gl_area_get_required_version")]
1583 #[doc(alias = "get_required_version")]
1584 fn required_version(&self) -> (i32, i32) {
1585 unsafe {
1586 let mut major = std::mem::MaybeUninit::uninit();
1587 let mut minor = std::mem::MaybeUninit::uninit();
1588 ffi::gtk_gl_area_get_required_version(
1589 self.as_ref().to_glib_none().0,
1590 major.as_mut_ptr(),
1591 minor.as_mut_ptr(),
1592 );
1593 (major.assume_init(), minor.assume_init())
1594 }
1595 }
1596
1597 /// Retrieves the value set by [`set_use_es()`][Self::set_use_es()].
1598 ///
1599 /// # Returns
1600 ///
1601 /// [`true`] if the [`GLArea`][crate::GLArea] should create an OpenGL ES context
1602 /// and [`false`] otherwise
1603 #[doc(alias = "gtk_gl_area_get_use_es")]
1604 #[doc(alias = "get_use_es")]
1605 #[doc(alias = "use-es")]
1606 fn uses_es(&self) -> bool {
1607 unsafe { from_glib(ffi::gtk_gl_area_get_use_es(self.as_ref().to_glib_none().0)) }
1608 }
1609
1610 /// Ensures that the [`gdk::GLContext`][crate::gdk::GLContext] used by `self` is associated with
1611 /// the [`GLArea`][crate::GLArea].
1612 ///
1613 /// This function is automatically called before emitting the
1614 /// [`render`][struct@crate::GLArea#render] signal, and doesn't normally need to be called
1615 /// by application code.
1616 #[doc(alias = "gtk_gl_area_make_current")]
1617 fn make_current(&self) {
1618 unsafe {
1619 ffi::gtk_gl_area_make_current(self.as_ref().to_glib_none().0);
1620 }
1621 }
1622
1623 /// Marks the currently rendered data (if any) as invalid, and queues
1624 /// a redraw of the widget, ensuring that the [`render`][struct@crate::GLArea#render] signal
1625 /// is emitted during the draw.
1626 ///
1627 /// This is only needed when the [`set_auto_render()`][Self::set_auto_render()] has
1628 /// been called with a [`false`] value. The default behaviour is to
1629 /// emit [`render`][struct@crate::GLArea#render] on each draw.
1630 #[doc(alias = "gtk_gl_area_queue_render")]
1631 fn queue_render(&self) {
1632 unsafe {
1633 ffi::gtk_gl_area_queue_render(self.as_ref().to_glib_none().0);
1634 }
1635 }
1636
1637 /// If `auto_render` is [`true`] the [`render`][struct@crate::GLArea#render] signal will be
1638 /// emitted every time the widget draws. This is the default and is
1639 /// useful if drawing the widget is faster.
1640 ///
1641 /// If `auto_render` is [`false`] the data from previous rendering is kept
1642 /// around and will be used for drawing the widget the next time,
1643 /// unless the window is resized. In order to force a rendering
1644 /// [`queue_render()`][Self::queue_render()] must be called. This mode is useful when
1645 /// the scene changes seldomly, but takes a long time to redraw.
1646 /// ## `auto_render`
1647 /// a boolean
1648 #[doc(alias = "gtk_gl_area_set_auto_render")]
1649 #[doc(alias = "auto-render")]
1650 fn set_auto_render(&self, auto_render: bool) {
1651 unsafe {
1652 ffi::gtk_gl_area_set_auto_render(
1653 self.as_ref().to_glib_none().0,
1654 auto_render.into_glib(),
1655 );
1656 }
1657 }
1658
1659 /// Sets an error on the area which will be shown instead of the
1660 /// GL rendering. This is useful in the [`create-context`][struct@crate::GLArea#create-context]
1661 /// signal if GL context creation fails.
1662 /// ## `error`
1663 /// a new [`glib::Error`][crate::glib::Error], or [`None`] to unset the error
1664 #[doc(alias = "gtk_gl_area_set_error")]
1665 fn set_error(&self, error: Option<&glib::Error>) {
1666 unsafe {
1667 ffi::gtk_gl_area_set_error(self.as_ref().to_glib_none().0, error.to_glib_none().0);
1668 }
1669 }
1670
1671 /// If `has_alpha` is [`true`] the buffer allocated by the widget will have
1672 /// an alpha channel component, and when rendering to the window the
1673 /// result will be composited over whatever is below the widget.
1674 ///
1675 /// If `has_alpha` is [`false`] there will be no alpha channel, and the
1676 /// buffer will fully replace anything below the widget.
1677 /// ## `has_alpha`
1678 /// [`true`] to add an alpha component
1679 #[doc(alias = "gtk_gl_area_set_has_alpha")]
1680 #[doc(alias = "has-alpha")]
1681 fn set_has_alpha(&self, has_alpha: bool) {
1682 unsafe {
1683 ffi::gtk_gl_area_set_has_alpha(self.as_ref().to_glib_none().0, has_alpha.into_glib());
1684 }
1685 }
1686
1687 /// If `has_depth_buffer` is [`true`] the widget will allocate and
1688 /// enable a depth buffer for the target framebuffer. Otherwise
1689 /// there will be none.
1690 /// ## `has_depth_buffer`
1691 /// [`true`] to add a depth buffer
1692 #[doc(alias = "gtk_gl_area_set_has_depth_buffer")]
1693 #[doc(alias = "has-depth-buffer")]
1694 fn set_has_depth_buffer(&self, has_depth_buffer: bool) {
1695 unsafe {
1696 ffi::gtk_gl_area_set_has_depth_buffer(
1697 self.as_ref().to_glib_none().0,
1698 has_depth_buffer.into_glib(),
1699 );
1700 }
1701 }
1702
1703 /// If `has_stencil_buffer` is [`true`] the widget will allocate and
1704 /// enable a stencil buffer for the target framebuffer. Otherwise
1705 /// there will be none.
1706 /// ## `has_stencil_buffer`
1707 /// [`true`] to add a stencil buffer
1708 #[doc(alias = "gtk_gl_area_set_has_stencil_buffer")]
1709 #[doc(alias = "has-stencil-buffer")]
1710 fn set_has_stencil_buffer(&self, has_stencil_buffer: bool) {
1711 unsafe {
1712 ffi::gtk_gl_area_set_has_stencil_buffer(
1713 self.as_ref().to_glib_none().0,
1714 has_stencil_buffer.into_glib(),
1715 );
1716 }
1717 }
1718
1719 /// Sets the required version of OpenGL to be used when creating the context
1720 /// for the widget.
1721 ///
1722 /// This function must be called before the area has been realized.
1723 /// ## `major`
1724 /// the major version
1725 /// ## `minor`
1726 /// the minor version
1727 #[doc(alias = "gtk_gl_area_set_required_version")]
1728 fn set_required_version(&self, major: i32, minor: i32) {
1729 unsafe {
1730 ffi::gtk_gl_area_set_required_version(self.as_ref().to_glib_none().0, major, minor);
1731 }
1732 }
1733
1734 /// Sets whether the `self` should create an OpenGL or an OpenGL ES context.
1735 ///
1736 /// You should check the capabilities of the [`gdk::GLContext`][crate::gdk::GLContext] before drawing
1737 /// with either API.
1738 /// ## `use_es`
1739 /// whether to use OpenGL or OpenGL ES
1740 #[doc(alias = "gtk_gl_area_set_use_es")]
1741 #[doc(alias = "use-es")]
1742 fn set_use_es(&self, use_es: bool) {
1743 unsafe {
1744 ffi::gtk_gl_area_set_use_es(self.as_ref().to_glib_none().0, use_es.into_glib());
1745 }
1746 }
1747
1748 /// The ::create-context signal is emitted when the widget is being
1749 /// realized, and allows you to override how the GL context is
1750 /// created. This is useful when you want to reuse an existing GL
1751 /// context, or if you want to try creating different kinds of GL
1752 /// options.
1753 ///
1754 /// If context creation fails then the signal handler can use
1755 /// [`set_error()`][Self::set_error()] to register a more detailed error
1756 /// of how the construction failed.
1757 ///
1758 /// # Returns
1759 ///
1760 /// a newly created [`gdk::GLContext`][crate::gdk::GLContext];
1761 /// the [`GLArea`][crate::GLArea] widget will take ownership of the returned value.
1762 #[doc(alias = "create-context")]
1763 fn connect_create_context<F: Fn(&Self) -> Option<gdk::GLContext> + 'static>(
1764 &self,
1765 f: F,
1766 ) -> SignalHandlerId {
1767 unsafe extern "C" fn create_context_trampoline<
1768 P: IsA<GLArea>,
1769 F: Fn(&P) -> Option<gdk::GLContext> + 'static,
1770 >(
1771 this: *mut ffi::GtkGLArea,
1772 f: glib::ffi::gpointer,
1773 ) -> *mut gdk::ffi::GdkGLContext {
1774 unsafe {
1775 let f: &F = &*(f as *const F);
1776 f(GLArea::from_glib_borrow(this).unsafe_cast_ref()).to_glib_full()
1777 }
1778 }
1779 unsafe {
1780 let f: Box_<F> = Box_::new(f);
1781 connect_raw(
1782 self.as_ptr() as *mut _,
1783 c"create-context".as_ptr(),
1784 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1785 create_context_trampoline::<Self, F> as *const (),
1786 )),
1787 Box_::into_raw(f),
1788 )
1789 }
1790 }
1791
1792 /// The ::render signal is emitted every time the contents
1793 /// of the [`GLArea`][crate::GLArea] should be redrawn.
1794 ///
1795 /// The `context` is bound to the `area` prior to emitting this function,
1796 /// and the buffers are painted to the window once the emission terminates.
1797 /// ## `context`
1798 /// the [`gdk::GLContext`][crate::gdk::GLContext] used by `area`
1799 ///
1800 /// # Returns
1801 ///
1802 /// [`true`] to stop other handlers from being invoked for the event.
1803 /// [`false`] to propagate the event further.
1804 #[doc(alias = "render")]
1805 fn connect_render<F: Fn(&Self, &gdk::GLContext) -> glib::Propagation + 'static>(
1806 &self,
1807 f: F,
1808 ) -> SignalHandlerId {
1809 unsafe extern "C" fn render_trampoline<
1810 P: IsA<GLArea>,
1811 F: Fn(&P, &gdk::GLContext) -> glib::Propagation + 'static,
1812 >(
1813 this: *mut ffi::GtkGLArea,
1814 context: *mut gdk::ffi::GdkGLContext,
1815 f: glib::ffi::gpointer,
1816 ) -> glib::ffi::gboolean {
1817 unsafe {
1818 let f: &F = &*(f as *const F);
1819 f(
1820 GLArea::from_glib_borrow(this).unsafe_cast_ref(),
1821 &from_glib_borrow(context),
1822 )
1823 .into_glib()
1824 }
1825 }
1826 unsafe {
1827 let f: Box_<F> = Box_::new(f);
1828 connect_raw(
1829 self.as_ptr() as *mut _,
1830 c"render".as_ptr(),
1831 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1832 render_trampoline::<Self, F> as *const (),
1833 )),
1834 Box_::into_raw(f),
1835 )
1836 }
1837 }
1838
1839 /// The ::resize signal is emitted once when the widget is realized, and
1840 /// then each time the widget is changed while realized. This is useful
1841 /// in order to keep GL state up to date with the widget size, like for
1842 /// instance camera properties which may depend on the width/height ratio.
1843 ///
1844 /// The GL context for the area is guaranteed to be current when this signal
1845 /// is emitted.
1846 ///
1847 /// The default handler sets up the GL viewport.
1848 /// ## `width`
1849 /// the width of the viewport
1850 /// ## `height`
1851 /// the height of the viewport
1852 #[doc(alias = "resize")]
1853 fn connect_resize<F: Fn(&Self, i32, i32) + 'static>(&self, f: F) -> SignalHandlerId {
1854 unsafe extern "C" fn resize_trampoline<P: IsA<GLArea>, F: Fn(&P, i32, i32) + 'static>(
1855 this: *mut ffi::GtkGLArea,
1856 width: std::ffi::c_int,
1857 height: std::ffi::c_int,
1858 f: glib::ffi::gpointer,
1859 ) {
1860 unsafe {
1861 let f: &F = &*(f as *const F);
1862 f(
1863 GLArea::from_glib_borrow(this).unsafe_cast_ref(),
1864 width,
1865 height,
1866 )
1867 }
1868 }
1869 unsafe {
1870 let f: Box_<F> = Box_::new(f);
1871 connect_raw(
1872 self.as_ptr() as *mut _,
1873 c"resize".as_ptr(),
1874 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1875 resize_trampoline::<Self, F> as *const (),
1876 )),
1877 Box_::into_raw(f),
1878 )
1879 }
1880 }
1881
1882 #[doc(alias = "auto-render")]
1883 fn connect_auto_render_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1884 unsafe extern "C" fn notify_auto_render_trampoline<P: IsA<GLArea>, F: Fn(&P) + 'static>(
1885 this: *mut ffi::GtkGLArea,
1886 _param_spec: glib::ffi::gpointer,
1887 f: glib::ffi::gpointer,
1888 ) {
1889 unsafe {
1890 let f: &F = &*(f as *const F);
1891 f(GLArea::from_glib_borrow(this).unsafe_cast_ref())
1892 }
1893 }
1894 unsafe {
1895 let f: Box_<F> = Box_::new(f);
1896 connect_raw(
1897 self.as_ptr() as *mut _,
1898 c"notify::auto-render".as_ptr(),
1899 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1900 notify_auto_render_trampoline::<Self, F> as *const (),
1901 )),
1902 Box_::into_raw(f),
1903 )
1904 }
1905 }
1906
1907 #[doc(alias = "context")]
1908 fn connect_context_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1909 unsafe extern "C" fn notify_context_trampoline<P: IsA<GLArea>, F: Fn(&P) + 'static>(
1910 this: *mut ffi::GtkGLArea,
1911 _param_spec: glib::ffi::gpointer,
1912 f: glib::ffi::gpointer,
1913 ) {
1914 unsafe {
1915 let f: &F = &*(f as *const F);
1916 f(GLArea::from_glib_borrow(this).unsafe_cast_ref())
1917 }
1918 }
1919 unsafe {
1920 let f: Box_<F> = Box_::new(f);
1921 connect_raw(
1922 self.as_ptr() as *mut _,
1923 c"notify::context".as_ptr(),
1924 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1925 notify_context_trampoline::<Self, F> as *const (),
1926 )),
1927 Box_::into_raw(f),
1928 )
1929 }
1930 }
1931
1932 #[doc(alias = "has-alpha")]
1933 fn connect_has_alpha_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1934 unsafe extern "C" fn notify_has_alpha_trampoline<P: IsA<GLArea>, F: Fn(&P) + 'static>(
1935 this: *mut ffi::GtkGLArea,
1936 _param_spec: glib::ffi::gpointer,
1937 f: glib::ffi::gpointer,
1938 ) {
1939 unsafe {
1940 let f: &F = &*(f as *const F);
1941 f(GLArea::from_glib_borrow(this).unsafe_cast_ref())
1942 }
1943 }
1944 unsafe {
1945 let f: Box_<F> = Box_::new(f);
1946 connect_raw(
1947 self.as_ptr() as *mut _,
1948 c"notify::has-alpha".as_ptr(),
1949 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1950 notify_has_alpha_trampoline::<Self, F> as *const (),
1951 )),
1952 Box_::into_raw(f),
1953 )
1954 }
1955 }
1956
1957 #[doc(alias = "has-depth-buffer")]
1958 fn connect_has_depth_buffer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1959 unsafe extern "C" fn notify_has_depth_buffer_trampoline<
1960 P: IsA<GLArea>,
1961 F: Fn(&P) + 'static,
1962 >(
1963 this: *mut ffi::GtkGLArea,
1964 _param_spec: glib::ffi::gpointer,
1965 f: glib::ffi::gpointer,
1966 ) {
1967 unsafe {
1968 let f: &F = &*(f as *const F);
1969 f(GLArea::from_glib_borrow(this).unsafe_cast_ref())
1970 }
1971 }
1972 unsafe {
1973 let f: Box_<F> = Box_::new(f);
1974 connect_raw(
1975 self.as_ptr() as *mut _,
1976 c"notify::has-depth-buffer".as_ptr(),
1977 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1978 notify_has_depth_buffer_trampoline::<Self, F> as *const (),
1979 )),
1980 Box_::into_raw(f),
1981 )
1982 }
1983 }
1984
1985 #[doc(alias = "has-stencil-buffer")]
1986 fn connect_has_stencil_buffer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1987 unsafe extern "C" fn notify_has_stencil_buffer_trampoline<
1988 P: IsA<GLArea>,
1989 F: Fn(&P) + 'static,
1990 >(
1991 this: *mut ffi::GtkGLArea,
1992 _param_spec: glib::ffi::gpointer,
1993 f: glib::ffi::gpointer,
1994 ) {
1995 unsafe {
1996 let f: &F = &*(f as *const F);
1997 f(GLArea::from_glib_borrow(this).unsafe_cast_ref())
1998 }
1999 }
2000 unsafe {
2001 let f: Box_<F> = Box_::new(f);
2002 connect_raw(
2003 self.as_ptr() as *mut _,
2004 c"notify::has-stencil-buffer".as_ptr(),
2005 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2006 notify_has_stencil_buffer_trampoline::<Self, F> as *const (),
2007 )),
2008 Box_::into_raw(f),
2009 )
2010 }
2011 }
2012
2013 #[doc(alias = "use-es")]
2014 fn connect_use_es_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2015 unsafe extern "C" fn notify_use_es_trampoline<P: IsA<GLArea>, F: Fn(&P) + 'static>(
2016 this: *mut ffi::GtkGLArea,
2017 _param_spec: glib::ffi::gpointer,
2018 f: glib::ffi::gpointer,
2019 ) {
2020 unsafe {
2021 let f: &F = &*(f as *const F);
2022 f(GLArea::from_glib_borrow(this).unsafe_cast_ref())
2023 }
2024 }
2025 unsafe {
2026 let f: Box_<F> = Box_::new(f);
2027 connect_raw(
2028 self.as_ptr() as *mut _,
2029 c"notify::use-es".as_ptr(),
2030 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2031 notify_use_es_trampoline::<Self, F> as *const (),
2032 )),
2033 Box_::into_raw(f),
2034 )
2035 }
2036 }
2037}
2038
2039impl<O: IsA<GLArea>> GLAreaExt for O {}