Class Assistant

All Implemented Interfaces:
PointerInterface

public class Assistant extends Window
`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.

https://docs.gtk.org/gtk4/class.Assistant.html

  • Field Details

  • Constructor Details

    • Assistant

      public Assistant(PointerContainer pointer)
    • Assistant

      public Assistant()
      Creates a new `GtkAssistant`.
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • addActionWidget

      public void addActionWidget(@Nonnull Widget child)
      Adds a widget to the action area of a `GtkAssistant`.
      Parameters:
      child - a `GtkWidget`
    • appendPage

      public int appendPage(@Nonnull Widget page)
      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

      public Widget getNthPage(int page_num)
      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

      public AssistantPage getPage(@Nonnull Widget child)
      Returns the `GtkAssistantPage` object for @child.
      Parameters:
      child - a child of @assistant
      Returns:
      the `GtkAssistantPage` for @child
    • getPageComplete

      public boolean getPageComplete(@Nonnull Widget page)
      Gets whether @page is complete.
      Parameters:
      page - a page of @assistant
      Returns:
      %TRUE if @page is complete.
    • getPageTitle

      public Str getPageTitle(@Nonnull Widget page)
      Gets the title for @page.
      Parameters:
      page - a page of @assistant
      Returns:
      the title for @page
    • getPageType

      public int getPageType(@Nonnull Widget page)
      Gets the page type of @page.
      Parameters:
      page - a page of @assistant
      Returns:
      the page type of @page
    • getPages

      public ListModel getPages()
      Gets a list model of the assistant pages.
      Returns:
      A list model of the pages.
    • insertPage

      public int insertPage(@Nonnull Widget page, int position)
      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

      public int prependPage(@Nonnull Widget page)
      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

      public void removeActionWidget(@Nonnull Widget child)
      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 one
      data - user data for @page_func
      destroy - destroy notifier for @data
    • setPageComplete

      public void setPageComplete(@Nonnull Widget page, boolean complete)
      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 @assistant
      complete - the completeness status of the page
    • setPageTitle

      public void setPageTitle(@Nonnull Widget page, @Nonnull Str title)
      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 @assistant
      title - the new title for @page
    • setPageTitle

      public void setPageTitle(@Nonnull Widget page, String title)
      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 @assistant
      title - the new title for @page
    • setPageType

      public void setPageType(@Nonnull Widget page, int type)
      Sets the page type for @page.

      The page type determines the page behavior in the @assistant.
      Parameters:
      page - a page of @assistant
      type - 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

      public SignalHandler onApply(Assistant.OnApply signal)
      Connect to signal "apply".
      See Assistant.OnApply.onApply() for signal description.
      Field SIGNAL_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

      public SignalHandler onCancel(Assistant.OnCancel signal)
      Connect to signal "cancel".
      See Assistant.OnCancel.onCancel() for signal description.
      Field SIGNAL_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

      public SignalHandler onClose(Assistant.OnClose signal)
      Connect to signal "close".
      See Assistant.OnClose.onClose() for signal description.
      Field SIGNAL_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

      public SignalHandler onEscape(Assistant.OnEscape signal)
      Connect to signal "escape".
      See Assistant.OnEscape.onEscape() for signal description.
      Field SIGNAL_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

      public SignalHandler onPrepare(Assistant.OnPrepare signal)
      Connect to signal "prepare".
      See Assistant.OnPrepare.onPrepare(ch.bailu.gtk.gtk.Widget) for signal description.
      Field SIGNAL_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

      public Accessible asAccessible()
      Implements interface Accessible. Call this to get access to interface functions.
      Overrides:
      asAccessible in class Window
      Returns:
      Accessible
    • asBuildable

      public Buildable asBuildable()
      Implements interface Buildable. Call this to get access to interface functions.
      Overrides:
      asBuildable in class Window
      Returns:
      Buildable
    • asConstraintTarget

      public ConstraintTarget asConstraintTarget()
      Implements interface ConstraintTarget. Call this to get access to interface functions.
      Overrides:
      asConstraintTarget in class Window
      Returns:
      ConstraintTarget
    • asNative

      public Native asNative()
      Implements interface Native. Call this to get access to interface functions.
      Overrides:
      asNative in class Window
      Returns:
      Native
    • asRoot

      public Root asRoot()
      Implements interface Root. Call this to get access to interface functions.
      Overrides:
      asRoot in class Window
      Returns:
      Root
    • asShortcutManager

      public ShortcutManager asShortcutManager()
      Implements interface ShortcutManager. Call this to get access to interface functions.
      Overrides:
      asShortcutManager in class Window
      Returns:
      ShortcutManager
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()