-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevents-user.lua
More file actions
118 lines (106 loc) · 2.64 KB
/
events-user.lua
File metadata and controls
118 lines (106 loc) · 2.64 KB
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
function on.mouseDown(x, y)
if Lib.Dialog.AreWinsOpen() then
Lib.Dialog._mouse_down(x,y)
return
end
App:_onMouseClick(x, y)
platform.window:invalidate()
end
function on.enterKey()
if Lib.Dialog.AreWinsOpen() then
Lib.Dialog._enter_key()
return
end
if App._focused == 0 then
if Lib.Lang.IsRunnable(App.Hooks.EnterKey) then
if App.Hooks.EnterKey(c) then
platform.window:invalidate()
end
end
return
end
App:_onElementClick()
platform.window:invalidate()
end
function on.arrowKey(ar)
if Lib.Dialog.AreWinsOpen() then
Lib.Dialog._arrow_key(ar)
return
end
end
function on.tabKey()
if Lib.Dialog.AreWinsOpen() then
Lib.Dialog._tab_key()
return
end
App:_change_focused(true)
end
function on.backtabKey()
if Lib.Dialog.AreWinsOpen() then
Lib.Dialog._back_tab_key()
return
end
App:_change_focused(false)
end
function on.escapeKey()
if Lib.Dialog.AreWinsOpen() then
Lib.Dialog._escape_key()
return
end
App._focused = 0
platform.window:invalidate()
end
function on.charIn(c)
if Lib.Dialog.AreWinsOpen() then
Lib.Dialog._char_in(ch)
return
end
if App._focused == 0 then
if Lib.Lang.IsRunnable(App.Hooks.CharIn) then
if App.Hooks.CharIn(c) then
platform.window:invalidate()
end
end
return
end
if Lib.Lang.IsRunnable(App._elements[App._focused].AcceptChar) then
App._elements[App._focused]:AcceptChar(c)
platform.window:invalidate()
end
end
function on.backspaceKey()
if Lib.Dialog.AreWinsOpen() then
Lib.Dialog._backspace_key()
return
end
if App._focused == 0 then
if Lib.Lang.IsRunnable(App.Hooks.Backspace) then
if App.Hooks.Backspace() then
platform.window:invalidate()
end
end
return
end
if Lib.Lang.IsRunnable(App._elements[App._focused].AcceptBackspace) then
App._elements[App._focused]:AcceptBackspace()
platform.window:invalidate()
end
end
function on.help()
Lib.Internal.ShowAboutDialog()
end
function on.copy()
if Lib.Lang.IsRunnable(App.Interactions.Copy) then
clipboard.addText(App.Interactions.Copy())
end
end
function on.cut()
if Lib.Lang.IsRunnable(App.Interactions.Cut) then
clipboard.addText(App.Interactions.Cut())
end
end
function on.paste()
if Lib.Lang.IsRunnable(App.Interactions.Paste) then
App.Interactions.Paste(clipboard.getText())
end
end