-
Notifications
You must be signed in to change notification settings - Fork 5
/
events.go
84 lines (69 loc) · 1.67 KB
/
events.go
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
package ink
/*
#include "inkview.h"
#cgo CFLAGS: -pthread
#cgo LDFLAGS: -pthread -lpthread -linkview
*/
import "C"
import "image"
type KeyEvent struct {
Key Key
State KeyState
}
type PointerEvent struct {
image.Point
State PointerState
}
type TouchEvent struct {
image.Point
State TouchState
}
type KeyState int
const (
KeyStateDown = KeyState(C.EVT_KEYDOWN)
KeyStatePress = KeyState(C.EVT_KEYPRESS)
KeyStateUp = KeyState(C.EVT_KEYUP)
KeyStateRelease = KeyState(C.EVT_KEYRELEASE)
KeyStateRepeat = KeyState(C.EVT_KEYREPEAT)
)
type PointerState int
const (
PointerUp = PointerState(C.EVT_POINTERUP)
PointerDown = PointerState(C.EVT_POINTERDOWN)
PointerMove = PointerState(C.EVT_POINTERMOVE)
PointerLong = PointerState(C.EVT_POINTERLONG)
PointerHold = PointerState(C.EVT_POINTERHOLD)
)
type TouchState int
const (
TouchUp = TouchState(C.EVT_TOUCHUP)
TouchDown = TouchState(C.EVT_TOUCHDOWN)
TouchMove = TouchState(C.EVT_TOUCHMOVE)
)
// Key is a key code for buttons.
type Key int
const (
KeyBack = Key(C.KEY_BACK)
KeyDelete = Key(C.KEY_DELETE)
KeyOk = Key(C.KEY_OK)
KeyUp = Key(C.KEY_UP)
KeyDown = Key(C.KEY_DOWN)
KeyLeft = Key(C.KEY_LEFT)
KeyRight = Key(C.KEY_RIGHT)
KeyMinus = Key(C.KEY_MINUS)
KeyPlus = Key(C.KEY_PLUS)
KeyMenu = Key(C.KEY_MENU)
KeyMusic = Key(C.KEY_MUSIC)
KeyPower = Key(C.KEY_POWER)
KeyPrev = Key(C.KEY_PREV)
KeyNext = Key(C.KEY_NEXT)
KeyPrev2 = Key(C.KEY_PREV2)
KeyNext2 = Key(C.KEY_NEXT2)
)
type Orientation int
const (
Orientation0 = Orientation(C.ROTATE0)
Orientation90 = Orientation(C.ROTATE90)
Orientation180 = Orientation(C.ROTATE180)
Orientation270 = Orientation(C.ROTATE270)
)