gtk/auto/notebook.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, DirectionType, NotebookTab, PackType, PositionType, ResizeMode,
7 Widget, ffi,
8};
9use glib::{
10 object::ObjectType as _,
11 prelude::*,
12 signal::{SignalHandlerId, connect_raw},
13 translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18 /// The [`Notebook`][crate::Notebook] widget is a [`Container`][crate::Container] whose children are pages that
19 /// can be switched between using tab labels along one edge.
20 ///
21 /// There are many configuration options for GtkNotebook. Among other
22 /// things, you can choose on which edge the tabs appear
23 /// (see [`NotebookExt::set_tab_pos()`][crate::prelude::NotebookExt::set_tab_pos()]), whether, if there are too many
24 /// tabs to fit the notebook should be made bigger or scrolling
25 /// arrows added (see [`NotebookExt::set_scrollable()`][crate::prelude::NotebookExt::set_scrollable()]), and whether there
26 /// will be a popup menu allowing the users to switch pages.
27 /// (see [`NotebookExt::popup_enable()`][crate::prelude::NotebookExt::popup_enable()], [`NotebookExt::popup_disable()`][crate::prelude::NotebookExt::popup_disable()])
28 ///
29 /// # GtkNotebook as GtkBuildable
30 ///
31 /// The GtkNotebook implementation of the [`Buildable`][crate::Buildable] interface
32 /// supports placing children into tabs by specifying “tab” as the
33 /// “type” attribute of a ``<child>`` element. Note that the content
34 /// of the tab must be created before the tab can be filled.
35 /// A tab child can be specified without specifying a ``<child>``
36 /// type attribute.
37 ///
38 /// To add a child widget in the notebooks action area, specify
39 /// "action-start" or “action-end” as the “type” attribute of the
40 /// ``<child>`` element.
41 ///
42 /// An example of a UI definition fragment with GtkNotebook:
43 ///
44 ///
45 ///
46 /// **⚠️ The following code is in xml ⚠️**
47 ///
48 /// ```xml
49 /// <object class="GtkNotebook">
50 /// <child>
51 /// <object class="GtkLabel" id="notebook-content">
52 /// <property name="label">Content</property>
53 /// </object>
54 /// </child>
55 /// <child type="tab">
56 /// <object class="GtkLabel" id="notebook-tab">
57 /// <property name="label">Tab</property>
58 /// </object>
59 /// </child>
60 /// </object>
61 /// ```
62 ///
63 /// # CSS nodes
64 ///
65 ///
66 ///
67 /// **⚠️ The following code is in plain ⚠️**
68 ///
69 /// ```plain
70 /// notebook
71 /// ├── header.top
72 /// │ ├── [<action widget>]
73 /// │ ├── tabs
74 /// │ │ ├── [arrow]
75 /// │ │ ├── tab
76 /// │ │ │ ╰── <tab label>
77 /// ┊ ┊ ┊
78 /// │ │ ├── tab[.reorderable-page]
79 /// │ │ │ ╰── <tab label>
80 /// │ │ ╰── [arrow]
81 /// │ ╰── [<action widget>]
82 /// │
83 /// ╰── stack
84 /// ├── <child>
85 /// ┊
86 /// ╰── <child>
87 /// ```
88 ///
89 /// GtkNotebook has a main CSS node with name notebook, a subnode
90 /// with name header and below that a subnode with name tabs which
91 /// contains one subnode per tab with name tab.
92 ///
93 /// If action widgets are present, their CSS nodes are placed next
94 /// to the tabs node. If the notebook is scrollable, CSS nodes with
95 /// name arrow are placed as first and last child of the tabs node.
96 ///
97 /// The main node gets the .frame style class when the notebook
98 /// has a border (see [`NotebookExt::set_show_border()`][crate::prelude::NotebookExt::set_show_border()]).
99 ///
100 /// The header node gets one of the style class .top, .bottom,
101 /// .left or .right, depending on where the tabs are placed. For
102 /// reorderable pages, the tab node gets the .reorderable-page class.
103 ///
104 /// A tab node gets the .dnd style class while it is moved with drag-and-drop.
105 ///
106 /// The nodes are always arranged from left-to-right, regarldess of text direction.
107 ///
108 /// ## Properties
109 ///
110 ///
111 /// #### `enable-popup`
112 /// Readable | Writable
113 ///
114 ///
115 /// #### `group-name`
116 /// Group name for tab drag and drop.
117 ///
118 /// Readable | Writable
119 ///
120 ///
121 /// #### `page`
122 /// Readable | Writable
123 ///
124 ///
125 /// #### `scrollable`
126 /// Readable | Writable
127 ///
128 ///
129 /// #### `show-border`
130 /// Readable | Writable
131 ///
132 ///
133 /// #### `show-tabs`
134 /// Readable | Writable
135 ///
136 ///
137 /// #### `tab-pos`
138 /// Readable | Writable
139 /// <details><summary><h4>Container</h4></summary>
140 ///
141 ///
142 /// #### `border-width`
143 /// Readable | Writable
144 ///
145 ///
146 /// #### `child`
147 /// Writable
148 ///
149 ///
150 /// #### `resize-mode`
151 /// Readable | Writable
152 /// </details>
153 /// <details><summary><h4>Widget</h4></summary>
154 ///
155 ///
156 /// #### `app-paintable`
157 /// Readable | Writable
158 ///
159 ///
160 /// #### `can-default`
161 /// Readable | Writable
162 ///
163 ///
164 /// #### `can-focus`
165 /// Readable | Writable
166 ///
167 ///
168 /// #### `composite-child`
169 /// Readable
170 ///
171 ///
172 /// #### `double-buffered`
173 /// Whether the widget is double buffered.
174 ///
175 /// Readable | Writable
176 ///
177 ///
178 /// #### `events`
179 /// Readable | Writable
180 ///
181 ///
182 /// #### `expand`
183 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
184 ///
185 /// Readable | Writable
186 ///
187 ///
188 /// #### `focus-on-click`
189 /// Whether the widget should grab focus when it is clicked with the mouse.
190 ///
191 /// This property is only relevant for widgets that can take focus.
192 ///
193 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
194 /// GtkComboBox) implemented this property individually.
195 ///
196 /// Readable | Writable
197 ///
198 ///
199 /// #### `halign`
200 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
201 ///
202 /// Readable | Writable
203 ///
204 ///
205 /// #### `has-default`
206 /// Readable | Writable
207 ///
208 ///
209 /// #### `has-focus`
210 /// Readable | Writable
211 ///
212 ///
213 /// #### `has-tooltip`
214 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
215 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
216 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
217 /// whether it will provide a tooltip or not.
218 ///
219 /// Note that setting this property to [`true`] for the first time will change
220 /// the event masks of the GdkWindows of this widget to include leave-notify
221 /// and motion-notify events. This cannot and will not be undone when the
222 /// property is set to [`false`] again.
223 ///
224 /// Readable | Writable
225 ///
226 ///
227 /// #### `height-request`
228 /// Readable | Writable
229 ///
230 ///
231 /// #### `hexpand`
232 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
233 ///
234 /// Readable | Writable
235 ///
236 ///
237 /// #### `hexpand-set`
238 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
239 ///
240 /// Readable | Writable
241 ///
242 ///
243 /// #### `is-focus`
244 /// Readable | Writable
245 ///
246 ///
247 /// #### `margin`
248 /// Sets all four sides' margin at once. If read, returns max
249 /// margin on any side.
250 ///
251 /// Readable | Writable
252 ///
253 ///
254 /// #### `margin-bottom`
255 /// Margin on bottom side of widget.
256 ///
257 /// This property adds margin outside of the widget's normal size
258 /// request, the margin will be added in addition to the size from
259 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
260 ///
261 /// Readable | Writable
262 ///
263 ///
264 /// #### `margin-end`
265 /// Margin on end of widget, horizontally. This property supports
266 /// left-to-right and right-to-left text directions.
267 ///
268 /// This property adds margin outside of the widget's normal size
269 /// request, the margin will be added in addition to the size from
270 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
271 ///
272 /// Readable | Writable
273 ///
274 ///
275 /// #### `margin-left`
276 /// Margin on left side of widget.
277 ///
278 /// This property adds margin outside of the widget's normal size
279 /// request, the margin will be added in addition to the size from
280 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
281 ///
282 /// Readable | Writable
283 ///
284 ///
285 /// #### `margin-right`
286 /// Margin on right side of widget.
287 ///
288 /// This property adds margin outside of the widget's normal size
289 /// request, the margin will be added in addition to the size from
290 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
291 ///
292 /// Readable | Writable
293 ///
294 ///
295 /// #### `margin-start`
296 /// Margin on start of widget, horizontally. This property supports
297 /// left-to-right and right-to-left text directions.
298 ///
299 /// This property adds margin outside of the widget's normal size
300 /// request, the margin will be added in addition to the size from
301 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
302 ///
303 /// Readable | Writable
304 ///
305 ///
306 /// #### `margin-top`
307 /// Margin on top side of widget.
308 ///
309 /// This property adds margin outside of the widget's normal size
310 /// request, the margin will be added in addition to the size from
311 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
312 ///
313 /// Readable | Writable
314 ///
315 ///
316 /// #### `name`
317 /// Readable | Writable
318 ///
319 ///
320 /// #### `no-show-all`
321 /// Readable | Writable
322 ///
323 ///
324 /// #### `opacity`
325 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
326 /// more details about window opacity.
327 ///
328 /// Before 3.8 this was only available in GtkWindow
329 ///
330 /// Readable | Writable
331 ///
332 ///
333 /// #### `parent`
334 /// Readable | Writable
335 ///
336 ///
337 /// #### `receives-default`
338 /// Readable | Writable
339 ///
340 ///
341 /// #### `scale-factor`
342 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
343 /// more details about widget scaling.
344 ///
345 /// Readable
346 ///
347 ///
348 /// #### `sensitive`
349 /// Readable | Writable
350 ///
351 ///
352 /// #### `style`
353 /// The style of the widget, which contains information about how it will look (colors, etc).
354 ///
355 /// Readable | Writable
356 ///
357 ///
358 /// #### `tooltip-markup`
359 /// Sets the text of tooltip to be the given string, which is marked up
360 /// with the [Pango text markup language][PangoMarkupFormat].
361 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
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 /// #### `tooltip-text`
375 /// Sets the text of tooltip to be the given string.
376 ///
377 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
378 ///
379 /// This is a convenience property which will take care of getting the
380 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
381 /// will automatically be set to [`true`] and there will be taken care of
382 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
383 ///
384 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
385 /// are set, the last one wins.
386 ///
387 /// Readable | Writable
388 ///
389 ///
390 /// #### `valign`
391 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
392 ///
393 /// Readable | Writable
394 ///
395 ///
396 /// #### `vexpand`
397 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
398 ///
399 /// Readable | Writable
400 ///
401 ///
402 /// #### `vexpand-set`
403 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
404 ///
405 /// Readable | Writable
406 ///
407 ///
408 /// #### `visible`
409 /// Readable | Writable
410 ///
411 ///
412 /// #### `width-request`
413 /// Readable | Writable
414 ///
415 ///
416 /// #### `window`
417 /// The widget's window if it is realized, [`None`] otherwise.
418 ///
419 /// Readable
420 /// </details>
421 ///
422 /// ## Signals
423 ///
424 ///
425 /// #### `change-current-page`
426 /// Action
427 ///
428 ///
429 /// #### `create-window`
430 /// The ::create-window signal is emitted when a detachable
431 /// tab is dropped on the root window.
432 ///
433 /// A handler for this signal can create a window containing
434 /// a notebook where the tab will be attached. It is also
435 /// responsible for moving/resizing the window and adding the
436 /// necessary properties to the notebook (e.g. the
437 /// [`group-name`][struct@crate::Notebook#group-name] ).
438 ///
439 ///
440 ///
441 ///
442 /// #### `focus-tab`
443 /// Action
444 ///
445 ///
446 /// #### `move-focus-out`
447 /// Action
448 ///
449 ///
450 /// #### `page-added`
451 /// the ::page-added signal is emitted in the notebook
452 /// right after a page is added to the notebook.
453 ///
454 ///
455 ///
456 ///
457 /// #### `page-removed`
458 /// the ::page-removed signal is emitted in the notebook
459 /// right after a page is removed from the notebook.
460 ///
461 ///
462 ///
463 ///
464 /// #### `page-reordered`
465 /// the ::page-reordered signal is emitted in the notebook
466 /// right after a page has been reordered.
467 ///
468 ///
469 ///
470 ///
471 /// #### `reorder-tab`
472 /// Action
473 ///
474 ///
475 /// #### `select-page`
476 /// Action
477 ///
478 ///
479 /// #### `switch-page`
480 /// Emitted when the user or a function changes the current page.
481 ///
482 ///
483 /// <details><summary><h4>Container</h4></summary>
484 ///
485 ///
486 /// #### `add`
487 ///
488 ///
489 ///
490 /// #### `check-resize`
491 ///
492 ///
493 ///
494 /// #### `remove`
495 ///
496 ///
497 ///
498 /// #### `set-focus-child`
499 ///
500 /// </details>
501 /// <details><summary><h4>Widget</h4></summary>
502 ///
503 ///
504 /// #### `accel-closures-changed`
505 ///
506 ///
507 ///
508 /// #### `button-press-event`
509 /// The ::button-press-event signal will be emitted when a button
510 /// (typically from a mouse) is pressed.
511 ///
512 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
513 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
514 ///
515 /// This signal will be sent to the grab widget if there is one.
516 ///
517 ///
518 ///
519 ///
520 /// #### `button-release-event`
521 /// The ::button-release-event signal will be emitted when a button
522 /// (typically from a mouse) is released.
523 ///
524 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
525 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
526 ///
527 /// This signal will be sent to the grab widget if there is one.
528 ///
529 ///
530 ///
531 ///
532 /// #### `can-activate-accel`
533 /// Determines whether an accelerator that activates the signal
534 /// identified by `signal_id` can currently be activated.
535 /// This signal is present to allow applications and derived
536 /// widgets to override the default [`Widget`][crate::Widget] handling
537 /// for determining whether an accelerator can be activated.
538 ///
539 ///
540 ///
541 ///
542 /// #### `child-notify`
543 /// The ::child-notify signal is emitted for each
544 /// [child property][child-properties] that has
545 /// changed on an object. The signal's detail holds the property name.
546 ///
547 /// Detailed
548 ///
549 ///
550 /// #### `composited-changed`
551 /// The ::composited-changed signal is emitted when the composited
552 /// status of `widgets` screen changes.
553 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
554 ///
555 /// Action
556 ///
557 ///
558 /// #### `configure-event`
559 /// The ::configure-event signal will be emitted when the size, position or
560 /// stacking of the `widget`'s window has changed.
561 ///
562 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
563 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
564 /// automatically for all new windows.
565 ///
566 ///
567 ///
568 ///
569 /// #### `damage-event`
570 /// Emitted when a redirected window belonging to `widget` gets drawn into.
571 /// The region/area members of the event shows what area of the redirected
572 /// drawable was drawn into.
573 ///
574 ///
575 ///
576 ///
577 /// #### `delete-event`
578 /// The ::delete-event signal is emitted if a user requests that
579 /// a toplevel window is closed. The default handler for this signal
580 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
581 /// this signal will cause the window to be hidden instead, so that
582 /// it can later be shown again without reconstructing it.
583 ///
584 ///
585 ///
586 ///
587 /// #### `destroy`
588 /// Signals that all holders of a reference to the widget should release
589 /// the reference that they hold. May result in finalization of the widget
590 /// if all references are released.
591 ///
592 /// This signal is not suitable for saving widget state.
593 ///
594 ///
595 ///
596 ///
597 /// #### `destroy-event`
598 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
599 /// You rarely get this signal, because most widgets disconnect themselves
600 /// from their window before they destroy it, so no widget owns the
601 /// window at destroy time.
602 ///
603 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
604 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
605 /// automatically for all new windows.
606 ///
607 ///
608 ///
609 ///
610 /// #### `direction-changed`
611 /// The ::direction-changed signal is emitted when the text direction
612 /// of a widget changes.
613 ///
614 ///
615 ///
616 ///
617 /// #### `drag-begin`
618 /// The ::drag-begin signal is emitted on the drag source when a drag is
619 /// started. A typical reason to connect to this signal is to set up a
620 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
621 ///
622 /// Note that some widgets set up a drag icon in the default handler of
623 /// this signal, so you may have to use `g_signal_connect_after()` to
624 /// override what the default handler did.
625 ///
626 ///
627 ///
628 ///
629 /// #### `drag-data-delete`
630 /// The ::drag-data-delete signal is emitted on the drag source when a drag
631 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
632 /// handler is responsible for deleting the data that has been dropped. What
633 /// "delete" means depends on the context of the drag operation.
634 ///
635 ///
636 ///
637 ///
638 /// #### `drag-data-get`
639 /// The ::drag-data-get signal is emitted on the drag source when the drop
640 /// site requests the data which is dragged. It is the responsibility of
641 /// the signal handler to fill `data` with the data in the format which
642 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
643 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
644 ///
645 ///
646 ///
647 ///
648 /// #### `drag-data-received`
649 /// The ::drag-data-received signal is emitted on the drop site when the
650 /// dragged data has been received. If the data was received in order to
651 /// determine whether the drop will be accepted, the handler is expected
652 /// to call `gdk_drag_status()` and not finish the drag.
653 /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
654 /// (and this is the last target to be received), the handler for this
655 /// signal is expected to process the received data and then call
656 /// `gtk_drag_finish()`, setting the `success` parameter depending on
657 /// whether the data was processed successfully.
658 ///
659 /// Applications must create some means to determine why the signal was emitted
660 /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
661 ///
662 /// The handler may inspect the selected action with
663 /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
664 /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
665 /// shown in the following example:
666 ///
667 ///
668 /// **⚠️ The following code is in C ⚠️**
669 ///
670 /// ```C
671 /// void
672 /// drag_data_received (GtkWidget *widget,
673 /// GdkDragContext *context,
674 /// gint x,
675 /// gint y,
676 /// GtkSelectionData *data,
677 /// guint info,
678 /// guint time)
679 /// {
680 /// if ((data->length >= 0) && (data->format == 8))
681 /// {
682 /// GdkDragAction action;
683 ///
684 /// // handle data here
685 ///
686 /// action = gdk_drag_context_get_selected_action (context);
687 /// if (action == GDK_ACTION_ASK)
688 /// {
689 /// GtkWidget *dialog;
690 /// gint response;
691 ///
692 /// dialog = gtk_message_dialog_new (NULL,
693 /// GTK_DIALOG_MODAL |
694 /// GTK_DIALOG_DESTROY_WITH_PARENT,
695 /// GTK_MESSAGE_INFO,
696 /// GTK_BUTTONS_YES_NO,
697 /// "Move the data ?\n");
698 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
699 /// gtk_widget_destroy (dialog);
700 ///
701 /// if (response == GTK_RESPONSE_YES)
702 /// action = GDK_ACTION_MOVE;
703 /// else
704 /// action = GDK_ACTION_COPY;
705 /// }
706 ///
707 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
708 /// }
709 /// else
710 /// gtk_drag_finish (context, FALSE, FALSE, time);
711 /// }
712 /// ```
713 ///
714 ///
715 ///
716 ///
717 /// #### `drag-drop`
718 /// The ::drag-drop signal is emitted on the drop site when the user drops
719 /// the data onto the widget. The signal handler must determine whether
720 /// the cursor position is in a drop zone or not. If it is not in a drop
721 /// zone, it returns [`false`] and no further processing is necessary.
722 /// Otherwise, the handler returns [`true`]. In this case, the handler must
723 /// ensure that `gtk_drag_finish()` is called to let the source know that
724 /// the drop is done. The call to `gtk_drag_finish()` can be done either
725 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
726 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
727 /// or more of the supported targets.
728 ///
729 ///
730 ///
731 ///
732 /// #### `drag-end`
733 /// The ::drag-end signal is emitted on the drag source when a drag is
734 /// finished. A typical reason to connect to this signal is to undo
735 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
736 ///
737 ///
738 ///
739 ///
740 /// #### `drag-failed`
741 /// The ::drag-failed signal is emitted on the drag source when a drag has
742 /// failed. The signal handler may hook custom code to handle a failed DnD
743 /// operation based on the type of error, it returns [`true`] is the failure has
744 /// been already handled (not showing the default "drag operation failed"
745 /// animation), otherwise it returns [`false`].
746 ///
747 ///
748 ///
749 ///
750 /// #### `drag-leave`
751 /// The ::drag-leave signal is emitted on the drop site when the cursor
752 /// leaves the widget. A typical reason to connect to this signal is to
753 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
754 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
755 ///
756 ///
757 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
758 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
759 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
760 ///
761 ///
762 ///
763 ///
764 /// #### `drag-motion`
765 /// The ::drag-motion signal is emitted on the drop site when the user
766 /// moves the cursor over the widget during a drag. The signal handler
767 /// must determine whether the cursor position is in a drop zone or not.
768 /// If it is not in a drop zone, it returns [`false`] and no further processing
769 /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
770 /// handler is responsible for providing the necessary information for
771 /// displaying feedback to the user, by calling `gdk_drag_status()`.
772 ///
773 /// If the decision whether the drop will be accepted or rejected can't be
774 /// made based solely on the cursor position and the type of the data, the
775 /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
776 /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
777 /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
778 /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
779 /// when using the drag-motion signal that way.
780 ///
781 /// Also note that there is no drag-enter signal. The drag receiver has to
782 /// keep track of whether he has received any drag-motion signals since the
783 /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
784 /// an "enter" signal. Upon an "enter", the handler will typically highlight
785 /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
786 ///
787 ///
788 /// **⚠️ The following code is in C ⚠️**
789 ///
790 /// ```C
791 /// static void
792 /// drag_motion (GtkWidget *widget,
793 /// GdkDragContext *context,
794 /// gint x,
795 /// gint y,
796 /// guint time)
797 /// {
798 /// GdkAtom target;
799 ///
800 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
801 ///
802 /// if (!private_data->drag_highlight)
803 /// {
804 /// private_data->drag_highlight = 1;
805 /// gtk_drag_highlight (widget);
806 /// }
807 ///
808 /// target = gtk_drag_dest_find_target (widget, context, NULL);
809 /// if (target == GDK_NONE)
810 /// gdk_drag_status (context, 0, time);
811 /// else
812 /// {
813 /// private_data->pending_status
814 /// = gdk_drag_context_get_suggested_action (context);
815 /// gtk_drag_get_data (widget, context, target, time);
816 /// }
817 ///
818 /// return TRUE;
819 /// }
820 ///
821 /// static void
822 /// drag_data_received (GtkWidget *widget,
823 /// GdkDragContext *context,
824 /// gint x,
825 /// gint y,
826 /// GtkSelectionData *selection_data,
827 /// guint info,
828 /// guint time)
829 /// {
830 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
831 ///
832 /// if (private_data->suggested_action)
833 /// {
834 /// private_data->suggested_action = 0;
835 ///
836 /// // We are getting this data due to a request in drag_motion,
837 /// // rather than due to a request in drag_drop, so we are just
838 /// // supposed to call gdk_drag_status(), not actually paste in
839 /// // the data.
840 ///
841 /// str = gtk_selection_data_get_text (selection_data);
842 /// if (!data_is_acceptable (str))
843 /// gdk_drag_status (context, 0, time);
844 /// else
845 /// gdk_drag_status (context,
846 /// private_data->suggested_action,
847 /// time);
848 /// }
849 /// else
850 /// {
851 /// // accept the drop
852 /// }
853 /// }
854 /// ```
855 ///
856 ///
857 ///
858 ///
859 /// #### `draw`
860 /// This signal is emitted when a widget is supposed to render itself.
861 /// The `widget`'s top left corner must be painted at the origin of
862 /// the passed in context and be sized to the values returned by
863 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
864 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
865 ///
866 /// Signal handlers connected to this signal can modify the cairo
867 /// context passed as `cr` in any way they like and don't need to
868 /// restore it. The signal emission takes care of calling `cairo_save()`
869 /// before and `cairo_restore()` after invoking the handler.
870 ///
871 /// The signal handler will get a `cr` with a clip region already set to the
872 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
873 /// widgets that want to avoid redrawing themselves completely can get the full
874 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
875 /// get a finer-grained representation of the dirty region with
876 /// `cairo_copy_clip_rectangle_list()`.
877 ///
878 ///
879 ///
880 ///
881 /// #### `enter-notify-event`
882 /// The ::enter-notify-event will be emitted when the pointer enters
883 /// the `widget`'s window.
884 ///
885 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
886 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
887 ///
888 /// This signal will be sent to the grab widget if there is one.
889 ///
890 ///
891 ///
892 ///
893 /// #### `event`
894 /// The GTK+ main loop will emit three signals for each GDK event delivered
895 /// to a widget: one generic ::event signal, another, more specific,
896 /// signal that matches the type of event delivered (e.g.
897 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
898 /// [`event-after`][struct@crate::Widget#event-after] signal.
899 ///
900 ///
901 ///
902 ///
903 /// #### `event-after`
904 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
905 /// the second more specific signal, ::event-after will be emitted
906 /// regardless of the previous two signals handlers return values.
907 ///
908 ///
909 ///
910 ///
911 /// #### `focus`
912 ///
913 ///
914 ///
915 /// #### `focus-in-event`
916 /// The ::focus-in-event signal will be emitted when the keyboard focus
917 /// enters the `widget`'s window.
918 ///
919 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
920 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
921 ///
922 ///
923 ///
924 ///
925 /// #### `focus-out-event`
926 /// The ::focus-out-event signal will be emitted when the keyboard focus
927 /// leaves the `widget`'s window.
928 ///
929 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
930 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
931 ///
932 ///
933 ///
934 ///
935 /// #### `grab-broken-event`
936 /// Emitted when a pointer or keyboard grab on a window belonging
937 /// to `widget` gets broken.
938 ///
939 /// On X11, this happens when the grab window becomes unviewable
940 /// (i.e. it or one of its ancestors is unmapped), or if the same
941 /// application grabs the pointer or keyboard again.
942 ///
943 ///
944 ///
945 ///
946 /// #### `grab-focus`
947 /// Action
948 ///
949 ///
950 /// #### `grab-notify`
951 /// The ::grab-notify signal is emitted when a widget becomes
952 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
953 /// another widget, or when it becomes unshadowed due to a grab
954 /// being removed.
955 ///
956 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
957 /// grab widget in the grab stack of its window group is not
958 /// its ancestor.
959 ///
960 ///
961 ///
962 ///
963 /// #### `hide`
964 /// The ::hide signal is emitted when `widget` is hidden, for example with
965 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
966 ///
967 ///
968 ///
969 ///
970 /// #### `hierarchy-changed`
971 /// The ::hierarchy-changed signal is emitted when the
972 /// anchored state of a widget changes. A widget is
973 /// “anchored” when its toplevel
974 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
975 /// a widget changes from un-anchored to anchored or vice-versa.
976 ///
977 ///
978 ///
979 ///
980 /// #### `key-press-event`
981 /// The ::key-press-event signal is emitted when a key is pressed. The signal
982 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
983 ///
984 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
985 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
986 ///
987 /// This signal will be sent to the grab widget if there is one.
988 ///
989 ///
990 ///
991 ///
992 /// #### `key-release-event`
993 /// The ::key-release-event signal is emitted when a key is released.
994 ///
995 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
996 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
997 ///
998 /// This signal will be sent to the grab widget if there is one.
999 ///
1000 ///
1001 ///
1002 ///
1003 /// #### `keynav-failed`
1004 /// Gets emitted if keyboard navigation fails.
1005 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
1006 ///
1007 ///
1008 ///
1009 ///
1010 /// #### `leave-notify-event`
1011 /// The ::leave-notify-event will be emitted when the pointer leaves
1012 /// the `widget`'s window.
1013 ///
1014 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1015 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
1016 ///
1017 /// This signal will be sent to the grab widget if there is one.
1018 ///
1019 ///
1020 ///
1021 ///
1022 /// #### `map`
1023 /// The ::map signal is emitted when `widget` is going to be mapped, that is
1024 /// when the widget is visible (which is controlled with
1025 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
1026 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
1027 /// be emitted.
1028 ///
1029 /// The ::map signal can be used to determine whether a widget will be drawn,
1030 /// for instance it can resume an animation that was stopped during the
1031 /// emission of [`unmap`][struct@crate::Widget#unmap].
1032 ///
1033 ///
1034 ///
1035 ///
1036 /// #### `map-event`
1037 /// The ::map-event signal will be emitted when the `widget`'s window is
1038 /// mapped. A window is mapped when it becomes visible on the screen.
1039 ///
1040 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1041 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1042 /// automatically for all new windows.
1043 ///
1044 ///
1045 ///
1046 ///
1047 /// #### `mnemonic-activate`
1048 /// The default handler for this signal activates `widget` if `group_cycling`
1049 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
1050 ///
1051 ///
1052 ///
1053 ///
1054 /// #### `motion-notify-event`
1055 /// The ::motion-notify-event signal is emitted when the pointer moves
1056 /// over the widget's [`gdk::Window`][crate::gdk::Window].
1057 ///
1058 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1059 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1060 ///
1061 /// This signal will be sent to the grab widget if there is one.
1062 ///
1063 ///
1064 ///
1065 ///
1066 /// #### `move-focus`
1067 /// Action
1068 ///
1069 ///
1070 /// #### `parent-set`
1071 /// The ::parent-set signal is emitted when a new parent
1072 /// has been set on a widget.
1073 ///
1074 ///
1075 ///
1076 ///
1077 /// #### `popup-menu`
1078 /// This signal gets emitted whenever a widget should pop up a context
1079 /// menu. This usually happens through the standard key binding mechanism;
1080 /// by pressing a certain key while a widget is focused, the user can cause
1081 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1082 /// a menu with clipboard commands. See the
1083 /// [Popup Menu Migration Checklist][checklist-popup-menu]
1084 /// for an example of how to use this signal.
1085 ///
1086 /// Action
1087 ///
1088 ///
1089 /// #### `property-notify-event`
1090 /// The ::property-notify-event signal will be emitted when a property on
1091 /// the `widget`'s window has been changed or deleted.
1092 ///
1093 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1094 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1095 ///
1096 ///
1097 ///
1098 ///
1099 /// #### `proximity-in-event`
1100 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1101 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1102 ///
1103 /// This signal will be sent to the grab widget if there is one.
1104 ///
1105 ///
1106 ///
1107 ///
1108 /// #### `proximity-out-event`
1109 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1110 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1111 ///
1112 /// This signal will be sent to the grab widget if there is one.
1113 ///
1114 ///
1115 ///
1116 ///
1117 /// #### `query-tooltip`
1118 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1119 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1120 /// focus in keyboard mode.
1121 ///
1122 /// Using the given coordinates, the signal handler should determine
1123 /// whether a tooltip should be shown for `widget`. If this is the case
1124 /// [`true`] should be returned, [`false`] otherwise. Note that if
1125 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1126 /// should not be used.
1127 ///
1128 /// The signal handler is free to manipulate `tooltip` with the therefore
1129 /// destined function calls.
1130 ///
1131 ///
1132 ///
1133 ///
1134 /// #### `realize`
1135 /// The ::realize signal is emitted when `widget` is associated with a
1136 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1137 /// widget has been mapped (that is, it is going to be drawn).
1138 ///
1139 ///
1140 ///
1141 ///
1142 /// #### `screen-changed`
1143 /// The ::screen-changed signal gets emitted when the
1144 /// screen of a widget has changed.
1145 ///
1146 ///
1147 ///
1148 ///
1149 /// #### `scroll-event`
1150 /// The ::scroll-event signal is emitted when a button in the 4 to 7
1151 /// range is pressed. Wheel mice are usually configured to generate
1152 /// button press events for buttons 4 and 5 when the wheel is turned.
1153 ///
1154 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1155 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1156 ///
1157 /// This signal will be sent to the grab widget if there is one.
1158 ///
1159 ///
1160 ///
1161 ///
1162 /// #### `selection-clear-event`
1163 /// The ::selection-clear-event signal will be emitted when the
1164 /// the `widget`'s window has lost ownership of a selection.
1165 ///
1166 ///
1167 ///
1168 ///
1169 /// #### `selection-get`
1170 ///
1171 ///
1172 ///
1173 /// #### `selection-notify-event`
1174 ///
1175 ///
1176 ///
1177 /// #### `selection-received`
1178 ///
1179 ///
1180 ///
1181 /// #### `selection-request-event`
1182 /// The ::selection-request-event signal will be emitted when
1183 /// another client requests ownership of the selection owned by
1184 /// the `widget`'s window.
1185 ///
1186 ///
1187 ///
1188 ///
1189 /// #### `show`
1190 /// The ::show signal is emitted when `widget` is shown, for example with
1191 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1192 ///
1193 ///
1194 ///
1195 ///
1196 /// #### `show-help`
1197 /// Action
1198 ///
1199 ///
1200 /// #### `size-allocate`
1201 ///
1202 ///
1203 ///
1204 /// #### `state-changed`
1205 /// The ::state-changed signal is emitted when the widget state changes.
1206 /// See `gtk_widget_get_state()`.
1207 ///
1208 ///
1209 ///
1210 ///
1211 /// #### `state-flags-changed`
1212 /// The ::state-flags-changed signal is emitted when the widget state
1213 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1214 ///
1215 ///
1216 ///
1217 ///
1218 /// #### `style-set`
1219 /// The ::style-set signal is emitted when a new style has been set
1220 /// on a widget. Note that style-modifying functions like
1221 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1222 ///
1223 /// Note that this signal is emitted for changes to the deprecated
1224 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1225 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1226 ///
1227 ///
1228 ///
1229 ///
1230 /// #### `style-updated`
1231 /// The ::style-updated signal is a convenience signal that is emitted when the
1232 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1233 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1234 ///
1235 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1236 /// cause this signal to be emitted.
1237 ///
1238 ///
1239 ///
1240 ///
1241 /// #### `touch-event`
1242 ///
1243 ///
1244 ///
1245 /// #### `unmap`
1246 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1247 /// means that either it or any of its parents up to the toplevel widget have
1248 /// been set as hidden.
1249 ///
1250 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1251 /// used to, for example, stop an animation on the widget.
1252 ///
1253 ///
1254 ///
1255 ///
1256 /// #### `unmap-event`
1257 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1258 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1259 ///
1260 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1261 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1262 /// automatically for all new windows.
1263 ///
1264 ///
1265 ///
1266 ///
1267 /// #### `unrealize`
1268 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1269 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1270 /// called or the widget has been unmapped (that is, it is going to be
1271 /// hidden).
1272 ///
1273 ///
1274 ///
1275 ///
1276 /// #### `visibility-notify-event`
1277 /// The ::visibility-notify-event will be emitted when the `widget`'s
1278 /// window is obscured or unobscured.
1279 ///
1280 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1281 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1282 ///
1283 ///
1284 ///
1285 ///
1286 /// #### `window-state-event`
1287 /// The ::window-state-event will be emitted when the state of the
1288 /// toplevel window associated to the `widget` changes.
1289 ///
1290 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1291 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1292 /// this mask automatically for all new windows.
1293 ///
1294 ///
1295 /// </details>
1296 ///
1297 /// # Implements
1298 ///
1299 /// [`NotebookExt`][trait@crate::prelude::NotebookExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`NotebookExtManual`][trait@crate::prelude::NotebookExtManual], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1300 #[doc(alias = "GtkNotebook")]
1301 pub struct Notebook(Object<ffi::GtkNotebook, ffi::GtkNotebookClass>) @extends Container, Widget, @implements Buildable;
1302
1303 match fn {
1304 type_ => || ffi::gtk_notebook_get_type(),
1305 }
1306}
1307
1308impl Notebook {
1309 pub const NONE: Option<&'static Notebook> = None;
1310
1311 /// Creates a new [`Notebook`][crate::Notebook] widget with no pages.
1312 ///
1313 /// # Returns
1314 ///
1315 /// the newly created [`Notebook`][crate::Notebook]
1316 #[doc(alias = "gtk_notebook_new")]
1317 pub fn new() -> Notebook {
1318 assert_initialized_main_thread!();
1319 unsafe { Widget::from_glib_none(ffi::gtk_notebook_new()).unsafe_cast() }
1320 }
1321
1322 // rustdoc-stripper-ignore-next
1323 /// Creates a new builder-pattern struct instance to construct [`Notebook`] objects.
1324 ///
1325 /// This method returns an instance of [`NotebookBuilder`](crate::builders::NotebookBuilder) which can be used to create [`Notebook`] objects.
1326 pub fn builder() -> NotebookBuilder {
1327 NotebookBuilder::new()
1328 }
1329}
1330
1331impl Default for Notebook {
1332 fn default() -> Self {
1333 Self::new()
1334 }
1335}
1336
1337// rustdoc-stripper-ignore-next
1338/// A [builder-pattern] type to construct [`Notebook`] objects.
1339///
1340/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1341#[must_use = "The builder must be built to be used"]
1342pub struct NotebookBuilder {
1343 builder: glib::object::ObjectBuilder<'static, Notebook>,
1344}
1345
1346impl NotebookBuilder {
1347 fn new() -> Self {
1348 Self {
1349 builder: glib::object::Object::builder(),
1350 }
1351 }
1352
1353 pub fn enable_popup(self, enable_popup: bool) -> Self {
1354 Self {
1355 builder: self.builder.property("enable-popup", enable_popup),
1356 }
1357 }
1358
1359 /// Group name for tab drag and drop.
1360 pub fn group_name(self, group_name: impl Into<glib::GString>) -> Self {
1361 Self {
1362 builder: self.builder.property("group-name", group_name.into()),
1363 }
1364 }
1365
1366 pub fn page(self, page: i32) -> Self {
1367 Self {
1368 builder: self.builder.property("page", page),
1369 }
1370 }
1371
1372 pub fn scrollable(self, scrollable: bool) -> Self {
1373 Self {
1374 builder: self.builder.property("scrollable", scrollable),
1375 }
1376 }
1377
1378 pub fn show_border(self, show_border: bool) -> Self {
1379 Self {
1380 builder: self.builder.property("show-border", show_border),
1381 }
1382 }
1383
1384 pub fn show_tabs(self, show_tabs: bool) -> Self {
1385 Self {
1386 builder: self.builder.property("show-tabs", show_tabs),
1387 }
1388 }
1389
1390 pub fn tab_pos(self, tab_pos: PositionType) -> Self {
1391 Self {
1392 builder: self.builder.property("tab-pos", tab_pos),
1393 }
1394 }
1395
1396 pub fn border_width(self, border_width: u32) -> Self {
1397 Self {
1398 builder: self.builder.property("border-width", border_width),
1399 }
1400 }
1401
1402 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1403 Self {
1404 builder: self.builder.property("child", child.clone().upcast()),
1405 }
1406 }
1407
1408 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1409 Self {
1410 builder: self.builder.property("resize-mode", resize_mode),
1411 }
1412 }
1413
1414 pub fn app_paintable(self, app_paintable: bool) -> Self {
1415 Self {
1416 builder: self.builder.property("app-paintable", app_paintable),
1417 }
1418 }
1419
1420 pub fn can_default(self, can_default: bool) -> Self {
1421 Self {
1422 builder: self.builder.property("can-default", can_default),
1423 }
1424 }
1425
1426 pub fn can_focus(self, can_focus: bool) -> Self {
1427 Self {
1428 builder: self.builder.property("can-focus", can_focus),
1429 }
1430 }
1431
1432 pub fn events(self, events: gdk::EventMask) -> Self {
1433 Self {
1434 builder: self.builder.property("events", events),
1435 }
1436 }
1437
1438 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1439 pub fn expand(self, expand: bool) -> Self {
1440 Self {
1441 builder: self.builder.property("expand", expand),
1442 }
1443 }
1444
1445 /// Whether the widget should grab focus when it is clicked with the mouse.
1446 ///
1447 /// This property is only relevant for widgets that can take focus.
1448 ///
1449 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1450 /// GtkComboBox) implemented this property individually.
1451 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1452 Self {
1453 builder: self.builder.property("focus-on-click", focus_on_click),
1454 }
1455 }
1456
1457 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1458 pub fn halign(self, halign: Align) -> Self {
1459 Self {
1460 builder: self.builder.property("halign", halign),
1461 }
1462 }
1463
1464 pub fn has_default(self, has_default: bool) -> Self {
1465 Self {
1466 builder: self.builder.property("has-default", has_default),
1467 }
1468 }
1469
1470 pub fn has_focus(self, has_focus: bool) -> Self {
1471 Self {
1472 builder: self.builder.property("has-focus", has_focus),
1473 }
1474 }
1475
1476 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1477 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1478 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1479 /// whether it will provide a tooltip or not.
1480 ///
1481 /// Note that setting this property to [`true`] for the first time will change
1482 /// the event masks of the GdkWindows of this widget to include leave-notify
1483 /// and motion-notify events. This cannot and will not be undone when the
1484 /// property is set to [`false`] again.
1485 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1486 Self {
1487 builder: self.builder.property("has-tooltip", has_tooltip),
1488 }
1489 }
1490
1491 pub fn height_request(self, height_request: i32) -> Self {
1492 Self {
1493 builder: self.builder.property("height-request", height_request),
1494 }
1495 }
1496
1497 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1498 pub fn hexpand(self, hexpand: bool) -> Self {
1499 Self {
1500 builder: self.builder.property("hexpand", hexpand),
1501 }
1502 }
1503
1504 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1505 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1506 Self {
1507 builder: self.builder.property("hexpand-set", hexpand_set),
1508 }
1509 }
1510
1511 pub fn is_focus(self, is_focus: bool) -> Self {
1512 Self {
1513 builder: self.builder.property("is-focus", is_focus),
1514 }
1515 }
1516
1517 /// Sets all four sides' margin at once. If read, returns max
1518 /// margin on any side.
1519 pub fn margin(self, margin: i32) -> Self {
1520 Self {
1521 builder: self.builder.property("margin", margin),
1522 }
1523 }
1524
1525 /// Margin on bottom side of widget.
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_bottom(self, margin_bottom: i32) -> Self {
1531 Self {
1532 builder: self.builder.property("margin-bottom", margin_bottom),
1533 }
1534 }
1535
1536 /// Margin on end of widget, horizontally. This property supports
1537 /// left-to-right and right-to-left text directions.
1538 ///
1539 /// This property adds margin outside of the widget's normal size
1540 /// request, the margin will be added in addition to the size from
1541 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1542 pub fn margin_end(self, margin_end: i32) -> Self {
1543 Self {
1544 builder: self.builder.property("margin-end", margin_end),
1545 }
1546 }
1547
1548 /// Margin on start of widget, horizontally. This property supports
1549 /// left-to-right and right-to-left text directions.
1550 ///
1551 /// This property adds margin outside of the widget's normal size
1552 /// request, the margin will be added in addition to the size from
1553 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1554 pub fn margin_start(self, margin_start: i32) -> Self {
1555 Self {
1556 builder: self.builder.property("margin-start", margin_start),
1557 }
1558 }
1559
1560 /// Margin on top side of widget.
1561 ///
1562 /// This property adds margin outside of the widget's normal size
1563 /// request, the margin will be added in addition to the size from
1564 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1565 pub fn margin_top(self, margin_top: i32) -> Self {
1566 Self {
1567 builder: self.builder.property("margin-top", margin_top),
1568 }
1569 }
1570
1571 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1572 Self {
1573 builder: self.builder.property("name", name.into()),
1574 }
1575 }
1576
1577 pub fn no_show_all(self, no_show_all: bool) -> Self {
1578 Self {
1579 builder: self.builder.property("no-show-all", no_show_all),
1580 }
1581 }
1582
1583 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1584 /// more details about window opacity.
1585 ///
1586 /// Before 3.8 this was only available in GtkWindow
1587 pub fn opacity(self, opacity: f64) -> Self {
1588 Self {
1589 builder: self.builder.property("opacity", opacity),
1590 }
1591 }
1592
1593 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1594 Self {
1595 builder: self.builder.property("parent", parent.clone().upcast()),
1596 }
1597 }
1598
1599 pub fn receives_default(self, receives_default: bool) -> Self {
1600 Self {
1601 builder: self.builder.property("receives-default", receives_default),
1602 }
1603 }
1604
1605 pub fn sensitive(self, sensitive: bool) -> Self {
1606 Self {
1607 builder: self.builder.property("sensitive", sensitive),
1608 }
1609 }
1610
1611 /// Sets the text of tooltip to be the given string, which is marked up
1612 /// with the [Pango text markup language][PangoMarkupFormat].
1613 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1614 ///
1615 /// This is a convenience property which will take care of getting the
1616 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1617 /// will automatically be set to [`true`] and there will be taken care of
1618 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1619 ///
1620 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1621 /// are set, the last one wins.
1622 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1623 Self {
1624 builder: self
1625 .builder
1626 .property("tooltip-markup", tooltip_markup.into()),
1627 }
1628 }
1629
1630 /// Sets the text of tooltip to be the given string.
1631 ///
1632 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1633 ///
1634 /// This is a convenience property which will take care of getting the
1635 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1636 /// will automatically be set to [`true`] and there will be taken care of
1637 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1638 ///
1639 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1640 /// are set, the last one wins.
1641 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1642 Self {
1643 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1644 }
1645 }
1646
1647 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1648 pub fn valign(self, valign: Align) -> Self {
1649 Self {
1650 builder: self.builder.property("valign", valign),
1651 }
1652 }
1653
1654 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1655 pub fn vexpand(self, vexpand: bool) -> Self {
1656 Self {
1657 builder: self.builder.property("vexpand", vexpand),
1658 }
1659 }
1660
1661 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1662 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1663 Self {
1664 builder: self.builder.property("vexpand-set", vexpand_set),
1665 }
1666 }
1667
1668 pub fn visible(self, visible: bool) -> Self {
1669 Self {
1670 builder: self.builder.property("visible", visible),
1671 }
1672 }
1673
1674 pub fn width_request(self, width_request: i32) -> Self {
1675 Self {
1676 builder: self.builder.property("width-request", width_request),
1677 }
1678 }
1679
1680 // rustdoc-stripper-ignore-next
1681 /// Build the [`Notebook`].
1682 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1683 pub fn build(self) -> Notebook {
1684 assert_initialized_main_thread!();
1685 self.builder.build()
1686 }
1687}
1688
1689/// Trait containing all [`struct@Notebook`] methods.
1690///
1691/// # Implementors
1692///
1693/// [`Notebook`][struct@crate::Notebook]
1694pub trait NotebookExt: IsA<Notebook> + 'static {
1695 /// Removes the child from the notebook.
1696 ///
1697 /// This function is very similar to [`ContainerExt::remove()`][crate::prelude::ContainerExt::remove()],
1698 /// but additionally informs the notebook that the removal
1699 /// is happening as part of a tab DND operation, which should
1700 /// not be cancelled.
1701 /// ## `child`
1702 /// a child
1703 #[doc(alias = "gtk_notebook_detach_tab")]
1704 fn detach_tab(&self, child: &impl IsA<Widget>) {
1705 unsafe {
1706 ffi::gtk_notebook_detach_tab(
1707 self.as_ref().to_glib_none().0,
1708 child.as_ref().to_glib_none().0,
1709 );
1710 }
1711 }
1712
1713 /// Gets one of the action widgets. See [`set_action_widget()`][Self::set_action_widget()].
1714 /// ## `pack_type`
1715 /// pack type of the action widget to receive
1716 ///
1717 /// # Returns
1718 ///
1719 /// The action widget with the given
1720 /// `pack_type` or [`None`] when this action widget has not been set
1721 #[doc(alias = "gtk_notebook_get_action_widget")]
1722 #[doc(alias = "get_action_widget")]
1723 fn action_widget(&self, pack_type: PackType) -> Option<Widget> {
1724 unsafe {
1725 from_glib_none(ffi::gtk_notebook_get_action_widget(
1726 self.as_ref().to_glib_none().0,
1727 pack_type.into_glib(),
1728 ))
1729 }
1730 }
1731
1732 /// Gets the current group name for `self`.
1733 ///
1734 /// # Returns
1735 ///
1736 /// the group name, or [`None`] if none is set
1737 #[doc(alias = "gtk_notebook_get_group_name")]
1738 #[doc(alias = "get_group_name")]
1739 #[doc(alias = "group-name")]
1740 fn group_name(&self) -> Option<glib::GString> {
1741 unsafe {
1742 from_glib_none(ffi::gtk_notebook_get_group_name(
1743 self.as_ref().to_glib_none().0,
1744 ))
1745 }
1746 }
1747
1748 /// Retrieves the menu label widget of the page containing `child`.
1749 /// ## `child`
1750 /// a widget contained in a page of `self`
1751 ///
1752 /// # Returns
1753 ///
1754 /// the menu label, or [`None`] if the
1755 /// notebook page does not have a menu label other than the default (the tab
1756 /// label).
1757 #[doc(alias = "gtk_notebook_get_menu_label")]
1758 #[doc(alias = "get_menu_label")]
1759 fn menu_label(&self, child: &impl IsA<Widget>) -> Option<Widget> {
1760 unsafe {
1761 from_glib_none(ffi::gtk_notebook_get_menu_label(
1762 self.as_ref().to_glib_none().0,
1763 child.as_ref().to_glib_none().0,
1764 ))
1765 }
1766 }
1767
1768 /// Retrieves the text of the menu label for the page containing
1769 /// `child`.
1770 /// ## `child`
1771 /// the child widget of a page of the notebook.
1772 ///
1773 /// # Returns
1774 ///
1775 /// the text of the tab label, or [`None`] if the widget does
1776 /// not have a menu label other than the default menu label, or the menu label
1777 /// widget is not a [`Label`][crate::Label]. The string is owned by the widget and must not be
1778 /// freed.
1779 #[doc(alias = "gtk_notebook_get_menu_label_text")]
1780 #[doc(alias = "get_menu_label_text")]
1781 fn menu_label_text(&self, child: &impl IsA<Widget>) -> Option<glib::GString> {
1782 unsafe {
1783 from_glib_none(ffi::gtk_notebook_get_menu_label_text(
1784 self.as_ref().to_glib_none().0,
1785 child.as_ref().to_glib_none().0,
1786 ))
1787 }
1788 }
1789
1790 /// Returns whether the tab label area has arrows for scrolling.
1791 /// See [`set_scrollable()`][Self::set_scrollable()].
1792 ///
1793 /// # Returns
1794 ///
1795 /// [`true`] if arrows for scrolling are present
1796 #[doc(alias = "gtk_notebook_get_scrollable")]
1797 #[doc(alias = "get_scrollable")]
1798 #[doc(alias = "scrollable")]
1799 fn is_scrollable(&self) -> bool {
1800 unsafe {
1801 from_glib(ffi::gtk_notebook_get_scrollable(
1802 self.as_ref().to_glib_none().0,
1803 ))
1804 }
1805 }
1806
1807 /// Returns whether a bevel will be drawn around the notebook pages.
1808 /// See [`set_show_border()`][Self::set_show_border()].
1809 ///
1810 /// # Returns
1811 ///
1812 /// [`true`] if the bevel is drawn
1813 #[doc(alias = "gtk_notebook_get_show_border")]
1814 #[doc(alias = "get_show_border")]
1815 #[doc(alias = "show-border")]
1816 fn shows_border(&self) -> bool {
1817 unsafe {
1818 from_glib(ffi::gtk_notebook_get_show_border(
1819 self.as_ref().to_glib_none().0,
1820 ))
1821 }
1822 }
1823
1824 /// Returns whether the tabs of the notebook are shown.
1825 /// See [`set_show_tabs()`][Self::set_show_tabs()].
1826 ///
1827 /// # Returns
1828 ///
1829 /// [`true`] if the tabs are shown
1830 #[doc(alias = "gtk_notebook_get_show_tabs")]
1831 #[doc(alias = "get_show_tabs")]
1832 #[doc(alias = "show-tabs")]
1833 fn shows_tabs(&self) -> bool {
1834 unsafe {
1835 from_glib(ffi::gtk_notebook_get_show_tabs(
1836 self.as_ref().to_glib_none().0,
1837 ))
1838 }
1839 }
1840
1841 /// Returns whether the tab contents can be detached from `self`.
1842 /// ## `child`
1843 /// a child [`Widget`][crate::Widget]
1844 ///
1845 /// # Returns
1846 ///
1847 /// [`true`] if the tab is detachable.
1848 #[doc(alias = "gtk_notebook_get_tab_detachable")]
1849 #[doc(alias = "get_tab_detachable")]
1850 fn tab_is_detachable(&self, child: &impl IsA<Widget>) -> bool {
1851 unsafe {
1852 from_glib(ffi::gtk_notebook_get_tab_detachable(
1853 self.as_ref().to_glib_none().0,
1854 child.as_ref().to_glib_none().0,
1855 ))
1856 }
1857 }
1858
1859 /// Returns the tab label widget for the page `child`.
1860 /// [`None`] is returned if `child` is not in `self` or
1861 /// if no tab label has specifically been set for `child`.
1862 /// ## `child`
1863 /// the page
1864 ///
1865 /// # Returns
1866 ///
1867 /// the tab label
1868 #[doc(alias = "gtk_notebook_get_tab_label")]
1869 #[doc(alias = "get_tab_label")]
1870 fn tab_label(&self, child: &impl IsA<Widget>) -> Option<Widget> {
1871 unsafe {
1872 from_glib_none(ffi::gtk_notebook_get_tab_label(
1873 self.as_ref().to_glib_none().0,
1874 child.as_ref().to_glib_none().0,
1875 ))
1876 }
1877 }
1878
1879 /// Retrieves the text of the tab label for the page containing
1880 /// `child`.
1881 /// ## `child`
1882 /// a widget contained in a page of `self`
1883 ///
1884 /// # Returns
1885 ///
1886 /// the text of the tab label, or [`None`] if the tab label
1887 /// widget is not a [`Label`][crate::Label]. The string is owned by the widget and must not be
1888 /// freed.
1889 #[doc(alias = "gtk_notebook_get_tab_label_text")]
1890 #[doc(alias = "get_tab_label_text")]
1891 fn tab_label_text(&self, child: &impl IsA<Widget>) -> Option<glib::GString> {
1892 unsafe {
1893 from_glib_none(ffi::gtk_notebook_get_tab_label_text(
1894 self.as_ref().to_glib_none().0,
1895 child.as_ref().to_glib_none().0,
1896 ))
1897 }
1898 }
1899
1900 /// Gets the edge at which the tabs for switching pages in the
1901 /// notebook are drawn.
1902 ///
1903 /// # Returns
1904 ///
1905 /// the edge at which the tabs are drawn
1906 #[doc(alias = "gtk_notebook_get_tab_pos")]
1907 #[doc(alias = "get_tab_pos")]
1908 #[doc(alias = "tab-pos")]
1909 fn tab_pos(&self) -> PositionType {
1910 unsafe {
1911 from_glib(ffi::gtk_notebook_get_tab_pos(
1912 self.as_ref().to_glib_none().0,
1913 ))
1914 }
1915 }
1916
1917 /// Gets whether the tab can be reordered via drag and drop or not.
1918 /// ## `child`
1919 /// a child [`Widget`][crate::Widget]
1920 ///
1921 /// # Returns
1922 ///
1923 /// [`true`] if the tab is reorderable.
1924 #[doc(alias = "gtk_notebook_get_tab_reorderable")]
1925 #[doc(alias = "get_tab_reorderable")]
1926 fn tab_is_reorderable(&self, child: &impl IsA<Widget>) -> bool {
1927 unsafe {
1928 from_glib(ffi::gtk_notebook_get_tab_reorderable(
1929 self.as_ref().to_glib_none().0,
1930 child.as_ref().to_glib_none().0,
1931 ))
1932 }
1933 }
1934
1935 /// Switches to the next page. Nothing happens if the current page is
1936 /// the last page.
1937 #[doc(alias = "gtk_notebook_next_page")]
1938 fn next_page(&self) {
1939 unsafe {
1940 ffi::gtk_notebook_next_page(self.as_ref().to_glib_none().0);
1941 }
1942 }
1943
1944 /// Disables the popup menu.
1945 #[doc(alias = "gtk_notebook_popup_disable")]
1946 fn popup_disable(&self) {
1947 unsafe {
1948 ffi::gtk_notebook_popup_disable(self.as_ref().to_glib_none().0);
1949 }
1950 }
1951
1952 /// Enables the popup menu: if the user clicks with the right
1953 /// mouse button on the tab labels, a menu with all the pages
1954 /// will be popped up.
1955 #[doc(alias = "gtk_notebook_popup_enable")]
1956 fn popup_enable(&self) {
1957 unsafe {
1958 ffi::gtk_notebook_popup_enable(self.as_ref().to_glib_none().0);
1959 }
1960 }
1961
1962 /// Switches to the previous page. Nothing happens if the current page
1963 /// is the first page.
1964 #[doc(alias = "gtk_notebook_prev_page")]
1965 fn prev_page(&self) {
1966 unsafe {
1967 ffi::gtk_notebook_prev_page(self.as_ref().to_glib_none().0);
1968 }
1969 }
1970
1971 /// Sets `widget` as one of the action widgets. Depending on the pack type
1972 /// the widget will be placed before or after the tabs. You can use
1973 /// a [`Box`][crate::Box] if you need to pack more than one widget on the same side.
1974 ///
1975 /// Note that action widgets are “internal” children of the notebook and thus
1976 /// not included in the list returned from [`ContainerExt::foreach()`][crate::prelude::ContainerExt::foreach()].
1977 /// ## `widget`
1978 /// a [`Widget`][crate::Widget]
1979 /// ## `pack_type`
1980 /// pack type of the action widget
1981 #[doc(alias = "gtk_notebook_set_action_widget")]
1982 fn set_action_widget(&self, widget: &impl IsA<Widget>, pack_type: PackType) {
1983 unsafe {
1984 ffi::gtk_notebook_set_action_widget(
1985 self.as_ref().to_glib_none().0,
1986 widget.as_ref().to_glib_none().0,
1987 pack_type.into_glib(),
1988 );
1989 }
1990 }
1991
1992 /// Sets a group name for `self`.
1993 ///
1994 /// Notebooks with the same name will be able to exchange tabs
1995 /// via drag and drop. A notebook with a [`None`] group name will
1996 /// not be able to exchange tabs with any other notebook.
1997 /// ## `group_name`
1998 /// the name of the notebook group,
1999 /// or [`None`] to unset it
2000 #[doc(alias = "gtk_notebook_set_group_name")]
2001 #[doc(alias = "group-name")]
2002 fn set_group_name(&self, group_name: Option<&str>) {
2003 unsafe {
2004 ffi::gtk_notebook_set_group_name(
2005 self.as_ref().to_glib_none().0,
2006 group_name.to_glib_none().0,
2007 );
2008 }
2009 }
2010
2011 /// Changes the menu label for the page containing `child`.
2012 /// ## `child`
2013 /// the child widget
2014 /// ## `menu_label`
2015 /// the menu label, or [`None`] for default
2016 #[doc(alias = "gtk_notebook_set_menu_label")]
2017 fn set_menu_label(&self, child: &impl IsA<Widget>, menu_label: Option<&impl IsA<Widget>>) {
2018 unsafe {
2019 ffi::gtk_notebook_set_menu_label(
2020 self.as_ref().to_glib_none().0,
2021 child.as_ref().to_glib_none().0,
2022 menu_label.map(|p| p.as_ref()).to_glib_none().0,
2023 );
2024 }
2025 }
2026
2027 /// Creates a new label and sets it as the menu label of `child`.
2028 /// ## `child`
2029 /// the child widget
2030 /// ## `menu_text`
2031 /// the label text
2032 #[doc(alias = "gtk_notebook_set_menu_label_text")]
2033 fn set_menu_label_text(&self, child: &impl IsA<Widget>, menu_text: &str) {
2034 unsafe {
2035 ffi::gtk_notebook_set_menu_label_text(
2036 self.as_ref().to_glib_none().0,
2037 child.as_ref().to_glib_none().0,
2038 menu_text.to_glib_none().0,
2039 );
2040 }
2041 }
2042
2043 /// Sets whether the tab label area will have arrows for
2044 /// scrolling if there are too many tabs to fit in the area.
2045 /// ## `scrollable`
2046 /// [`true`] if scroll arrows should be added
2047 #[doc(alias = "gtk_notebook_set_scrollable")]
2048 #[doc(alias = "scrollable")]
2049 fn set_scrollable(&self, scrollable: bool) {
2050 unsafe {
2051 ffi::gtk_notebook_set_scrollable(
2052 self.as_ref().to_glib_none().0,
2053 scrollable.into_glib(),
2054 );
2055 }
2056 }
2057
2058 /// Sets whether a bevel will be drawn around the notebook pages.
2059 /// This only has a visual effect when the tabs are not shown.
2060 /// See [`set_show_tabs()`][Self::set_show_tabs()].
2061 /// ## `show_border`
2062 /// [`true`] if a bevel should be drawn around the notebook
2063 #[doc(alias = "gtk_notebook_set_show_border")]
2064 #[doc(alias = "show-border")]
2065 fn set_show_border(&self, show_border: bool) {
2066 unsafe {
2067 ffi::gtk_notebook_set_show_border(
2068 self.as_ref().to_glib_none().0,
2069 show_border.into_glib(),
2070 );
2071 }
2072 }
2073
2074 /// Sets whether to show the tabs for the notebook or not.
2075 /// ## `show_tabs`
2076 /// [`true`] if the tabs should be shown
2077 #[doc(alias = "gtk_notebook_set_show_tabs")]
2078 #[doc(alias = "show-tabs")]
2079 fn set_show_tabs(&self, show_tabs: bool) {
2080 unsafe {
2081 ffi::gtk_notebook_set_show_tabs(self.as_ref().to_glib_none().0, show_tabs.into_glib());
2082 }
2083 }
2084
2085 /// Sets whether the tab can be detached from `self` to another
2086 /// notebook or widget.
2087 ///
2088 /// Note that 2 notebooks must share a common group identificator
2089 /// (see [`set_group_name()`][Self::set_group_name()]) to allow automatic tabs
2090 /// interchange between them.
2091 ///
2092 /// If you want a widget to interact with a notebook through DnD
2093 /// (i.e.: accept dragged tabs from it) it must be set as a drop
2094 /// destination and accept the target “GTK_NOTEBOOK_TAB”. The notebook
2095 /// will fill the selection with a GtkWidget** pointing to the child
2096 /// widget that corresponds to the dropped tab.
2097 ///
2098 /// Note that you should use [`detach_tab()`][Self::detach_tab()] instead
2099 /// of [`ContainerExt::remove()`][crate::prelude::ContainerExt::remove()] if you want to remove the tab from
2100 /// the source notebook as part of accepting a drop. Otherwise,
2101 /// the source notebook will think that the dragged tab was
2102 /// removed from underneath the ongoing drag operation, and
2103 /// will initiate a drag cancel animation.
2104 ///
2105 ///
2106 ///
2107 /// **⚠️ The following code is in C ⚠️**
2108 ///
2109 /// ```C
2110 /// static void
2111 /// on_drag_data_received (GtkWidget *widget,
2112 /// GdkDragContext *context,
2113 /// gint x,
2114 /// gint y,
2115 /// GtkSelectionData *data,
2116 /// guint info,
2117 /// guint time,
2118 /// gpointer user_data)
2119 /// {
2120 /// GtkWidget *notebook;
2121 /// GtkWidget **child;
2122 ///
2123 /// notebook = gtk_drag_get_source_widget (context);
2124 /// child = (void*) gtk_selection_data_get_data (data);
2125 ///
2126 /// // process_widget (*child);
2127 ///
2128 /// gtk_notebook_detach_tab (GTK_NOTEBOOK (notebook), *child);
2129 /// }
2130 /// ```
2131 ///
2132 /// If you want a notebook to accept drags from other widgets,
2133 /// you will have to set your own DnD code to do it.
2134 /// ## `child`
2135 /// a child [`Widget`][crate::Widget]
2136 /// ## `detachable`
2137 /// whether the tab is detachable or not
2138 #[doc(alias = "gtk_notebook_set_tab_detachable")]
2139 fn set_tab_detachable(&self, child: &impl IsA<Widget>, detachable: bool) {
2140 unsafe {
2141 ffi::gtk_notebook_set_tab_detachable(
2142 self.as_ref().to_glib_none().0,
2143 child.as_ref().to_glib_none().0,
2144 detachable.into_glib(),
2145 );
2146 }
2147 }
2148
2149 /// Changes the tab label for `child`.
2150 /// If [`None`] is specified for `tab_label`, then the page will
2151 /// have the label “page N”.
2152 /// ## `child`
2153 /// the page
2154 /// ## `tab_label`
2155 /// the tab label widget to use, or [`None`]
2156 /// for default tab label
2157 #[doc(alias = "gtk_notebook_set_tab_label")]
2158 fn set_tab_label(&self, child: &impl IsA<Widget>, tab_label: Option<&impl IsA<Widget>>) {
2159 unsafe {
2160 ffi::gtk_notebook_set_tab_label(
2161 self.as_ref().to_glib_none().0,
2162 child.as_ref().to_glib_none().0,
2163 tab_label.map(|p| p.as_ref()).to_glib_none().0,
2164 );
2165 }
2166 }
2167
2168 /// Creates a new label and sets it as the tab label for the page
2169 /// containing `child`.
2170 /// ## `child`
2171 /// the page
2172 /// ## `tab_text`
2173 /// the label text
2174 #[doc(alias = "gtk_notebook_set_tab_label_text")]
2175 fn set_tab_label_text(&self, child: &impl IsA<Widget>, tab_text: &str) {
2176 unsafe {
2177 ffi::gtk_notebook_set_tab_label_text(
2178 self.as_ref().to_glib_none().0,
2179 child.as_ref().to_glib_none().0,
2180 tab_text.to_glib_none().0,
2181 );
2182 }
2183 }
2184
2185 /// Sets the edge at which the tabs for switching pages in the
2186 /// notebook are drawn.
2187 /// ## `pos`
2188 /// the edge to draw the tabs at
2189 #[doc(alias = "gtk_notebook_set_tab_pos")]
2190 #[doc(alias = "tab-pos")]
2191 fn set_tab_pos(&self, pos: PositionType) {
2192 unsafe {
2193 ffi::gtk_notebook_set_tab_pos(self.as_ref().to_glib_none().0, pos.into_glib());
2194 }
2195 }
2196
2197 /// Sets whether the notebook tab can be reordered
2198 /// via drag and drop or not.
2199 /// ## `child`
2200 /// a child [`Widget`][crate::Widget]
2201 /// ## `reorderable`
2202 /// whether the tab is reorderable or not
2203 #[doc(alias = "gtk_notebook_set_tab_reorderable")]
2204 fn set_tab_reorderable(&self, child: &impl IsA<Widget>, reorderable: bool) {
2205 unsafe {
2206 ffi::gtk_notebook_set_tab_reorderable(
2207 self.as_ref().to_glib_none().0,
2208 child.as_ref().to_glib_none().0,
2209 reorderable.into_glib(),
2210 );
2211 }
2212 }
2213
2214 #[doc(alias = "enable-popup")]
2215 fn enables_popup(&self) -> bool {
2216 ObjectExt::property(self.as_ref(), "enable-popup")
2217 }
2218
2219 #[doc(alias = "enable-popup")]
2220 fn set_enable_popup(&self, enable_popup: bool) {
2221 ObjectExt::set_property(self.as_ref(), "enable-popup", enable_popup)
2222 }
2223
2224 fn page(&self) -> i32 {
2225 ObjectExt::property(self.as_ref(), "page")
2226 }
2227
2228 fn set_page(&self, page: i32) {
2229 ObjectExt::set_property(self.as_ref(), "page", page)
2230 }
2231
2232 fn child_is_detachable<T: IsA<crate::Widget>>(&self, item: &T) -> bool {
2233 crate::prelude::ContainerExtManual::child_property(
2234 self.as_ref(),
2235 &item.clone().upcast(),
2236 "detachable",
2237 )
2238 }
2239
2240 fn set_child_detachable<T: IsA<crate::Widget>>(&self, item: &T, detachable: bool) {
2241 crate::prelude::ContainerExtManual::child_set_property(
2242 self.as_ref(),
2243 &item.clone().upcast(),
2244 "detachable",
2245 &detachable,
2246 )
2247 }
2248
2249 #[doc(alias = "child.menu-label")]
2250 fn child_menu_label<T: IsA<crate::Widget>>(&self, item: &T) -> Option<glib::GString> {
2251 crate::prelude::ContainerExtManual::child_property(
2252 self.as_ref(),
2253 &item.clone().upcast(),
2254 "menu-label",
2255 )
2256 }
2257
2258 #[doc(alias = "child.menu-label")]
2259 fn set_child_menu_label<T: IsA<crate::Widget>>(&self, item: &T, menu_label: Option<&str>) {
2260 crate::prelude::ContainerExtManual::child_set_property(
2261 self.as_ref(),
2262 &item.clone().upcast(),
2263 "menu-label",
2264 &menu_label,
2265 )
2266 }
2267
2268 fn child_position<T: IsA<crate::Widget>>(&self, item: &T) -> i32 {
2269 crate::prelude::ContainerExtManual::child_property(
2270 self.as_ref(),
2271 &item.clone().upcast(),
2272 "position",
2273 )
2274 }
2275
2276 fn set_child_position<T: IsA<crate::Widget>>(&self, item: &T, position: i32) {
2277 crate::prelude::ContainerExtManual::child_set_property(
2278 self.as_ref(),
2279 &item.clone().upcast(),
2280 "position",
2281 &position,
2282 )
2283 }
2284
2285 fn child_is_reorderable<T: IsA<crate::Widget>>(&self, item: &T) -> bool {
2286 crate::prelude::ContainerExtManual::child_property(
2287 self.as_ref(),
2288 &item.clone().upcast(),
2289 "reorderable",
2290 )
2291 }
2292
2293 fn set_child_reorderable<T: IsA<crate::Widget>>(&self, item: &T, reorderable: bool) {
2294 crate::prelude::ContainerExtManual::child_set_property(
2295 self.as_ref(),
2296 &item.clone().upcast(),
2297 "reorderable",
2298 &reorderable,
2299 )
2300 }
2301
2302 #[doc(alias = "child.tab-expand")]
2303 fn child_tab_expands<T: IsA<crate::Widget>>(&self, item: &T) -> bool {
2304 crate::prelude::ContainerExtManual::child_property(
2305 self.as_ref(),
2306 &item.clone().upcast(),
2307 "tab-expand",
2308 )
2309 }
2310
2311 #[doc(alias = "child.tab-expand")]
2312 fn set_child_tab_expand<T: IsA<crate::Widget>>(&self, item: &T, tab_expand: bool) {
2313 crate::prelude::ContainerExtManual::child_set_property(
2314 self.as_ref(),
2315 &item.clone().upcast(),
2316 "tab-expand",
2317 &tab_expand,
2318 )
2319 }
2320
2321 #[doc(alias = "child.tab-fill")]
2322 fn child_tab_fills<T: IsA<crate::Widget>>(&self, item: &T) -> bool {
2323 crate::prelude::ContainerExtManual::child_property(
2324 self.as_ref(),
2325 &item.clone().upcast(),
2326 "tab-fill",
2327 )
2328 }
2329
2330 #[doc(alias = "child.tab-fill")]
2331 fn set_child_tab_fill<T: IsA<crate::Widget>>(&self, item: &T, tab_fill: bool) {
2332 crate::prelude::ContainerExtManual::child_set_property(
2333 self.as_ref(),
2334 &item.clone().upcast(),
2335 "tab-fill",
2336 &tab_fill,
2337 )
2338 }
2339
2340 #[doc(alias = "child.tab-label")]
2341 fn child_tab_label<T: IsA<crate::Widget>>(&self, item: &T) -> Option<glib::GString> {
2342 crate::prelude::ContainerExtManual::child_property(
2343 self.as_ref(),
2344 &item.clone().upcast(),
2345 "tab-label",
2346 )
2347 }
2348
2349 #[doc(alias = "child.tab-label")]
2350 fn set_child_tab_label<T: IsA<crate::Widget>>(&self, item: &T, tab_label: Option<&str>) {
2351 crate::prelude::ContainerExtManual::child_set_property(
2352 self.as_ref(),
2353 &item.clone().upcast(),
2354 "tab-label",
2355 &tab_label,
2356 )
2357 }
2358
2359 #[doc(alias = "change-current-page")]
2360 fn connect_change_current_page<F: Fn(&Self, i32) -> bool + 'static>(
2361 &self,
2362 f: F,
2363 ) -> SignalHandlerId {
2364 unsafe extern "C" fn change_current_page_trampoline<
2365 P: IsA<Notebook>,
2366 F: Fn(&P, i32) -> bool + 'static,
2367 >(
2368 this: *mut ffi::GtkNotebook,
2369 object: std::ffi::c_int,
2370 f: glib::ffi::gpointer,
2371 ) -> glib::ffi::gboolean {
2372 unsafe {
2373 let f: &F = &*(f as *const F);
2374 f(Notebook::from_glib_borrow(this).unsafe_cast_ref(), object).into_glib()
2375 }
2376 }
2377 unsafe {
2378 let f: Box_<F> = Box_::new(f);
2379 connect_raw(
2380 self.as_ptr() as *mut _,
2381 c"change-current-page".as_ptr(),
2382 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2383 change_current_page_trampoline::<Self, F> as *const (),
2384 )),
2385 Box_::into_raw(f),
2386 )
2387 }
2388 }
2389
2390 fn emit_change_current_page(&self, object: i32) -> bool {
2391 self.emit_by_name("change-current-page", &[&object])
2392 }
2393
2394 /// The ::create-window signal is emitted when a detachable
2395 /// tab is dropped on the root window.
2396 ///
2397 /// A handler for this signal can create a window containing
2398 /// a notebook where the tab will be attached. It is also
2399 /// responsible for moving/resizing the window and adding the
2400 /// necessary properties to the notebook (e.g. the
2401 /// [`group-name`][struct@crate::Notebook#group-name] ).
2402 /// ## `page`
2403 /// the tab of `notebook` that is being detached
2404 /// ## `x`
2405 /// the X coordinate where the drop happens
2406 /// ## `y`
2407 /// the Y coordinate where the drop happens
2408 ///
2409 /// # Returns
2410 ///
2411 /// a [`Notebook`][crate::Notebook] that `page` should be
2412 /// added to, or [`None`].
2413 #[doc(alias = "create-window")]
2414 fn connect_create_window<F: Fn(&Self, &Widget, i32, i32) -> Notebook + 'static>(
2415 &self,
2416 f: F,
2417 ) -> SignalHandlerId {
2418 unsafe extern "C" fn create_window_trampoline<
2419 P: IsA<Notebook>,
2420 F: Fn(&P, &Widget, i32, i32) -> Notebook + 'static,
2421 >(
2422 this: *mut ffi::GtkNotebook,
2423 page: *mut ffi::GtkWidget,
2424 x: std::ffi::c_int,
2425 y: std::ffi::c_int,
2426 f: glib::ffi::gpointer,
2427 ) -> *mut ffi::GtkNotebook {
2428 unsafe {
2429 let f: &F = &*(f as *const F);
2430 f(
2431 Notebook::from_glib_borrow(this).unsafe_cast_ref(),
2432 &from_glib_borrow(page),
2433 x,
2434 y,
2435 ) /*Not checked*/
2436 .to_glib_none()
2437 .0
2438 }
2439 }
2440 unsafe {
2441 let f: Box_<F> = Box_::new(f);
2442 connect_raw(
2443 self.as_ptr() as *mut _,
2444 c"create-window".as_ptr(),
2445 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2446 create_window_trampoline::<Self, F> as *const (),
2447 )),
2448 Box_::into_raw(f),
2449 )
2450 }
2451 }
2452
2453 #[doc(alias = "focus-tab")]
2454 fn connect_focus_tab<F: Fn(&Self, NotebookTab) -> bool + 'static>(
2455 &self,
2456 f: F,
2457 ) -> SignalHandlerId {
2458 unsafe extern "C" fn focus_tab_trampoline<
2459 P: IsA<Notebook>,
2460 F: Fn(&P, NotebookTab) -> bool + 'static,
2461 >(
2462 this: *mut ffi::GtkNotebook,
2463 object: ffi::GtkNotebookTab,
2464 f: glib::ffi::gpointer,
2465 ) -> glib::ffi::gboolean {
2466 unsafe {
2467 let f: &F = &*(f as *const F);
2468 f(
2469 Notebook::from_glib_borrow(this).unsafe_cast_ref(),
2470 from_glib(object),
2471 )
2472 .into_glib()
2473 }
2474 }
2475 unsafe {
2476 let f: Box_<F> = Box_::new(f);
2477 connect_raw(
2478 self.as_ptr() as *mut _,
2479 c"focus-tab".as_ptr(),
2480 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2481 focus_tab_trampoline::<Self, F> as *const (),
2482 )),
2483 Box_::into_raw(f),
2484 )
2485 }
2486 }
2487
2488 fn emit_focus_tab(&self, object: NotebookTab) -> bool {
2489 self.emit_by_name("focus-tab", &[&object])
2490 }
2491
2492 #[doc(alias = "move-focus-out")]
2493 fn connect_move_focus_out<F: Fn(&Self, DirectionType) + 'static>(
2494 &self,
2495 f: F,
2496 ) -> SignalHandlerId {
2497 unsafe extern "C" fn move_focus_out_trampoline<
2498 P: IsA<Notebook>,
2499 F: Fn(&P, DirectionType) + 'static,
2500 >(
2501 this: *mut ffi::GtkNotebook,
2502 object: ffi::GtkDirectionType,
2503 f: glib::ffi::gpointer,
2504 ) {
2505 unsafe {
2506 let f: &F = &*(f as *const F);
2507 f(
2508 Notebook::from_glib_borrow(this).unsafe_cast_ref(),
2509 from_glib(object),
2510 )
2511 }
2512 }
2513 unsafe {
2514 let f: Box_<F> = Box_::new(f);
2515 connect_raw(
2516 self.as_ptr() as *mut _,
2517 c"move-focus-out".as_ptr(),
2518 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2519 move_focus_out_trampoline::<Self, F> as *const (),
2520 )),
2521 Box_::into_raw(f),
2522 )
2523 }
2524 }
2525
2526 fn emit_move_focus_out(&self, object: DirectionType) {
2527 self.emit_by_name::<()>("move-focus-out", &[&object]);
2528 }
2529
2530 /// the ::page-added signal is emitted in the notebook
2531 /// right after a page is added to the notebook.
2532 /// ## `child`
2533 /// the child [`Widget`][crate::Widget] affected
2534 /// ## `page_num`
2535 /// the new page number for `child`
2536 #[doc(alias = "page-added")]
2537 fn connect_page_added<F: Fn(&Self, &Widget, u32) + 'static>(&self, f: F) -> SignalHandlerId {
2538 unsafe extern "C" fn page_added_trampoline<
2539 P: IsA<Notebook>,
2540 F: Fn(&P, &Widget, u32) + 'static,
2541 >(
2542 this: *mut ffi::GtkNotebook,
2543 child: *mut ffi::GtkWidget,
2544 page_num: std::ffi::c_uint,
2545 f: glib::ffi::gpointer,
2546 ) {
2547 unsafe {
2548 let f: &F = &*(f as *const F);
2549 f(
2550 Notebook::from_glib_borrow(this).unsafe_cast_ref(),
2551 &from_glib_borrow(child),
2552 page_num,
2553 )
2554 }
2555 }
2556 unsafe {
2557 let f: Box_<F> = Box_::new(f);
2558 connect_raw(
2559 self.as_ptr() as *mut _,
2560 c"page-added".as_ptr(),
2561 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2562 page_added_trampoline::<Self, F> as *const (),
2563 )),
2564 Box_::into_raw(f),
2565 )
2566 }
2567 }
2568
2569 /// the ::page-removed signal is emitted in the notebook
2570 /// right after a page is removed from the notebook.
2571 /// ## `child`
2572 /// the child [`Widget`][crate::Widget] affected
2573 /// ## `page_num`
2574 /// the `child` page number
2575 #[doc(alias = "page-removed")]
2576 fn connect_page_removed<F: Fn(&Self, &Widget, u32) + 'static>(&self, f: F) -> SignalHandlerId {
2577 unsafe extern "C" fn page_removed_trampoline<
2578 P: IsA<Notebook>,
2579 F: Fn(&P, &Widget, u32) + 'static,
2580 >(
2581 this: *mut ffi::GtkNotebook,
2582 child: *mut ffi::GtkWidget,
2583 page_num: std::ffi::c_uint,
2584 f: glib::ffi::gpointer,
2585 ) {
2586 unsafe {
2587 let f: &F = &*(f as *const F);
2588 f(
2589 Notebook::from_glib_borrow(this).unsafe_cast_ref(),
2590 &from_glib_borrow(child),
2591 page_num,
2592 )
2593 }
2594 }
2595 unsafe {
2596 let f: Box_<F> = Box_::new(f);
2597 connect_raw(
2598 self.as_ptr() as *mut _,
2599 c"page-removed".as_ptr(),
2600 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2601 page_removed_trampoline::<Self, F> as *const (),
2602 )),
2603 Box_::into_raw(f),
2604 )
2605 }
2606 }
2607
2608 /// the ::page-reordered signal is emitted in the notebook
2609 /// right after a page has been reordered.
2610 /// ## `child`
2611 /// the child [`Widget`][crate::Widget] affected
2612 /// ## `page_num`
2613 /// the new page number for `child`
2614 #[doc(alias = "page-reordered")]
2615 fn connect_page_reordered<F: Fn(&Self, &Widget, u32) + 'static>(
2616 &self,
2617 f: F,
2618 ) -> SignalHandlerId {
2619 unsafe extern "C" fn page_reordered_trampoline<
2620 P: IsA<Notebook>,
2621 F: Fn(&P, &Widget, u32) + 'static,
2622 >(
2623 this: *mut ffi::GtkNotebook,
2624 child: *mut ffi::GtkWidget,
2625 page_num: std::ffi::c_uint,
2626 f: glib::ffi::gpointer,
2627 ) {
2628 unsafe {
2629 let f: &F = &*(f as *const F);
2630 f(
2631 Notebook::from_glib_borrow(this).unsafe_cast_ref(),
2632 &from_glib_borrow(child),
2633 page_num,
2634 )
2635 }
2636 }
2637 unsafe {
2638 let f: Box_<F> = Box_::new(f);
2639 connect_raw(
2640 self.as_ptr() as *mut _,
2641 c"page-reordered".as_ptr(),
2642 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2643 page_reordered_trampoline::<Self, F> as *const (),
2644 )),
2645 Box_::into_raw(f),
2646 )
2647 }
2648 }
2649
2650 #[doc(alias = "reorder-tab")]
2651 fn connect_reorder_tab<F: Fn(&Self, DirectionType, bool) -> bool + 'static>(
2652 &self,
2653 f: F,
2654 ) -> SignalHandlerId {
2655 unsafe extern "C" fn reorder_tab_trampoline<
2656 P: IsA<Notebook>,
2657 F: Fn(&P, DirectionType, bool) -> bool + 'static,
2658 >(
2659 this: *mut ffi::GtkNotebook,
2660 object: ffi::GtkDirectionType,
2661 p0: glib::ffi::gboolean,
2662 f: glib::ffi::gpointer,
2663 ) -> glib::ffi::gboolean {
2664 unsafe {
2665 let f: &F = &*(f as *const F);
2666 f(
2667 Notebook::from_glib_borrow(this).unsafe_cast_ref(),
2668 from_glib(object),
2669 from_glib(p0),
2670 )
2671 .into_glib()
2672 }
2673 }
2674 unsafe {
2675 let f: Box_<F> = Box_::new(f);
2676 connect_raw(
2677 self.as_ptr() as *mut _,
2678 c"reorder-tab".as_ptr(),
2679 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2680 reorder_tab_trampoline::<Self, F> as *const (),
2681 )),
2682 Box_::into_raw(f),
2683 )
2684 }
2685 }
2686
2687 fn emit_reorder_tab(&self, object: DirectionType, p0: bool) -> bool {
2688 self.emit_by_name("reorder-tab", &[&object, &p0])
2689 }
2690
2691 #[doc(alias = "select-page")]
2692 fn connect_select_page<F: Fn(&Self, bool) -> bool + 'static>(&self, f: F) -> SignalHandlerId {
2693 unsafe extern "C" fn select_page_trampoline<
2694 P: IsA<Notebook>,
2695 F: Fn(&P, bool) -> bool + 'static,
2696 >(
2697 this: *mut ffi::GtkNotebook,
2698 object: glib::ffi::gboolean,
2699 f: glib::ffi::gpointer,
2700 ) -> glib::ffi::gboolean {
2701 unsafe {
2702 let f: &F = &*(f as *const F);
2703 f(
2704 Notebook::from_glib_borrow(this).unsafe_cast_ref(),
2705 from_glib(object),
2706 )
2707 .into_glib()
2708 }
2709 }
2710 unsafe {
2711 let f: Box_<F> = Box_::new(f);
2712 connect_raw(
2713 self.as_ptr() as *mut _,
2714 c"select-page".as_ptr(),
2715 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2716 select_page_trampoline::<Self, F> as *const (),
2717 )),
2718 Box_::into_raw(f),
2719 )
2720 }
2721 }
2722
2723 fn emit_select_page(&self, object: bool) -> bool {
2724 self.emit_by_name("select-page", &[&object])
2725 }
2726
2727 /// Emitted when the user or a function changes the current page.
2728 /// ## `page`
2729 /// the new current page
2730 /// ## `page_num`
2731 /// the index of the page
2732 #[doc(alias = "switch-page")]
2733 fn connect_switch_page<F: Fn(&Self, &Widget, u32) + 'static>(&self, f: F) -> SignalHandlerId {
2734 unsafe extern "C" fn switch_page_trampoline<
2735 P: IsA<Notebook>,
2736 F: Fn(&P, &Widget, u32) + 'static,
2737 >(
2738 this: *mut ffi::GtkNotebook,
2739 page: *mut ffi::GtkWidget,
2740 page_num: std::ffi::c_uint,
2741 f: glib::ffi::gpointer,
2742 ) {
2743 unsafe {
2744 let f: &F = &*(f as *const F);
2745 f(
2746 Notebook::from_glib_borrow(this).unsafe_cast_ref(),
2747 &from_glib_borrow(page),
2748 page_num,
2749 )
2750 }
2751 }
2752 unsafe {
2753 let f: Box_<F> = Box_::new(f);
2754 connect_raw(
2755 self.as_ptr() as *mut _,
2756 c"switch-page".as_ptr(),
2757 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2758 switch_page_trampoline::<Self, F> as *const (),
2759 )),
2760 Box_::into_raw(f),
2761 )
2762 }
2763 }
2764
2765 #[doc(alias = "enable-popup")]
2766 fn connect_enable_popup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2767 unsafe extern "C" fn notify_enable_popup_trampoline<
2768 P: IsA<Notebook>,
2769 F: Fn(&P) + 'static,
2770 >(
2771 this: *mut ffi::GtkNotebook,
2772 _param_spec: glib::ffi::gpointer,
2773 f: glib::ffi::gpointer,
2774 ) {
2775 unsafe {
2776 let f: &F = &*(f as *const F);
2777 f(Notebook::from_glib_borrow(this).unsafe_cast_ref())
2778 }
2779 }
2780 unsafe {
2781 let f: Box_<F> = Box_::new(f);
2782 connect_raw(
2783 self.as_ptr() as *mut _,
2784 c"notify::enable-popup".as_ptr(),
2785 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2786 notify_enable_popup_trampoline::<Self, F> as *const (),
2787 )),
2788 Box_::into_raw(f),
2789 )
2790 }
2791 }
2792
2793 #[doc(alias = "group-name")]
2794 fn connect_group_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2795 unsafe extern "C" fn notify_group_name_trampoline<P: IsA<Notebook>, F: Fn(&P) + 'static>(
2796 this: *mut ffi::GtkNotebook,
2797 _param_spec: glib::ffi::gpointer,
2798 f: glib::ffi::gpointer,
2799 ) {
2800 unsafe {
2801 let f: &F = &*(f as *const F);
2802 f(Notebook::from_glib_borrow(this).unsafe_cast_ref())
2803 }
2804 }
2805 unsafe {
2806 let f: Box_<F> = Box_::new(f);
2807 connect_raw(
2808 self.as_ptr() as *mut _,
2809 c"notify::group-name".as_ptr(),
2810 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2811 notify_group_name_trampoline::<Self, F> as *const (),
2812 )),
2813 Box_::into_raw(f),
2814 )
2815 }
2816 }
2817
2818 #[doc(alias = "page")]
2819 fn connect_page_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2820 unsafe extern "C" fn notify_page_trampoline<P: IsA<Notebook>, F: Fn(&P) + 'static>(
2821 this: *mut ffi::GtkNotebook,
2822 _param_spec: glib::ffi::gpointer,
2823 f: glib::ffi::gpointer,
2824 ) {
2825 unsafe {
2826 let f: &F = &*(f as *const F);
2827 f(Notebook::from_glib_borrow(this).unsafe_cast_ref())
2828 }
2829 }
2830 unsafe {
2831 let f: Box_<F> = Box_::new(f);
2832 connect_raw(
2833 self.as_ptr() as *mut _,
2834 c"notify::page".as_ptr(),
2835 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2836 notify_page_trampoline::<Self, F> as *const (),
2837 )),
2838 Box_::into_raw(f),
2839 )
2840 }
2841 }
2842
2843 #[doc(alias = "scrollable")]
2844 fn connect_scrollable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2845 unsafe extern "C" fn notify_scrollable_trampoline<P: IsA<Notebook>, F: Fn(&P) + 'static>(
2846 this: *mut ffi::GtkNotebook,
2847 _param_spec: glib::ffi::gpointer,
2848 f: glib::ffi::gpointer,
2849 ) {
2850 unsafe {
2851 let f: &F = &*(f as *const F);
2852 f(Notebook::from_glib_borrow(this).unsafe_cast_ref())
2853 }
2854 }
2855 unsafe {
2856 let f: Box_<F> = Box_::new(f);
2857 connect_raw(
2858 self.as_ptr() as *mut _,
2859 c"notify::scrollable".as_ptr(),
2860 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2861 notify_scrollable_trampoline::<Self, F> as *const (),
2862 )),
2863 Box_::into_raw(f),
2864 )
2865 }
2866 }
2867
2868 #[doc(alias = "show-border")]
2869 fn connect_show_border_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2870 unsafe extern "C" fn notify_show_border_trampoline<
2871 P: IsA<Notebook>,
2872 F: Fn(&P) + 'static,
2873 >(
2874 this: *mut ffi::GtkNotebook,
2875 _param_spec: glib::ffi::gpointer,
2876 f: glib::ffi::gpointer,
2877 ) {
2878 unsafe {
2879 let f: &F = &*(f as *const F);
2880 f(Notebook::from_glib_borrow(this).unsafe_cast_ref())
2881 }
2882 }
2883 unsafe {
2884 let f: Box_<F> = Box_::new(f);
2885 connect_raw(
2886 self.as_ptr() as *mut _,
2887 c"notify::show-border".as_ptr(),
2888 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2889 notify_show_border_trampoline::<Self, F> as *const (),
2890 )),
2891 Box_::into_raw(f),
2892 )
2893 }
2894 }
2895
2896 #[doc(alias = "show-tabs")]
2897 fn connect_show_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2898 unsafe extern "C" fn notify_show_tabs_trampoline<P: IsA<Notebook>, F: Fn(&P) + 'static>(
2899 this: *mut ffi::GtkNotebook,
2900 _param_spec: glib::ffi::gpointer,
2901 f: glib::ffi::gpointer,
2902 ) {
2903 unsafe {
2904 let f: &F = &*(f as *const F);
2905 f(Notebook::from_glib_borrow(this).unsafe_cast_ref())
2906 }
2907 }
2908 unsafe {
2909 let f: Box_<F> = Box_::new(f);
2910 connect_raw(
2911 self.as_ptr() as *mut _,
2912 c"notify::show-tabs".as_ptr(),
2913 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2914 notify_show_tabs_trampoline::<Self, F> as *const (),
2915 )),
2916 Box_::into_raw(f),
2917 )
2918 }
2919 }
2920
2921 #[doc(alias = "tab-pos")]
2922 fn connect_tab_pos_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2923 unsafe extern "C" fn notify_tab_pos_trampoline<P: IsA<Notebook>, F: Fn(&P) + 'static>(
2924 this: *mut ffi::GtkNotebook,
2925 _param_spec: glib::ffi::gpointer,
2926 f: glib::ffi::gpointer,
2927 ) {
2928 unsafe {
2929 let f: &F = &*(f as *const F);
2930 f(Notebook::from_glib_borrow(this).unsafe_cast_ref())
2931 }
2932 }
2933 unsafe {
2934 let f: Box_<F> = Box_::new(f);
2935 connect_raw(
2936 self.as_ptr() as *mut _,
2937 c"notify::tab-pos".as_ptr(),
2938 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2939 notify_tab_pos_trampoline::<Self, F> as *const (),
2940 )),
2941 Box_::into_raw(f),
2942 )
2943 }
2944 }
2945}
2946
2947impl<O: IsA<Notebook>> NotebookExt for O {}