# bitmaps.pl

use subs qw/bitmaps_row/;
use vars qw/$TOP/;

sub bitmaps {

    # Create a top-level window that displays all of Tk's built-in bitmaps.

    my($demo) = @ARG;
    my $demo_widget = $MW->WidgetDemo(
        -name     => $demo,
        -text     => 'This window displays all of Tk\'s built-in bitmaps, along with the names you can use for them in Perl scripts.',
        -title    => 'Bitmap Demonstration',
        -iconname => 'bitmaps',
    );
    $TOP = $demo_widget->Top;	# get geometry master

    my $frame = $TOP->Frame;
    $frame->pack(qw/-side top -expand yes -fill both/);
    bitmaps_row $frame, qw/error gray25 gray50 hourglass/;
    bitmaps_row $frame, qw/info question questhead warning/;

} # end bitmaps

sub bitmaps_row {
 
    # The procedure below creates a new row of bitmaps in a window.

    my($w, @names) = @ARG;

    my $row = $w->Frame->pack(qw/-side top -fill both/);

    foreach my $bitmap_name (@names) {
	my $bit = $row->Frame;
	$bit->pack(qw/-side left -fill both -pady .25c -padx .25c/);
	my $label = $bit->Label(-text => $bitmap_name, -width => 9);
	$label->pack(qw/-side bottom/);
	my $bitmap = $bit->Label('-bitmap' => $bitmap_name);
	$bitmap->pack(qw/-side bottom/);
    }

} # end bitmaps_row

1;
