nitg-s: remove partial_types
[nit.git] / lib / mnit / input_events.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Copyright 2011-2013 Alexis Laferrière <alexis.laf@xymus.net>
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 # Defines abstract classes for user inputs
18 module input_events
19
20 # General type of inputs
21 interface InputEvent
22 end
23
24 # Mouse and touch input events
25 interface PointerEvent
26 super InputEvent
27
28 # X position on screen (in pixels)
29 fun x: Float is abstract
30
31 # Y position on screen (in pixels)
32 fun y: Float is abstract
33
34 # Is down? either going down or already down
35 fun pressed: Bool is abstract
36 fun depressed: Bool is abstract
37 end
38
39 # Pointer motion event, mais concern many events
40 interface MotionEvent
41 super InputEvent
42
43 # A pointer just went down?
44 fun just_went_down: Bool is abstract
45
46 # Which pointer is down, if any
47 fun down_pointer: nullable PointerEvent is abstract
48 end
49
50 # Specific touch event
51 interface TouchEvent
52 super PointerEvent
53
54 # Pressure level of input
55 fun pressure: Float is abstract
56 end
57
58 # Keyboard or other keys event
59 interface KeyEvent
60 super InputEvent
61
62 # Key is currently down?
63 fun is_down: Bool is abstract
64
65 # Key is currently up?
66 fun is_up: Bool is abstract
67
68 # Key is the up arrow key?
69 fun is_arrow_up: Bool is abstract
70
71 # Key is the left arrow key?
72 fun is_arrow_left: Bool is abstract
73
74 # Key is the down arrow key?
75 fun is_arrow_down: Bool is abstract
76
77 # Key is the right arrow key?
78 fun is_arrow_right: Bool is abstract
79
80 # Key code, is plateform specific
81 fun code: Int is abstract
82
83 # Get Char value of key, if any
84 fun to_c: nullable Char is abstract
85 end
86
87 # Mobile hardware (or pseudo hardware) event
88 interface MobileKeyEvent
89 super KeyEvent
90
91 # Key is back button? (mostly for Android)
92 fun is_back_key: Bool is abstract
93
94 # Key is menu button? (mostly for Android)
95 fun is_menu_key: Bool is abstract
96
97 # Key is search button? (mostly for Android)
98 fun is_search_key: Bool is abstract
99
100 # Key is home button? (mostly for Android)
101 fun is_home_key: Bool is abstract
102 end
103
104 # Quit event, used for window close button
105 interface QuitEvent
106 super InputEvent
107 end