Créer  Editer  FrontPage  Index  Chercher  Changements  History  RSS  Login

Gtk::Assistant

class Gtk::Assistant

A 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. Since 2.10

<URL:http://developer.gnome.org/doc/API/2.0/gtk/assistant.png>

Class Methods

Gtk::Assistant.new
Creates a new Gtk::Assistant. Since 2.10

Instance Methods

current_page
Returns the page number of the current page. Since 2.10
  • Returns: The index (starting from 0) of the current page in the assistant, if the assistant has no pages, -1 will be returned.
current_page=(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. Since 2.10
  • 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.
  • Returns: page_num
n_pages
Returns the number of pages in the assistant. Since 2.10
  • Returns: The number of pages in the assistant.
get_nth_page(page_num)
Returns the child widget contained in page number page_num. Since 2.10
  • page_num: The index of a page in the assistant, or -1 to get the last page;
  • Returns: The child widget, or nil if page_num is out of bounds.
prepend_page(page)
Prepends a page to the assistant. Since 2.10
  • page: a Gtk::Widget
  • Returns: the index (starting at 0) of the inserted page
append_page(page)
Appends a page to the assistant. Since 2.10
  • page: a Gtk::Widget
  • Returns: the index (starting at 0) of the inserted page
insert_page(page, position)
Inserts a page in the assistant at a given position. Since 2.10
  • page: a Gtk::Widget
  • 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
set_forward_page_func{|current_page| ...}
Sets the page forwarding method to be block, this method will be used to determine what will be the next page when the user presses the forward button. Setting page_func to nil will make the assistant to use the default forward function, which just goes to the next visible page. Since 2.10
  • {|current_page| ... }: the page forwarding block
    • current_page: passed argument is the page number used to calculate the next page
    • Returns: the next page number
  • Returns: self
set_page_type(page, type)
Sets the page type for the specified page. The page type determines the page behavior in the assistant. Since 2.10
get_page_type(page)
Gets the page type of the specified page. Since 2.10
set_page_title(page, title)
Sets a title for the specified page. The title is displayed in the header area of the assistant when page is the current page. Since 2.10
  • page: a page of assistant (Gtk::Widget)
  • title: the new title for page (String)
  • Returns: self
get_page_title(page)
Gets the title for the specified page. Since 2.10
  • page: a page of assistant (Gtk::Widget)
  • Returns: the title for page
set_page_header_image(page, pixbuf)
Sets a header image for the specified page. This image is displayed in the header area of the assistant when page is the current page. Since 2.10
get_page_header_image(page)
Gets the header image for the specified page. Since 2.10
  • page: a page of assistant (Gtk::Widget)
  • Returns: the header image for page (Gdk::Pixbuf), or nil if there's no header image for the page.
set_page_side_image(page, pixbuf)
Sets a header image for the specified page. This image is displayed in the side area of the assistant when page is the current page. Since 2.10
get_page_side_image(page)
Gets the header image for the specified page. Since 2.10
  • page: a page of assistant (Gtk::Widget)
  • Returns: the side image for page (Gdk::Pixbuf), or nil if there's no side image for the page.
set_page_complete(page, complete)
Sets whether specified page contents are complete. This will make assistant update the buttons state to be able to continue the task. Since 2.10
  • page: a page of assistant (Gtk::Widget)
  • complete: the completeness status of the page (true or false)
  • Returns: self
get_page_complete(page)
Gets whether page is complete. Since 2.10
  • page: a page of assistant (Gtk::Widget)
  • Returns: true if page is complete, otherwise false
add_action_widget(child)
Adds a widget to the action area of the assistant. Since 2.10
remove_action_widget(child)
Removes a widget from the action area of the assistant. Since 2.10
update_buttons_state

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 2.10

  • Returns: self

Constants

PageType

A value determining the page role inside the 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::PAGE_CONFIRM or Gtk::Assistant::PAGE_SUMMARY to be correct.

PAGE_CONTENT
The page has regular contents. Since 2.10
PAGE_INTRO
The page contains an introduction to the assistant task. Since 2.10
PAGE_CONFIRM
The page lets the user confirm or deny the changes. Since 2.10
PAGE_SUMMARY
The page informs the user of the changes done. Since 2.10
PAGE_PROGRESS
Used for tasks that take a long time to complete, blocks the assistant until the page is marked as complete. Since 2.10

Style Properties

content-padding: Integer (Read)
Number of pixels around the content pages. Since 2.10
  • Allowed values: >= 0
  • Default value: 1
header-padding: Integer (Read)
Number of pixels around the header. Since 2.10
  • Allowed values: >= 0
  • Default value: 6

Child Properties

complete: true or false (Read/Write)
Whether all required fields on the page have been filled out Since 2.10
header-image: Gdk::Pixbuf (Read/Write)
Header image for the assistant page Since 2.10
page-type: Gtk::Assistant#PageType (Read/Write)
The type of the assistant page Since 2.10
sidebar-image: Gdk::Pixbuf (Read/Write)
Sidebar image for the assistant page Since 2.10
title: String (Read/Write)
The title of the assistant page Since 2.10

Signals

apply: self (run last)

The "apply" signal is emitted when the apply button is clicked. The default behavior of the 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 to put a page of type Gtk::Assistant::PAGE_PROGRESS after the confirmation page and handle this operation within the "prepare" signal of the progress page. Since 2.10

cancel: self (run last)
The "cancel" signal is emitted when then the cancel button is clicked. Since 2.10
close: self (run last)
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::PAGE_CONFIRM) is clicked. Since 2.10
prepare: self, page (run last)
The "prepared" 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 preparation which are necessary before showing page. Since 2.10

ChangeLog

  • 2007-01-30: Updated. - Masao?
  • 2006-07-16: new widget binded and documented for 2.10. - gc?

- gc?

Dernière modification:2011/07/05 06:07:21
Mots clef:
Références:[Gtk::Assistant]