Package ch.bailu.gtk.gtk
Class Assistant
- All Implemented Interfaces:
PointerInterface
`GtkAssistant` is used to represent a complex as a series of steps.
![An example GtkAssistant](assistant.png)
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 [enum@Gtk.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 [method@Gtk.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.
![An example GtkAssistant](assistant.png)
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 [enum@Gtk.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 [method@Gtk.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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
static interface
static interface
static interface
static interface
static interface
Nested classes/interfaces inherited from class ch.bailu.gtk.gtk.Window
Window.OnActivateDefault, Window.OnActivateFocus, Window.OnCloseRequest, Window.OnEnableDebugging, Window.OnKeysChanged
Nested classes/interfaces inherited from class ch.bailu.gtk.gtk.Widget
Widget.OnDestroy, Widget.OnDirectionChanged, Widget.OnHide, Widget.OnKeynavFailed, Widget.OnMap, Widget.OnMnemonicActivate, Widget.OnMoveFocus, Widget.OnQueryTooltip, Widget.OnRealize, Widget.OnShow, Widget.OnStateFlagsChanged, Widget.OnTickCallback, Widget.OnUnmap, Widget.OnUnrealize
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
Fields inherited from class ch.bailu.gtk.gtk.Window
SIGNAL_ON_ACTIVATE_DEFAULT, SIGNAL_ON_ACTIVATE_FOCUS, SIGNAL_ON_CLOSE_REQUEST, SIGNAL_ON_ENABLE_DEBUGGING, SIGNAL_ON_KEYS_CHANGED
Fields inherited from class ch.bailu.gtk.gtk.Widget
SIGNAL_ON_DESTROY, SIGNAL_ON_DIRECTION_CHANGED, SIGNAL_ON_HIDE, SIGNAL_ON_KEYNAV_FAILED, SIGNAL_ON_MAP, SIGNAL_ON_MNEMONIC_ACTIVATE, SIGNAL_ON_MOVE_FOCUS, SIGNAL_ON_QUERY_TOOLTIP, SIGNAL_ON_REALIZE, SIGNAL_ON_SHOW, SIGNAL_ON_STATE_FLAGS_CHANGED, SIGNAL_ON_UNMAP, SIGNAL_ON_UNREALIZE
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addActionWidget
(Widget child) Adds a widget to the action area of a `GtkAssistant`.int
appendPage
(Widget page) Appends a page to the @assistant.Implements interfaceAccessible
.Implements interfaceBuildable
.Implements interfaceConstraintTarget
.asNative()
Implements interfaceNative
.asRoot()
Implements interfaceRoot
.Implements interfaceShortcutManager
.void
commit()
Erases the visited page history.static ClassHandler
int
Returns the page number of the current page.static int
int
Returns the number of pages in the @assistantgetNthPage
(int page_num) Returns the child widget contained in page number @page_num.Returns the `GtkAssistantPage` object for @child.boolean
getPageComplete
(Widget page) Gets whether @page is complete.getPages()
Gets a list model of the assistant pages.getPageTitle
(Widget page) Gets the title for @page.int
getPageType
(Widget page) Gets the page type of @page.static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
int
insertPage
(Widget page, int position) Inserts a page in the @assistant at a given position.void
nextPage()
Navigate to the next page.onApply
(Assistant.OnApply signal) Connect to signal "apply".onCancel
(Assistant.OnCancel signal) Connect to signal "cancel".onClose
(Assistant.OnClose signal) Connect to signal "close".onEscape
(Assistant.OnEscape signal) Connect to signal "escape".onPrepare
(Assistant.OnPrepare signal) Connect to signal "prepare".int
prependPage
(Widget page) Prepends a page to the @assistant.void
Navigate to the previous visited page.void
removeActionWidget
(Widget child) Removes a widget from the action area of a `GtkAssistant`.void
removePage
(int page_num) Removes the @page_num’s page from @assistant.void
setCurrentPage
(int page_num) Switches the page to @page_num.void
setForwardPageFunc
(Assistant.OnAssistantPageFunc page_func, Pointer data, Assistant.OnDestroyNotify destroy) Sets the page forwarding function to be @page_func.void
setPageComplete
(Widget page, boolean complete) Sets whether @page contents are complete.void
setPageTitle
(Widget page, Str title) Sets a title for @page.void
setPageTitle
(Widget page, String title) Sets a title for @page.void
setPageType
(Widget page, int type) Sets the page type for @page.void
Forces @assistant to recompute the buttons state.Methods inherited from class ch.bailu.gtk.gtk.Window
close, destroy, fullscreen, fullscreenOnMonitor, getApplication, getChild, getDecorated, getDefaultIconName, getDefaultSize, getDefaultWidget, getDeletable, getDestroyWithParent, getFocus, getFocusVisible, getGroup, getHandleMenubarAccel, getHideOnClose, getIconName, getMnemonicsVisible, getModal, getResizable, getTitle, getTitlebar, getToplevels, getTransientFor, hasGroup, isActive, isFullscreen, isMaximized, listToplevels, maximize, minimize, onActivateDefault, onActivateFocus, onCloseRequest, onEnableDebugging, onKeysChanged, present, presentWithTime, setApplication, setAutoStartupNotification, setChild, setDecorated, setDefaultIconName, setDefaultSize, setDefaultWidget, setDeletable, setDestroyWithParent, setDisplay, setFocus, setFocusVisible, setHandleMenubarAccel, setHideOnClose, setIconName, setIconName, setInteractiveDebugging, setMnemonicsVisible, setModal, setResizable, setStartupId, setStartupId, setTitle, setTitle, setTitlebar, setTransientFor, unfullscreen, unmaximize, unminimize
Methods inherited from class ch.bailu.gtk.gtk.Widget
actionSetEnabled, actionSetEnabled, activate, activateAction, activateAction, activateActionVariant, activateActionVariant, activateDefault, addController, addCssClass, addCssClass, addMnemonicLabel, addTickCallback, allocate, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, createPangoLayout, disposeTemplate, dragCheckThreshold, errorBell, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getCanFocus, getCanTarget, getChildVisible, getClipboard, getCssClasses, getCssName, getCursor, getDefaultDirection, getDirection, getDisplay, getFirstChild, getFocusable, getFocusChild, getFocusOnClick, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPreferredSize, getPrevSibling, getPrimaryClipboard, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth, grabFocus, hasCssClass, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, observeChildren, observeControllers, onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, pick, queueAllocate, queueDraw, queueResize, realize, removeController, removeCssClass, removeCssClass, removeMnemonicLabel, removeTickCallback, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setCursorFromName, setDefaultDirection, setDirection, setFocusable, setFocusChild, setFocusOnClick, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setName, setOpacity, setOverflow, setParent, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipMarkup, setTooltipText, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, shouldLayout, show, sizeAllocate, snapshotChild, triggerTooltipQuery, unmap, unparent, unrealize, unsetStateFlags
Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Field Details
-
SIGNAL_ON_APPLY
- See Also:
-
SIGNAL_ON_CANCEL
- See Also:
-
SIGNAL_ON_CLOSE
- See Also:
-
SIGNAL_ON_ESCAPE
- See Also:
-
SIGNAL_ON_PREPARE
- See Also:
-
-
Constructor Details
-
Assistant
-
Assistant
public Assistant()Creates a new `GtkAssistant`.
-
-
Method Details
-
getClassHandler
-
addActionWidget
Adds a widget to the action area of a `GtkAssistant`.- Parameters:
child
- a `GtkWidget`
-
appendPage
Appends a page to the @assistant.- Parameters:
page
- a `GtkWidget`- Returns:
- the index (starting at 0) of the inserted page
-
commit
public void commit()Erases 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. -
getCurrentPage
public int getCurrentPage()Returns the page number of the current page.- Returns:
- The index (starting from 0) of the current page in the @assistant, or -1 if the @assistant has no pages, or no current page
-
getNPages
public int getNPages()Returns the number of pages in the @assistant- Returns:
- the number of pages in the @assistant
-
getNthPage
Returns the child widget contained in page number @page_num.- Parameters:
page_num
- the index of a page in the @assistant, or -1 to get the last page- Returns:
- the child widget, or %NULL if @page_num is out of bounds
-
getPage
Returns the `GtkAssistantPage` object for @child.- Parameters:
child
- a child of @assistant- Returns:
- the `GtkAssistantPage` for @child
-
getPageComplete
Gets whether @page is complete.- Parameters:
page
- a page of @assistant- Returns:
- %TRUE if @page is complete.
-
getPageTitle
Gets the title for @page.- Parameters:
page
- a page of @assistant- Returns:
- the title for @page
-
getPageType
Gets the page type of @page.- Parameters:
page
- a page of @assistant- Returns:
- the page type of @page
-
getPages
Gets a list model of the assistant pages.- Returns:
- A list model of the pages.
-
insertPage
Inserts a page in the @assistant at a given position.- Parameters:
page
- a `GtkWidget`position
- the index (starting at 0) at which to insert the page, or -1 to append the page to the @assistant- Returns:
- the index (starting from 0) of the inserted page
-
nextPage
public void nextPage()Navigate 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. -
prependPage
Prepends a page to the @assistant.- Parameters:
page
- a `GtkWidget`- Returns:
- the index (starting at 0) of the inserted page
-
previousPage
public void previousPage()Navigate 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. -
removeActionWidget
Removes a widget from the action area of a `GtkAssistant`.- Parameters:
child
- a `GtkWidget`
-
removePage
public void removePage(int page_num) Removes the @page_num’s page from @assistant.- Parameters:
page_num
- the index of a page in the @assistant, or -1 to remove the last page
-
setCurrentPage
public void setCurrentPage(int page_num) Switches the page to @page_num.
Note that this will only be necessary in custom buttons,
as the @assistant flow can be set with
gtk_assistant_set_forward_page_func().- Parameters:
page_num
- index of the page to switch to, starting from 0. If negative, the last page will be used. If greater than the number of pages in the @assistant, nothing will be done.
-
setForwardPageFunc
public void setForwardPageFunc(Assistant.OnAssistantPageFunc page_func, @Nullable Pointer data, Assistant.OnDestroyNotify 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 to %NULL will make the assistant to
use the default forward function, which just goes to the
next visible page.- Parameters:
page_func
- the `GtkAssistantPageFunc`, or %NULL to use the default onedata
- user data for @page_funcdestroy
- destroy notifier for @data
-
setPageComplete
Sets whether @page contents are complete.
This will make @assistant update the buttons state
to be able to continue the task.- Parameters:
page
- a page of @assistantcomplete
- the completeness status of the page
-
setPageTitle
Sets a title for @page.
The title is displayed in the header area of the assistant
when @page is the current page.- Parameters:
page
- a page of @assistanttitle
- the new title for @page
-
setPageTitle
Sets a title for @page.
The title is displayed in the header area of the assistant
when @page is the current page.- Parameters:
page
- a page of @assistanttitle
- the new title for @page
-
setPageType
Sets the page type for @page.
The page type determines the page behavior in the @assistant.- Parameters:
page
- a page of @assistanttype
- the new type for @page
-
updateButtonsState
public void updateButtonsState()Forces @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. -
onApply
Connect to signal "apply".
SeeAssistant.OnApply.onApply()
for signal description.
FieldSIGNAL_ON_APPLY
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
onCancel
Connect to signal "cancel".
SeeAssistant.OnCancel.onCancel()
for signal description.
FieldSIGNAL_ON_CANCEL
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
onClose
Connect to signal "close".
SeeAssistant.OnClose.onClose()
for signal description.
FieldSIGNAL_ON_CLOSE
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
onEscape
Connect to signal "escape".
SeeAssistant.OnEscape.onEscape()
for signal description.
FieldSIGNAL_ON_ESCAPE
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
onPrepare
Connect to signal "prepare".
SeeAssistant.OnPrepare.onPrepare(ch.bailu.gtk.gtk.Widget)
for signal description.
FieldSIGNAL_ON_PREPARE
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
asAccessible
Implements interfaceAccessible
. Call this to get access to interface functions.- Overrides:
asAccessible
in classWindow
- Returns:
Accessible
-
asBuildable
Implements interfaceBuildable
. Call this to get access to interface functions.- Overrides:
asBuildable
in classWindow
- Returns:
Buildable
-
asConstraintTarget
Implements interfaceConstraintTarget
. Call this to get access to interface functions.- Overrides:
asConstraintTarget
in classWindow
- Returns:
ConstraintTarget
-
asNative
Implements interfaceNative
. Call this to get access to interface functions. -
asRoot
Implements interfaceRoot
. Call this to get access to interface functions. -
asShortcutManager
Implements interfaceShortcutManager
. Call this to get access to interface functions.- Overrides:
asShortcutManager
in classWindow
- Returns:
ShortcutManager
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-