gtk4/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    ffi, Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, DirectionType,
7    LayoutManager, NotebookPage, NotebookTab, Overflow, PackType, PositionType, Widget,
8};
9use glib::{
10    object::ObjectType as _,
11    prelude::*,
12    signal::{connect_raw, SignalHandlerId},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18    /// [`Notebook`][crate::Notebook] is a container whose children are pages switched
19    /// between using tabs.
20    ///
21    /// ![An example GtkNotebook](notebook.png)
22    ///
23    /// There are many configuration options for [`Notebook`][crate::Notebook]. Among
24    /// other things, you can choose on which edge the tabs appear
25    /// (see [`set_tab_pos()`][Self::set_tab_pos()]), whether, if there are
26    /// too many tabs to fit the notebook should be made bigger or scrolling
27    /// arrows added (see [`set_scrollable()`][Self::set_scrollable()]), and whether
28    /// there will be a popup menu allowing the users to switch pages.
29    /// (see [`popup_enable()`][Self::popup_enable()]).
30    ///
31    /// # GtkNotebook as GtkBuildable
32    ///
33    /// The [`Notebook`][crate::Notebook] implementation of the [`Buildable`][crate::Buildable] interface
34    /// supports placing children into tabs by specifying “tab” as the
35    /// “type” attribute of a `<child>` element. Note that the content
36    /// of the tab must be created before the tab can be filled.
37    /// A tab child can be specified without specifying a `<child>`
38    /// type attribute.
39    ///
40    /// To add a child widget in the notebooks action area, specify
41    /// "action-start" or “action-end” as the “type” attribute of the
42    /// `<child>` element.
43    ///
44    /// An example of a UI definition fragment with [`Notebook`][crate::Notebook]:
45    ///
46    /// ```xml
47    /// <object class="GtkNotebook">
48    ///   <child>
49    ///     <object class="GtkLabel" id="notebook-content">
50    ///       <property name="label">Content</property>
51    ///     </object>
52    ///   </child>
53    ///   <child type="tab">
54    ///     <object class="GtkLabel" id="notebook-tab">
55    ///       <property name="label">Tab</property>
56    ///     </object>
57    ///   </child>
58    /// </object>
59    /// ```
60    ///
61    /// # Shortcuts and Gestures
62    ///
63    /// [`Notebook`][crate::Notebook] supports the following keyboard shortcuts:
64    ///
65    /// - <kbd>Shift</kbd>+<kbd>F10</kbd> or <kbd>Menu</kbd> opens the context menu.
66    /// - <kbd>Home</kbd> moves the focus to the first tab.
67    /// - <kbd>End</kbd> moves the focus to the last tab.
68    ///
69    /// Additionally, the following signals have default keybindings:
70    ///
71    /// - [`change-current-page`][struct@crate::Notebook#change-current-page]
72    /// - [`focus-tab`][struct@crate::Notebook#focus-tab]
73    /// - [`move-focus-out`][struct@crate::Notebook#move-focus-out]
74    /// - [`reorder-tab`][struct@crate::Notebook#reorder-tab]
75    /// - [`select-page`][struct@crate::Notebook#select-page]
76    ///
77    /// Tabs support drag-and-drop between notebooks sharing the same `group-name`,
78    /// or to new windows by handling the `::create-window` signal.
79    ///
80    /// # Actions
81    ///
82    /// [`Notebook`][crate::Notebook] defines a set of built-in actions:
83    ///
84    /// - `menu.popup` opens the tabs context menu.
85    ///
86    /// # CSS nodes
87    ///
88    /// ```text
89    /// notebook
90    /// ├── header.top
91    /// │   ├── [<action widget>]
92    /// │   ├── tabs
93    /// │   │   ├── [arrow]
94    /// │   │   ├── tab
95    /// │   │   │   ╰── <tab label>
96    /// ┊   ┊   ┊
97    /// │   │   ├── tab[.reorderable-page]
98    /// │   │   │   ╰── <tab label>
99    /// │   │   ╰── [arrow]
100    /// │   ╰── [<action widget>]
101    /// │
102    /// ╰── stack
103    ///     ├── <child>
104    ///     ┊
105    ///     ╰── <child>
106    /// ```
107    ///
108    /// [`Notebook`][crate::Notebook] has a main CSS node with name `notebook`, a subnode
109    /// with name `header` and below that a subnode with name `tabs` which
110    /// contains one subnode per tab with name `tab`.
111    ///
112    /// If action widgets are present, their CSS nodes are placed next
113    /// to the `tabs` node. If the notebook is scrollable, CSS nodes with
114    /// name `arrow` are placed as first and last child of the `tabs` node.
115    ///
116    /// The main node gets the `.frame` style class when the notebook
117    /// has a border (see [`set_show_border()`][Self::set_show_border()]).
118    ///
119    /// The header node gets one of the style class `.top`, `.bottom`,
120    /// `.left` or `.right`, depending on where the tabs are placed. For
121    /// reorderable pages, the tab node gets the `.reorderable-page` class.
122    ///
123    /// A `tab` node gets the `.dnd` style class while it is moved with drag-and-drop.
124    ///
125    /// The nodes are always arranged from left-to-right, regardless of text direction.
126    ///
127    /// # Accessibility
128    ///
129    /// [`Notebook`][crate::Notebook] uses the following roles:
130    ///
131    ///  - [`AccessibleRole::Group`][crate::AccessibleRole::Group] for the notebook widget
132    ///  - [`AccessibleRole::TabList`][crate::AccessibleRole::TabList] for the list of tabs
133    ///  - [`AccessibleRole::Tab`][crate::AccessibleRole::Tab] role for each tab
134    ///  - [`AccessibleRole::TabPanel`][crate::AccessibleRole::TabPanel] for each page
135    ///
136    /// ## Properties
137    ///
138    ///
139    /// #### `enable-popup`
140    ///  If [`true`], pressing the right mouse button on the notebook shows a page switching menu.
141    ///
142    /// Readable | Writeable
143    ///
144    ///
145    /// #### `group-name`
146    ///  Group name for tab drag and drop.
147    ///
148    /// Readable | Writeable
149    ///
150    ///
151    /// #### `page`
152    ///  The index of the current page.
153    ///
154    /// Readable | Writeable
155    ///
156    ///
157    /// #### `pages`
158    ///  A selection model with the pages.
159    ///
160    /// Readable
161    ///
162    ///
163    /// #### `scrollable`
164    ///  If [`true`], scroll arrows are added if there are too many pages to fit.
165    ///
166    /// Readable | Writeable
167    ///
168    ///
169    /// #### `show-border`
170    ///  Whether the border should be shown.
171    ///
172    /// Readable | Writeable
173    ///
174    ///
175    /// #### `show-tabs`
176    ///  Whether tabs should be shown.
177    ///
178    /// Readable | Writeable
179    ///
180    ///
181    /// #### `tab-pos`
182    ///  Which side of the notebook holds the tabs.
183    ///
184    /// Readable | Writeable
185    /// <details><summary><h4>Widget</h4></summary>
186    ///
187    ///
188    /// #### `can-focus`
189    ///  Whether the widget or any of its descendents can accept
190    /// the input focus.
191    ///
192    /// This property is meant to be set by widget implementations,
193    /// typically in their instance init function.
194    ///
195    /// Readable | Writeable
196    ///
197    ///
198    /// #### `can-target`
199    ///  Whether the widget can receive pointer events.
200    ///
201    /// Readable | Writeable
202    ///
203    ///
204    /// #### `css-classes`
205    ///  A list of css classes applied to this widget.
206    ///
207    /// Readable | Writeable
208    ///
209    ///
210    /// #### `css-name`
211    ///  The name of this widget in the CSS tree.
212    ///
213    /// This property is meant to be set by widget implementations,
214    /// typically in their instance init function.
215    ///
216    /// Readable | Writeable | Construct Only
217    ///
218    ///
219    /// #### `cursor`
220    ///  The cursor used by @widget.
221    ///
222    /// Readable | Writeable
223    ///
224    ///
225    /// #### `focus-on-click`
226    ///  Whether the widget should grab focus when it is clicked with the mouse.
227    ///
228    /// This property is only relevant for widgets that can take focus.
229    ///
230    /// Readable | Writeable
231    ///
232    ///
233    /// #### `focusable`
234    ///  Whether this widget itself will accept the input focus.
235    ///
236    /// Readable | Writeable
237    ///
238    ///
239    /// #### `halign`
240    ///  How to distribute horizontal space if widget gets extra space.
241    ///
242    /// Readable | Writeable
243    ///
244    ///
245    /// #### `has-default`
246    ///  Whether the widget is the default widget.
247    ///
248    /// Readable
249    ///
250    ///
251    /// #### `has-focus`
252    ///  Whether the widget has the input focus.
253    ///
254    /// Readable
255    ///
256    ///
257    /// #### `has-tooltip`
258    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
259    /// signal on @widget.
260    ///
261    /// A true value indicates that @widget can have a tooltip, in this case
262    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
263    /// determine whether it will provide a tooltip or not.
264    ///
265    /// Readable | Writeable
266    ///
267    ///
268    /// #### `height-request`
269    ///  Overrides for height request of the widget.
270    ///
271    /// If this is -1, the natural request will be used.
272    ///
273    /// Readable | Writeable
274    ///
275    ///
276    /// #### `hexpand`
277    ///  Whether to expand horizontally.
278    ///
279    /// Readable | Writeable
280    ///
281    ///
282    /// #### `hexpand-set`
283    ///  Whether to use the `hexpand` property.
284    ///
285    /// Readable | Writeable
286    ///
287    ///
288    /// #### `layout-manager`
289    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
290    /// the preferred size of the widget, and allocate its children.
291    ///
292    /// This property is meant to be set by widget implementations,
293    /// typically in their instance init function.
294    ///
295    /// Readable | Writeable
296    ///
297    ///
298    /// #### `limit-events`
299    ///  Makes this widget act like a modal dialog, with respect to
300    /// event delivery.
301    ///
302    /// Global event controllers will not handle events with targets
303    /// inside the widget, unless they are set up to ignore propagation
304    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
305    ///
306    /// Readable | Writeable
307    ///
308    ///
309    /// #### `margin-bottom`
310    ///  Margin on bottom side of widget.
311    ///
312    /// This property adds margin outside of the widget's normal size
313    /// request, the margin will be added in addition to the size from
314    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
315    ///
316    /// Readable | Writeable
317    ///
318    ///
319    /// #### `margin-end`
320    ///  Margin on end of widget, horizontally.
321    ///
322    /// This property supports left-to-right and right-to-left text
323    /// directions.
324    ///
325    /// This property adds margin outside of the widget's normal size
326    /// request, the margin will be added in addition to the size from
327    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
328    ///
329    /// Readable | Writeable
330    ///
331    ///
332    /// #### `margin-start`
333    ///  Margin on start of widget, horizontally.
334    ///
335    /// This property supports left-to-right and right-to-left text
336    /// directions.
337    ///
338    /// This property adds margin outside of the widget's normal size
339    /// request, the margin will be added in addition to the size from
340    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
341    ///
342    /// Readable | Writeable
343    ///
344    ///
345    /// #### `margin-top`
346    ///  Margin on top side of widget.
347    ///
348    /// This property adds margin outside of the widget's normal size
349    /// request, the margin will be added in addition to the size from
350    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
351    ///
352    /// Readable | Writeable
353    ///
354    ///
355    /// #### `name`
356    ///  The name of the widget.
357    ///
358    /// Readable | Writeable
359    ///
360    ///
361    /// #### `opacity`
362    ///  The requested opacity of the widget.
363    ///
364    /// Readable | Writeable
365    ///
366    ///
367    /// #### `overflow`
368    ///  How content outside the widget's content area is treated.
369    ///
370    /// This property is meant to be set by widget implementations,
371    /// typically in their instance init function.
372    ///
373    /// Readable | Writeable
374    ///
375    ///
376    /// #### `parent`
377    ///  The parent widget of this widget.
378    ///
379    /// Readable
380    ///
381    ///
382    /// #### `receives-default`
383    ///  Whether the widget will receive the default action when it is focused.
384    ///
385    /// Readable | Writeable
386    ///
387    ///
388    /// #### `root`
389    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
390    ///
391    /// This will be `NULL` if the widget is not contained in a root widget.
392    ///
393    /// Readable
394    ///
395    ///
396    /// #### `scale-factor`
397    ///  The scale factor of the widget.
398    ///
399    /// Readable
400    ///
401    ///
402    /// #### `sensitive`
403    ///  Whether the widget responds to input.
404    ///
405    /// Readable | Writeable
406    ///
407    ///
408    /// #### `tooltip-markup`
409    ///  Sets the text of tooltip to be the given string, which is marked up
410    /// with Pango markup.
411    ///
412    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
413    ///
414    /// This is a convenience property which will take care of getting the
415    /// tooltip shown if the given string is not `NULL`:
416    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
417    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
418    /// the default signal handler.
419    ///
420    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
421    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
422    ///
423    /// Readable | Writeable
424    ///
425    ///
426    /// #### `tooltip-text`
427    ///  Sets the text of tooltip to be the given string.
428    ///
429    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
430    ///
431    /// This is a convenience property which will take care of getting the
432    /// tooltip shown if the given string is not `NULL`:
433    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
434    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
435    /// the default signal handler.
436    ///
437    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
438    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
439    ///
440    /// Readable | Writeable
441    ///
442    ///
443    /// #### `valign`
444    ///  How to distribute vertical space if widget gets extra space.
445    ///
446    /// Readable | Writeable
447    ///
448    ///
449    /// #### `vexpand`
450    ///  Whether to expand vertically.
451    ///
452    /// Readable | Writeable
453    ///
454    ///
455    /// #### `vexpand-set`
456    ///  Whether to use the `vexpand` property.
457    ///
458    /// Readable | Writeable
459    ///
460    ///
461    /// #### `visible`
462    ///  Whether the widget is visible.
463    ///
464    /// Readable | Writeable
465    ///
466    ///
467    /// #### `width-request`
468    ///  Overrides for width request of the widget.
469    ///
470    /// If this is -1, the natural request will be used.
471    ///
472    /// Readable | Writeable
473    /// </details>
474    /// <details><summary><h4>Accessible</h4></summary>
475    ///
476    ///
477    /// #### `accessible-role`
478    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
479    ///
480    /// The accessible role cannot be changed once set.
481    ///
482    /// Readable | Writeable
483    /// </details>
484    ///
485    /// ## Signals
486    ///
487    ///
488    /// #### `change-current-page`
489    ///  Emitted when the current page should be changed.
490    ///
491    /// The default bindings for this signal are
492    /// <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>PgUp</kbd>,
493    /// <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>PgDn</kbd>,
494    /// <kbd>Ctrl</kbd>+<kbd>PgUp</kbd> and <kbd>Ctrl</kbd>+<kbd>PgDn</kbd>.
495    ///
496    /// Action
497    ///
498    ///
499    /// #### `create-window`
500    ///  The ::create-window signal is emitted when a detachable
501    /// tab is dropped on the root window.
502    ///
503    /// A handler for this signal can create a window containing
504    /// a notebook where the tab will be attached. It is also
505    /// responsible for moving/resizing the window and adding the
506    /// necessary properties to the notebook (e.g. the
507    /// [`Notebook`][crate::Notebook]:group-name ).
508    ///
509    ///
510    ///
511    ///
512    /// #### `focus-tab`
513    ///  Emitted when a tab should be focused.
514    ///
515    /// Action
516    ///
517    ///
518    /// #### `move-focus-out`
519    ///  Emitted when focus was moved out.
520    ///
521    /// The default bindings for this signal are
522    /// <kbd>Ctrl</kbd>+<kbd>Tab</kbd>,
523    /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Tab</kbd>,
524    /// <kbd>Ctrl</kbd>+<kbd>←</kbd>, <kbd>Ctrl</kbd>+<kbd>→</kbd>,
525    /// <kbd>Ctrl</kbd>+<kbd>↑</kbd> and <kbd>Ctrl</kbd>+<kbd>↓</kbd>.
526    ///
527    /// Action
528    ///
529    ///
530    /// #### `page-added`
531    ///  the ::page-added signal is emitted in the notebook
532    /// right after a page is added to the notebook.
533    ///
534    ///
535    ///
536    ///
537    /// #### `page-removed`
538    ///  the ::page-removed signal is emitted in the notebook
539    /// right after a page is removed from the notebook.
540    ///
541    ///
542    ///
543    ///
544    /// #### `page-reordered`
545    ///  the ::page-reordered signal is emitted in the notebook
546    /// right after a page has been reordered.
547    ///
548    ///
549    ///
550    ///
551    /// #### `reorder-tab`
552    ///  Emitted when the tab should be reordered.
553    ///
554    /// The default bindings for this signal are
555    /// <kbd>Alt</kbd>+<kbd>Home</kbd>, <kbd>Alt</kbd>+<kbd>End</kbd>,
556    /// <kbd>Alt</kbd>+<kbd>PgUp</kbd>, <kbd>Alt</kbd>+<kbd>PgDn</kbd>,
557    /// <kbd>Alt</kbd>+<kbd>←</kbd>, <kbd>Alt</kbd>+<kbd>→</kbd>,
558    /// <kbd>Alt</kbd>+<kbd>↑</kbd> and <kbd>Alt</kbd>+<kbd>↓</kbd>.
559    ///
560    /// Action
561    ///
562    ///
563    /// #### `select-page`
564    ///  Emitted when a page should be selected.
565    ///
566    /// The default binding for this signal is <kbd>␣</kbd>.
567    ///
568    /// Action
569    ///
570    ///
571    /// #### `switch-page`
572    ///  Emitted when the user or a function changes the current page.
573    ///
574    ///
575    /// <details><summary><h4>Widget</h4></summary>
576    ///
577    ///
578    /// #### `destroy`
579    ///  Signals that all holders of a reference to the widget should release
580    /// the reference that they hold.
581    ///
582    /// May result in finalization of the widget if all references are released.
583    ///
584    /// This signal is not suitable for saving widget state.
585    ///
586    ///
587    ///
588    ///
589    /// #### `direction-changed`
590    ///  Emitted when the text direction of a widget changes.
591    ///
592    ///
593    ///
594    ///
595    /// #### `hide`
596    ///  Emitted when @widget is hidden.
597    ///
598    ///
599    ///
600    ///
601    /// #### `keynav-failed`
602    ///  Emitted if keyboard navigation fails.
603    ///
604    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
605    ///
606    ///
607    ///
608    ///
609    /// #### `map`
610    ///  Emitted when @widget is going to be mapped.
611    ///
612    /// A widget is mapped when the widget is visible (which is controlled with
613    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
614    /// are also visible.
615    ///
616    /// The `::map` signal can be used to determine whether a widget will be drawn,
617    /// for instance it can resume an animation that was stopped during the
618    /// emission of [`unmap`][struct@crate::Widget#unmap].
619    ///
620    ///
621    ///
622    ///
623    /// #### `mnemonic-activate`
624    ///  Emitted when a widget is activated via a mnemonic.
625    ///
626    /// The default handler for this signal activates @widget if @group_cycling
627    /// is false, or just makes @widget grab focus if @group_cycling is true.
628    ///
629    ///
630    ///
631    ///
632    /// #### `move-focus`
633    ///  Emitted when the focus is moved.
634    ///
635    /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
636    ///
637    /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
638    /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
639    ///
640    /// Action
641    ///
642    ///
643    /// #### `query-tooltip`
644    ///  Emitted when the widget’s tooltip is about to be shown.
645    ///
646    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
647    /// is true and the hover timeout has expired with the cursor hovering
648    /// above @widget; or emitted when @widget got focus in keyboard mode.
649    ///
650    /// Using the given coordinates, the signal handler should determine
651    /// whether a tooltip should be shown for @widget. If this is the case
652    /// true should be returned, false otherwise. Note that if @keyboard_mode
653    /// is true, the values of @x and @y are undefined and should not be used.
654    ///
655    /// The signal handler is free to manipulate @tooltip with the therefore
656    /// destined function calls.
657    ///
658    ///
659    ///
660    ///
661    /// #### `realize`
662    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
663    ///
664    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
665    /// or the widget has been mapped (that is, it is going to be drawn).
666    ///
667    ///
668    ///
669    ///
670    /// #### `show`
671    ///  Emitted when @widget is shown.
672    ///
673    ///
674    ///
675    ///
676    /// #### `state-flags-changed`
677    ///  Emitted when the widget state changes.
678    ///
679    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
680    ///
681    ///
682    ///
683    ///
684    /// #### `unmap`
685    ///  Emitted when @widget is going to be unmapped.
686    ///
687    /// A widget is unmapped when either it or any of its parents up to the
688    /// toplevel widget have been set as hidden.
689    ///
690    /// As `::unmap` indicates that a widget will not be shown any longer,
691    /// it can be used to, for example, stop an animation on the widget.
692    ///
693    ///
694    ///
695    ///
696    /// #### `unrealize`
697    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
698    ///
699    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
700    /// or the widget has been unmapped (that is, it is going to be hidden).
701    ///
702    ///
703    /// </details>
704    ///
705    /// # Implements
706    ///
707    /// [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
708    #[doc(alias = "GtkNotebook")]
709    pub struct Notebook(Object<ffi::GtkNotebook>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget;
710
711    match fn {
712        type_ => || ffi::gtk_notebook_get_type(),
713    }
714}
715
716impl Notebook {
717    /// Creates a new [`Notebook`][crate::Notebook] widget with no pages.
718    ///
719    /// # Returns
720    ///
721    /// the newly created [`Notebook`][crate::Notebook]
722    #[doc(alias = "gtk_notebook_new")]
723    pub fn new() -> Notebook {
724        assert_initialized_main_thread!();
725        unsafe { Widget::from_glib_none(ffi::gtk_notebook_new()).unsafe_cast() }
726    }
727
728    // rustdoc-stripper-ignore-next
729    /// Creates a new builder-pattern struct instance to construct [`Notebook`] objects.
730    ///
731    /// This method returns an instance of [`NotebookBuilder`](crate::builders::NotebookBuilder) which can be used to create [`Notebook`] objects.
732    pub fn builder() -> NotebookBuilder {
733        NotebookBuilder::new()
734    }
735
736    /// Removes the child from the notebook.
737    ///
738    /// This function is very similar to [`remove_page()`][Self::remove_page()],
739    /// but additionally informs the notebook that the removal
740    /// is happening as part of a tab DND operation, which should
741    /// not be cancelled.
742    /// ## `child`
743    /// a child
744    #[doc(alias = "gtk_notebook_detach_tab")]
745    pub fn detach_tab(&self, child: &impl IsA<Widget>) {
746        unsafe {
747            ffi::gtk_notebook_detach_tab(self.to_glib_none().0, child.as_ref().to_glib_none().0);
748        }
749    }
750
751    /// Gets one of the action widgets.
752    ///
753    /// See [`set_action_widget()`][Self::set_action_widget()].
754    /// ## `pack_type`
755    /// pack type of the action widget to receive
756    ///
757    /// # Returns
758    ///
759    /// The action widget
760    ///   with the given @pack_type or [`None`] when this action
761    ///   widget has not been set
762    #[doc(alias = "gtk_notebook_get_action_widget")]
763    #[doc(alias = "get_action_widget")]
764    pub fn action_widget(&self, pack_type: PackType) -> Option<Widget> {
765        unsafe {
766            from_glib_none(ffi::gtk_notebook_get_action_widget(
767                self.to_glib_none().0,
768                pack_type.into_glib(),
769            ))
770        }
771    }
772
773    /// Gets the current group name for @self.
774    ///
775    /// # Returns
776    ///
777    /// the group name,
778    ///   or [`None`] if none is set
779    #[doc(alias = "gtk_notebook_get_group_name")]
780    #[doc(alias = "get_group_name")]
781    #[doc(alias = "group-name")]
782    pub fn group_name(&self) -> Option<glib::GString> {
783        unsafe { from_glib_none(ffi::gtk_notebook_get_group_name(self.to_glib_none().0)) }
784    }
785
786    /// Retrieves the menu label widget of the page containing @child.
787    /// ## `child`
788    /// a widget contained in a page of @self
789    ///
790    /// # Returns
791    ///
792    /// the menu label, or [`None`]
793    ///   if the notebook page does not have a menu label other than
794    ///   the default (the tab label).
795    #[doc(alias = "gtk_notebook_get_menu_label")]
796    #[doc(alias = "get_menu_label")]
797    pub fn menu_label(&self, child: &impl IsA<Widget>) -> Option<Widget> {
798        unsafe {
799            from_glib_none(ffi::gtk_notebook_get_menu_label(
800                self.to_glib_none().0,
801                child.as_ref().to_glib_none().0,
802            ))
803        }
804    }
805
806    /// Retrieves the text of the menu label for the page containing
807    /// @child.
808    /// ## `child`
809    /// the child widget of a page of the notebook.
810    ///
811    /// # Returns
812    ///
813    /// the text of the tab label, or [`None`] if
814    ///   the widget does not have a menu label other than the default
815    ///   menu label, or the menu label widget is not a [`Label`][crate::Label].
816    ///   The string is owned by the widget and must not be freed.
817    #[doc(alias = "gtk_notebook_get_menu_label_text")]
818    #[doc(alias = "get_menu_label_text")]
819    pub fn menu_label_text(&self, child: &impl IsA<Widget>) -> Option<glib::GString> {
820        unsafe {
821            from_glib_none(ffi::gtk_notebook_get_menu_label_text(
822                self.to_glib_none().0,
823                child.as_ref().to_glib_none().0,
824            ))
825        }
826    }
827
828    /// Returns the [`NotebookPage`][crate::NotebookPage] for @child.
829    /// ## `child`
830    /// a child of @self
831    ///
832    /// # Returns
833    ///
834    /// the [`NotebookPage`][crate::NotebookPage] for @child
835    #[doc(alias = "gtk_notebook_get_page")]
836    #[doc(alias = "get_page")]
837    pub fn page(&self, child: &impl IsA<Widget>) -> NotebookPage {
838        unsafe {
839            from_glib_none(ffi::gtk_notebook_get_page(
840                self.to_glib_none().0,
841                child.as_ref().to_glib_none().0,
842            ))
843        }
844    }
845
846    /// Returns a `GListModel` that contains the pages of the notebook.
847    ///
848    /// This can be used to keep an up-to-date view. The model also
849    /// implements [`SelectionModel`][crate::SelectionModel] and can be used to track
850    /// and modify the visible page.
851    ///
852    /// # Returns
853    ///
854    /// a
855    ///   `GListModel` for the notebook's children
856    #[doc(alias = "gtk_notebook_get_pages")]
857    #[doc(alias = "get_pages")]
858    pub fn pages(&self) -> gio::ListModel {
859        unsafe { from_glib_full(ffi::gtk_notebook_get_pages(self.to_glib_none().0)) }
860    }
861
862    /// Returns whether the tab label area has arrows for scrolling.
863    ///
864    /// # Returns
865    ///
866    /// [`true`] if arrows for scrolling are present
867    #[doc(alias = "gtk_notebook_get_scrollable")]
868    #[doc(alias = "get_scrollable")]
869    #[doc(alias = "scrollable")]
870    pub fn is_scrollable(&self) -> bool {
871        unsafe { from_glib(ffi::gtk_notebook_get_scrollable(self.to_glib_none().0)) }
872    }
873
874    /// Returns whether a bevel will be drawn around the notebook pages.
875    ///
876    /// # Returns
877    ///
878    /// [`true`] if the bevel is drawn
879    #[doc(alias = "gtk_notebook_get_show_border")]
880    #[doc(alias = "get_show_border")]
881    #[doc(alias = "show-border")]
882    pub fn shows_border(&self) -> bool {
883        unsafe { from_glib(ffi::gtk_notebook_get_show_border(self.to_glib_none().0)) }
884    }
885
886    /// Returns whether the tabs of the notebook are shown.
887    ///
888    /// # Returns
889    ///
890    /// [`true`] if the tabs are shown
891    #[doc(alias = "gtk_notebook_get_show_tabs")]
892    #[doc(alias = "get_show_tabs")]
893    #[doc(alias = "show-tabs")]
894    pub fn shows_tabs(&self) -> bool {
895        unsafe { from_glib(ffi::gtk_notebook_get_show_tabs(self.to_glib_none().0)) }
896    }
897
898    /// Returns whether the tab contents can be detached from @self.
899    /// ## `child`
900    /// a child [`Widget`][crate::Widget]
901    ///
902    /// # Returns
903    ///
904    /// [`true`] if the tab is detachable.
905    #[doc(alias = "gtk_notebook_get_tab_detachable")]
906    #[doc(alias = "get_tab_detachable")]
907    pub fn tab_is_detachable(&self, child: &impl IsA<Widget>) -> bool {
908        unsafe {
909            from_glib(ffi::gtk_notebook_get_tab_detachable(
910                self.to_glib_none().0,
911                child.as_ref().to_glib_none().0,
912            ))
913        }
914    }
915
916    /// Returns the tab label widget for the page @child.
917    ///
918    /// [`None`] is returned if @child is not in @self or
919    /// if no tab label has specifically been set for @child.
920    /// ## `child`
921    /// the page
922    ///
923    /// # Returns
924    ///
925    /// the tab label
926    #[doc(alias = "gtk_notebook_get_tab_label")]
927    #[doc(alias = "get_tab_label")]
928    pub fn tab_label(&self, child: &impl IsA<Widget>) -> Option<Widget> {
929        unsafe {
930            from_glib_none(ffi::gtk_notebook_get_tab_label(
931                self.to_glib_none().0,
932                child.as_ref().to_glib_none().0,
933            ))
934        }
935    }
936
937    /// Retrieves the text of the tab label for the page containing
938    /// @child.
939    /// ## `child`
940    /// a widget contained in a page of @self
941    ///
942    /// # Returns
943    ///
944    /// the text of the tab label, or [`None`] if
945    ///   the tab label widget is not a [`Label`][crate::Label]. The string is owned
946    ///   by the widget and must not be freed.
947    #[doc(alias = "gtk_notebook_get_tab_label_text")]
948    #[doc(alias = "get_tab_label_text")]
949    pub fn tab_label_text(&self, child: &impl IsA<Widget>) -> Option<glib::GString> {
950        unsafe {
951            from_glib_none(ffi::gtk_notebook_get_tab_label_text(
952                self.to_glib_none().0,
953                child.as_ref().to_glib_none().0,
954            ))
955        }
956    }
957
958    /// Gets the edge at which the tabs are drawn.
959    ///
960    /// # Returns
961    ///
962    /// the edge at which the tabs are drawn
963    #[doc(alias = "gtk_notebook_get_tab_pos")]
964    #[doc(alias = "get_tab_pos")]
965    #[doc(alias = "tab-pos")]
966    pub fn tab_pos(&self) -> PositionType {
967        unsafe { from_glib(ffi::gtk_notebook_get_tab_pos(self.to_glib_none().0)) }
968    }
969
970    /// Gets whether the tab can be reordered via drag and drop or not.
971    /// ## `child`
972    /// a child [`Widget`][crate::Widget]
973    ///
974    /// # Returns
975    ///
976    /// [`true`] if the tab is reorderable.
977    #[doc(alias = "gtk_notebook_get_tab_reorderable")]
978    #[doc(alias = "get_tab_reorderable")]
979    pub fn tab_is_reorderable(&self, child: &impl IsA<Widget>) -> bool {
980        unsafe {
981            from_glib(ffi::gtk_notebook_get_tab_reorderable(
982                self.to_glib_none().0,
983                child.as_ref().to_glib_none().0,
984            ))
985        }
986    }
987
988    /// Switches to the next page.
989    ///
990    /// Nothing happens if the current page is the last page.
991    #[doc(alias = "gtk_notebook_next_page")]
992    pub fn next_page(&self) {
993        unsafe {
994            ffi::gtk_notebook_next_page(self.to_glib_none().0);
995        }
996    }
997
998    /// Disables the popup menu.
999    #[doc(alias = "gtk_notebook_popup_disable")]
1000    pub fn popup_disable(&self) {
1001        unsafe {
1002            ffi::gtk_notebook_popup_disable(self.to_glib_none().0);
1003        }
1004    }
1005
1006    /// Enables the popup menu.
1007    ///
1008    /// If the user clicks with the right mouse button on the tab labels,
1009    /// a menu with all the pages will be popped up.
1010    #[doc(alias = "gtk_notebook_popup_enable")]
1011    pub fn popup_enable(&self) {
1012        unsafe {
1013            ffi::gtk_notebook_popup_enable(self.to_glib_none().0);
1014        }
1015    }
1016
1017    /// Switches to the previous page.
1018    ///
1019    /// Nothing happens if the current page is the first page.
1020    #[doc(alias = "gtk_notebook_prev_page")]
1021    pub fn prev_page(&self) {
1022        unsafe {
1023            ffi::gtk_notebook_prev_page(self.to_glib_none().0);
1024        }
1025    }
1026
1027    /// Sets @widget as one of the action widgets.
1028    ///
1029    /// Depending on the pack type the widget will be placed before
1030    /// or after the tabs. You can use a [`Box`][crate::Box] if you need to pack
1031    /// more than one widget on the same side.
1032    /// ## `widget`
1033    /// a [`Widget`][crate::Widget]
1034    /// ## `pack_type`
1035    /// pack type of the action widget
1036    #[doc(alias = "gtk_notebook_set_action_widget")]
1037    pub fn set_action_widget(&self, widget: &impl IsA<Widget>, pack_type: PackType) {
1038        unsafe {
1039            ffi::gtk_notebook_set_action_widget(
1040                self.to_glib_none().0,
1041                widget.as_ref().to_glib_none().0,
1042                pack_type.into_glib(),
1043            );
1044        }
1045    }
1046
1047    /// Sets a group name for @self.
1048    ///
1049    /// Notebooks with the same name will be able to exchange tabs
1050    /// via drag and drop. A notebook with a [`None`] group name will
1051    /// not be able to exchange tabs with any other notebook.
1052    /// ## `group_name`
1053    /// the name of the notebook group,
1054    ///   or [`None`] to unset it
1055    #[doc(alias = "gtk_notebook_set_group_name")]
1056    #[doc(alias = "group-name")]
1057    pub fn set_group_name(&self, group_name: Option<&str>) {
1058        unsafe {
1059            ffi::gtk_notebook_set_group_name(self.to_glib_none().0, group_name.to_glib_none().0);
1060        }
1061    }
1062
1063    /// Changes the menu label for the page containing @child.
1064    /// ## `child`
1065    /// the child widget
1066    /// ## `menu_label`
1067    /// the menu label, or [`None`] for default
1068    #[doc(alias = "gtk_notebook_set_menu_label")]
1069    pub fn set_menu_label(&self, child: &impl IsA<Widget>, menu_label: Option<&impl IsA<Widget>>) {
1070        unsafe {
1071            ffi::gtk_notebook_set_menu_label(
1072                self.to_glib_none().0,
1073                child.as_ref().to_glib_none().0,
1074                menu_label.map(|p| p.as_ref()).to_glib_none().0,
1075            );
1076        }
1077    }
1078
1079    /// Creates a new label and sets it as the menu label of @child.
1080    /// ## `child`
1081    /// the child widget
1082    /// ## `menu_text`
1083    /// the label text
1084    #[doc(alias = "gtk_notebook_set_menu_label_text")]
1085    pub fn set_menu_label_text(&self, child: &impl IsA<Widget>, menu_text: &str) {
1086        unsafe {
1087            ffi::gtk_notebook_set_menu_label_text(
1088                self.to_glib_none().0,
1089                child.as_ref().to_glib_none().0,
1090                menu_text.to_glib_none().0,
1091            );
1092        }
1093    }
1094
1095    /// Sets whether the tab label area will have arrows for
1096    /// scrolling if there are too many tabs to fit in the area.
1097    /// ## `scrollable`
1098    /// [`true`] if scroll arrows should be added
1099    #[doc(alias = "gtk_notebook_set_scrollable")]
1100    #[doc(alias = "scrollable")]
1101    pub fn set_scrollable(&self, scrollable: bool) {
1102        unsafe {
1103            ffi::gtk_notebook_set_scrollable(self.to_glib_none().0, scrollable.into_glib());
1104        }
1105    }
1106
1107    /// Sets whether a bevel will be drawn around the notebook pages.
1108    ///
1109    /// This only has a visual effect when the tabs are not shown.
1110    /// ## `show_border`
1111    /// [`true`] if a bevel should be drawn around the notebook
1112    #[doc(alias = "gtk_notebook_set_show_border")]
1113    #[doc(alias = "show-border")]
1114    pub fn set_show_border(&self, show_border: bool) {
1115        unsafe {
1116            ffi::gtk_notebook_set_show_border(self.to_glib_none().0, show_border.into_glib());
1117        }
1118    }
1119
1120    /// Sets whether to show the tabs for the notebook or not.
1121    /// ## `show_tabs`
1122    /// [`true`] if the tabs should be shown
1123    #[doc(alias = "gtk_notebook_set_show_tabs")]
1124    #[doc(alias = "show-tabs")]
1125    pub fn set_show_tabs(&self, show_tabs: bool) {
1126        unsafe {
1127            ffi::gtk_notebook_set_show_tabs(self.to_glib_none().0, show_tabs.into_glib());
1128        }
1129    }
1130
1131    /// Sets whether the tab can be detached from @self to another
1132    /// notebook or widget.
1133    ///
1134    /// Note that two notebooks must share a common group identifier
1135    /// (see [`set_group_name()`][Self::set_group_name()]) to allow automatic tabs
1136    /// interchange between them.
1137    ///
1138    /// If you want a widget to interact with a notebook through DnD
1139    /// (i.e.: accept dragged tabs from it) it must be set as a drop
1140    /// destination by adding to it a [`DropTarget`][crate::DropTarget] controller that accepts
1141    /// the GType `GTK_TYPE_NOTEBOOK_PAGE`. The `:value` of said drop target will be
1142    /// preloaded with a [`NotebookPage`][crate::NotebookPage] object that corresponds to the
1143    /// dropped tab, so you can process the value via `::accept` or `::drop` signals.
1144    ///
1145    /// Note that you should use [`detach_tab()`][Self::detach_tab()] instead
1146    /// of [`remove_page()`][Self::remove_page()] if you want to remove the tab
1147    /// from the source notebook as part of accepting a drop. Otherwise,
1148    /// the source notebook will think that the dragged tab was removed
1149    /// from underneath the ongoing drag operation, and will initiate a
1150    /// drag cancel animation.
1151    ///
1152    /// **⚠️ The following code is in c ⚠️**
1153    ///
1154    /// ```c
1155    /// static void
1156    /// on_drag_data_received (GtkWidget        *widget,
1157    ///                        GdkDrop          *drop,
1158    ///                        GtkSelectionData *data,
1159    ///                        guint             time,
1160    ///                        gpointer          user_data)
1161    /// {
1162    ///   GtkDrag *drag;
1163    ///   GtkWidget *notebook;
1164    ///   GtkWidget **child;
1165    ///
1166    ///   drag = gtk_drop_get_drag (drop);
1167    ///   notebook = g_object_get_data (drag, "gtk-notebook-drag-origin");
1168    ///   child = (void*) gtk_selection_data_get_data (data);
1169    ///
1170    ///   // process_widget (*child);
1171    ///
1172    ///   gtk_notebook_detach_tab (GTK_NOTEBOOK (notebook), *child);
1173    /// }
1174    /// ```
1175    ///
1176    /// If you want a notebook to accept drags from other widgets,
1177    /// you will have to set your own DnD code to do it.
1178    /// ## `child`
1179    /// a child [`Widget`][crate::Widget]
1180    /// ## `detachable`
1181    /// whether the tab is detachable or not
1182    #[doc(alias = "gtk_notebook_set_tab_detachable")]
1183    pub fn set_tab_detachable(&self, child: &impl IsA<Widget>, detachable: bool) {
1184        unsafe {
1185            ffi::gtk_notebook_set_tab_detachable(
1186                self.to_glib_none().0,
1187                child.as_ref().to_glib_none().0,
1188                detachable.into_glib(),
1189            );
1190        }
1191    }
1192
1193    /// Changes the tab label for @child.
1194    ///
1195    /// If [`None`] is specified for @tab_label, then the page will
1196    /// have the label “page N”.
1197    /// ## `child`
1198    /// the page
1199    /// ## `tab_label`
1200    /// the tab label widget to use, or [`None`]
1201    ///   for default tab label
1202    #[doc(alias = "gtk_notebook_set_tab_label")]
1203    pub fn set_tab_label(&self, child: &impl IsA<Widget>, tab_label: Option<&impl IsA<Widget>>) {
1204        unsafe {
1205            ffi::gtk_notebook_set_tab_label(
1206                self.to_glib_none().0,
1207                child.as_ref().to_glib_none().0,
1208                tab_label.map(|p| p.as_ref()).to_glib_none().0,
1209            );
1210        }
1211    }
1212
1213    /// Creates a new label and sets it as the tab label for the page
1214    /// containing @child.
1215    /// ## `child`
1216    /// the page
1217    /// ## `tab_text`
1218    /// the label text
1219    #[doc(alias = "gtk_notebook_set_tab_label_text")]
1220    pub fn set_tab_label_text(&self, child: &impl IsA<Widget>, tab_text: &str) {
1221        unsafe {
1222            ffi::gtk_notebook_set_tab_label_text(
1223                self.to_glib_none().0,
1224                child.as_ref().to_glib_none().0,
1225                tab_text.to_glib_none().0,
1226            );
1227        }
1228    }
1229
1230    /// Sets the edge at which the tabs are drawn.
1231    /// ## `pos`
1232    /// the edge to draw the tabs at
1233    #[doc(alias = "gtk_notebook_set_tab_pos")]
1234    #[doc(alias = "tab-pos")]
1235    pub fn set_tab_pos(&self, pos: PositionType) {
1236        unsafe {
1237            ffi::gtk_notebook_set_tab_pos(self.to_glib_none().0, pos.into_glib());
1238        }
1239    }
1240
1241    /// Sets whether the notebook tab can be reordered
1242    /// via drag and drop or not.
1243    /// ## `child`
1244    /// a child [`Widget`][crate::Widget]
1245    /// ## `reorderable`
1246    /// whether the tab is reorderable or not
1247    #[doc(alias = "gtk_notebook_set_tab_reorderable")]
1248    pub fn set_tab_reorderable(&self, child: &impl IsA<Widget>, reorderable: bool) {
1249        unsafe {
1250            ffi::gtk_notebook_set_tab_reorderable(
1251                self.to_glib_none().0,
1252                child.as_ref().to_glib_none().0,
1253                reorderable.into_glib(),
1254            );
1255        }
1256    }
1257
1258    /// If [`true`], pressing the right mouse button on the notebook shows a page switching menu.
1259    #[doc(alias = "enable-popup")]
1260    pub fn enables_popup(&self) -> bool {
1261        ObjectExt::property(self, "enable-popup")
1262    }
1263
1264    /// If [`true`], pressing the right mouse button on the notebook shows a page switching menu.
1265    #[doc(alias = "enable-popup")]
1266    pub fn set_enable_popup(&self, enable_popup: bool) {
1267        ObjectExt::set_property(self, "enable-popup", enable_popup)
1268    }
1269
1270    /// Emitted when the current page should be changed.
1271    ///
1272    /// The default bindings for this signal are
1273    /// <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>PgUp</kbd>,
1274    /// <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>PgDn</kbd>,
1275    /// <kbd>Ctrl</kbd>+<kbd>PgUp</kbd> and <kbd>Ctrl</kbd>+<kbd>PgDn</kbd>.
1276    /// ## `page`
1277    /// the page index
1278    ///
1279    /// # Returns
1280    ///
1281    /// whether the page was changed
1282    #[doc(alias = "change-current-page")]
1283    pub fn connect_change_current_page<F: Fn(&Self, i32) -> bool + 'static>(
1284        &self,
1285        f: F,
1286    ) -> SignalHandlerId {
1287        unsafe extern "C" fn change_current_page_trampoline<
1288            F: Fn(&Notebook, i32) -> bool + 'static,
1289        >(
1290            this: *mut ffi::GtkNotebook,
1291            page: std::ffi::c_int,
1292            f: glib::ffi::gpointer,
1293        ) -> glib::ffi::gboolean {
1294            let f: &F = &*(f as *const F);
1295            f(&from_glib_borrow(this), page).into_glib()
1296        }
1297        unsafe {
1298            let f: Box_<F> = Box_::new(f);
1299            connect_raw(
1300                self.as_ptr() as *mut _,
1301                b"change-current-page\0".as_ptr() as *const _,
1302                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1303                    change_current_page_trampoline::<F> as *const (),
1304                )),
1305                Box_::into_raw(f),
1306            )
1307        }
1308    }
1309
1310    pub fn emit_change_current_page(&self, page: i32) -> bool {
1311        self.emit_by_name("change-current-page", &[&page])
1312    }
1313
1314    /// The ::create-window signal is emitted when a detachable
1315    /// tab is dropped on the root window.
1316    ///
1317    /// A handler for this signal can create a window containing
1318    /// a notebook where the tab will be attached. It is also
1319    /// responsible for moving/resizing the window and adding the
1320    /// necessary properties to the notebook (e.g. the
1321    /// [`Notebook`][crate::Notebook]:group-name ).
1322    /// ## `page`
1323    /// the tab of @notebook that is being detached
1324    ///
1325    /// # Returns
1326    ///
1327    /// a [`Notebook`][crate::Notebook] that
1328    ///   @page should be added to
1329    #[doc(alias = "create-window")]
1330    pub fn connect_create_window<F: Fn(&Self, &Widget) -> Option<Notebook> + 'static>(
1331        &self,
1332        f: F,
1333    ) -> SignalHandlerId {
1334        unsafe extern "C" fn create_window_trampoline<
1335            F: Fn(&Notebook, &Widget) -> Option<Notebook> + 'static,
1336        >(
1337            this: *mut ffi::GtkNotebook,
1338            page: *mut ffi::GtkWidget,
1339            f: glib::ffi::gpointer,
1340        ) -> *mut ffi::GtkNotebook {
1341            let f: &F = &*(f as *const F);
1342            f(&from_glib_borrow(this), &from_glib_borrow(page)) /*Not checked*/
1343                .to_glib_none()
1344                .0
1345        }
1346        unsafe {
1347            let f: Box_<F> = Box_::new(f);
1348            connect_raw(
1349                self.as_ptr() as *mut _,
1350                b"create-window\0".as_ptr() as *const _,
1351                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1352                    create_window_trampoline::<F> as *const (),
1353                )),
1354                Box_::into_raw(f),
1355            )
1356        }
1357    }
1358
1359    /// Emitted when a tab should be focused.
1360    /// ## `tab`
1361    /// the notebook tab
1362    ///
1363    /// # Returns
1364    ///
1365    /// whether the tab has been focused
1366    #[doc(alias = "focus-tab")]
1367    pub fn connect_focus_tab<F: Fn(&Self, NotebookTab) -> bool + 'static>(
1368        &self,
1369        f: F,
1370    ) -> SignalHandlerId {
1371        unsafe extern "C" fn focus_tab_trampoline<
1372            F: Fn(&Notebook, NotebookTab) -> bool + 'static,
1373        >(
1374            this: *mut ffi::GtkNotebook,
1375            tab: ffi::GtkNotebookTab,
1376            f: glib::ffi::gpointer,
1377        ) -> glib::ffi::gboolean {
1378            let f: &F = &*(f as *const F);
1379            f(&from_glib_borrow(this), from_glib(tab)).into_glib()
1380        }
1381        unsafe {
1382            let f: Box_<F> = Box_::new(f);
1383            connect_raw(
1384                self.as_ptr() as *mut _,
1385                b"focus-tab\0".as_ptr() as *const _,
1386                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1387                    focus_tab_trampoline::<F> as *const (),
1388                )),
1389                Box_::into_raw(f),
1390            )
1391        }
1392    }
1393
1394    pub fn emit_focus_tab(&self, tab: NotebookTab) -> bool {
1395        self.emit_by_name("focus-tab", &[&tab])
1396    }
1397
1398    /// Emitted when focus was moved out.
1399    ///
1400    /// The default bindings for this signal are
1401    /// <kbd>Ctrl</kbd>+<kbd>Tab</kbd>,
1402    /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Tab</kbd>,
1403    /// <kbd>Ctrl</kbd>+<kbd>←</kbd>, <kbd>Ctrl</kbd>+<kbd>→</kbd>,
1404    /// <kbd>Ctrl</kbd>+<kbd>↑</kbd> and <kbd>Ctrl</kbd>+<kbd>↓</kbd>.
1405    /// ## `direction`
1406    /// the direction to move the focus
1407    #[doc(alias = "move-focus-out")]
1408    pub fn connect_move_focus_out<F: Fn(&Self, DirectionType) + 'static>(
1409        &self,
1410        f: F,
1411    ) -> SignalHandlerId {
1412        unsafe extern "C" fn move_focus_out_trampoline<
1413            F: Fn(&Notebook, DirectionType) + 'static,
1414        >(
1415            this: *mut ffi::GtkNotebook,
1416            direction: ffi::GtkDirectionType,
1417            f: glib::ffi::gpointer,
1418        ) {
1419            let f: &F = &*(f as *const F);
1420            f(&from_glib_borrow(this), from_glib(direction))
1421        }
1422        unsafe {
1423            let f: Box_<F> = Box_::new(f);
1424            connect_raw(
1425                self.as_ptr() as *mut _,
1426                b"move-focus-out\0".as_ptr() as *const _,
1427                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1428                    move_focus_out_trampoline::<F> as *const (),
1429                )),
1430                Box_::into_raw(f),
1431            )
1432        }
1433    }
1434
1435    pub fn emit_move_focus_out(&self, direction: DirectionType) {
1436        self.emit_by_name::<()>("move-focus-out", &[&direction]);
1437    }
1438
1439    /// the ::page-added signal is emitted in the notebook
1440    /// right after a page is added to the notebook.
1441    /// ## `child`
1442    /// the child [`Widget`][crate::Widget] affected
1443    /// ## `page_num`
1444    /// the new page number for @child
1445    #[doc(alias = "page-added")]
1446    pub fn connect_page_added<F: Fn(&Self, &Widget, u32) + 'static>(
1447        &self,
1448        f: F,
1449    ) -> SignalHandlerId {
1450        unsafe extern "C" fn page_added_trampoline<F: Fn(&Notebook, &Widget, u32) + 'static>(
1451            this: *mut ffi::GtkNotebook,
1452            child: *mut ffi::GtkWidget,
1453            page_num: std::ffi::c_uint,
1454            f: glib::ffi::gpointer,
1455        ) {
1456            let f: &F = &*(f as *const F);
1457            f(&from_glib_borrow(this), &from_glib_borrow(child), page_num)
1458        }
1459        unsafe {
1460            let f: Box_<F> = Box_::new(f);
1461            connect_raw(
1462                self.as_ptr() as *mut _,
1463                b"page-added\0".as_ptr() as *const _,
1464                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1465                    page_added_trampoline::<F> as *const (),
1466                )),
1467                Box_::into_raw(f),
1468            )
1469        }
1470    }
1471
1472    /// the ::page-removed signal is emitted in the notebook
1473    /// right after a page is removed from the notebook.
1474    /// ## `child`
1475    /// the child [`Widget`][crate::Widget] affected
1476    /// ## `page_num`
1477    /// the @child page number
1478    #[doc(alias = "page-removed")]
1479    pub fn connect_page_removed<F: Fn(&Self, &Widget, u32) + 'static>(
1480        &self,
1481        f: F,
1482    ) -> SignalHandlerId {
1483        unsafe extern "C" fn page_removed_trampoline<F: Fn(&Notebook, &Widget, u32) + 'static>(
1484            this: *mut ffi::GtkNotebook,
1485            child: *mut ffi::GtkWidget,
1486            page_num: std::ffi::c_uint,
1487            f: glib::ffi::gpointer,
1488        ) {
1489            let f: &F = &*(f as *const F);
1490            f(&from_glib_borrow(this), &from_glib_borrow(child), page_num)
1491        }
1492        unsafe {
1493            let f: Box_<F> = Box_::new(f);
1494            connect_raw(
1495                self.as_ptr() as *mut _,
1496                b"page-removed\0".as_ptr() as *const _,
1497                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1498                    page_removed_trampoline::<F> as *const (),
1499                )),
1500                Box_::into_raw(f),
1501            )
1502        }
1503    }
1504
1505    /// the ::page-reordered signal is emitted in the notebook
1506    /// right after a page has been reordered.
1507    /// ## `child`
1508    /// the child [`Widget`][crate::Widget] affected
1509    /// ## `page_num`
1510    /// the new page number for @child
1511    #[doc(alias = "page-reordered")]
1512    pub fn connect_page_reordered<F: Fn(&Self, &Widget, u32) + 'static>(
1513        &self,
1514        f: F,
1515    ) -> SignalHandlerId {
1516        unsafe extern "C" fn page_reordered_trampoline<F: Fn(&Notebook, &Widget, u32) + 'static>(
1517            this: *mut ffi::GtkNotebook,
1518            child: *mut ffi::GtkWidget,
1519            page_num: std::ffi::c_uint,
1520            f: glib::ffi::gpointer,
1521        ) {
1522            let f: &F = &*(f as *const F);
1523            f(&from_glib_borrow(this), &from_glib_borrow(child), page_num)
1524        }
1525        unsafe {
1526            let f: Box_<F> = Box_::new(f);
1527            connect_raw(
1528                self.as_ptr() as *mut _,
1529                b"page-reordered\0".as_ptr() as *const _,
1530                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1531                    page_reordered_trampoline::<F> as *const (),
1532                )),
1533                Box_::into_raw(f),
1534            )
1535        }
1536    }
1537
1538    /// Emitted when the tab should be reordered.
1539    ///
1540    /// The default bindings for this signal are
1541    /// <kbd>Alt</kbd>+<kbd>Home</kbd>, <kbd>Alt</kbd>+<kbd>End</kbd>,
1542    /// <kbd>Alt</kbd>+<kbd>PgUp</kbd>, <kbd>Alt</kbd>+<kbd>PgDn</kbd>,
1543    /// <kbd>Alt</kbd>+<kbd>←</kbd>, <kbd>Alt</kbd>+<kbd>→</kbd>,
1544    /// <kbd>Alt</kbd>+<kbd>↑</kbd> and <kbd>Alt</kbd>+<kbd>↓</kbd>.
1545    /// ## `direction`
1546    /// the direction to move the tab
1547    /// ## `move_to_last`
1548    /// whether to move to the last position
1549    ///
1550    /// # Returns
1551    ///
1552    /// whether the tab was moved.
1553    #[doc(alias = "reorder-tab")]
1554    pub fn connect_reorder_tab<F: Fn(&Self, DirectionType, bool) -> bool + 'static>(
1555        &self,
1556        f: F,
1557    ) -> SignalHandlerId {
1558        unsafe extern "C" fn reorder_tab_trampoline<
1559            F: Fn(&Notebook, DirectionType, bool) -> bool + 'static,
1560        >(
1561            this: *mut ffi::GtkNotebook,
1562            direction: ffi::GtkDirectionType,
1563            move_to_last: glib::ffi::gboolean,
1564            f: glib::ffi::gpointer,
1565        ) -> glib::ffi::gboolean {
1566            let f: &F = &*(f as *const F);
1567            f(
1568                &from_glib_borrow(this),
1569                from_glib(direction),
1570                from_glib(move_to_last),
1571            )
1572            .into_glib()
1573        }
1574        unsafe {
1575            let f: Box_<F> = Box_::new(f);
1576            connect_raw(
1577                self.as_ptr() as *mut _,
1578                b"reorder-tab\0".as_ptr() as *const _,
1579                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1580                    reorder_tab_trampoline::<F> as *const (),
1581                )),
1582                Box_::into_raw(f),
1583            )
1584        }
1585    }
1586
1587    pub fn emit_reorder_tab(&self, direction: DirectionType, move_to_last: bool) -> bool {
1588        self.emit_by_name("reorder-tab", &[&direction, &move_to_last])
1589    }
1590
1591    /// Emitted when a page should be selected.
1592    ///
1593    /// The default binding for this signal is <kbd>␣</kbd>.
1594    /// ## `move_focus`
1595    /// whether to move focus
1596    ///
1597    /// # Returns
1598    ///
1599    /// whether the page was selected
1600    #[doc(alias = "select-page")]
1601    pub fn connect_select_page<F: Fn(&Self, bool) -> bool + 'static>(
1602        &self,
1603        f: F,
1604    ) -> SignalHandlerId {
1605        unsafe extern "C" fn select_page_trampoline<F: Fn(&Notebook, bool) -> bool + 'static>(
1606            this: *mut ffi::GtkNotebook,
1607            move_focus: glib::ffi::gboolean,
1608            f: glib::ffi::gpointer,
1609        ) -> glib::ffi::gboolean {
1610            let f: &F = &*(f as *const F);
1611            f(&from_glib_borrow(this), from_glib(move_focus)).into_glib()
1612        }
1613        unsafe {
1614            let f: Box_<F> = Box_::new(f);
1615            connect_raw(
1616                self.as_ptr() as *mut _,
1617                b"select-page\0".as_ptr() as *const _,
1618                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1619                    select_page_trampoline::<F> as *const (),
1620                )),
1621                Box_::into_raw(f),
1622            )
1623        }
1624    }
1625
1626    pub fn emit_select_page(&self, move_focus: bool) -> bool {
1627        self.emit_by_name("select-page", &[&move_focus])
1628    }
1629
1630    /// Emitted when the user or a function changes the current page.
1631    /// ## `page`
1632    /// the new current page
1633    /// ## `page_num`
1634    /// the index of the page
1635    #[doc(alias = "switch-page")]
1636    pub fn connect_switch_page<F: Fn(&Self, &Widget, u32) + 'static>(
1637        &self,
1638        f: F,
1639    ) -> SignalHandlerId {
1640        unsafe extern "C" fn switch_page_trampoline<F: Fn(&Notebook, &Widget, u32) + 'static>(
1641            this: *mut ffi::GtkNotebook,
1642            page: *mut ffi::GtkWidget,
1643            page_num: std::ffi::c_uint,
1644            f: glib::ffi::gpointer,
1645        ) {
1646            let f: &F = &*(f as *const F);
1647            f(&from_glib_borrow(this), &from_glib_borrow(page), page_num)
1648        }
1649        unsafe {
1650            let f: Box_<F> = Box_::new(f);
1651            connect_raw(
1652                self.as_ptr() as *mut _,
1653                b"switch-page\0".as_ptr() as *const _,
1654                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1655                    switch_page_trampoline::<F> as *const (),
1656                )),
1657                Box_::into_raw(f),
1658            )
1659        }
1660    }
1661
1662    #[doc(alias = "enable-popup")]
1663    pub fn connect_enable_popup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1664        unsafe extern "C" fn notify_enable_popup_trampoline<F: Fn(&Notebook) + 'static>(
1665            this: *mut ffi::GtkNotebook,
1666            _param_spec: glib::ffi::gpointer,
1667            f: glib::ffi::gpointer,
1668        ) {
1669            let f: &F = &*(f as *const F);
1670            f(&from_glib_borrow(this))
1671        }
1672        unsafe {
1673            let f: Box_<F> = Box_::new(f);
1674            connect_raw(
1675                self.as_ptr() as *mut _,
1676                b"notify::enable-popup\0".as_ptr() as *const _,
1677                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1678                    notify_enable_popup_trampoline::<F> as *const (),
1679                )),
1680                Box_::into_raw(f),
1681            )
1682        }
1683    }
1684
1685    #[doc(alias = "group-name")]
1686    pub fn connect_group_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1687        unsafe extern "C" fn notify_group_name_trampoline<F: Fn(&Notebook) + 'static>(
1688            this: *mut ffi::GtkNotebook,
1689            _param_spec: glib::ffi::gpointer,
1690            f: glib::ffi::gpointer,
1691        ) {
1692            let f: &F = &*(f as *const F);
1693            f(&from_glib_borrow(this))
1694        }
1695        unsafe {
1696            let f: Box_<F> = Box_::new(f);
1697            connect_raw(
1698                self.as_ptr() as *mut _,
1699                b"notify::group-name\0".as_ptr() as *const _,
1700                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1701                    notify_group_name_trampoline::<F> as *const (),
1702                )),
1703                Box_::into_raw(f),
1704            )
1705        }
1706    }
1707
1708    #[doc(alias = "page")]
1709    pub fn connect_page_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1710        unsafe extern "C" fn notify_page_trampoline<F: Fn(&Notebook) + 'static>(
1711            this: *mut ffi::GtkNotebook,
1712            _param_spec: glib::ffi::gpointer,
1713            f: glib::ffi::gpointer,
1714        ) {
1715            let f: &F = &*(f as *const F);
1716            f(&from_glib_borrow(this))
1717        }
1718        unsafe {
1719            let f: Box_<F> = Box_::new(f);
1720            connect_raw(
1721                self.as_ptr() as *mut _,
1722                b"notify::page\0".as_ptr() as *const _,
1723                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1724                    notify_page_trampoline::<F> as *const (),
1725                )),
1726                Box_::into_raw(f),
1727            )
1728        }
1729    }
1730
1731    #[doc(alias = "pages")]
1732    pub fn connect_pages_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1733        unsafe extern "C" fn notify_pages_trampoline<F: Fn(&Notebook) + 'static>(
1734            this: *mut ffi::GtkNotebook,
1735            _param_spec: glib::ffi::gpointer,
1736            f: glib::ffi::gpointer,
1737        ) {
1738            let f: &F = &*(f as *const F);
1739            f(&from_glib_borrow(this))
1740        }
1741        unsafe {
1742            let f: Box_<F> = Box_::new(f);
1743            connect_raw(
1744                self.as_ptr() as *mut _,
1745                b"notify::pages\0".as_ptr() as *const _,
1746                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1747                    notify_pages_trampoline::<F> as *const (),
1748                )),
1749                Box_::into_raw(f),
1750            )
1751        }
1752    }
1753
1754    #[doc(alias = "scrollable")]
1755    pub fn connect_scrollable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1756        unsafe extern "C" fn notify_scrollable_trampoline<F: Fn(&Notebook) + 'static>(
1757            this: *mut ffi::GtkNotebook,
1758            _param_spec: glib::ffi::gpointer,
1759            f: glib::ffi::gpointer,
1760        ) {
1761            let f: &F = &*(f as *const F);
1762            f(&from_glib_borrow(this))
1763        }
1764        unsafe {
1765            let f: Box_<F> = Box_::new(f);
1766            connect_raw(
1767                self.as_ptr() as *mut _,
1768                b"notify::scrollable\0".as_ptr() as *const _,
1769                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1770                    notify_scrollable_trampoline::<F> as *const (),
1771                )),
1772                Box_::into_raw(f),
1773            )
1774        }
1775    }
1776
1777    #[doc(alias = "show-border")]
1778    pub fn connect_show_border_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1779        unsafe extern "C" fn notify_show_border_trampoline<F: Fn(&Notebook) + 'static>(
1780            this: *mut ffi::GtkNotebook,
1781            _param_spec: glib::ffi::gpointer,
1782            f: glib::ffi::gpointer,
1783        ) {
1784            let f: &F = &*(f as *const F);
1785            f(&from_glib_borrow(this))
1786        }
1787        unsafe {
1788            let f: Box_<F> = Box_::new(f);
1789            connect_raw(
1790                self.as_ptr() as *mut _,
1791                b"notify::show-border\0".as_ptr() as *const _,
1792                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1793                    notify_show_border_trampoline::<F> as *const (),
1794                )),
1795                Box_::into_raw(f),
1796            )
1797        }
1798    }
1799
1800    #[doc(alias = "show-tabs")]
1801    pub fn connect_show_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1802        unsafe extern "C" fn notify_show_tabs_trampoline<F: Fn(&Notebook) + 'static>(
1803            this: *mut ffi::GtkNotebook,
1804            _param_spec: glib::ffi::gpointer,
1805            f: glib::ffi::gpointer,
1806        ) {
1807            let f: &F = &*(f as *const F);
1808            f(&from_glib_borrow(this))
1809        }
1810        unsafe {
1811            let f: Box_<F> = Box_::new(f);
1812            connect_raw(
1813                self.as_ptr() as *mut _,
1814                b"notify::show-tabs\0".as_ptr() as *const _,
1815                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1816                    notify_show_tabs_trampoline::<F> as *const (),
1817                )),
1818                Box_::into_raw(f),
1819            )
1820        }
1821    }
1822
1823    #[doc(alias = "tab-pos")]
1824    pub fn connect_tab_pos_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1825        unsafe extern "C" fn notify_tab_pos_trampoline<F: Fn(&Notebook) + 'static>(
1826            this: *mut ffi::GtkNotebook,
1827            _param_spec: glib::ffi::gpointer,
1828            f: glib::ffi::gpointer,
1829        ) {
1830            let f: &F = &*(f as *const F);
1831            f(&from_glib_borrow(this))
1832        }
1833        unsafe {
1834            let f: Box_<F> = Box_::new(f);
1835            connect_raw(
1836                self.as_ptr() as *mut _,
1837                b"notify::tab-pos\0".as_ptr() as *const _,
1838                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1839                    notify_tab_pos_trampoline::<F> as *const (),
1840                )),
1841                Box_::into_raw(f),
1842            )
1843        }
1844    }
1845}
1846
1847impl Default for Notebook {
1848    fn default() -> Self {
1849        Self::new()
1850    }
1851}
1852
1853// rustdoc-stripper-ignore-next
1854/// A [builder-pattern] type to construct [`Notebook`] objects.
1855///
1856/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1857#[must_use = "The builder must be built to be used"]
1858pub struct NotebookBuilder {
1859    builder: glib::object::ObjectBuilder<'static, Notebook>,
1860}
1861
1862impl NotebookBuilder {
1863    fn new() -> Self {
1864        Self {
1865            builder: glib::object::Object::builder(),
1866        }
1867    }
1868
1869    /// If [`true`], pressing the right mouse button on the notebook shows a page switching menu.
1870    pub fn enable_popup(self, enable_popup: bool) -> Self {
1871        Self {
1872            builder: self.builder.property("enable-popup", enable_popup),
1873        }
1874    }
1875
1876    /// Group name for tab drag and drop.
1877    pub fn group_name(self, group_name: impl Into<glib::GString>) -> Self {
1878        Self {
1879            builder: self.builder.property("group-name", group_name.into()),
1880        }
1881    }
1882
1883    /// The index of the current page.
1884    pub fn page(self, page: i32) -> Self {
1885        Self {
1886            builder: self.builder.property("page", page),
1887        }
1888    }
1889
1890    /// If [`true`], scroll arrows are added if there are too many pages to fit.
1891    pub fn scrollable(self, scrollable: bool) -> Self {
1892        Self {
1893            builder: self.builder.property("scrollable", scrollable),
1894        }
1895    }
1896
1897    /// Whether the border should be shown.
1898    pub fn show_border(self, show_border: bool) -> Self {
1899        Self {
1900            builder: self.builder.property("show-border", show_border),
1901        }
1902    }
1903
1904    /// Whether tabs should be shown.
1905    pub fn show_tabs(self, show_tabs: bool) -> Self {
1906        Self {
1907            builder: self.builder.property("show-tabs", show_tabs),
1908        }
1909    }
1910
1911    /// Which side of the notebook holds the tabs.
1912    pub fn tab_pos(self, tab_pos: PositionType) -> Self {
1913        Self {
1914            builder: self.builder.property("tab-pos", tab_pos),
1915        }
1916    }
1917
1918    /// Whether the widget or any of its descendents can accept
1919    /// the input focus.
1920    ///
1921    /// This property is meant to be set by widget implementations,
1922    /// typically in their instance init function.
1923    pub fn can_focus(self, can_focus: bool) -> Self {
1924        Self {
1925            builder: self.builder.property("can-focus", can_focus),
1926        }
1927    }
1928
1929    /// Whether the widget can receive pointer events.
1930    pub fn can_target(self, can_target: bool) -> Self {
1931        Self {
1932            builder: self.builder.property("can-target", can_target),
1933        }
1934    }
1935
1936    /// A list of css classes applied to this widget.
1937    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1938        Self {
1939            builder: self.builder.property("css-classes", css_classes.into()),
1940        }
1941    }
1942
1943    /// The name of this widget in the CSS tree.
1944    ///
1945    /// This property is meant to be set by widget implementations,
1946    /// typically in their instance init function.
1947    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1948        Self {
1949            builder: self.builder.property("css-name", css_name.into()),
1950        }
1951    }
1952
1953    /// The cursor used by @widget.
1954    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1955        Self {
1956            builder: self.builder.property("cursor", cursor.clone()),
1957        }
1958    }
1959
1960    /// Whether the widget should grab focus when it is clicked with the mouse.
1961    ///
1962    /// This property is only relevant for widgets that can take focus.
1963    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1964        Self {
1965            builder: self.builder.property("focus-on-click", focus_on_click),
1966        }
1967    }
1968
1969    /// Whether this widget itself will accept the input focus.
1970    pub fn focusable(self, focusable: bool) -> Self {
1971        Self {
1972            builder: self.builder.property("focusable", focusable),
1973        }
1974    }
1975
1976    /// How to distribute horizontal space if widget gets extra space.
1977    pub fn halign(self, halign: Align) -> Self {
1978        Self {
1979            builder: self.builder.property("halign", halign),
1980        }
1981    }
1982
1983    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1984    /// signal on @widget.
1985    ///
1986    /// A true value indicates that @widget can have a tooltip, in this case
1987    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1988    /// determine whether it will provide a tooltip or not.
1989    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1990        Self {
1991            builder: self.builder.property("has-tooltip", has_tooltip),
1992        }
1993    }
1994
1995    /// Overrides for height request of the widget.
1996    ///
1997    /// If this is -1, the natural request will be used.
1998    pub fn height_request(self, height_request: i32) -> Self {
1999        Self {
2000            builder: self.builder.property("height-request", height_request),
2001        }
2002    }
2003
2004    /// Whether to expand horizontally.
2005    pub fn hexpand(self, hexpand: bool) -> Self {
2006        Self {
2007            builder: self.builder.property("hexpand", hexpand),
2008        }
2009    }
2010
2011    /// Whether to use the `hexpand` property.
2012    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
2013        Self {
2014            builder: self.builder.property("hexpand-set", hexpand_set),
2015        }
2016    }
2017
2018    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
2019    /// the preferred size of the widget, and allocate its children.
2020    ///
2021    /// This property is meant to be set by widget implementations,
2022    /// typically in their instance init function.
2023    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
2024        Self {
2025            builder: self
2026                .builder
2027                .property("layout-manager", layout_manager.clone().upcast()),
2028        }
2029    }
2030
2031    /// Makes this widget act like a modal dialog, with respect to
2032    /// event delivery.
2033    ///
2034    /// Global event controllers will not handle events with targets
2035    /// inside the widget, unless they are set up to ignore propagation
2036    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
2037    #[cfg(feature = "v4_18")]
2038    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
2039    pub fn limit_events(self, limit_events: bool) -> Self {
2040        Self {
2041            builder: self.builder.property("limit-events", limit_events),
2042        }
2043    }
2044
2045    /// Margin on bottom side of widget.
2046    ///
2047    /// This property adds margin outside of the widget's normal size
2048    /// request, the margin will be added in addition to the size from
2049    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2050    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
2051        Self {
2052            builder: self.builder.property("margin-bottom", margin_bottom),
2053        }
2054    }
2055
2056    /// Margin on end of widget, horizontally.
2057    ///
2058    /// This property supports left-to-right and right-to-left text
2059    /// directions.
2060    ///
2061    /// This property adds margin outside of the widget's normal size
2062    /// request, the margin will be added in addition to the size from
2063    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2064    pub fn margin_end(self, margin_end: i32) -> Self {
2065        Self {
2066            builder: self.builder.property("margin-end", margin_end),
2067        }
2068    }
2069
2070    /// Margin on start of widget, horizontally.
2071    ///
2072    /// This property supports left-to-right and right-to-left text
2073    /// directions.
2074    ///
2075    /// This property adds margin outside of the widget's normal size
2076    /// request, the margin will be added in addition to the size from
2077    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2078    pub fn margin_start(self, margin_start: i32) -> Self {
2079        Self {
2080            builder: self.builder.property("margin-start", margin_start),
2081        }
2082    }
2083
2084    /// Margin on top side of widget.
2085    ///
2086    /// This property adds margin outside of the widget's normal size
2087    /// request, the margin will be added in addition to the size from
2088    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2089    pub fn margin_top(self, margin_top: i32) -> Self {
2090        Self {
2091            builder: self.builder.property("margin-top", margin_top),
2092        }
2093    }
2094
2095    /// The name of the widget.
2096    pub fn name(self, name: impl Into<glib::GString>) -> Self {
2097        Self {
2098            builder: self.builder.property("name", name.into()),
2099        }
2100    }
2101
2102    /// The requested opacity of the widget.
2103    pub fn opacity(self, opacity: f64) -> Self {
2104        Self {
2105            builder: self.builder.property("opacity", opacity),
2106        }
2107    }
2108
2109    /// How content outside the widget's content area is treated.
2110    ///
2111    /// This property is meant to be set by widget implementations,
2112    /// typically in their instance init function.
2113    pub fn overflow(self, overflow: Overflow) -> Self {
2114        Self {
2115            builder: self.builder.property("overflow", overflow),
2116        }
2117    }
2118
2119    /// Whether the widget will receive the default action when it is focused.
2120    pub fn receives_default(self, receives_default: bool) -> Self {
2121        Self {
2122            builder: self.builder.property("receives-default", receives_default),
2123        }
2124    }
2125
2126    /// Whether the widget responds to input.
2127    pub fn sensitive(self, sensitive: bool) -> Self {
2128        Self {
2129            builder: self.builder.property("sensitive", sensitive),
2130        }
2131    }
2132
2133    /// Sets the text of tooltip to be the given string, which is marked up
2134    /// with Pango markup.
2135    ///
2136    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
2137    ///
2138    /// This is a convenience property which will take care of getting the
2139    /// tooltip shown if the given string is not `NULL`:
2140    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
2141    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
2142    /// the default signal handler.
2143    ///
2144    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
2145    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
2146    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
2147        Self {
2148            builder: self
2149                .builder
2150                .property("tooltip-markup", tooltip_markup.into()),
2151        }
2152    }
2153
2154    /// Sets the text of tooltip to be the given string.
2155    ///
2156    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
2157    ///
2158    /// This is a convenience property which will take care of getting the
2159    /// tooltip shown if the given string is not `NULL`:
2160    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
2161    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
2162    /// the default signal handler.
2163    ///
2164    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
2165    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
2166    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
2167        Self {
2168            builder: self.builder.property("tooltip-text", tooltip_text.into()),
2169        }
2170    }
2171
2172    /// How to distribute vertical space if widget gets extra space.
2173    pub fn valign(self, valign: Align) -> Self {
2174        Self {
2175            builder: self.builder.property("valign", valign),
2176        }
2177    }
2178
2179    /// Whether to expand vertically.
2180    pub fn vexpand(self, vexpand: bool) -> Self {
2181        Self {
2182            builder: self.builder.property("vexpand", vexpand),
2183        }
2184    }
2185
2186    /// Whether to use the `vexpand` property.
2187    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
2188        Self {
2189            builder: self.builder.property("vexpand-set", vexpand_set),
2190        }
2191    }
2192
2193    /// Whether the widget is visible.
2194    pub fn visible(self, visible: bool) -> Self {
2195        Self {
2196            builder: self.builder.property("visible", visible),
2197        }
2198    }
2199
2200    /// Overrides for width request of the widget.
2201    ///
2202    /// If this is -1, the natural request will be used.
2203    pub fn width_request(self, width_request: i32) -> Self {
2204        Self {
2205            builder: self.builder.property("width-request", width_request),
2206        }
2207    }
2208
2209    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
2210    ///
2211    /// The accessible role cannot be changed once set.
2212    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
2213        Self {
2214            builder: self.builder.property("accessible-role", accessible_role),
2215        }
2216    }
2217
2218    // rustdoc-stripper-ignore-next
2219    /// Build the [`Notebook`].
2220    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
2221    pub fn build(self) -> Notebook {
2222        assert_initialized_main_thread!();
2223        self.builder.build()
2224    }
2225}