File: Event.pm

package info (click to toggle)
libtickit-perl 0.73-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 660 kB
  • sloc: perl: 4,944; makefile: 5
file content (153 lines) | stat: -rw-r--r-- 2,978 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#  You may distribute under the terms of either the GNU General Public License
#  or the Artistic License (the same terms as Perl itself)
#
#  (C) Paul Evans, 2009-2016 -- leonerd@leonerd.org.uk

package Tickit::Event 0.73;

use v5.14;
use warnings;

use Carp;

=head1 NAME

C<Tickit::Event> - event information structures

=head1 DESCRIPTION

When event handlers bound to L<Tickit::Term> or L<Tickit::Window> instances
are invoked they receive an object instance to contain information about the
event. Details of the event can be accessed as via accessor methods on these
instances.

=head1 ACCESSORS

The following methods are shared between C<Tickit::Event::Key> and
C<Tickit::Event::Mouse> instances.

=head2 mod_is_alt

=head2 mod_is_ctrl

=head2 mod_is_shift

Convenient shortcuts to tests on the C<mod> bitmask to test if each of the
modifiers is set.

=cut

sub mod_is_alt   { shift->mod & Tickit::MOD_ALT }
sub mod_is_ctrl  { shift->mod & Tickit::MOD_CTRL }
sub mod_is_shift { shift->mod & Tickit::MOD_SHIFT }

package
   Tickit::Event::Expose;
our @ISA = qw( Tickit::Event );

=head1 Tickit::Event::Expose

=head2 rb

The L<Tickit::RenderBuffer> instance containing the buffer for this redraw
cycle.

=head2 rect

A L<Tickit::Rect> instance containing the region of the window that needs
repainting.

=cut

package
   Tickit::Event::Focus;
our @ISA = qw( Tickit::Event );

=head1 Tickit::Event::Focus

=head2 type

This accessor has two forms of operation.

The new behaviour is that it returns a dualvar giving the focus event type as
an integer or a string event name (C<in> or C<out>). This behaviour is
selected if the method is invoked with any true value as an argument.

The legacy behaviour is that it returns a simple boolean giving the focus
direction; C<1> for in, C<0> for out. This legacy behaviour will be removed in
a later version.

=head2 win

The child L<Tickit::Window> instance for child-focus notify events.

=cut

package
   Tickit::Event::Key;
our @ISA = qw( Tickit::Event );

=head1 Tickit::Event::Key

=head2 type

A dualvar giving the key event type as an integer or string event name (C<text> or C<key>).

=head2 str

A string containing the key event string.

=head2 mod

An integer bitmask indicating the modifier state.

=cut

package
   Tickit::Event::Mouse;
our @ISA = qw( Tickit::Event );

=head1 Tickit::Event::Mouse

=head2 type

A dualvar giving the mouse event type as an integer or string event name (C<press>, C<drag>, C<release> or C<wheel>).

=head2 button

An integer for non-wheel events or a dualvar for wheel events giving the
wheel direction (C<up> or C<down>).

=head2 line

=head2 col

Integers giving the mouse position.

=head2 mod

An integer bitmask indicating the modifier state.

=cut

package
   Tickit::Event::Resize;
our @ISA = qw( Tickit::Event );

=head1 Tickit::Event::Resize

=head2 lines

=head2 cols

Integers giving the new size.

=cut

=head1 AUTHOR

Paul Evans <leonerd@leonerd.org.uk>

=cut

0x55AA;