### ----------------------------------------------------
### -- Gnome::Gtk3
### -- Licenses: Artistic-2.0
### -- Authors: Marcel Timmerman
### -- File: lib/Gnome/Gtk3/Notebook.rakumod
### ----------------------------------------------------
### -- Chunk 1 of 3
#TL:1:Gnome::Gtk3::Notebook:

use v6;
#-------------------------------------------------------------------------------
=begin pod

=head1 Gnome::Gtk3::Notebook

A tabbed notebook container

![](images/notebook.png)

=head1 Description

The B<Gnome::Gtk3::Notebook> widget is a B<Gnome::Gtk3::Container> whose children are pages that can be switched between using tab labels along one edge.

There are many configuration options for B<Gnome::Gtk3::Notebook>. Among other things, you can choose on which edge the tabs appear (see C<gtk_notebook_set_tab_pos()>), whether, if there are too many tabs to fit the notebook should be made bigger or scrolling arrows added (see C<gtk_notebook_set_scrollable()>), and whether there will be a popup menu allowing the users to switch pages. (see C<gtk_notebook_popup_enable()>, C<gtk_notebook_popup_disable()>)


=head2 B<Gnome::Gtk3::Notebook> as B<Gnome::Gtk3::Buildable>

The B<Gnome::Gtk3::Notebook> implementation of the B<Gnome::Gtk3::Buildable> interface supports placing children into tabs by specifying “tab” as the “type” attribute of a <child> element. Note that the content of the tab must be created before the tab can be filled. A tab child can be specified without specifying a <child> type attribute.

To add a child widget in the notebooks action area, specify "action-start" or “action-end” as the “type” attribute of the <child> element.

An example of a UI definition fragment with B<Gnome::Gtk3::Notebook>:

  <object class="GtkNotebook">
    <child>
      <object class="GtkLabel" id="notebook-content">
        <property name="label">Content</property>
      </object>
    </child>
    <child type="tab">
      <object class="GtkLabel" id="notebook-tab">
        <property name="label">Tab</property>
      </object>
    </child>
  </object>


=head2 Css Nodes

  notebook
  ├── header.top
  │   ├── [<action widget>]
  │   ├── tabs
  │   │   ├── [arrow]
  │   │   ├── tab
  │   │   │   ╰── <tab label>
  ┊   ┊   ┊
  │   │   ├── tab[.reorderable-page]
  │   │   │   ╰── <tab label>
  │   │   ╰── [arrow]
  │   ╰── [<action widget>]
  │
  ╰── stack
      ├── <child>
      ┊
      ╰── <child>

B<Gnome::Gtk3::Notebook> has a main CSS node with name notebook, a subnode with name header and below that a subnode with name tabs which contains one subnode per tab with name tab.

If action widgets are present, their CSS nodes are placed next to the tabs node. If the notebook is scrollable, CSS nodes with name arrow are placed as first and last child of the tabs node.

The main node gets the .frame style class when the notebook has a border (see C<gtk_notebook_set_show_border()>).

The header node gets one of the style class .top, .bottom, .left or .right, depending on where the tabs are placed. For reorderable pages, the tab node gets the .reorderable-page class.

A tab node gets the .dnd style class while it is moved with drag-and-drop.

The nodes are always arranged from left-to-right, regardless of text direction.


=head2 See Also

B<Gnome::Gtk3::Container>


=head1 Synopsis
=head2 Declaration

  unit class Gnome::Gtk3::Notebook;
  also is Gnome::Gtk3::Container;


=head2 Uml Diagram

![](plantuml/Notebook.svg)


=head2 Inheriting this class

Inheriting is done in a special way in that it needs a call from new() to get the native object created by the class you are inheriting from.

  use Gnome::Gtk3::Notebook:api<1>;

  unit class MyGuiClass;
  also is Gnome::Gtk3::Notebook;

  submethod new ( |c ) {
    # let the Gnome::Gtk3::Notebook class process the options
    self.bless( :GtkNotebook, |c);
  }

  submethod BUILD ( ... ) {
    ...
  }


=comment head2 Example

=end pod

#-------------------------------------------------------------------------------
use NativeCall;

#use Gnome::N::X:api<1>;
use Gnome::N::NativeLib:api<1>;
use Gnome::N::N-GObject:api<1>;
use Gnome::N::GlibToRakuTypes:api<1>;

