NotebookProtocol
public protocol NotebookProtocol : WidgetProtocol
GtkNotebook is a container whose children are pages switched
between using tabs.

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:
<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>
CSS nodes
notebook
├── header.top
│ ├── [<action widget>]
│ ├── tabs
│ │ ├── [arrow]
│ │ ├── tab
│ │ │ ╰── <tab label>
┊ ┊ ┊
│ │ ├── tab[.reorderable-page]
│ │ │ ╰── <tab label>
│ │ ╰── [arrow]
│ ╰── [<action widget>]
│
╰── stack
├── <child>
┊
╰── <child>
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_GROUPfor the notebook widgetGTK_ACCESSIBLE_ROLE_TAB_LISTfor the list of tabsGTK_ACCESSIBLE_ROLE_TABrole for each tabGTK_ACCESSIBLE_ROLE_TAB_PANELfor 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.
-
Untyped pointer to the underlying
GtkNotebookinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
notebook_ptrDefault implementationTyped pointer to the underlying
GtkNotebookinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkNotebookinstance.Declaration
Swift
var notebook_ptr: UnsafeMutablePointer<GtkNotebook>! { get } -
Required Initialiser for types conforming to
NotebookProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
NotebookPropertyNamesource 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 : ObjectProtocolParameters
source_propertythe source property to bind
targetthe target object to bind to
target_propertythe target property to bind to
flagsthe flags to pass to the
Bindingtransform_fromValueTransformerto use for forward transformationtransform_toValueTransformerto use for backwards transformationReturn Value
binding reference or
nilin case of an error -
get(property:Extension method) Get the value of a Notebook property
Declaration
Swift
@inlinable func get(property: NotebookPropertyName) -> GLibObject.ValueParameters
propertythe property to get the value for
Return Value
the value of the named property
-
set(property:Extension methodvalue: ) 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
propertythe property to get the value for
Return Value
the value of the named property
-
connect(signal:Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
NotebookSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: NotebookSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatahandlerThe 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(signal:Extension methodflags: data: destroyData: signalHandler: ) Connect a C signal handler to the given, typed
NotebookSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: NotebookSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatasignalHandlerThe C function to be called on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
createWindowSignalExtension methodThe
create-windowsignal 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 underlyingcreate-windowsignalWarning
aonCreateWindowwrapper 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 connectcreateWindowSignalusing theconnect(signal:)methodsDeclaration
Swift
static var createWindowSignal: NotebookSignalName { get }Parameters
flagsFlags
unownedSelfReference to instance of self
pagethe tab of
notebookthat is being detachedhandlera
GtkNotebookthatpageshould be added to -
onChangeCurrentPage(flags:Extension methodhandler: ) Note
This represents the underlyingchange-current-pagesignalDeclaration
Swift
@discardableResult @inlinable func onChangeCurrentPage(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ object: Int) -> Bool) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
objectnone
handlerThe signal handler to call Run the given callback whenever the
changeCurrentPagesignal is emitted -
changeCurrentPageSignalExtension methodTyped
change-current-pagesignal for using theconnect(signal:)methodsDeclaration
Swift
static var changeCurrentPageSignal: NotebookSignalName { get } -
onFocusTab(flags:Extension methodhandler: ) Note
This represents the underlyingfocus-tabsignalDeclaration
Swift
@discardableResult @inlinable func onFocusTab(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ object: NotebookTab) -> Bool) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
objectnone
handlerThe signal handler to call Run the given callback whenever the
focusTabsignal is emitted -
focusTabSignalExtension methodTyped
focus-tabsignal for using theconnect(signal:)methodsDeclaration
Swift
static var focusTabSignal: NotebookSignalName { get } -
onMoveFocusOut(flags:Extension methodhandler: ) Note
This represents the underlyingmove-focus-outsignalDeclaration
Swift
@discardableResult @inlinable func onMoveFocusOut(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ object: DirectionType) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
objectnone
handlerThe signal handler to call Run the given callback whenever the
moveFocusOutsignal is emitted -
moveFocusOutSignalExtension methodTyped
move-focus-outsignal for using theconnect(signal:)methodsDeclaration
Swift
static var moveFocusOutSignal: NotebookSignalName { get } -
onPageAdded(flags:Extension methodhandler: ) the
page-addedsignal is emitted in the notebook right after a page is added to the notebook.Note
This represents the underlyingpage-addedsignalDeclaration
Swift
@discardableResult @inlinable func onPageAdded(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ child: WidgetRef, _ pageNum: UInt) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
childthe child
GtkWidgetaffectedpageNumthe new page number for
childhandlerThe signal handler to call Run the given callback whenever the
pageAddedsignal is emitted -
pageAddedSignalExtension methodTyped
page-addedsignal for using theconnect(signal:)methodsDeclaration
Swift
static var pageAddedSignal: NotebookSignalName { get } -
onPageRemoved(flags:Extension methodhandler: ) the
page-removedsignal is emitted in the notebook right after a page is removed from the notebook.Note
This represents the underlyingpage-removedsignalDeclaration
Swift
@discardableResult @inlinable func onPageRemoved(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ child: WidgetRef, _ pageNum: UInt) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
childthe child
GtkWidgetaffectedpageNumthe
childpage numberhandlerThe signal handler to call Run the given callback whenever the
pageRemovedsignal is emitted -
pageRemovedSignalExtension methodTyped
page-removedsignal for using theconnect(signal:)methodsDeclaration
Swift
static var pageRemovedSignal: NotebookSignalName { get } -
onPageReordered(flags:Extension methodhandler: ) the
page-reorderedsignal is emitted in the notebook right after a page has been reordered.Note
This represents the underlyingpage-reorderedsignalDeclaration
Swift
@discardableResult @inlinable func onPageReordered(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ child: WidgetRef, _ pageNum: UInt) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
childthe child
GtkWidgetaffectedpageNumthe new page number for
childhandlerThe signal handler to call Run the given callback whenever the
pageReorderedsignal is emitted -
pageReorderedSignalExtension methodTyped
page-reorderedsignal for using theconnect(signal:)methodsDeclaration
Swift
static var pageReorderedSignal: NotebookSignalName { get } -
onReorderTab(flags:Extension methodhandler: ) Note
This represents the underlyingreorder-tabsignalDeclaration
Swift
@discardableResult @inlinable func onReorderTab(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ object: DirectionType, _ p0: Bool) -> Bool) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
objectnone
p0none
handlerThe signal handler to call Run the given callback whenever the
reorderTabsignal is emitted -
reorderTabSignalExtension methodTyped
reorder-tabsignal for using theconnect(signal:)methodsDeclaration
Swift
static var reorderTabSignal: NotebookSignalName { get } -
onSelectPage(flags:Extension methodhandler: ) Note
This represents the underlyingselect-pagesignalDeclaration
Swift
@discardableResult @inlinable func onSelectPage(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ object: Bool) -> Bool) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
objectnone
handlerThe signal handler to call Run the given callback whenever the
selectPagesignal is emitted -
selectPageSignalExtension methodTyped
select-pagesignal for using theconnect(signal:)methodsDeclaration
Swift
static var selectPageSignal: NotebookSignalName { get } -
onSwitchPage(flags:Extension methodhandler: ) Emitted when the user or a function changes the current page.
Note
This represents the underlyingswitch-pagesignalDeclaration
Swift
@discardableResult @inlinable func onSwitchPage(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ page: WidgetRef, _ pageNum: UInt) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pagethe new current page
pageNumthe index of the page
handlerThe signal handler to call Run the given callback whenever the
switchPagesignal is emitted -
switchPageSignalExtension methodTyped
switch-pagesignal for using theconnect(signal:)methodsDeclaration
Swift
static var switchPageSignal: NotebookSignalName { get } -
onNotifyEnablePopup(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::enable-popupsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyEnablePopup(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyEnablePopupsignal is emitted -
notifyEnablePopupSignalExtension methodTyped
notify::enable-popupsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyEnablePopupSignal: NotebookSignalName { get } -
onNotifyGroupName(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::group-namesignalDeclaration
Swift
@discardableResult @inlinable func onNotifyGroupName(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyGroupNamesignal is emitted -
notifyGroupNameSignalExtension methodTyped
notify::group-namesignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyGroupNameSignal: NotebookSignalName { get } -
onNotifyPage(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::pagesignalDeclaration
Swift
@discardableResult @inlinable func onNotifyPage(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyPagesignal is emitted -
notifyPageSignalExtension methodTyped
notify::pagesignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyPageSignal: NotebookSignalName { get } -
onNotifyPages(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::pagessignalDeclaration
Swift
@discardableResult @inlinable func onNotifyPages(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyPagessignal is emitted -
notifyPagesSignalExtension methodTyped
notify::pagessignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyPagesSignal: NotebookSignalName { get } -
onNotifyScrollable(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::scrollablesignalDeclaration
Swift
@discardableResult @inlinable func onNotifyScrollable(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyScrollablesignal is emitted -
notifyScrollableSignalExtension methodTyped
notify::scrollablesignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyScrollableSignal: NotebookSignalName { get } -
onNotifyShowBorder(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::show-bordersignalDeclaration
Swift
@discardableResult @inlinable func onNotifyShowBorder(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyShowBordersignal is emitted -
notifyShowBorderSignalExtension methodTyped
notify::show-bordersignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyShowBorderSignal: NotebookSignalName { get } -
onNotifyShowTabs(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::show-tabssignalDeclaration
Swift
@discardableResult @inlinable func onNotifyShowTabs(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyShowTabssignal is emitted -
notifyShowTabsSignalExtension methodTyped
notify::show-tabssignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyShowTabsSignal: NotebookSignalName { get } -
onNotifyTabPos(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::tab-possignalDeclaration
Swift
@discardableResult @inlinable func onNotifyTabPos(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: NotebookRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyTabPossignal is emitted -
notifyTabPosSignalExtension methodTyped
notify::tab-possignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyTabPosSignal: NotebookSignalName { get }
-
appendPage(child:Extension methodtabLabel: ) Appends a page to
notebook.Declaration
Swift
@inlinable func appendPage<WidgetT>(child: WidgetT, tabLabel: WidgetT?) -> Int where WidgetT : WidgetProtocol -
appendPageMenu(child:Extension methodtabLabel: menuLabel: ) 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 [method
Gtk.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 [method
Gtk.Notebook.set_action_widget].Declaration
Swift
@inlinable func getActionWidget(packType: GtkPackType) -> WidgetRef! -
getCurrentPage()Extension methodReturns the page number of the current page.
Declaration
Swift
@inlinable func getCurrentPage() -> Int -
getGroupName()Extension methodGets 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 methodGets 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
GtkNotebookPageforchild.Declaration
Swift
@inlinable func getPage<WidgetT>(child: WidgetT) -> NotebookPageRef! where WidgetT : WidgetProtocol -
getPages()Extension methodReturns a
GListModelthat contains the pages of the notebook.This can be used to keep an up-to-date view. The model also implements [iface
Gtk.SelectionModel] and can be used to track and modify the visible page.Declaration
Swift
@inlinable func getPages() -> GIO.ListModelRef! -
getScrollable()Extension methodReturns whether the tab label area has arrows for scrolling.
Declaration
Swift
@inlinable func getScrollable() -> Bool -
getShowBorder()Extension methodReturns whether a bevel will be drawn around the notebook pages.
Declaration
Swift
@inlinable func getShowBorder() -> Bool -
getShowTabs()Extension methodReturns 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.nilis returned ifchildis not innotebookor if no tab label has specifically been set forchild.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 methodGets 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 -
insertPage(child:Extension methodtabLabel: position: ) Insert a page into
notebookat the given position.Declaration
Swift
@inlinable func insertPage<WidgetT>(child: WidgetT, tabLabel: WidgetT?, position: Int) -> Int where WidgetT : WidgetProtocol -
insertPageMenu(child:Extension methodtabLabel: menuLabel: position: ) Insert a page into
notebookat 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 methodSwitches 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 methodDisables the popup menu.
Declaration
Swift
@inlinable func popupDisable() -
popupEnable()Extension methodEnables 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:Extension methodtabLabel: ) Prepends a page to
notebook.Declaration
Swift
@inlinable func prependPage<WidgetT>(child: WidgetT, tabLabel: WidgetT?) -> Int where WidgetT : WidgetProtocol -
prependPageMenu(child:Extension methodtabLabel: menuLabel: ) 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 methodSwitches 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:Extension methodposition: ) Reorders the page containing
child, so that it appears in positionposition.If
positionis greater than or equal to the number of children in the list or negative,childwill be moved to the end of the list.Declaration
Swift
@inlinable func reorder<WidgetT>(child: WidgetT, position: Int) where WidgetT : WidgetProtocol -
setAction(widget:Extension methodpackType: ) Sets
widgetas one of the action widgets.Depending on the pack type the widget will be placed before or after the tabs. You can use a
GtkBoxif 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
nilgroup name will not be able to exchange tabs with any other notebook.Declaration
Swift
@inlinable func set(groupName: UnsafePointer<CChar>? = nil) -
setMenuLabel(child:Extension methodmenuLabel: ) Changes the menu label for the page containing
child.Declaration
Swift
@inlinable func setMenuLabel<WidgetT>(child: WidgetT, menuLabel: WidgetT?) where WidgetT : WidgetProtocol -
setMenuLabelText(child:Extension methodmenuText: ) 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) -
setTabDetachable(child:Extension methoddetachable: ) Sets whether the tab can be detached from
notebookto another notebook or widget.Note that two notebooks must share a common group identificator (see [method
Gtk.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 [method
Gtk.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:Extension methodtabLabel: ) Changes the tab label for
child.If
nilis specified fortab_label, then the page will have the label “page N”.Declaration
Swift
@inlinable func setTabLabel<WidgetT>(child: WidgetT, tabLabel: WidgetT?) where WidgetT : WidgetProtocol -
setTabLabelText(child:Extension methodtabText: ) 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) -
setTabReorderable(child:Extension methodreorderable: ) 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 -
currentPageExtension methodReturns the page number of the current page.
Declaration
Swift
@inlinable var currentPage: Int { get nonmutating set } -
groupNameExtension methodGets the current group name for
notebook.Declaration
Swift
@inlinable var groupName: String! { get nonmutating set } -
nPagesExtension methodGets the number of pages in a notebook.
Declaration
Swift
@inlinable var nPages: Int { get } -
pagesExtension methodA selection model with the pages.
Declaration
Swift
@inlinable var pages: GIO.ListModelRef! { get } -
scrollableExtension methodIf
true, scroll arrows are added if there are too many pages to fit.Declaration
Swift
@inlinable var scrollable: Bool { get nonmutating set } -
showBorderExtension methodReturns whether a bevel will be drawn around the notebook pages.
Declaration
Swift
@inlinable var showBorder: Bool { get nonmutating set } -
showTabsExtension methodReturns whether the tabs of the notebook are shown.
Declaration
Swift
@inlinable var showTabs: Bool { get nonmutating set } -
tabPosExtension methodGets the edge at which the tabs are drawn.
Declaration
Swift
@inlinable var tabPos: GtkPositionType { get nonmutating set }
View on GitHub
Install in Dash
NotebookProtocol Protocol Reference