#!/usr/bin/perl --
use strict;
use warnings;
use Wx 0.98 ();
Main( @ARGV );
exit( 0 );
sub Main {
my $app = Wx::SimpleApp->new;
my $frame = Wx::Frame->new(undef,-1,'Menu Icon Test');
my $menu1 = Wx::Menu->new();;
for my $icon (
Wx::Bitmap->new( Wx::GetWxPerlIcon() ),
#~ $ perl -MWx=:everything -le " print for grep /wxICON_/, keys %:: "
+>1
qw[
wxICON_QUESTION
wxICON_HAND
wxICON_INFORMATION
wxICON_WARNING
wxICON_ERROR
wxICON_EXCLAMATION
]
){
my $bmp = $icon ;
if( not ref $icon ){
$bmp = Wx::Bitmap->new( $app->GetStdIcon( Wx->$icon ) );
}
my $item = Wx::MenuItem->new( $menu1 , -1 , "$icon $bmp");
$item->SetBitmap( $bmp );
$menu1->Append( $item );
}
my $menu1item = $menu1->Append( Wx::wxID_EXIT(), "E&xit", "Quit to
+olbar sample" );
$menu1item->SetBitmap ( Wx::Bitmap->new( Wx::GetWxPerlIcon() ) );
+## too late
# Creates menu bar
my $menubar = Wx::MenuBar->new();
$menubar->Append($menu1, "File");
# Attach menubar to the window
$frame->SetMenuBar($menubar);
$frame->Show();
Wx::Event::EVT_MENU( $frame, Wx::wxID_EXIT(), sub { $_[0]->Destroy
+ } );
$app->SetTopWindow($frame);
$app->MainLoop();
}
__END__