4. Taking a look at Gnome2::Druid

This part will take a look at Gnome2::Druid

We will follow it up looking at Gnome2::DruidPage and its sub classes Gnome2::DruidPageEdge and Gnome2::DruidPageStandard and finally look at a practical example.

4.1. Creating an instance of Gnome2::Druid

Gnome2::Druid is a subclass of Gtk2::Container. It has two ways to construct it. You may construct a Gnome2::Druid and add it to an existing container. To do this we make use of the standard 'new' constructor method.

widget = Gnome2::Druid->new 	
If you need a Druid contained in a Gtk2::Window, make use of the 'new_with_window' method. This method will return a list containing a Gnome2::Druid as the first item and a Gtk2::Window as its second.
($druid,$window) = Gnome2::Druid->new_with_window ($title, $parent, $close_on_cancel) 
	* $title (string)
	* $parent (Gtk2::Window or undef)
	* $close_on_cancel (boolean)	

4.2. Gnome2::Druid as a container

Gnome2::Druid contains navigation buttons. The "Pages" that gets displayed when navigating through the Druid must be first created and then added to the Druid. These "Pages" are either Gnome2::DruidPageEdge or Gnome2::DruidPageStandard widgets.

4.2.1. The buttons

The buttons used to navigate as well as a "Help" and "Cancel" button are situated at the bottom of Gnome2::Druid. Should you want to change their appearance, you can do so by using available methods. To get a reference to one of these buttons, the following methods are available to you. This will return a blessed reference to the button, and you can then manipulate it to tailor make your Druid.

Table 1. Extracting the buttons

Gtk2::Button NameMethod
Help Buttonwidget = $druid->help
Cancel Buttonwidget = $druid->cancel
Back Buttonwidget = $druid->back
Next Buttonwidget = $druid->next
Finish Buttonwidget = $druid->finish

The Finish button will only be displayed on the last page of the Druid. This will replace the Next button.

You have a choice to display the Help button by using the following method:

$druid->set_show_help ($show_help) 
	* $show_help (boolean)

4.2.2. Adding Gnome2::DruidPages

Pages gets added to the druid using one of the following methods:

$druid->append_page ($page)
	
$druid->insert_page ($back_page, $page)

$druid->prepend_page ($page) 
The start and end pages are Gnome2::DruidPageEdge widgets. The in between pages are Gnome2::DruidPageStandard widgets. See their respective man pages on how to create them before adding it to Gnome2::Druid.