Gtk.Assistant

Entities

Simple Types

Tagged Types

Access Types

Constants

Subprograms

Generic Instantiations

Description

A Gtk.Assistant.Gtk_Assistant is a widget used to represent a generally complex operation splitted in several steps, guiding the user through its pages and controlling the page flow to collect the necessary data.

The design of GtkAssistant is that it controls what buttons to show and to make sensitive, based on what it knows about the page sequence and the [type][GtkAssistantPageType] of each page, in addition to state information like the page [completion][gtk-assistant-set-page-complete] and [committed][gtk-assistant-commit] status.

If you have a case that doesn't quite fit in Gtk_Assistants way of handling buttons, you can use the GTK_ASSISTANT_PAGE_CUSTOM page type and handle buttons yourself.

# GtkAssistant as GtkBuildable

The GtkAssistant implementation of the Gtk.Buildable.Gtk_Buildable interface exposes the Action_Area as internal children with the name "action_area".

To add pages to an assistant in Gtk.Builder.Gtk_Builder, simply add it as a child to the GtkAssistant object, and set its child properties as necessary.

# CSS nodes

GtkAssistant has a single CSS node with the name assistant.

<group>Windows</group> <testgtk>create_assistant.adb</testgtk>

"+"

function "+"
  (Widget : access Gtk_Assistant_Record'Class)
return Gtk.Buildable.Gtk_Buildable
Parameters
Widget
Return Value

"-"

function "-"
  (Interf : Gtk.Buildable.Gtk_Buildable)
return Gtk_Assistant
Parameters
Interf
Return Value

Add_Action_Widget

procedure Add_Action_Widget
   (Assistant : not null access Gtk_Assistant_Record;
    Child     : not null access Gtk.Widget.Gtk_Widget_Record'Class)

Adds a widget to the action area of a Gtk.Assistant.Gtk_Assistant. Since: gtk+ 2.10

Parameters
Assistant
Child

a Gtk.Widget.Gtk_Widget

Append_Page

function Append_Page
   (Assistant : not null access Gtk_Assistant_Record;
    Page      : not null access Gtk.Widget.Gtk_Widget_Record'Class)
    return Glib.Gint

Appends a page to the Assistant. Since: gtk+ 2.10

Parameters
Assistant
Page

a Gtk.Widget.Gtk_Widget

Return Value

the index (starting at 0) of the inserted page

Cb_GObject_Gtk_Widget_Void

type Cb_GObject_Gtk_Widget_Void is not null access procedure
  (Self : access Glib.Object.GObject_Record'Class;
   Page : not null access Gtk.Widget.Gtk_Widget_Record'Class);
Parameters
Self
Page

Cb_GObject_Void

type Cb_GObject_Void is not null access procedure
  (Self : access Glib.Object.GObject_Record'Class);
Parameters
Self

Cb_Gtk_Assistant_Gtk_Widget_Void

type Cb_Gtk_Assistant_Gtk_Widget_Void is not null access procedure
  (Self : access Gtk_Assistant_Record'Class;
   Page : not null access Gtk.Widget.Gtk_Widget_Record'Class);
Parameters
Self
Page

Cb_Gtk_Assistant_Void

type Cb_Gtk_Assistant_Void is not null access procedure (Self : access Gtk_Assistant_Record'Class);
Parameters
Self

Commit

procedure Commit (Assistant : not null access Gtk_Assistant_Record)

Erases the visited page history so the back button is not shown 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. Since: gtk+ 2.22

Parameters
Assistant

Get_Current_Page

function Get_Current_Page
   (Assistant : not null access Gtk_Assistant_Record) return Glib.Gint

Returns the page number of the current page. Since: gtk+ 2.10

Parameters
Assistant
Return Value

The index (starting from 0) of the current page in the Assistant, or -1 if the Assistant has no pages, or no current page.

Get_N_Pages

function Get_N_Pages
   (Assistant : not null access Gtk_Assistant_Record) return Glib.Gint

Returns the number of pages in the Assistant Since: gtk+ 2.10

Parameters
Assistant
Return Value

the number of pages in the Assistant

Get_Nth_Page

function Get_Nth_Page
   (Assistant : not null access Gtk_Assistant_Record;
    Page_Num  : Glib.Gint) return Gtk.Widget.Gtk_Widget

Returns the child widget contained in page number Page_Num. Since: gtk+ 2.10

Parameters
Assistant
Page_Num

the index of a page in the Assistant, or -1 to get the last page

Return Value

the child widget, or null if Page_Num is out of bounds

Get_Page_Complete

function Get_Page_Complete
   (Assistant : not null access Gtk_Assistant_Record;
    Page      : not null access Gtk.Widget.Gtk_Widget_Record'Class)
    return Boolean

Gets whether Page is complete. Since: gtk+ 2.10

Parameters
Assistant
Page

a page of Assistant

Return Value

True if Page is complete.

Get_Page_Has_Padding

function Get_Page_Has_Padding
   (Assistant : not null access Gtk_Assistant_Record;
    Page      : not null access Gtk.Widget.Gtk_Widget_Record'Class)
    return Boolean

Gets whether page has padding. Since: gtk+ 3.18

Parameters
Assistant
Page

a page of Assistant

Return Value

True if Page has padding

Get_Page_Header_Image

function Get_Page_Header_Image
   (Assistant : not null access Gtk_Assistant_Record;
    Page      : not null access Gtk.Widget.Gtk_Widget_Record'Class)
    return Gdk.Pixbuf.Gdk_Pixbuf

Gets the header image for Page. Since: gtk+ 2.10 Deprecated since 3.2, 1

Parameters
Assistant
Page

a page of Assistant

Return Value

the header image for Page, or null if there's no header image for the page

Get_Page_Side_Image

function Get_Page_Side_Image
   (Assistant : not null access Gtk_Assistant_Record;
    Page      : not null access Gtk.Widget.Gtk_Widget_Record'Class)
    return Gdk.Pixbuf.Gdk_Pixbuf

Gets the side image for Page. Since: gtk+ 2.10 Deprecated since 3.2, 1

Parameters
Assistant
Page

a page of Assistant

Return Value

the side image for Page, or null if there's no side image for the page

Get_Page_Title

function Get_Page_Title
   (Assistant : not null access Gtk_Assistant_Record;
    Page      : not null access Gtk.Widget.Gtk_Widget_Record'Class)
    return UTF8_String

Gets the title for Page. Since: gtk+ 2.10

Parameters
Assistant
Page

a page of Assistant

Return Value

the title for Page

Get_Page_Type

function Get_Page_Type
   (Assistant : not null access Gtk_Assistant_Record;
    Page      : not null access Gtk.Widget.Gtk_Widget_Record'Class)
    return Gtk_Assistant_Page_Type

Gets the page type of Page. Since: gtk+ 2.10

Parameters
Assistant
Page

a page of Assistant

Return Value

the page type of Page

Get_Type

function Get_Type return Glib.GType
Return Value

Gtk_Assistant

type Gtk_Assistant is access all Gtk_Assistant_Record'Class;

Gtk_Assistant_New

function Gtk_Assistant_New return Gtk_Assistant

Creates a new Gtk.Assistant.Gtk_Assistant. Since: gtk+ 2.10

Return Value

Gtk_Assistant_Page_Func

type Gtk_Assistant_Page_Func is access function (Current_Page : Glib.Gint) return Glib.Gint;

A function used by Gtk.Assistant.Set_Forward_Page_Func to know which is the next page given a current one. It's called both for computing the next page when the user presses the "forward" button and for handling the behavior of the "last" button.

Parameters
Current_Page

The page number used to calculate the next page.

Return Value

The next page number.

Gtk_Assistant_Page_Type

type Gtk_Assistant_Page_Type is (
   Gtk_Assistant_Page_Content,
   Gtk_Assistant_Page_Intro,
   Gtk_Assistant_Page_Confirm,
   Gtk_Assistant_Page_Summary,
   Gtk_Assistant_Page_Progress,
   Gtk_Assistant_Page_Custom);

An enum for determining the page role inside the Gtk.Assistant.Gtk_Assistant. It's used to handle buttons sensitivity and visibility.

Note that an assistant needs to end its page flow with a page of type Gtk.Assistant.Gtk_Assistant_Page_Confirm, Gtk.Assistant.Gtk_Assistant_Page_Summary or Gtk.Assistant.Gtk_Assistant_Page_Progress to be correct.

The Cancel button will only be shown if the page isn't "committed". See Gtk.Assistant.Commit for details.

Enumeration Literal
Gtk_Assistant_Page_Content
Gtk_Assistant_Page_Intro
Gtk_Assistant_Page_Confirm
Gtk_Assistant_Page_Summary
Gtk_Assistant_Page_Progress
Gtk_Assistant_Page_Custom

Gtk_Assistant_Page_Type_Properties

package Gtk_Assistant_Page_Type_Properties is
   new Generic_Internal_Discrete_Property (Gtk_Assistant_Page_Type);

Gtk_Assistant_Record

type Gtk_Assistant_Record is new Gtk_Window_Record with null record;

Gtk_New

procedure Gtk_New (Assistant : out Gtk_Assistant)

Creates a new Gtk.Assistant.Gtk_Assistant. Since: gtk+ 2.10 Initialize does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Assistant

Implements_Gtk_Buildable

package Implements_Gtk_Buildable is new Glib.Types.Implements
  (Gtk.Buildable.Gtk_Buildable, Gtk_Assistant_Record, Gtk_Assistant);

Initialize

procedure Initialize
   (Assistant : not null access Gtk_Assistant_Record'Class)

Creates a new Gtk.Assistant.Gtk_Assistant. Since: gtk+ 2.10 Initialize does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Assistant

Insert_Page

function Insert_Page
   (Assistant : not null access Gtk_Assistant_Record;
    Page      : not null access Gtk.Widget.Gtk_Widget_Record'Class;
    Position  : Glib.Gint) return Glib.Gint

Inserts a page in the Assistant at a given position. Since: gtk+ 2.10

Parameters
Assistant
Page

a Gtk.Widget.Gtk_Widget

Position

the index (starting at 0) at which to insert the page, or -1 to append the page to the Assistant

Return Value

the index (starting from 0) of the inserted page

Next_Page

procedure Next_Page (Assistant : not null access Gtk_Assistant_Record)

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. Since: gtk+ 3.0

Parameters
Assistant

On_Apply

procedure On_Apply
   (Self  : not null access Gtk_Assistant_Record;
    Call  : Cb_GObject_Void;
    Slot  : not null access Glib.Object.GObject_Record'Class;
    After : Boolean := False)

The ::apply signal is emitted when the apply button is clicked.

The default behavior of the Gtk.Assistant.Gtk_Assistant 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 type Gtk.Assistant.Gtk_Assistant_Page_Progress after the confirmation page and handle this operation within the Gtk.Assistant.Gtk_Assistant::prepare signal of the progress page.

Parameters
Self
Call
Slot
After

On_Apply

procedure On_Apply
   (Self  : not null access Gtk_Assistant_Record;
    Call  : Cb_Gtk_Assistant_Void;
    After : Boolean := False)

The ::apply signal is emitted when the apply button is clicked.

The default behavior of the Gtk.Assistant.Gtk_Assistant 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 type Gtk.Assistant.Gtk_Assistant_Page_Progress after the confirmation page and handle this operation within the Gtk.Assistant.Gtk_Assistant::prepare signal of the progress page.

Parameters
Self
Call
After

On_Cancel

procedure On_Cancel
   (Self  : not null access Gtk_Assistant_Record;
    Call  : Cb_GObject_Void;
    Slot  : not null access Glib.Object.GObject_Record'Class;
    After : Boolean := False)

The ::cancel signal is emitted when then the cancel button is clicked.

Parameters
Self
Call
Slot
After

On_Cancel

procedure On_Cancel
   (Self  : not null access Gtk_Assistant_Record;
    Call  : Cb_Gtk_Assistant_Void;
    After : Boolean := False)

The ::cancel signal is emitted when then the cancel button is clicked.

Parameters
Self
Call
After

On_Close

procedure On_Close
   (Self  : not null access Gtk_Assistant_Record;
    Call  : Cb_GObject_Void;
    Slot  : not null access Glib.Object.GObject_Record'Class;
    After : Boolean := False)

The ::close signal is 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.Gtk_Assistant_Page_Confirm) is clicked.

Parameters
Self
Call
Slot
After

On_Close

procedure On_Close
   (Self  : not null access Gtk_Assistant_Record;
    Call  : Cb_Gtk_Assistant_Void;
    After : Boolean := False)

The ::close signal is 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.Gtk_Assistant_Page_Confirm) is clicked.

Parameters
Self
Call
After

On_Escape

procedure On_Escape
   (Self  : not null access Gtk_Assistant_Record;
    Call  : Cb_GObject_Void;
    Slot  : not null access Glib.Object.GObject_Record'Class;
    After : Boolean := False)
Parameters
Self
Call
Slot
After

On_Escape

procedure On_Escape
   (Self  : not null access Gtk_Assistant_Record;
    Call  : Cb_Gtk_Assistant_Void;
    After : Boolean := False)
Parameters
Self
Call
After

On_Prepare

procedure On_Prepare
   (Self  : not null access Gtk_Assistant_Record;
    Call  : Cb_GObject_Gtk_Widget_Void;
    Slot  : not null access Glib.Object.GObject_Record'Class;
    After : Boolean := False)

The ::prepare signal is 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.

Parameters
Self
Call
Slot
After

On_Prepare

procedure On_Prepare
   (Self  : not null access Gtk_Assistant_Record;
    Call  : Cb_Gtk_Assistant_Gtk_Widget_Void;
    After : Boolean := False)

The ::prepare signal is 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.

Parameters
Self
Call
After

Prepend_Page

function Prepend_Page
   (Assistant : not null access Gtk_Assistant_Record;
    Page      : not null access Gtk.Widget.Gtk_Widget_Record'Class)
    return Glib.Gint

Prepends a page to the Assistant. Since: gtk+ 2.10

Parameters
Assistant
Page

a Gtk.Widget.Gtk_Widget

Return Value

the index (starting at 0) of the inserted page

Previous_Page

procedure Previous_Page
   (Assistant : not null access Gtk_Assistant_Record)

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. Since: gtk+ 3.0

Parameters
Assistant

Property_Gtk_Assistant_Page_Type

type Property_Gtk_Assistant_Page_Type is new Gtk_Assistant_Page_Type_Properties.Property;

Remove_Action_Widget

procedure Remove_Action_Widget
   (Assistant : not null access Gtk_Assistant_Record;
    Child     : not null access Gtk.Widget.Gtk_Widget_Record'Class)

Removes a widget from the action area of a Gtk.Assistant.Gtk_Assistant. Since: gtk+ 2.10

Parameters
Assistant
Child

a Gtk.Widget.Gtk_Widget

Remove_Page

procedure Remove_Page
   (Assistant : not null access Gtk_Assistant_Record;
    Page_Num  : Glib.Gint)

Removes the Page_Num's page from Assistant. Since: gtk+ 3.2

Parameters
Assistant
Page_Num

the index of a page in the Assistant, or -1 to remove the last page

Set_Current_Page

procedure Set_Current_Page
   (Assistant : not null access Gtk_Assistant_Record;
    Page_Num  : Glib.Gint)

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. Since: gtk+ 2.10

Parameters
Assistant
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.

Set_Forward_Page_Func

procedure Set_Forward_Page_Func
   (Assistant : not null access Gtk_Assistant_Record;
    Page_Func : Gtk_Assistant_Page_Func)

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. Since: gtk+ 2.10

Parameters
Assistant
Page_Func

the Gtk_Assistant_Page_Func, or null to use the default one

Set_Page_Complete

procedure Set_Page_Complete
   (Assistant : not null access Gtk_Assistant_Record;
    Page      : not null access Gtk.Widget.Gtk_Widget_Record'Class;
    Complete  : Boolean)

Sets whether Page contents are complete. This will make Assistant update the buttons state to be able to continue the task. Since: gtk+ 2.10

Parameters
Assistant
Page

a page of Assistant

Complete

the completeness status of the page

Set_Page_Has_Padding

procedure Set_Page_Has_Padding
   (Assistant   : not null access Gtk_Assistant_Record;
    Page        : not null access Gtk.Widget.Gtk_Widget_Record'Class;
    Has_Padding : Boolean)

Sets whether the assistant is adding padding around the page. Since: gtk+ 3.18

Parameters
Assistant
Page

a page of Assistant

Has_Padding

whether this page has padding

Set_Page_Header_Image

procedure Set_Page_Header_Image
   (Assistant : not null access Gtk_Assistant_Record;
    Page      : not null access Gtk.Widget.Gtk_Widget_Record'Class;
    Pixbuf    : access Gdk.Pixbuf.Gdk_Pixbuf_Record'Class)

Sets a header image for Page. Since: gtk+ 2.10 Deprecated since 3.2, 1

Parameters
Assistant
Page

a page of Assistant

Pixbuf

the new header image Page

Set_Page_Side_Image

procedure Set_Page_Side_Image
   (Assistant : not null access Gtk_Assistant_Record;
    Page      : not null access Gtk.Widget.Gtk_Widget_Record'Class;
    Pixbuf    : access Gdk.Pixbuf.Gdk_Pixbuf_Record'Class)

Sets a side image for Page. This image used to be displayed in the side area of the assistant when Page is the current page. Since: gtk+ 2.10 Deprecated since 3.2, 1

Parameters
Assistant
Page

a page of Assistant

Pixbuf

the new side image Page

Set_Page_Title

procedure Set_Page_Title
   (Assistant : not null access Gtk_Assistant_Record;
    Page      : not null access Gtk.Widget.Gtk_Widget_Record'Class;
    Title     : UTF8_String)

Sets a title for Page. The title is displayed in the header area of the assistant when Page is the current page. Since: gtk+ 2.10

Parameters
Assistant
Page

a page of Assistant

Title

the new title for Page

Set_Page_Type

procedure Set_Page_Type
   (Assistant : not null access Gtk_Assistant_Record;
    Page      : not null access Gtk.Widget.Gtk_Widget_Record'Class;
    The_Type  : Gtk_Assistant_Page_Type)

Sets the page type for Page. The page type determines the page behavior in the Assistant. Since: gtk+ 2.10

Parameters
Assistant
Page

a page of Assistant

The_Type

the new type for Page

Signal_Apply

Signal_Apply : constant Glib.Signal_Name := "apply";

The ::apply signal is emitted when the apply button is clicked.

The default behavior of the Gtk.Assistant.Gtk_Assistant 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 type Gtk.Assistant.Gtk_Assistant_Page_Progress after the confirmation page and handle this operation within the Gtk.Assistant.Gtk_Assistant::prepare signal of the progress page.

Signal_Cancel

Signal_Cancel : constant Glib.Signal_Name := "cancel";

The ::cancel signal is emitted when then the cancel button is clicked.

Signal_Close

Signal_Close : constant Glib.Signal_Name := "close";

The ::close signal is 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.Gtk_Assistant_Page_Confirm) is clicked.

Signal_Escape

Signal_Escape : constant Glib.Signal_Name := "escape";

Signal_Prepare

Signal_Prepare : constant Glib.Signal_Name := "prepare";

The ::prepare signal is 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.

Update_Buttons_State

procedure Update_Buttons_State
   (Assistant : not null access Gtk_Assistant_Record)

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. Since: gtk+ 2.10

Parameters
Assistant

Use_Header_Bar_Property

Use_Header_Bar_Property : constant Glib.Properties.Property_Int;

True if the assistant uses a Gtk.Header_Bar.Gtk_Header_Bar for action buttons instead of the action-area.

For technical reasons, this property is declared as an integer property, but you should only set it to True or False.