2. Arrows

The Arrow widget draws an arrowhead, facing in a number of possible directions and having a number of possible styles. It can be very useful when placed on a button in many applications. Like the Label widget, it emits no signals.

There are only two functions for manipulating an Arrow widget:

$arrow = Gtk2::Arrow->new($arrow_type, $shadow_type);

Gtk2::Arrow->set($arrow, $arrow_type, $shadow_type);

The first creates a new arrow widget with the indicated type and appearance. The second allows these values to be altered retrospectively. The arrow_type argument may take one of the following values:


These values obviously indicate the direction in which the arrow will point. The shadow_type argument may take one of these values:

  'out'/'GTK_SHADOW_OUT' (the default)

Here's a brief example to illustrate their use.

use Glib qw/TRUE FALSE/;
use Gtk2;

# Create an Arrow widget with the specified parameters
# and pack in into a button
sub create_arrow_button
	my ($arrow_type, $shadow_type) = @_;

	$button = Gtk2::Button->new;
	$arrow = Gtk2::Arrow->new($arrow_type, $shadow_type);



	return $button;


$window = Gtk2::Window->new('toplevel');
$window->set_title("Arrow Buttons");

# It's a good idea to do this for all windows.
$window->signal_connect(destroy => sub { Gtk2->main_quit; });

# Sets the border width of the window.

# Create a box to hold the arrows/buttons
$box = Gtk2::HBox->new(FALSE, 0);

# Pack and show all our widgets

$button = create_arrow_button('up', 'in');
$box->pack_start($button, FALSE, FALSE, 3);

$button = create_arrow_button('down', 'out');
$box->pack_start($button, FALSE, FALSE, 3);

$button = create_arrow_button('left', 'etched-in');
$box->pack_start($button, FALSE, FALSE, 3);

$button = create_arrow_button('right', 'etched-out');
$box->pack_start($button, FALSE, FALSE, 3);


# Rest in gtk_main and wait for the fun to begin!