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