A 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 of each page, in addition to state information like the page completion and committed status.
If you have a case that doesn’t quite fit in Assistants way of handling buttons, you can use the
CUSTOM page type and handle buttons yourself.
GtkAssistant as GtkBuildable
The GtkAssistant implementation of the Buildable interface exposes the
action_area
as internal children with the name “action_area”.
To add pages to an assistant in 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.
Example: Assistant:
public static int main (string[] args) {
Gtk.init (ref args);
Gtk.Assistant assistant = new Gtk.Assistant ();
assistant.apply.connect (Gtk.main_quit);
assistant.cancel.connect (Gtk.main_quit);
assistant.set_default_size (500, 500);
Gtk.Label label1 = new Gtk.Label ("My first page");
int page_num = assistant.append_page (label1);
assistant.set_page_title (label1, "Page %d: My Intro".printf (page_num));
assistant.set_page_type (label1, Gtk.AssistantPageType.INTRO);
assistant.set_page_complete (label1, true);
Gtk.Label label2 = new Gtk.Label ("My second page");
page_num = assistant.append_page (label2);
assistant.set_page_title (label2, "Page %d: My Content".printf (page_num));
assistant.set_page_type (label2, Gtk.AssistantPageType.CONTENT);
assistant.set_page_complete (label2, true);
Gtk.Label label3 = new Gtk.Label ("My third page");
page_num = assistant.append_page (label3);
assistant.set_page_title (label3, "Page %d: Confirm".printf (page_num));
assistant.set_page_type (label3, Gtk.AssistantPageType.CONFIRM);
assistant.set_page_complete (label3, true);
assistant.show_all ();
Gtk.main ();
return 0;
}
valac --pkg gtk+-3.0 Gtk.Assistant.vala