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, 2009-2016 -- leonerd@leonerd.org.uk
5
6package Tickit::Event 0.72;
7
8use v5.14;
9use warnings;
10
11use Carp;
12
13=head1 NAME
14
15C<Tickit::Event> - event information structures
16
17=head1 DESCRIPTION
18
19When event handlers bound to L<Tickit::Term> or L<Tickit::Window> instances
20are invoked they receive an object instance to contain information about the
21event. Details of the event can be accessed as via accessor methods on these
22instances.
23
24=head1 ACCESSORS
25
26The following methods are shared between C<Tickit::Event::Key> and
27C<Tickit::Event::Mouse> instances.
28
29=head2 mod_is_alt
30
31=head2 mod_is_ctrl
32
33=head2 mod_is_shift
34
35Convenient shortcuts to tests on the C<mod> bitmask to test if each of the
36modifiers is set.
37
38=cut
39
40sub mod_is_alt   { shift->mod & Tickit::MOD_ALT }
41sub mod_is_ctrl  { shift->mod & Tickit::MOD_CTRL }
42sub mod_is_shift { shift->mod & Tickit::MOD_SHIFT }
43
44package
45   Tickit::Event::Expose;
46our @ISA = qw( Tickit::Event );
47
48=head1 Tickit::Event::Expose
49
50=head2 rb
51
52The L<Tickit::RenderBuffer> instance containing the buffer for this redraw
53cycle.
54
55=head2 rect
56
57A L<Tickit::Rect> instance containing the region of the window that needs
58repainting.
59
60=cut
61
62package
63   Tickit::Event::Focus;
64our @ISA = qw( Tickit::Event );
65
66=head1 Tickit::Event::Focus
67
68=head2 type
69
70This accessor has two forms of operation.
71
72The new behaviour is that it returns a dualvar giving the focus event type as
73an integer or a string event name (C<in> or C<out>). This behaviour is
74selected if the method is invoked with any true value as an argument.
75
76The legacy behaviour is that it returns a simple boolean giving the focus
77direction; C<1> for in, C<0> for out. This legacy behaviour will be removed in
78a later version.
79
80=head2 win
81
82The child L<Tickit::Window> instance for child-focus notify events.
83
84=cut
85
86package
87   Tickit::Event::Key;
88our @ISA = qw( Tickit::Event );
89
90=head1 Tickit::Event::Key
91
92=head2 type
93
94A dualvar giving the key event type as an integer or string event name (C<text> or C<key>).
95
96=head2 str
97
98A string containing the key event string.
99
100=head2 mod
101
102An integer bitmask indicating the modifier state.
103
104=cut
105
106package
107   Tickit::Event::Mouse;
108our @ISA = qw( Tickit::Event );
109
110=head1 Tickit::Event::Mouse
111
112=head2 type
113
114A dualvar giving the mouse event type as an integer or string event name (C<press>, C<drag>, C<release> or C<wheel>).
115
116=head2 button
117
118An integer for non-wheel events or a dualvar for wheel events giving the
119wheel direction (C<up> or C<down>).
120
121=head2 line
122
123=head2 col
124
125Integers giving the mouse position.
126
127=head2 mod
128
129An integer bitmask indicating the modifier state.
130
131=cut
132
133package
134   Tickit::Event::Resize;
135our @ISA = qw( Tickit::Event );
136
137=head1 Tickit::Event::Resize
138
139=head2 lines
140
141=head2 cols
142
143Integers giving the new size.
144
145=cut
146
147=head1 AUTHOR
148
149Paul Evans <leonerd@leonerd.org.uk>
150
151=cut
152
1530x55AA;
154