NotebookProtocol

public protocol NotebookProtocol : WidgetProtocol

GtkNotebook is a container whose children are pages switched between using tabs.

An example GtkNotebook

There are many configuration options for GtkNotebook. Among other things, you can choose on which edge the tabs appear (see [methodGtk.Notebook.set_tab_pos]), whether, if there are too many tabs to fit the notebook should be made bigger or scrolling arrows added (see [methodGtk.Notebook.set_scrollable]), and whether there will be a popup menu allowing the users to switch pages. (see [methodGtk.Notebook.popup_enable]).

GtkNotebook as GtkBuildable

The GtkNotebook implementation of the GtkBuildable 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 GtkNotebook:

&lt;object class="GtkNotebook"&gt;
  &lt;child&gt;
    &lt;object class="GtkLabel" id="notebook-content"&gt;
      &lt;property name="label"&gt;Content&lt;/property&gt;
    &lt;/object&gt;
  &lt;/child&gt;
  &lt;child type="tab"&gt;
    &lt;object class="GtkLabel" id="notebook-tab"&gt;
      &lt;property name="label"&gt;Tab&lt;/property&gt;
    &lt;/object&gt;
  &lt;/child&gt;
&lt;/object&gt;

CSS nodes

notebook
├── header.top
   ├── [&lt;action widget&gt;]
   ├── tabs
      ├── [arrow]
      ├── tab
         ╰── &lt;tab label&gt;
      
      ├── tab[.reorderable-page]
         ╰── &lt;tab label&gt;
      ╰── [arrow]
   ╰── [&lt;action widget&gt;]

╰── stack
    ├── &lt;child&gt;
    
    ╰── &lt;child&gt;