use Gnome::GObject::Object:api<1>;

use Gnome::Gtk3::Container:api<1>;
use Gnome::Gtk3::Enums:api<1>;

#-------------------------------------------------------------------------------
unit class Gnome::Gtk3::Notebook:auth<github:MARTIMM>:api<1>;
also is Gnome::Gtk3::Container;

#-------------------------------------------------------------------------------
my Bool $signals-added = False;

#-------------------------------------------------------------------------------
=begin pod
=head1 Methods
=head2 new

=head3 default, no options

Create a new Notebook object.

  multi method new ( )


=head3 :native-object

Create a Notebook object using a native object from elsewhere. See also B<Gnome::GObject::Object>.

  multi method new ( N-GObject :$native-object! )


=head3 :build-id

Create a Notebook object using a native object returned from a builder. See also B<Gnome::GObject::Object>.

  multi method new ( Str :$build-id! )

=end pod

#TM:1:new():inheriting:
#TM:1:new():
#TM:4:new(:native-object):TopLevelClassSupport
#TM:4:new(:build-id):Object
submethod BUILD ( *%options ) {

  # add signal info in the form of w*<signal-name>.
  unless $signals-added {
    $signals-added = self.add-signal-types( $?CLASS.^name,
      :w1<page-reordered page-removed page-added create-window>,
      :w2<switch-page reorder-tab page-reordered page-removed page-added>,
      :w3<create-window>,
    );

    # signals from interfaces
    #_add_..._signal_types($?CLASS.^name);
  }

  # prevent creating wrong native-objects
  if self.^name eq 'Gnome::Gtk3::Notebook' or %options<GtkNotebook> {

    # process all named arguments
    if self.is-valid { }

    # check if common options are handled by some parent
    elsif %options<native-object>:exists { }
    elsif %options<build-id>:exists { }

    # process all other arguments
    else {
      my $no;
      if ? %options<___x___> {
        #$no = %options<___x___>;
        #$no .= _get-native-object-no-reffing unless $no ~~ N-GObject;
        #$no = _gtk_notebook_new___x___($no);
      }

      #`{{ use this when the module is not made inheritable
      # check if there are unknown options
      elsif %options.elems {
        die X::Gnome.new(
          :message(
            'Unsupported, undefined, incomplete or wrongly typed options for ' ~
            self.^name ~ ': ' ~ %options.keys.join(', ')
          )
        );
      }
      }}

      #`{{ when there are no defaults use this
      # check if there are any options
      elsif %options.elems == 0 {
        die X::Gnome.new(:message('No options specified ' ~ self.^name));
      }
      }}

      ##`{{ when there are defaults use this instead
      # create default object
      else {
        $no = _gtk_notebook_new();
      }
      #}}

      self._set-native-object($no);
    }

    # only after creating the native-object, the gtype is known
    self._set-class-info('GtkNotebook');
  }
}

#-------------------------------------------------------------------------------
# no pod. user does not have to know about it.
method _fallback ( $native-sub is copy --> Callable ) {

  my Callable $s;
  try { $s = &::("gtk_notebook_$native-sub"); };
  try { $s = &::("gtk_$native-sub"); } unless ?$s;
  try { $s = &::($native-sub); } if !$s and $native-sub ~~ m/^ 'gtk_' /;

  self._set-class-name-of-sub('GtkNotebook');
  $s = callsame unless ?$s;

  $s;
}

#-------------------------------------------------------------------------------
#TM:1:append-page:
=begin pod
=head2 append-page

Appends a page to I<notebook>.

Returns: the index (starting from 0) of the appended page in the notebook, or -1 if function fails

  method append-page (
    N-GObject $child, N-GObject $tab_label --> Int
  )

=item N-GObject $child; the B<Gnome::Gtk3::Widget> to use as the contents of the page
=item N-GObject $tab_label; the B<Gnome::Gtk3::Widget> to be used as the label for the page, or C<undefined> to use the default label, “page N”
=end pod

method append-page ( $child is copy, $tab_label is copy --> Int ) {
  $child .= _get-native-object-no-reffing unless $child ~~ N-GObject;
  $tab_label .= _get-native-object-no-reffing unless $tab_label ~~ N-GObject;

  gtk_notebook_append_page(
    self._get-native-object-no-reffing, $child, $tab_label
  )
}

