AssistantProtocol
public protocol AssistantProtocol : WindowProtocol
GtkAssistant
is used to represent a complex as a series of steps.
Each step consists of one or more pages. GtkAssistant
guides the user
through the pages, and controls the page flow to collect the data needed
for the operation.
GtkAssistant
handles which buttons to show and to make sensitive based
on page sequence knowledge and the [enumGtk.AssistantPageType
] of each
page in addition to state information like the completed and committed
page statuses.
If you have a case that doesn’t quite fit in GtkAssistant
s way of
handling buttons, you can use the GTK_ASSISTANT_PAGE_CUSTOM
page
type and handle buttons yourself.
GtkAssistant
maintains a GtkAssistantPage
object for each added
child, which holds additional per-child properties. You
obtain the GtkAssistantPage
for a child with [methodGtk.Assistant.get_page
].
GtkAssistant as GtkBuildable
The GtkAssistant
implementation of the GtkBuildable
interface
exposes the action_area
as internal children with the name
“action_area”.
To add pages to an assistant in GtkBuilder
, simply add it as a
child to the GtkAssistant
object. If you need to set per-object
properties, create a GtkAssistantPage
object explicitly, and
set the child widget as a property on it.
CSS nodes
GtkAssistant
has a single CSS node with the name window and style
class .assistant.
The AssistantProtocol
protocol exposes the methods and properties of an underlying GtkAssistant
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 Assistant
.
Alternatively, use AssistantRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkAssistant
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
assistant_ptr
Default implementationTyped pointer to the underlying
GtkAssistant
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkAssistant
instance.Declaration
Swift
var assistant_ptr: UnsafeMutablePointer<GtkAssistant>! { get }
-
Required Initialiser for types conforming to
AssistantProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
AssistantPropertyName
source property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: AssistantPropertyName, 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 transformationtransform_to
ValueTransformer
to use for backwards transformationReturn Value
binding reference or
nil
in case of an error -
get(property:
Extension method) Get the value of a Assistant property
Declaration
Swift
@inlinable func get(property: AssistantPropertyName) -> GLibObject.Value
Parameters
property
the property to get the value for
Return Value
the value of the named property
-
set(property:
Extension methodvalue: ) Set the value of a Assistant property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: AssistantPropertyName, value v: GLibObject.Value)
Parameters
property
the 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
AssistantSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: AssistantSignalName, 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 byuserData
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(signal:
Extension methodflags: data: destroyData: signalHandler: ) Connect a C signal handler to the given, typed
AssistantSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: AssistantSignalName, 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 byuserData
signalHandler
The C function to be called on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
onApply(flags:
Extension methodhandler: ) Emitted when the apply button is clicked.
The default behavior of the
GtkAssistant
is to switch to the page after the current page, unless the current page is the last one.A handler for the
apply
signal should carry out the actions for which the wizard has collected data. If the action takes a long time to complete, you might consider putting a page of typeGTK_ASSISTANT_PAGE_PROGRESS
after the confirmation page and handle this operation within the [signalGtk.Assistant::prepare
] signal of the progress page.Note
This represents the underlyingapply
signalDeclaration
Swift
@discardableResult @inlinable func onApply(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: AssistantRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
handler
The signal handler to call Run the given callback whenever the
apply
signal is emitted -
applySignal
Extension methodTyped
apply
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var applySignal: AssistantSignalName { get }
-
onCancel(flags:
Extension methodhandler: ) Emitted when then the cancel button is clicked.
Note
This represents the underlyingcancel
signalDeclaration
Swift
@discardableResult @inlinable func onCancel(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: AssistantRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
handler
The signal handler to call Run the given callback whenever the
cancel
signal is emitted -
cancelSignal
Extension methodTyped
cancel
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var cancelSignal: AssistantSignalName { get }
-
onClose(flags:
Extension methodhandler: ) Emitted either when the close button of a summary page is clicked, or when the apply button in the last page in the flow (of type
GTK_ASSISTANT_PAGE_CONFIRM
) is clicked.Note
This represents the underlyingclose
signalDeclaration
Swift
@discardableResult @inlinable func onClose(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: AssistantRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
handler
The signal handler to call Run the given callback whenever the
close
signal is emitted -
closeSignal
Extension methodTyped
close
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var closeSignal: AssistantSignalName { get }
-
onEscape(flags:
Extension methodhandler: ) The action signal for the Escape binding.
Note
This represents the underlyingescape
signalDeclaration
Swift
@discardableResult @inlinable func onEscape(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: AssistantRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
handler
The signal handler to call Run the given callback whenever the
escape
signal is emitted -
escapeSignal
Extension methodTyped
escape
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var escapeSignal: AssistantSignalName { get }
-
onPrepare(flags:
Extension methodhandler: ) Emitted when a new page is set as the assistant’s current page, before making the new page visible.
A handler for this signal can do any preparations which are necessary before showing
page
.Note
This represents the underlyingprepare
signalDeclaration
Swift
@discardableResult @inlinable func onPrepare(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: AssistantRef, _ page: WidgetRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
page
the current page
handler
The signal handler to call Run the given callback whenever the
prepare
signal is emitted -
prepareSignal
Extension methodTyped
prepare
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var prepareSignal: AssistantSignalName { 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 innotify
being 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::pages
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyPages(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: AssistantRef, _ 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 methodTyped
notify::pages
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyPagesSignal: AssistantSignalName { get }
-
onNotifyUseHeaderBar(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 innotify
being 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::use-header-bar
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyUseHeaderBar(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: AssistantRef, _ 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
notifyUseHeaderBar
signal is emitted -
notifyUseHeaderBarSignal
Extension methodTyped
notify::use-header-bar
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyUseHeaderBarSignal: AssistantSignalName { get }
-
addActionWidget(child:
Extension method) Adds a widget to the action area of a
GtkAssistant
.Declaration
Swift
@inlinable func addActionWidget<WidgetT>(child: WidgetT) where WidgetT : WidgetProtocol
-
append(page:
Extension method) Appends a page to the
assistant
.Declaration
Swift
@inlinable func append<WidgetT>(page: WidgetT) -> Int where WidgetT : WidgetProtocol
-
commit()
Extension methodErases the visited page history.
GTK will then hide the back button on the current page, and removes the cancel button from subsequent pages.
Use this when the information provided up to the current page is hereafter deemed permanent and cannot be modified or undone. For example, showing a progress page to track a long-running, unreversible operation after the user has clicked apply on a confirmation page.
Declaration
Swift
@inlinable func commit()
-
getCurrentPage()
Extension methodReturns the page number of the current page.
Declaration
Swift
@inlinable func getCurrentPage() -> Int
-
getNPages()
Extension methodReturns the number of pages in the
assistant
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
GtkAssistantPage
object forchild
.Declaration
Swift
@inlinable func getPage<WidgetT>(child: WidgetT) -> AssistantPageRef! where WidgetT : WidgetProtocol
-
getPageComplete(page:
Extension method) Gets whether
page
is complete.Declaration
Swift
@inlinable func getPageComplete<WidgetT>(page: WidgetT) -> Bool where WidgetT : WidgetProtocol
-
getPageTitle(page:
Extension method) Gets the title for
page
.Declaration
Swift
@inlinable func getPageTitle<WidgetT>(page: WidgetT) -> String! where WidgetT : WidgetProtocol
-
getPageType(page:
Extension method) Gets the page type of
page
.Declaration
Swift
@inlinable func getPageType<WidgetT>(page: WidgetT) -> GtkAssistantPageType where WidgetT : WidgetProtocol
-
getPages()
Extension methodGets a list model of the assistant pages.
Declaration
Swift
@inlinable func getPages() -> GIO.ListModelRef!
-
insert(page:
Extension methodposition: ) Inserts a page in the
assistant
at a given position.Declaration
Swift
@inlinable func insert<WidgetT>(page: WidgetT, position: Int) -> Int where WidgetT : WidgetProtocol
-
nextPage()
Extension methodNavigate to the next page.
It is a programming error to call this function when there is no next page.
This function is for use when creating pages of the
GTK_ASSISTANT_PAGE_CUSTOM
type.Declaration
Swift
@inlinable func nextPage()
-
prepend(page:
Extension method) Prepends a page to the
assistant
.Declaration
Swift
@inlinable func prepend<WidgetT>(page: WidgetT) -> Int where WidgetT : WidgetProtocol
-
previousPage()
Extension methodNavigate to the previous visited page.
It is a programming error to call this function when no previous page is available.
This function is for use when creating pages of the
GTK_ASSISTANT_PAGE_CUSTOM
type.Declaration
Swift
@inlinable func previousPage()
-
removeActionWidget(child:
Extension method) Removes a widget from the action area of a
GtkAssistant
.Declaration
Swift
@inlinable func removeActionWidget<WidgetT>(child: WidgetT) where WidgetT : WidgetProtocol
-
removePage(pageNum:
Extension method) Removes the
page_num
’s page fromassistant
.Declaration
Swift
@inlinable func removePage(pageNum: Int)
-
setCurrentPage(pageNum:
Extension method) Switches the page to
page_num
.Note that this will only be necessary in custom buttons, as the
assistant
flow can be set withgtk_assistant_set_forward_page_func()
.Declaration
Swift
@inlinable func setCurrentPage(pageNum: Int)
-
setForward(pageFunc:
Extension methoddata: destroy: ) Sets the page forwarding function to be
page_func
.This function will be used to determine what will be the next page when the user presses the forward button. Setting
page_func
tonil
will make the assistant to use the default forward function, which just goes to the next visible page.Declaration
Swift
@inlinable func setForward(pageFunc: GtkAssistantPageFunc? = nil, data: gpointer! = nil, destroy: GDestroyNotify?)
-
setPageComplete(page:
Extension methodcomplete: ) Sets whether
page
contents are complete.This will make
assistant
update the buttons state to be able to continue the task.Declaration
Swift
@inlinable func setPageComplete<WidgetT>(page: WidgetT, complete: Bool) where WidgetT : WidgetProtocol
-
setPageTitle(page:
Extension methodtitle: ) Sets a title for
page
.The title is displayed in the header area of the assistant when
page
is the current page.Declaration
Swift
@inlinable func setPageTitle<WidgetT>(page: WidgetT, title: UnsafePointer<CChar>!) where WidgetT : WidgetProtocol
-
setPageType(page:
Extension methodtype: ) Sets the page type for
page
.The page type determines the page behavior in the
assistant
.Declaration
Swift
@inlinable func setPageType<WidgetT>(page: WidgetT, type: GtkAssistantPageType) where WidgetT : WidgetProtocol
-
updateButtonsState()
Extension methodForces
assistant
to recompute the buttons state.GTK automatically takes care of this in most situations, e.g. when the user goes to a different page, or when the visibility or completeness of a page changes.
One situation where it can be necessary to call this function is when changing a value on the current page affects the future page flow of the assistant.
Declaration
Swift
@inlinable func updateButtonsState()
-
currentPage
Extension methodReturns the page number of the current page.
Declaration
Swift
@inlinable var currentPage: Int { get nonmutating set }
-
nPages
Extension methodReturns the number of pages in the
assistant
Declaration
Swift
@inlinable var nPages: Int { get }
-
pages
Extension methodGListModel
containing the pages.Declaration
Swift
@inlinable var pages: GIO.ListModelRef! { get }