GtkNotebook 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 [methodGtk.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.

Accessibility

GtkNotebook uses the following roles:

  • GTK_ACCESSIBLE_ROLE_GROUP for the notebook widget
  • GTK_ACCESSIBLE_ROLE_TAB_LIST for the list of tabs
  • GTK_ACCESSIBLE_ROLE_TAB role for each tab
  • GTK_ACCESSIBLE_ROLE_TAB_PANEL for each page

The NotebookProtocol protocol exposes the methods and properties of an underlying GtkNotebook instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see Notebook. Alternatively, use NotebookRef as a lighweight, unowned reference if you already have an instance you just want to use.

  • ptr

    Untyped pointer to the underlying GtkNotebook instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • notebook_ptr Default implementation

    Typed pointer to the underlying GtkNotebook instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the GtkNotebook instance.

    Declaration

    Swift

    var notebook_ptr: UnsafeMutablePointer<GtkNotebook>! { get }
  • Required Initialiser for types conforming to NotebookProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

Notebook Class

  • Bind a NotebookPropertyName source property to a given target object.

    Declaration

    Swift

    @discardableResult
    @inlinable
    func bind<Q, T>(property source_property: NotebookPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocol

    Parameters

    source_property

    the source property to bind

    target

    the target object to bind to

    target_property

    the target property to bind to

    flags

    the flags to pass to the Binding

    transform_from

    ValueTransformer to use for forward transformation

    transform_to

    ValueTransformer to use for backwards transformation

    Return Value

    binding reference or nil in case of an error

  • get(property:) Extension method

    Get the value of a Notebook property

    Declaration

    Swift

    @inlinable
    func get(property: NotebookPropertyName) -> GLibObject.Value

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

  • set(property:value:) Extension method

    Set the value of a Notebook property. Note that this will only have an effect on properties that are writable and not construct-only!

    Declaration

    Swift

    @inlinable
    func set(property: NotebookPropertyName, value v: GLibObject.Value)

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

Notebook signals

  • Connect a Swift signal handler to the given, typed NotebookSignalName signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: NotebookSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> Int

    Parameters

    signal

    The signal to connect

    flags

    The connection flags to use

    data

    A pointer to user data to provide to the callback

    destroyData

    A GClosureNotify C function to destroy the data pointed to by userData

    handler

    The Swift signal handler (function or callback) to invoke on the given signal

    Return Value

    The signal handler ID (always greater than 0 for successful connections)

  • Connect a C signal handler to the given, typed NotebookSignalName signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: NotebookSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> Int

    Parameters

    signal

    The signal to connect

    flags

    The connection flags to use

    data

    A pointer to user data to provide to the callback

    destroyData

    A GClosureNotify C function to destroy the data pointed to by userData

    signalHandler

    The C function to be called on the given signal

    Return Value

    The signal handler ID (always greater than 0 for successful connections)

  • createWindowSignal Extension method

    The create-window signal is emitted when a detachable tab is dropped on the root window.

    A handler for this signal can create a window containing a notebook where the tab will be attached. It is also responsible for moving/resizing the window and adding the necessary properties to the notebook (e.g. the GtkNotebook:group-name ).

    Note

    This represents the underlying create-window signal

    Warning

    a onCreateWindow wrapper for this signal could not be generated because it contains unimplemented features: { (8) nullable argument or return type is not allowed, (9) Record return type is not yet supported }

    Note

    Instead, you can connect createWindowSignal using the connect(signal:) methods

    Declaration

    Swift

    static var createWindowSignal: NotebookSignalName { get }

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    page

    the tab of notebook that is being detached

    handler

    a GtkNotebook that page should be added to

  • Note

    This represents the underlying change-current-page signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onChangeCurrentPage(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ object: Int) -> Bool) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    object

    none

    handler

    The signal handler to call Run the given callback whenever the changeCurrentPage signal is emitted

  • changeCurrentPageSignal Extension method

    Typed change-current-page signal for using the connect(signal:) methods

    Declaration

    Swift

    static var changeCurrentPageSignal: NotebookSignalName { get }
  • onFocusTab(flags:handler:) Extension method

    Note

    This represents the underlying focus-tab signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onFocusTab(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ object: NotebookTab) -> Bool) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    object

    none

    handler

    The signal handler to call Run the given callback whenever the focusTab signal is emitted

  • focusTabSignal Extension method

    Typed focus-tab signal for using the connect(signal:) methods

    Declaration

    Swift

    static var focusTabSignal: NotebookSignalName { get }
  • Note

    This represents the underlying move-focus-out signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onMoveFocusOut(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ object: DirectionType) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    object

    none

    handler

    The signal handler to call Run the given callback whenever the moveFocusOut signal is emitted

  • moveFocusOutSignal Extension method

    Typed move-focus-out signal for using the connect(signal:) methods

    Declaration

    Swift

    static var moveFocusOutSignal: NotebookSignalName { get }
  • onPageAdded(flags:handler:) Extension method

    the page-added signal is emitted in the notebook right after a page is added to the notebook.

    Note

    This represents the underlying page-added signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onPageAdded(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ child: WidgetRef, _ pageNum: UInt) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    child

    the child GtkWidget affected

    pageNum

    the new page number for child

    handler

    The signal handler to call Run the given callback whenever the pageAdded signal is emitted

  • pageAddedSignal Extension method

    Typed page-added signal for using the connect(signal:) methods

    Declaration

    Swift

    static var pageAddedSignal: NotebookSignalName { get }
  • the page-removed signal is emitted in the notebook right after a page is removed from the notebook.

    Note

    This represents the underlying page-removed signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onPageRemoved(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ child: WidgetRef, _ pageNum: UInt) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    child

    the child GtkWidget affected

    pageNum

    the child page number

    handler

    The signal handler to call Run the given callback whenever the pageRemoved signal is emitted

  • pageRemovedSignal Extension method

    Typed page-removed signal for using the connect(signal:) methods

    Declaration

    Swift

    static var pageRemovedSignal: NotebookSignalName { get }
  • the page-reordered signal is emitted in the notebook right after a page has been reordered.

    Note

    This represents the underlying page-reordered signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onPageReordered(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ child: WidgetRef, _ pageNum: UInt) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    child

    the child GtkWidget affected

    pageNum

    the new page number for child

    handler

    The signal handler to call Run the given callback whenever the pageReordered signal is emitted

  • pageReorderedSignal Extension method

    Typed page-reordered signal for using the connect(signal:) methods

    Declaration

    Swift

    static var pageReorderedSignal: NotebookSignalName { get }
  • onReorderTab(flags:handler:) Extension method

    Note

    This represents the underlying reorder-tab signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onReorderTab(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ object: DirectionType, _ p0: Bool) -> Bool) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    object

    none

    p0

    none

    handler

    The signal handler to call Run the given callback whenever the reorderTab signal is emitted

  • reorderTabSignal Extension method

    Typed reorder-tab signal for using the connect(signal:) methods

    Declaration

    Swift

    static var reorderTabSignal: NotebookSignalName { get }
  • onSelectPage(flags:handler:) Extension method

    Note

    This represents the underlying select-page signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onSelectPage(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ object: Bool) -> Bool) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    object

    none

    handler

    The signal handler to call Run the given callback whenever the selectPage signal is emitted

  • selectPageSignal Extension method

    Typed select-page signal for using the connect(signal:) methods

    Declaration

    Swift

    static var selectPageSignal: NotebookSignalName { get }
  • onSwitchPage(flags:handler:) Extension method

    Emitted when the user or a function changes the current page.

    Note

    This represents the underlying switch-page signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onSwitchPage(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ page: WidgetRef, _ pageNum: UInt) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    page

    the new current page

    pageNum

    the index of the page

    handler

    The signal handler to call Run the given callback whenever the switchPage signal is emitted

  • switchPageSignal Extension method

    Typed switch-page signal for using the connect(signal:) methods

    Declaration

    Swift

    static var switchPageSignal: NotebookSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::enable-popup signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyEnablePopup(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyEnablePopup signal is emitted

  • notifyEnablePopupSignal Extension method

    Typed notify::enable-popup signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyEnablePopupSignal: NotebookSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::group-name signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyGroupName(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyGroupName signal is emitted

  • notifyGroupNameSignal Extension method

    Typed notify::group-name signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyGroupNameSignal: NotebookSignalName { get }
  • onNotifyPage(flags:handler:) Extension method

    The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::page signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyPage(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyPage signal is emitted

  • notifyPageSignal Extension method

    Typed notify::page signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyPageSignal: NotebookSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::pages signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyPages(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyPages signal is emitted

  • notifyPagesSignal Extension method

    Typed notify::pages signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyPagesSignal: NotebookSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::scrollable signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyScrollable(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyScrollable signal is emitted

  • notifyScrollableSignal Extension method

    Typed notify::scrollable signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyScrollableSignal: NotebookSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::show-border signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyShowBorder(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyShowBorder signal is emitted

  • notifyShowBorderSignal Extension method

    Typed notify::show-border signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyShowBorderSignal: NotebookSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::show-tabs signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyShowTabs(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyShowTabs signal is emitted

  • notifyShowTabsSignal Extension method

    Typed notify::show-tabs signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyShowTabsSignal: NotebookSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::tab-pos signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyTabPos(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyTabPos signal is emitted

  • notifyTabPosSignal Extension method

    Typed notify::tab-pos signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyTabPosSignal: NotebookSignalName { get }

Notebook Class: NotebookProtocol extension (methods and fields)

  • appendPage(child:tabLabel:) Extension method

    Appends a page to notebook.

    Declaration

    Swift

    @inlinable
    func appendPage<WidgetT>(child: WidgetT, tabLabel: WidgetT?) -> Int where WidgetT : WidgetProtocol
  • Appends a page to notebook, specifying the widget to use as the label in the popup menu.

    Declaration

    Swift

    @inlinable
    func appendPageMenu<WidgetT>(child: WidgetT, tabLabel: WidgetT?, menuLabel: WidgetT?) -> Int where WidgetT : WidgetProtocol
  • detachTab(child:) Extension method

    Removes the child from the notebook.

    This function is very similar to [methodGtk.Notebook.remove_page], but additionally informs the notebook that the removal is happening as part of a tab DND operation, which should not be cancelled.

    Declaration

    Swift

    @inlinable
    func detachTab<WidgetT>(child: WidgetT) where WidgetT : WidgetProtocol
  • getActionWidget(packType:) Extension method

    Gets one of the action widgets.

    See [methodGtk.Notebook.set_action_widget].

    Declaration

    Swift

    @inlinable
    func getActionWidget(packType: GtkPackType) -> WidgetRef!
  • getCurrentPage() Extension method

    Returns the page number of the current page.

    Declaration

    Swift

    @inlinable
    func getCurrentPage() -> Int
  • getGroupName() Extension method

    Gets the current group name for notebook.

    Declaration

    Swift

    @inlinable
    func getGroupName() -> String!
  • getMenuLabel(child:) Extension method

    Retrieves the menu label widget of the page containing child.

    Declaration

    Swift

    @inlinable
    func getMenuLabel<WidgetT>(child: WidgetT) -> WidgetRef! where WidgetT : WidgetProtocol
  • getMenuLabelText(child:) Extension method

    Retrieves the text of the menu label for the page containing child.

    Declaration

    Swift

    @inlinable
    func getMenuLabelText<WidgetT>(child: WidgetT) -> String! where WidgetT : WidgetProtocol
  • getNPages() Extension method

    Gets the number of pages in a notebook.

    Declaration

    Swift

    @inlinable
    func getNPages() -> Int
  • getNthPage(pageNum:) Extension method

    Returns the child widget contained in page number page_num.

    Declaration

    Swift

    @inlinable
    func getNthPage(pageNum: Int) -> WidgetRef!
  • getPage(child:) Extension method

    Returns the GtkNotebookPage for child.

    Declaration

    Swift

    @inlinable
    func getPage<WidgetT>(child: WidgetT) -> NotebookPageRef! where WidgetT : WidgetProtocol
  • getPages() Extension method

    Returns a GListModel that contains the pages of the notebook.

    This can be used to keep an up-to-date view. The model also implements [ifaceGtk.SelectionModel] and can be used to track and modify the visible page.

    Declaration

    Swift

    @inlinable
    func getPages() -> GIO.ListModelRef!
  • getScrollable() Extension method

    Returns whether the tab label area has arrows for scrolling.

    Declaration

    Swift

    @inlinable
    func getScrollable() -> Bool
  • getShowBorder() Extension method

    Returns whether a bevel will be drawn around the notebook pages.

    Declaration

    Swift

    @inlinable
    func getShowBorder() -> Bool
  • getShowTabs() Extension method

    Returns whether the tabs of the notebook are shown.

    Declaration

    Swift

    @inlinable
    func getShowTabs() -> Bool
  • getTabDetachable(child:) Extension method

    Returns whether the tab contents can be detached from notebook.

    Declaration

    Swift

    @inlinable
    func getTabDetachable<WidgetT>(child: WidgetT) -> Bool where WidgetT : WidgetProtocol
  • getTabLabel(child:) Extension method

    Returns the tab label widget for the page child.

    nil is returned if child is not in notebook or if no tab label has specifically been set for child.

    Declaration

    Swift

    @inlinable
    func getTabLabel<WidgetT>(child: WidgetT) -> WidgetRef! where WidgetT : WidgetProtocol
  • getTabLabelText(child:) Extension method

    Retrieves the text of the tab label for the page containing child.

    Declaration

    Swift

    @inlinable
    func getTabLabelText<WidgetT>(child: WidgetT) -> String! where WidgetT : WidgetProtocol
  • getTabPos() Extension method

    Gets the edge at which the tabs are drawn.

    Declaration

    Swift

    @inlinable
    func getTabPos() -> GtkPositionType
  • getTabReorderable(child:) Extension method

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

    Declaration

    Swift

    @inlinable
    func getTabReorderable<WidgetT>(child: WidgetT) -> Bool where WidgetT : WidgetProtocol
  • Insert a page into notebook at the given position.

    Declaration

    Swift

    @inlinable
    func insertPage<WidgetT>(child: WidgetT, tabLabel: WidgetT?, position: Int) -> Int where WidgetT : WidgetProtocol
  • Insert a page into notebook at the given position, specifying the widget to use as the label in the popup menu.

    Declaration

    Swift

    @inlinable
    func insertPageMenu<WidgetT>(child: WidgetT, tabLabel: WidgetT?, menuLabel: WidgetT?, position: Int) -> Int where WidgetT : WidgetProtocol
  • nextPage() Extension method

    Switches to the next page.

    Nothing happens if the current page is the last page.

    Declaration

    Swift

    @inlinable
    func nextPage()
  • pageNum(child:) Extension method

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

    Declaration

    Swift

    @inlinable
    func pageNum<WidgetT>(child: WidgetT) -> Int where WidgetT : WidgetProtocol
  • popupDisable() Extension method

    Disables the popup menu.

    Declaration

    Swift

    @inlinable
    func popupDisable()
  • popupEnable() Extension method

    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.

    Declaration

    Swift

    @inlinable
    func popupEnable()
  • prependPage(child:tabLabel:) Extension method

    Prepends a page to notebook.

    Declaration

    Swift

    @inlinable
    func prependPage<WidgetT>(child: WidgetT, tabLabel: WidgetT?) -> Int where WidgetT : WidgetProtocol
  • Prepends a page to notebook, specifying the widget to use as the label in the popup menu.

    Declaration

    Swift

    @inlinable
    func prependPageMenu<WidgetT>(child: WidgetT, tabLabel: WidgetT?, menuLabel: WidgetT?) -> Int where WidgetT : WidgetProtocol
  • prevPage() Extension method

    Switches to the previous page.

    Nothing happens if the current page is the first page.

    Declaration

    Swift

    @inlinable
    func prevPage()
  • removePage(pageNum:) Extension method

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

    Declaration

    Swift

    @inlinable
    func removePage(pageNum: Int)
  • reorder(child:position:) Extension method

    Reorders the page containing child, so that it appears in position position.

    If position is greater than or equal to the number of children in the list or negative, child will be moved to the end of the list.

    Declaration

    Swift

    @inlinable
    func reorder<WidgetT>(child: WidgetT, position: Int) where WidgetT : WidgetProtocol
  • setAction(widget:packType:) Extension method

    Sets widget as one of the action widgets.

    Depending on the pack type the widget will be placed before or after the tabs. You can use a GtkBox if you need to pack more than one widget on the same side.

    Declaration

    Swift

    @inlinable
    func setAction<WidgetT>(widget: WidgetT, packType: GtkPackType) where WidgetT : WidgetProtocol
  • setCurrentPage(pageNum:) Extension method

    Switches to the page number page_num.

    Note that due to historical reasons, GtkNotebook refuses to switch to a page unless the child widget is visible. Therefore, it is recommended to show child widgets before adding them to a notebook.

    Declaration

    Swift

    @inlinable
    func setCurrentPage(pageNum: Int)
  • set(groupName:) Extension method

    Sets a group name for notebook.

    Notebooks with the same name will be able to exchange tabs via drag and drop. A notebook with a nil group name will not be able to exchange tabs with any other notebook.

    Declaration

    Swift

    @inlinable
    func set(groupName: UnsafePointer<CChar>? = nil)
  • Changes the menu label for the page containing child.

    Declaration

    Swift

    @inlinable
    func setMenuLabel<WidgetT>(child: WidgetT, menuLabel: WidgetT?) where WidgetT : WidgetProtocol
  • Creates a new label and sets it as the menu label of child.

    Declaration

    Swift

    @inlinable
    func setMenuLabelText<WidgetT>(child: WidgetT, menuText: UnsafePointer<CChar>!) where WidgetT : WidgetProtocol
  • set(scrollable:) Extension method

    Sets whether the tab label area will have arrows for scrolling if there are too many tabs to fit in the area.

    Declaration

    Swift

    @inlinable
    func set(scrollable: Bool)
  • set(showBorder:) Extension method

    Sets whether a bevel will be drawn around the notebook pages.

    This only has a visual effect when the tabs are not shown.

    Declaration

    Swift

    @inlinable
    func set(showBorder: Bool)
  • set(showTabs:) Extension method

    Sets whether to show the tabs for the notebook or not.

    Declaration

    Swift

    @inlinable
    func set(showTabs: Bool)
  • Sets whether the tab can be detached from notebook to another notebook or widget.

    Note that two notebooks must share a common group identificator (see [methodGtk.Notebook.set_group_name]) to allow automatic tabs interchange between them.

    If you want a widget to interact with a notebook through DnD (i.e.: accept dragged tabs from it) it must be set as a drop destination and accept the target “GTK_NOTEBOOK_TAB”. The notebook will fill the selection with a GtkWidget** pointing to the child widget that corresponds to the dropped tab.

    Note that you should use [methodGtk.Notebook.detach_tab] instead of [methodGtk.Notebook.remove_page] if you want to remove the tab from the source notebook as part of accepting a drop. Otherwise, the source notebook will think that the dragged tab was removed from underneath the ongoing drag operation, and will initiate a drag cancel animation.

    static void
    on_drag_data_received (GtkWidget        *widget,
                           GdkDrop          *drop,
                           GtkSelectionData *data,
                           guint             time,
                           gpointer          user_data)
    {
      GtkDrag *drag;
      GtkWidget *notebook;
      GtkWidget **child;
    
      drag = gtk_drop_get_drag (drop);
      notebook = g_object_get_data (drag, "gtk-notebook-drag-origin");
      child = (void*) gtk_selection_data_get_data (data);
    
      // process_widget (*child);
    
      gtk_notebook_detach_tab (GTK_NOTEBOOK (notebook), *child);
    }
    

    If you want a notebook to accept drags from other widgets, you will have to set your own DnD code to do it.

    Declaration

    Swift

    @inlinable
    func setTabDetachable<WidgetT>(child: WidgetT, detachable: Bool) where WidgetT : WidgetProtocol
  • setTabLabel(child:tabLabel:) Extension method

    Changes the tab label for child.

    If nil is specified for tab_label, then the page will have the label “page N”.

    Declaration

    Swift

    @inlinable
    func setTabLabel<WidgetT>(child: WidgetT, tabLabel: WidgetT?) where WidgetT : WidgetProtocol
  • Creates a new label and sets it as the tab label for the page containing child.

    Declaration

    Swift

    @inlinable
    func setTabLabelText<WidgetT>(child: WidgetT, tabText: UnsafePointer<CChar>!) where WidgetT : WidgetProtocol
  • setTab(pos:) Extension method

    Sets the edge at which the tabs are drawn.

    Declaration

    Swift

    @inlinable
    func setTab(pos: GtkPositionType)
  • Sets whether the notebook tab can be reordered via drag and drop or not.

    Declaration

    Swift

    @inlinable
    func setTabReorderable<WidgetT>(child: WidgetT, reorderable: Bool) where WidgetT : WidgetProtocol
  • currentPage Extension method

    Returns the page number of the current page.

    Declaration

    Swift

    @inlinable
    var currentPage: Int { get nonmutating set }
  • groupName Extension method

    Gets the current group name for notebook.

    Declaration

    Swift

    @inlinable
    var groupName: String! { get nonmutating set }
  • nPages Extension method

    Gets the number of pages in a notebook.

    Declaration

    Swift

    @inlinable
    var nPages: Int { get }
  • pages Extension method

    A selection model with the pages.

    Declaration

    Swift

    @inlinable
    var pages: GIO.ListModelRef! { get }
  • scrollable Extension method

    If true, scroll arrows are added if there are too many pages to fit.

    Declaration

    Swift

    @inlinable
    var scrollable: Bool { get nonmutating set }
  • showBorder Extension method

    Returns whether a bevel will be drawn around the notebook pages.

    Declaration

    Swift

    @inlinable
    var showBorder: Bool { get nonmutating set }
  • showTabs Extension method

    Returns whether the tabs of the notebook are shown.

    Declaration

    Swift

    @inlinable
    var showTabs: Bool { get nonmutating set }
  • tabPos Extension method

    Gets the edge at which the tabs are drawn.

    Declaration

    Swift

    @inlinable
    var tabPos: GtkPositionType { get nonmutating set }