| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
############################################################################# |
|
2
|
|
|
|
|
|
|
## Name: lib/Wx/DemoModules/wxRadioBox.pm |
|
3
|
|
|
|
|
|
|
## Purpose: wxPerl demo helper for Wx::RadioBox |
|
4
|
|
|
|
|
|
|
## Author: Mattia Barbon |
|
5
|
|
|
|
|
|
|
## Modified by: |
|
6
|
|
|
|
|
|
|
## Created: 13/08/2006 |
|
7
|
|
|
|
|
|
|
## RCS-ID: $Id: wxRadioBox.pm 2189 2007-08-21 18:15:31Z mbarbon $ |
|
8
|
|
|
|
|
|
|
## Copyright: (c) 2000, 2003, 2005-2006 Mattia Barbon |
|
9
|
|
|
|
|
|
|
## Licence: This program is free software; you can redistribute it and/or |
|
10
|
|
|
|
|
|
|
## modify it under the same terms as Perl itself |
|
11
|
|
|
|
|
|
|
############################################################################# |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Wx::DemoModules::wxRadioBox; |
|
14
|
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
1430
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
32
|
|
|
16
|
1
|
|
|
1
|
|
4
|
use base qw(Wx::DemoModules::lib::BaseModule Class::Accessor::Fast); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
103
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
use Wx qw(:radiobox wxNOT_FOUND wxDefaultPosition wxDefaultSize); |
|
19
|
|
|
|
|
|
|
use Wx::Event qw(EVT_RADIOBOX); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors( qw(radiobox) ); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub commands { |
|
24
|
|
|
|
|
|
|
my( $self ) = @_; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
return ( { label => 'Select item', |
|
27
|
|
|
|
|
|
|
with_value => 1, |
|
28
|
|
|
|
|
|
|
action => sub { $self->radiobox->SetSelection( $_[0] ) }, |
|
29
|
|
|
|
|
|
|
}, |
|
30
|
|
|
|
|
|
|
{ label => 'Select string', |
|
31
|
|
|
|
|
|
|
with_value => 1, |
|
32
|
|
|
|
|
|
|
action => sub { $self->radiobox |
|
33
|
|
|
|
|
|
|
->SetStringSelection( $_[0] ) }, |
|
34
|
|
|
|
|
|
|
}, |
|
35
|
|
|
|
|
|
|
{ label => 'Set label', |
|
36
|
|
|
|
|
|
|
with_value => 1, |
|
37
|
|
|
|
|
|
|
action => sub { $self->radiobox->SetLabel( $_[0] ) }, |
|
38
|
|
|
|
|
|
|
}, |
|
39
|
|
|
|
|
|
|
{ label => 'Set item label', |
|
40
|
|
|
|
|
|
|
with_value => 2, |
|
41
|
|
|
|
|
|
|
action => sub { $self->radiobox |
|
42
|
|
|
|
|
|
|
->SetItemLabel( $_[0], $_[1] ) }, |
|
43
|
|
|
|
|
|
|
}, |
|
44
|
|
|
|
|
|
|
{ label => 'Disable item', |
|
45
|
|
|
|
|
|
|
with_value => 1, |
|
46
|
|
|
|
|
|
|
action => sub { $self->radiobox->EnableItem( $_[0], 0 ) }, |
|
47
|
|
|
|
|
|
|
}, |
|
48
|
|
|
|
|
|
|
{ label => 'Enable item', |
|
49
|
|
|
|
|
|
|
with_value => 1, |
|
50
|
|
|
|
|
|
|
action => sub { $self->radiobox->EnableItem( $_[0], 1 ) }, |
|
51
|
|
|
|
|
|
|
}, |
|
52
|
|
|
|
|
|
|
{ label => 'Hide item', |
|
53
|
|
|
|
|
|
|
with_value => 1, |
|
54
|
|
|
|
|
|
|
action => sub { $self->radiobox->ShowItem( $_[0], 0 ) }, |
|
55
|
|
|
|
|
|
|
}, |
|
56
|
|
|
|
|
|
|
{ label => 'Show item', |
|
57
|
|
|
|
|
|
|
with_value => 1, |
|
58
|
|
|
|
|
|
|
action => sub { $self->radiobox->ShowItem( $_[0], 1 ) }, |
|
59
|
|
|
|
|
|
|
}, |
|
60
|
|
|
|
|
|
|
); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub create_control { |
|
64
|
|
|
|
|
|
|
my( $self ) = @_; |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my $choices = [ "First", "Second", "Third", "Fourth", "Fifth", |
|
67
|
|
|
|
|
|
|
"Sixth", "Seventh", "Eighth", "Nineth", "Tenth" ]; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
my $radiobox = Wx::DemoModules::wxRadioBox::Custom->new |
|
70
|
|
|
|
|
|
|
( $self, -1, "Radio box", [-1, -1], |
|
71
|
|
|
|
|
|
|
wxDefaultSize, $choices, 3, wxRA_SPECIFY_COLS ); |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
EVT_RADIOBOX( $self, $radiobox, \&OnRadio ); |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
return $self->radiobox( $radiobox ); |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub OnRadio { |
|
79
|
|
|
|
|
|
|
my( $self, $event ) = @_; |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Wx::LogMessage( join '', "RadioBox selection string is: ", |
|
82
|
|
|
|
|
|
|
$event->GetString() ); |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub add_to_tags { qw(controls) } |
|
86
|
|
|
|
|
|
|
sub title { 'wxRadioBox' } |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
package Wx::DemoModules::wxRadioBox::Custom; |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
use strict; |
|
91
|
|
|
|
|
|
|
use base qw(Wx::RadioBox); |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
use Wx::Event qw(EVT_SET_FOCUS EVT_KILL_FOCUS); |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub new { |
|
96
|
|
|
|
|
|
|
my( $class ) = shift; |
|
97
|
|
|
|
|
|
|
my( $self ) = $class->SUPER::new( @_ ); |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
EVT_SET_FOCUS( $self, \&OnFocusGot ); |
|
100
|
|
|
|
|
|
|
EVT_KILL_FOCUS( $self, \&OnFocusLost ); |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
return $self; |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub OnFocusGot { |
|
106
|
|
|
|
|
|
|
my( $self, $event ) = @_; |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Wx::LogMessage( 'Wx::DemoModules::wxRadioBox::Custom::OnFocusGot' ); |
|
109
|
|
|
|
|
|
|
$event->Skip(); |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub OnFocusLost { |
|
113
|
|
|
|
|
|
|
my( $self, $event ) = @_; |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Wx::LogMessage( 'Wx::DemoModules::wxRadioBox::Custom::OnFocusLost' ); |
|
116
|
|
|
|
|
|
|
$event->Skip(); |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
1; |