sub gtk_notebook_append_page (
  N-GObject $notebook, N-GObject $child, N-GObject $tab_label --> gint
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:append-page-menu:
=begin pod
=head2 append-page-menu

Appends a page to I<notebook>, specifying the widget to use as the label in the popup menu.

Returns: the index (starting from 0) of the appended page in the notebook, or -1 if function fails

  method append-page-menu (
    N-GObject $child, N-GObject $tab_label, N-GObject $menu_label
    --> Int
  )

=item N-GObject $child; the B<Gnome::Gtk3::Widget> to use as the contents of the page
=item N-GObject $tab_label; the B<Gnome::Gtk3::Widget> to be used as the label for the page, or C<undefined> to use the default label, “page N”
=item N-GObject $menu_label; the widget to use as a label for the page-switch menu, if that is enabled. If C<undefined>, and I<$tab-label> is a B<Gnome::Gtk3::Label> or C<undefined>, then the menu label will be a newly created label with the same text as I<$tab-label>; if I<$tab-label> is not a B<Gnome::Gtk3::Label>, I<$menu-label> must be specified if the page-switch menu is to be used.
=end pod

method append-page-menu (
  $child is copy, $tab_label is copy, $menu_label is copy
  --> Int
) {
  $child .= _get-native-object-no-reffing unless $child ~~ N-GObject;
  $tab_label .= _get-native-object-no-reffing unless $tab_label ~~ N-GObject;
  $menu_label .= _get-native-object-no-reffing unless $menu_label ~~ N-GObject;

  gtk_notebook_append_page_menu(
    self._get-native-object-no-reffing, $child, $tab_label, $menu_label
  )
}

sub gtk_notebook_append_page_menu (
  N-GObject $notebook, N-GObject $child, N-GObject $tab_label, N-GObject $menu_label --> gint
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:detach-tab:
=begin pod
=head2 detach-tab

Removes the child from the notebook.

This function is very similar to C<Gnome::Gtk3::Container.remove()>, but additionally informs the notebook that the removal is happening as part of a tab DND operation, which should not be cancelled.

  method detach-tab ( N-GObject $child )

=item N-GObject $child; a child
=end pod

method detach-tab ( $child is copy ) {
  $child .= _get-native-object-no-reffing unless $child ~~ N-GObject;

  gtk_notebook_detach_tab(
    self._get-native-object-no-reffing, $child
  );
}

sub gtk_notebook_detach_tab (
  N-GObject $notebook, N-GObject $child
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-action-widget:
#TM:1:get-action-widget-rk:
=begin pod
=head2 get-action-widget, get-action-widget-rk

Gets one of the action widgets. See C<set-action-widget()>.

Returns: The action widget with the given I<$pack-type> or C<undefined> when this action widget has not been set

  method get-action-widget ( GtkPackType $pack_type --> N-GObject )

  method get-action-widget-rk (
    GtkPackType $pack_type, :$child-type? --> Gnome::GObject::Object
  )

=item GtkPackType $pack_type; pack type of the action widget to receive
=item $child-type: This is an optional argument. You can specify a real type or a type as a string. In the latter case the type must be defined in a module which can be found by the Raku require call.

=end pod

method get-action-widget ( GtkPackType $pack_type --> N-GObject ) {
  gtk_notebook_get_action_widget(
    self._get-native-object-no-reffing, $pack_type
  )
}

method get-action-widget-rk (
  GtkPackType $pack_type, *%options --> Gnome::GObject::Object
) {
  self._wrap-native-type-from-no(
    gtk_notebook_get_action_widget(
      self._get-native-object-no-reffing, $pack_type
    ), |%options
  )
}

sub gtk_notebook_get_action_widget (
  N-GObject $notebook, GEnum $pack_type --> N-GObject
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-current-page:
=begin pod
=head2 get-current-page

Returns the page number of the current page.

Returns: the index (starting from 0) of the current page in the notebook. If the notebook has no pages, then -1 will be returned.

  method get-current-page ( --> Int )

=end pod

method get-current-page ( --> Int ) {
  gtk_notebook_get_current_page(self._get-native-object-no-reffing)
}

sub gtk_notebook_get_current_page (
  N-GObject $notebook --> gint
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-group-name:
=begin pod
=head2 get-group-name

Gets the current group name for I<notebook>.

Returns: the group name, or C<undefined> if none is set

  method get-group-name ( --> Str )

=end pod

method get-group-name ( --> Str ) {
  gtk_notebook_get_group_name(self._get-native-object-no-reffing)
}

sub gtk_notebook_get_group_name (
  N-GObject $notebook --> gchar-ptr
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-menu-label:
#TM:1:get-menu-label-rk:
=begin pod
=head2 get-menu-label, get-menu-label-rk

Retrieves the menu label widget of the page containing I<$child>.

Returns: the menu label, or C<undefined> if the notebook page does not have a menu label other than the default (the tab label).

  method get-menu-label ( N-GObject $child --> N-GObject )
  method get-menu-label-rk (
    N-GObject $child, :$child-type? --> Gnome::GObject::Object
  )

=item N-GObject $child; a widget contained in a page of I<notebook>
=item $child-type: This is an optional argument. You can specify a real type or a type as a string. In the latter case the type must be defined in a module which can be found by the Raku require call.
=end pod

method get-menu-label ( $child is copy --> N-GObject ) {
  $child .= _get-native-object-no-reffing unless $child ~~ N-GObject;
  gtk_notebook_get_menu_label( self._get-native-object-no-reffing, $child)
}

method get-menu-label-rk (
  $child is copy, *%options --> Gnome::GObject::Object
) {
  $child .= _get-native-object-no-reffing unless $child ~~ N-GObject;
  self._wrap-native-type-from-no(
    gtk_notebook_get_menu_label( self._get-native-object-no-reffing, $child),
    |%options
  );
}

sub gtk_notebook_get_menu_label (
  N-GObject $notebook, N-GObject $child --> N-GObject
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-menu-label-text:
=begin pod
=head2 get-menu-label-text

Retrieves the text of the menu label for the page containing I<$child>.

Returns: the text of the tab label, or C<undefined> if the widget does not have a menu label other than the default menu label, or the menu label widget is not a B<Gnome::Gtk3::Label>. The string is owned by the widget and must not be freed.

  method get-menu-label-text ( N-GObject $child --> Str )

=item N-GObject $child; the child widget of a page of the notebook.
=end pod

method get-menu-label-text ( $child is copy --> Str ) {
  $child .= _get-native-object-no-reffing unless $child ~~ N-GObject;

  gtk_notebook_get_menu_label_text(
    self._get-native-object-no-reffing, $child
  )
}

sub gtk_notebook_get_menu_label_text (
  N-GObject $notebook, N-GObject $child --> gchar-ptr
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-n-pages:
=begin pod
=head2 get-n-pages

Gets the number of pages in a notebook.

Returns: the number of pages in the notebook

  method get-n-pages ( --> Int )

=end pod

method get-n-pages ( --> Int ) {
  gtk_notebook_get_n_pages(self._get-native-object-no-reffing)
}

sub gtk_notebook_get_n_pages (
  N-GObject $notebook --> gint
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-nth-page:
#TM:1:get-nth-page-rk:
=begin pod
=head2 get-nth-page, get-nth-page-rk

Returns the child widget contained in page number I<$page-num>.

Returns: the child widget, or C<undefined> if I<$page-num> is out of bounds

  method get-nth-page ( Int() $page_num --> N-GObject )
  method get-nth-page-rk (
    Int() $page_num, :$child-type? --> Gnome::GObject::Object
  )

=item Int() $page_num; the index of a page in the notebook, or -1 to get the last page
=item $child-type: This is an optional argument. You can specify a real type or a type as a string. In the latter case the type must be defined in a module which can be found by the Raku require call.
=end pod

method get-nth-page ( Int() $page_num --> N-GObject ) {
  gtk_notebook_get_nth_page( self._get-native-object-no-reffing, $page_num)
}

method get-nth-page-rk (
  Int() $page_num, *%options --> Gnome::GObject::Object
) {
  self._wrap-native-type-from-no(
    gtk_notebook_get_nth_page( self._get-native-object-no-reffing, $page_num),
    |%options
  )
}

sub gtk_notebook_get_nth_page (
  N-GObject $notebook, gint $page_num --> N-GObject
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-scrollable:
=begin pod
=head2 get-scrollable

Returns whether the tab label area has arrows for scrolling. See C<set-scrollable()>.

Returns: C<True> if arrows for scrolling are present

  method get-scrollable ( --> Bool )

=end pod

method get-scrollable ( --> Bool ) {
  gtk_notebook_get_scrollable(self._get-native-object-no-reffing).Bool
}

sub gtk_notebook_get_scrollable (
  N-GObject $notebook --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-show-border:
=begin pod
=head2 get-show-border

Returns whether a bevel will be drawn around the notebook pages. See C<set-show-border()>.

Returns: C<True> if the bevel is drawn

  method get-show-border ( --> Bool )

=end pod

method get-show-border ( --> Bool ) {
  gtk_notebook_get_show_border(self._get-native-object-no-reffing).Bool
}

sub gtk_notebook_get_show_border (
  N-GObject $notebook --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-show-tabs:
=begin pod
=head2 get-show-tabs

Returns whether the tabs of the notebook are shown. See C<set-show-tabs()>.

Returns: C<True> if the tabs are shown

  method get-show-tabs ( --> Bool )

=end pod

method get-show-tabs ( --> Bool ) {
  gtk_notebook_get_show_tabs(self._get-native-object-no-reffing).Bool
}

sub gtk_notebook_get_show_tabs (
  N-GObject $notebook --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-tab-detachable:
=begin pod
=head2 get-tab-detachable

Returns whether the tab contents can be detached from I<notebook>.

Returns: C<True> if the tab is detachable.

  method get-tab-detachable ( N-GObject $child --> Bool )

=item N-GObject $child; a child B<Gnome::Gtk3::Widget>
=end pod

method get-tab-detachable ( $child is copy --> Bool ) {
  $child .= _get-native-object-no-reffing unless $child ~~ N-GObject;
  gtk_notebook_get_tab_detachable(
    self._get-native-object-no-reffing, $child
  ).Bool
}

sub gtk_notebook_get_tab_detachable (
  N-GObject $notebook, N-GObject $child --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-tab-label:
#TM:1:get-tab-label-rk:
=begin pod
=head2 get-tab-label, get-tab-label-rk

Returns the tab label widget for the page I<$$child>. C<undefined> is returned if I<$$child> is not in I<notebook> or if no tab label has specifically been set for I<$$child>.

Returns: the tab label

  method get-tab-label ( N-GObject $child --> N-GObject )
  method get-tab-label-rk (
    N-GObject $child, :$child-type? --> Gnome::GObject::Object
  )

=item N-GObject $child; the page
=item $child-type: This is an optional argument. You can specify a real type or a type as a string. In the latter case the type must be defined in a module which can be found by the Raku require call.
=end pod

method get-tab-label ( $child is copy --> N-GObject ) {
  $child .= _get-native-object-no-reffing unless $child ~~ N-GObject;
  gtk_notebook_get_tab_label( self._get-native-object-no-reffing, $child)
}

method get-tab-label-rk (
  $child is copy, *%options --> Gnome::GObject::Object
) {
  $child .= _get-native-object-no-reffing unless $child ~~ N-GObject;
  self._wrap-native-type-from-no(
    gtk_notebook_get_tab_label( self._get-native-object-no-reffing, $child),
    |%options
  )
}

sub gtk_notebook_get_tab_label (
  N-GObject $notebook, N-GObject $child --> N-GObject
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-tab-label-text:
=begin pod
=head2 get-tab-label-text

Retrieves the text of the tab label for the page containing I<$child>.

Returns: the text of the tab label, or C<undefined> if the tab label widget is not a B<Gnome::Gtk3::Label>. The string is owned by the widget and must not be freed.

  method get-tab-label-text ( N-GObject $child --> Str )

=item N-GObject $child; a widget contained in a page of I<notebook>
=end pod

method get-tab-label-text ( $child is copy --> Str ) {
  $child .= _get-native-object-no-reffing unless $child ~~ N-GObject;
  gtk_notebook_get_tab_label_text( self._get-native-object-no-reffing, $child)
}

sub gtk_notebook_get_tab_label_text (
  N-GObject $notebook, N-GObject $child --> gchar-ptr
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-tab-pos:
=begin pod
=head2 get-tab-pos

Gets the edge at which the tabs for switching pages in the notebook are drawn.

Returns: the edge at which the tabs are drawn

  method get-tab-pos ( --> GtkPositionType )

=end pod

method get-tab-pos ( --> GtkPositionType ) {
  GtkPositionType(gtk_notebook_get_tab_pos(self._get-native-object-no-reffing))
}

sub gtk_notebook_get_tab_pos (
  N-GObject $notebook --> GEnum
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-tab-reorderable:
=begin pod
=head2 get-tab-reorderable

Gets whether the tab can be reordered via drag and drop or not.

Returns: C<True> if the tab is reorderable.

  method get-tab-reorderable ( N-GObject $child --> Bool )

=item N-GObject $child; a child B<Gnome::Gtk3::Widget>
=end pod

method get-tab-reorderable ( $child is copy --> Bool ) {
  $child .= _get-native-object-no-reffing unless $child ~~ N-GObject;

  gtk_notebook_get_tab_reorderable(
    self._get-native-object-no-reffing, $child
  ).Bool
}

sub gtk_notebook_get_tab_reorderable (
  N-GObject $notebook, N-GObject $child --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:insert-page:
=begin pod
=head2 insert-page

Insert a page into I<notebook> at the given position.

Returns: the index (starting from 0) of the inserted page in the notebook, or -1 if function fails

  method insert-page (
    N-GObject $child, N-GObject $tab_label, Int() $position
    --> Int
  )

=item N-GObject $child; the B<Gnome::Gtk3::Widget> to use as the contents of the page
=item N-GObject $tab_label; the B<Gnome::Gtk3::Widget> to be used as the label for the page, or C<undefined> to use the default label, “page N”
=item Int() $position; the index (starting at 0) at which to insert the page, or -1 to append the page after all other pages
=end pod

method insert-page ( $child is copy, $tab_label is copy, Int() $position --> Int ) {
  $child .= _get-native-object-no-reffing unless $child ~~ N-GObject;
  $tab_label .= _get-native-object-no-reffing unless $tab_label ~~ N-GObject;

  gtk_notebook_insert_page(
    self._get-native-object-no-reffing, $child, $tab_label, $position
  )
}

sub gtk_notebook_insert_page (
  N-GObject $notebook, N-GObject $child, N-GObject $tab_label, gint $position --> gint
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:insert-page-menu:
=begin pod
=head2 insert-page-menu

Insert a page into I<notebook> at the given position, specifying the widget to use as the label in the popup menu.

Returns: the index (starting from 0) of the inserted page in the notebook

  method insert-page-menu (
    N-GObject $child, N-GObject $tab_label,
    N-GObject $menu_label, Int() $position
    --> Int
  )

=item N-GObject $child; the B<Gnome::Gtk3::Widget> to use as the contents of the page
=item N-GObject $tab_label; the B<Gnome::Gtk3::Widget> to be used as the label for the page, or C<undefined> to use the default label, “page N”
=item N-GObject $menu_label; the widget to use as a label for the page-switch menu, if that is enabled. If C<undefined>, and I<$tab-label> is a B<Gnome::Gtk3::Label> or C<undefined>, then the menu label will be a newly created label with the same text as I<$tab-label>; if I<$tab-label> is not a B<Gnome::Gtk3::Label>, I<$menu-label> must be specified if the page-switch menu is to be used.
=item Int() $position; the index (starting at 0) at which to insert the page, or -1 to append the page after all other pages.
=end pod

method insert-page-menu ( $child is copy, $tab_label is copy, $menu_label is copy, Int() $position --> Int ) {
  $child .= _get-native-object-no-reffing unless $child ~~ N-GObject;
  $tab_label .= _get-native-object-no-reffing unless $tab_label ~~ N-GObject;
  $menu_label .= _get-native-object-no-reffing unless $menu_label ~~ N-GObject;

  gtk_notebook_insert_page_menu(
    self._get-native-object-no-reffing,
    $child, $tab_label, $menu_label, $position
  )
}

sub gtk_notebook_insert_page_menu (
  N-GObject $notebook, N-GObject $child, N-GObject $tab_label, N-GObject $menu_label, gint $position --> gint
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:next-page:
=begin pod
=head2 next-page

Switches to the next page. Nothing happens if the current page is the last page.

  method next-page ( )

=end pod

method next-page ( ) {
  gtk_notebook_next_page(self._get-native-object-no-reffing);
}

sub gtk_notebook_next_page (
  N-GObject $notebook
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:page-num:
=begin pod
=head2 page-num

Finds the index of the page which contains the given child widget.

Returns: the index of the page containing I<$child>, or -1 if I<$child> is not in the notebook

  method page-num ( N-GObject $child --> Int )

=item N-GObject $child; a B<Gnome::Gtk3::Widget>
=end pod

method page-num ( $child is copy --> Int ) {
  $child .= _get-native-object-no-reffing unless $child ~~ N-GObject;

  gtk_notebook_page_num(
    self._get-native-object-no-reffing, $child
  )
}

sub gtk_notebook_page_num (
  N-GObject $notebook, N-GObject $child --> gint
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:popup-disable:
=begin pod
=head2 popup-disable

Disables the popup menu.

  method popup-disable ( )

=end pod

method popup-disable ( ) {
  gtk_notebook_popup_disable(self._get-native-object-no-reffing);
}

sub gtk_notebook_popup_disable (
  N-GObject $notebook
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:popup-enable:
=begin pod
=head2 popup-enable

Enables the popup menu: if the user clicks with the right mouse button on the tab labels, a menu with all the pages will be popped up.

  method popup-enable ( )

=end pod

method popup-enable ( ) {

  gtk_notebook_popup_enable(
    self._get-native-object-no-reffing,
  );
}

sub gtk_notebook_popup_enable (
  N-GObject $notebook
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:prepend-page:
=begin pod
=head2 prepend-page

Prepends a page to I<notebook>.

Returns: the index (starting from 0) of the prepended page in the notebook, or -1 if function fails

  method prepend-page ( N-GObject $child, N-GObject $tab_label --> Int )

=item N-GObject $child; the B<Gnome::Gtk3::Widget> to use as the contents of the page
=item N-GObject $tab_label; the B<Gnome::Gtk3::Widget> to be used as the label for the page, or C<undefined> to use the default label, “page N”
=end pod

method prepend-page ( $child is copy, $tab_label is copy --> Int ) {
  $child .= _get-native-object-no-reffing unless $child ~~ N-GObject;
  $tab_label .= _get-native-object-no-reffing unless $tab_label ~~ N-GObject;

  gtk_notebook_prepend_page(
    self._get-native-object-no-reffing, $child, $tab_label
  )
}

sub gtk_notebook_prepend_page (
  N-GObject $notebook, N-GObject $child, N-GObject $tab_label --> gint
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:prepend-page-menu:
=begin pod
=head2 prepend-page-menu

Prepends a page to I<notebook>, specifying the widget to use as the label in the popup menu.

Returns: the index (starting from 0) of the prepended page in the notebook, or -1 if function fails

  method prepend-page-menu ( N-GObject $child, N-GObject $tab_label, N-GObject $menu_label --> Int )

=item N-GObject $child; the B<Gnome::Gtk3::Widget> to use as the contents of the page
=item N-GObject $tab_label; the B<Gnome::Gtk3::Widget> to be used as the label for the page, or C<undefined> to use the default label, “page N”
=item N-GObject $menu_label; the widget to use as a label for the page-switch menu, if that is enabled. If C<undefined>, and I<$tab-label> is a B<Gnome::Gtk3::Label> or C<undefined>, then the menu label will be a newly created label with the same text as I<$tab-label>; if I<$tab-label> is not a B<Gnome::Gtk3::Label>, I<$menu-label> must be specified if the page-switch menu is to be used.
=end pod

method prepend-page-menu ( $child is copy, $tab_label is copy, $menu_label is copy --> Int ) {
  $child .= _get-native-object-no-reffing unless $child ~~ N-GObject;
  $tab_label .= _get-native-object-no-reffing unless $tab_label ~~ N-GObject;
  $menu_label .= _get-native-object-no-reffing unless $menu_label ~~ N-GObject;

  gtk_notebook_prepend_page_menu(
    self._get-native-object-no-reffing, $child, $tab_label, $menu_label
  )
}

sub gtk_notebook_prepend_page_menu (
  N-GObject $notebook, N-GObject $child, N-GObject $tab_label, N-GObject $menu_label --> gint
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:prev-page:
=begin pod
=head2 prev-page

Switches to the previous page. Nothing happens if the current page is the first page.

  method prev-page ( )

=end pod

method prev-page ( ) {

  gtk_notebook_prev_page(
    self._get-native-object-no-reffing,
  );
}

sub gtk_notebook_prev_page (
  N-GObject $notebook
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:remove-page:
=begin pod
=head2 remove-page

Removes a page from the notebook given its index in the notebook.

  method remove-page ( Int() $page_num )

=item Int() $page_num; the index of a notebook page, starting from 0. If -1, the last page will be removed.
=end pod

method remove