line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
############################################################################# |
2
|
|
|
|
|
|
|
## Name: lib/Wx/DemoModules/wxMultiChoiceDialog.pm |
3
|
|
|
|
|
|
|
## Purpose: wxPerl demo helper for Wx::MultiChoiceDialog |
4
|
|
|
|
|
|
|
## Author: Mattia Barbon |
5
|
|
|
|
|
|
|
## Modified by: |
6
|
|
|
|
|
|
|
## Created: 11/02/2001 |
7
|
|
|
|
|
|
|
## RCS-ID: $Id: wxMultiChoiceDialog.pm 2189 2007-08-21 18:15:31Z mbarbon $ |
8
|
|
|
|
|
|
|
## Copyright: (c) 2001, 2003, 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::wxMultiChoiceDialog; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
1704
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
16
|
1
|
|
|
1
|
|
5
|
use base qw(Wx::DemoModules::lib::BaseModule Class::Accessor::Fast); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
113
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
use Wx qw(:id); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub commands { |
21
|
|
|
|
|
|
|
my( $self ) = @_; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
return ( { label => 'Multiple choice dialog', |
24
|
|
|
|
|
|
|
action => \&multiple_choice_dialog, |
25
|
|
|
|
|
|
|
}, |
26
|
|
|
|
|
|
|
{ label => 'Get multiple choice (string)', |
27
|
|
|
|
|
|
|
action => \&get_multiple_choice_string, |
28
|
|
|
|
|
|
|
}, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $choices = [ 'Apple', 'Orange', 'Banana', 'Pear', 'Cranberry' ]; |
33
|
|
|
|
|
|
|
my $data = [ '1 - apple', '2 - orange', '3 - banana', '4 - pear', |
34
|
|
|
|
|
|
|
'5 - cranberry' ]; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub get_multiple_choice_string { |
37
|
|
|
|
|
|
|
my( $self ) = @_; |
38
|
|
|
|
|
|
|
my @strings = Wx::GetMultipleChoices( 'Make some choices', 'Choose', |
39
|
|
|
|
|
|
|
$choices, $self ); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Wx::LogMessage( "The choices are: %s", join ", ", @strings ); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub multiple_choice_dialog { |
45
|
|
|
|
|
|
|
my( $this ) = @_; |
46
|
|
|
|
|
|
|
my $dialog = Wx::MultiChoiceDialog->new |
47
|
|
|
|
|
|
|
( $this, "Make a choice", "Choose", $choices ); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
if( $dialog->ShowModal == wxID_CANCEL ) { |
50
|
|
|
|
|
|
|
Wx::LogMessage( "User cancelled the dialog" ); |
51
|
|
|
|
|
|
|
} else { |
52
|
|
|
|
|
|
|
my @strings = $dialog->GetSelections; |
53
|
|
|
|
|
|
|
Wx::LogMessage( "The choices are: %s", join ", ", @strings ); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
$dialog->Destroy; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub add_to_tags { qw(dialogs) } |
60
|
|
|
|
|
|
|
sub title { 'wxMultiChoiceDialog' } |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |