StackRef
public struct StackRef : StackProtocol, GWeakCapturing
GtkStack
is a container which only shows one of its children
at a time.
In contrast to GtkNotebook
, GtkStack
does not provide a means
for users to change the visible child. Instead, a separate widget
such as [classGtk.StackSwitcher
] or [classGtk.StackSidebar
] can
be used with GtkStack
to provide this functionality.
Transitions between pages can be animated as slides or fades. This
can be controlled with [methodGtk.Stack.set_transition_type
].
These animations respect the [propertyGtk.Settings:gtk-enable-animations
]
setting.
GtkStack
maintains a [classGtk.StackPage
] object for each added
child, which holds additional per-child properties. You
obtain the GtkStackPage
for a child with [methodGtk.Stack.get_page
]
and you can obtain a GtkSelectionModel
containing all the pages
with [methodGtk.Stack.get_pages
].
GtkStack as GtkBuildable
To set child-specific properties in a .ui file, create GtkStackPage
objects explicitly, and set the child widget as a property on it:
<object class="GtkStack" id="stack">
<child>
<object class="GtkStackPage">
<property name="name">page1</property>
<property name="title">In the beginning…</property>
<property name="child">
<object class="GtkLabel">
<property name="label">It was dark</property>
</object>
</property>
</object>
</child>
CSS nodes
GtkStack
has a single CSS node named stack.
Accessibility
GtkStack
uses the GTK_ACCESSIBLE_ROLE_TAB_PANEL
for the stack
pages, which are the accessible parent objects of the child widgets.
The StackRef
type acts as a lightweight Swift reference to an underlying GtkStack
instance.
It exposes methods that can operate on this data type through StackProtocol
conformance.
Use StackRef
only as an unowned
reference to an existing GtkStack
instance.
-
Untyped pointer to the underlying `GtkStack` instance.
For type-safe access, use the generated, typed pointer
stack_ptr
property instead.Declaration
Swift
public let ptr: UnsafeMutableRawPointer!
-
Designated initialiser from the underlying
C
data typeDeclaration
Swift
@inlinable init(_ p: UnsafeMutablePointer<GtkStack>)
-
Designated initialiser from a constant pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init(_ p: UnsafePointer<GtkStack>)
-
Conditional initialiser from an optional pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafeMutablePointer<GtkStack>?)
-
Conditional initialiser from an optional, non-mutable pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafePointer<GtkStack>?)
-
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
StackProtocol
Declaration
Swift
@inlinable init<T>(_ other: T) where T : StackProtocol
-
This factory is syntactic sugar for setting weak pointers wrapped in
GWeak<T>
Declaration
Swift
@inlinable static func unowned<T>(_ other: T) -> StackRef where T : StackProtocol
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
StackProtocol
.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
StackProtocol
.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
StackProtocol
.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
StackProtocol
.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
StackProtocol
.Declaration
Swift
@inlinable init(opaquePointer: OpaquePointer)
-
Creates a new
GtkStack
.Declaration
Swift
@inlinable init()