| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
############################################################################# |
|
2
|
|
|
|
|
|
|
## Name: lib/Wx/DemoModules/wxRadioButton.pm |
|
3
|
|
|
|
|
|
|
## Purpose: wxPerl demo helper for Wx::RadioButton |
|
4
|
|
|
|
|
|
|
## Author: Mattia Barbon |
|
5
|
|
|
|
|
|
|
## Modified by: |
|
6
|
|
|
|
|
|
|
## Created: 13/08/2006 |
|
7
|
|
|
|
|
|
|
## RCS-ID: $Id: wxRadioButton.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::wxRadioButton; |
|
14
|
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
1190
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
28
|
|
|
16
|
1
|
|
|
1
|
|
4
|
use base qw(Wx::Panel Class::Accessor::Fast); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
605
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
use Wx qw(:radiobutton :font wxDefaultPosition wxDefaultSize); |
|
19
|
|
|
|
|
|
|
use Wx::Event qw(EVT_RADIOBUTTON EVT_BUTTON); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors( qw(radiobut1_1 radiobut1_2 |
|
22
|
|
|
|
|
|
|
radiobut2_1 radiobut2_2 |
|
23
|
|
|
|
|
|
|
radiobut2_3) ); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub new { |
|
26
|
|
|
|
|
|
|
my( $class, $parent ) = @_; |
|
27
|
|
|
|
|
|
|
my $self = $class->SUPER::new( $parent ); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $b1 = Wx::Button->new( $self, -1, "Select #&1", [180, 30], [140, 30] ); |
|
31
|
|
|
|
|
|
|
my $b2 = Wx::Button->new( $self, -1, "&Select #&2", |
|
32
|
|
|
|
|
|
|
[180, 80], [140, 30] ); |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $rb11 = Wx::RadioButton->new( $self, -1, "Radio&1,1", |
|
35
|
|
|
|
|
|
|
[10, 30], wxDefaultSize, wxRB_GROUP ); |
|
36
|
|
|
|
|
|
|
my $rb12 = Wx::RadioButton->new( $self, -1, "Radio&1,2", |
|
37
|
|
|
|
|
|
|
[10, 70], wxDefaultSize ); |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $rb21 = Wx::RadioButton->new( $self, -1, "Radio&2,1", |
|
40
|
|
|
|
|
|
|
[90, 30], wxDefaultSize, wxRB_GROUP ); |
|
41
|
|
|
|
|
|
|
my $rb22 = Wx::RadioButton->new( $self, -1, "Radio&2,2", |
|
42
|
|
|
|
|
|
|
[90, 70], wxDefaultSize ); |
|
43
|
|
|
|
|
|
|
my $rb23 = Wx::RadioButton->new( $self, -1, "Radio&2,3", |
|
44
|
|
|
|
|
|
|
[90, 110], wxDefaultSize ); |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
$rb11->SetValue( 1 ); |
|
47
|
|
|
|
|
|
|
$rb21->SetValue( 1 ); |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
EVT_BUTTON( $self, $b1, \&OnRadioButton_Sel1 ); |
|
50
|
|
|
|
|
|
|
EVT_BUTTON( $self, $b2, \&OnRadioButton_Sel2 ); |
|
51
|
|
|
|
|
|
|
foreach my $rb ( $rb11, $rb12, $rb21, $rb22, $rb23 ) { |
|
52
|
|
|
|
|
|
|
EVT_RADIOBUTTON( $self, $rb, \&OnRadio ); |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
@{$self}{qw(radiobut1_1 radiobut1_2 |
|
55
|
|
|
|
|
|
|
radiobut2_1 radiobut2_2 |
|
56
|
|
|
|
|
|
|
radiobut2_3)} = ( $rb11, $rb12, $rb21, $rb22, $rb23 ); |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
return $self; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub OnRadio { |
|
62
|
|
|
|
|
|
|
my( $self, $event ) = @_; |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Wx::LogMessage( join '', "RadioButton selection string is: ", |
|
65
|
|
|
|
|
|
|
$event->GetEventObject->GetLabel ); |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub OnRadioButton_Sel1 { |
|
69
|
|
|
|
|
|
|
my( $self, $event ) = @_; |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
$self->radiobut1_1->SetValue( 1 ); |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub OnRadioButton_Sel2 { |
|
75
|
|
|
|
|
|
|
my( $self, $event ) = @_; |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
$self->radiobut1_2->SetValue( 1 ); |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub add_to_tags { qw(controls) } |
|
81
|
|
|
|
|
|
|
sub title { 'wxRadioButton' } |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |