Wx-Demo
view release on metacpan or search on metacpan
lib/Wx/DemoModules/wxChoice.pm view on Meta::CPAN
## Copyright: (c) 2000, 2003, 2005-2006 Mattia Barbon
## Licence: This program is free software; you can redistribute it and/or
## modify it under the same terms as Perl itself
#############################################################################
package Wx::DemoModules::wxChoice;
use strict;
use base qw(Wx::DemoModules::lib::BaseModule Class::Accessor::Fast);
use Wx qw(:combobox wxNOT_FOUND);
use Wx::Event qw(EVT_CHOICE);
__PACKAGE__->mk_accessors( qw(choice) );
sub styles {
my( $self ) = @_;
return ( [ wxCB_SORT, 'Sorted' ],
);
}
lib/Wx/DemoModules/wxComboBox.pm view on Meta::CPAN
## Copyright: (c) 2000, 2003, 2005-2006 Mattia Barbon
## Licence: This program is free software; you can redistribute it and/or
## modify it under the same terms as Perl itself
#############################################################################
package Wx::DemoModules::wxComboBox;
use strict;
use base qw(Wx::DemoModules::lib::BaseModule Class::Accessor::Fast);
use Wx qw(:combobox :textctrl wxNOT_FOUND);
use Wx::Event qw(EVT_COMBOBOX EVT_TEXT EVT_TEXT_ENTER);
__PACKAGE__->mk_accessors( qw(combobox) );
sub styles {
my( $self ) = @_;
return ( [ wxCB_SORT, 'Sorted' ],
[ wxCB_SIMPLE, 'Simple' ],
[ wxCB_DROPDOWN, 'Dropdown' ],
[ wxCB_READONLY, 'Read-only' ],
[ wxTE_PROCESS_ENTER, 'Process enter' ],
);
}
sub commands {
my( $self ) = @_;
return ( { label => 'Select item',
with_value => 1,
action => sub { $self->combobox->SetSelection( $_[0] ) },
},
{ label => 'Select string',
with_value => 1,
action => sub { $self->combobox
->SetStringSelection( $_[0] ) },
},
{ label => 'Clear',
action => sub { $self->combobox->Clear },
},
{ label => 'Append',
with_value => 1,
action => sub { $self->combobox->Append( $_[0] ) }
},
{ label => 'Delete selected item',
action => \&on_delete_selected,
},
);
}
sub create_control {
my( $self ) = @_;
my $choices = [ 'This', 'is one of my',
'really', 'wonderful', 'examples', ];
my $combobox = Wx::DemoModules::wxComboBox::Custom->new
( $self, -1, "This", [-1, -1], [-1, -1],
$choices, $self->style );
EVT_COMBOBOX( $self, $combobox, \&OnCombo );
EVT_TEXT( $self, $combobox, \&OnComboTextChanged );
EVT_TEXT_ENTER( $self, $combobox, \&OnComboTextEnter );
return $self->combobox( $combobox );
}
sub OnCombo {
my( $self, $event ) = @_;
Wx::LogMessage( join '', "ComboBox event selection string is: '",
$event->GetString(), "'" );
Wx::LogMessage( "ComboBox control selection string is: '",
$self->combobox->GetStringSelection(), "'" );
}
sub OnComboTextChanged {
my( $self ) = @_;
Wx::LogMessage( "Text in the combobox changed: now is '%s'.",
$self->combobox->GetValue() );
}
sub OnComboTextEnter {
my( $self ) = @_;
Wx::LogMessage( "Enter pressed in the combobox changed: now is '%s'.",
$self->combobox->GetValue() );
}
sub on_delete_selected {
my( $self ) = @_;
my( $idx );
if( ( $idx = $self->combobox->GetSelection() ) != wxNOT_FOUND ) {
$self->combobox->Delete( $idx );
}
}
sub add_to_tags { qw(controls) }
sub title { 'wxComboBox' }
package Wx::DemoModules::wxComboBox::Custom;
use strict;
use base qw(Wx::ComboBox);
lib/Wx/DemoModules/wxRibbonControl.pm view on Meta::CPAN
}
#-------------------------------------------------------------------------------------
package Wx::DemoModules::wxRibbonControl::RibbonBar;
#-------------------------------------------------------------------------------------
use strict;
use Wx::Ribbon;
use Wx qw( :ribbon :ribbonart :id :bitmap :misc :combobox :sizer :font :pen :colour :brush);
use base qw( Wx::RibbonBar );
use Wx::ArtProvider qw( :clientid :artid );
use Wx::Event qw(
EVT_RIBBONBUTTONBAR_CLICKED EVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED EVT_RIBBONGALLERY_HOVER_CHANGED
EVT_RIBBONGALLERY_SELECTED EVT_RIBBONTOOLBAR_CLICKED EVT_RIBBONTOOLBAR_DROPDOWN_CLICKED
EVT_BUTTON EVT_TOGGLEBUTTON EVT_MENU
);
sub new {
my ($class, $parent) = @_;
lib/Wx/DemoModules/wxToolBar.pm view on Meta::CPAN
map { Wx::Bitmap->new( Wx::Image->new( $_ )->Scale( $w, $h ) ) }
@bitmaps;
$t->SetToolBitmapSize( [ $w, $h ] );
}
my $width = ( Wx::wxMSW() ) ? 24 : 16;
$t->AddTool( wxID_SAVE, $bitmaps[1], wxNullBitmap, 0, undef, 'Open File' );
if( $this->horizontal_toolbar ) {
my $c = Wx::ComboBox->new
( $t, $ID_COMBO, '', wxDefaultPosition, wxDefaultSize,
[ 'This', 'is a', 'combobox', 'in a', 'toolbar' ] );
$t->AddControl( $c );
}
$t->AddTool( -1, $bitmaps[2], wxNullBitmap, 1, undef,
'Toggle button 1' );
$t->AddSeparator;
$t->AddTool( $ID_QUOTES, $bitmaps[3], wxNullBitmap, 1, undef,
'Toggle button 1' );
$t->Realize;
}
( run in 0.910 second using v1.01-cache-2.11-cpan-2398b32b56e )