| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# You may distribute under the terms of either the GNU General Public License |
|
2
|
|
|
|
|
|
|
# or the Artistic License (the same terms as Perl itself) |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
# (C) Paul Evans, 2012 -- leonerd@leonerd.org.uk |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Tickit::Widget::Menu::Item; |
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
1088
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
29
|
|
|
9
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
23
|
|
|
10
|
1
|
|
|
1
|
|
4
|
use base qw( Tickit::Widget::Menu::itembase ); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
354
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.09'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
154
|
use Tickit::Utils qw( textwidth ); |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
C - an item to display in a C |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Objects in this class are displayed in menus. Each item has a name and a |
|
23
|
|
|
|
|
|
|
callback to invoke when the menu option is clicked on. |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head2 $item = Tickit::Widget::Menu::Item->new( %args ) |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Constructs a new C object. |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Takes the following named arguments: |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=over 8 |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=item name => STRING |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Gives the name of the menu item. |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=item on_activate => CODE |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Callback to invoke when the menu item is clicked on. |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=back |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub new |
|
52
|
|
|
|
|
|
|
{ |
|
53
|
|
|
|
|
|
|
my $class = shift; |
|
54
|
|
|
|
|
|
|
my %args = @_; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
my $self = bless { |
|
57
|
|
|
|
|
|
|
on_activate => $args{on_activate}, |
|
58
|
|
|
|
|
|
|
}, $class; |
|
59
|
|
|
|
|
|
|
$self->_init_itembase( %args ); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
return $self; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub activate |
|
65
|
|
|
|
|
|
|
{ |
|
66
|
|
|
|
|
|
|
my $self = shift; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
$self->{on_activate}->( $self ) if $self->{on_activate}; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 AUTHOR |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Paul Evans |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
0x55AA; |