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