#!/usr/bin/perl # use strict; use Wx; package TestFrame; use base qw(Wx::Frame); use Wx qw(:everything); sub new { my $class = shift; my $self = $class->SUPER::new(@_); # Call superclass' constructor my $toolbar = $self->CreateToolBar(wxTB_HORIZONTAL|wxTB_FLAT, -1); # Add icons $toolbar->AddTool(1, "Create a new invoice", Wx::Bitmap->new('new.bmp', wxBITMAP_TYPE_BMP), 'Create a new invoice'); $toolbar->AddTool(2, 'Save this invoice', Wx::Bitmap->new('save.bmp', wxBITMAP_TYPE_BMP), 'Save this invoice'); $toolbar->AddSeparator(); $toolbar->Realize(); # Update the toolbar return $self; } package TestApp; use base qw(Wx::App); use Wx qw(:everything); sub OnInit { my $self = shift; my $mainframe = TestFrame->new( undef, # Parent window -1, # Window ID 'Toolbar test', # Window title [1, 1], # X, Y position [300, 200] # X, Y size ); $self->SetTopWindow($mainframe); # Set the top-level window. $mainframe->Show(1); # Show the frame. } package main; use strict; use Wx; TestApp->new()->MainLoop;