NotebookRef
public struct NotebookRef : NotebookProtocol, GWeakCapturing
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_GROUP
for the notebook widgetGTK_ACCESSIBLE_ROLE_TAB_LIST
for the list of tabsGTK_ACCESSIBLE_ROLE_TAB
role for each tabGTK_ACCESSIBLE_ROLE_TAB_PANEL
for each page
The NotebookRef
type acts as a lightweight Swift reference to an underlying GtkNotebook
instance.
It exposes methods that can operate on this data type through NotebookProtocol
conformance.
Use NotebookRef
only as an unowned
reference to an existing GtkNotebook
instance.
-
Untyped pointer to the underlying `GtkNotebook` instance.
For type-safe access, use the generated, typed pointer
notebook_ptr
property instead.Declaration
Swift
public let ptr: UnsafeMutableRawPointer!
-
Designated initialiser from the underlying
C
data typeDeclaration
Swift
@inlinable init(_ p: UnsafeMutablePointer<GtkNotebook>)
-
Designated initialiser from a constant pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init(_ p: UnsafePointer<GtkNotebook>)
-
Conditional initialiser from an optional pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafeMutablePointer<GtkNotebook>?)
-
Conditional initialiser from an optional, non-mutable pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafePointer<GtkNotebook>?)
-
Conditional initialiser from an optional
gpointer
Declaration
Swift
@inlinable init!(gpointer g: gpointer?)
-
Conditional initialiser from an optional, non-mutable
gconstpointer
Declaration
Swift
@inlinable init!(gconstpointer g: gconstpointer?)
-
Reference intialiser for a related type that implements
NotebookProtocol
Declaration
Swift
@inlinable init<T>(_ other: T) where T : NotebookProtocol
-
This factory is syntactic sugar for setting weak pointers wrapped in
GWeak<T>
Declaration
Swift
@inlinable static func unowned<T>(_ other: T) -> NotebookRef where T : NotebookProtocol
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
NotebookProtocol
.Declaration
Swift
@inlinable init<T>(cPointer: UnsafeMutablePointer<T>)
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
NotebookProtocol
.Declaration
Swift
@inlinable init<T>(constPointer: UnsafePointer<T>)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
NotebookProtocol
.Declaration
Swift
@inlinable init(mutating raw: UnsafeRawPointer)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
NotebookProtocol
.Declaration
Swift
@inlinable init(raw: UnsafeMutableRawPointer)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
NotebookProtocol
.Declaration
Swift
@inlinable init(opaquePointer: OpaquePointer)
-
Creates a new
GtkNotebook
widget with no pages.Declaration
Swift
@inlinable init()