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