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