reflexion 0.1.21 → 0.1.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.doc/ext/reflex/contact_event.cpp +6 -6
- data/.doc/ext/reflex/focus_event.cpp +6 -6
- data/.doc/ext/reflex/key_event.cpp +210 -12
- data/.doc/ext/reflex/pointer_event.cpp +21 -21
- data/VERSION +1 -1
- data/ext/reflex/contact_event.cpp +6 -6
- data/ext/reflex/focus_event.cpp +6 -6
- data/ext/reflex/key_event.cpp +211 -12
- data/ext/reflex/pointer_event.cpp +21 -21
- data/include/reflex/defs.h +143 -91
- data/lib/reflex/application.rb +3 -3
- data/lib/reflex/autoinit.rb +1 -1
- data/lib/reflex/button.rb +7 -7
- data/lib/reflex/capture_event.rb +7 -7
- data/lib/reflex/contact_event.rb +4 -4
- data/lib/reflex/draw_event.rb +2 -2
- data/lib/reflex/ellipse_shape.rb +2 -2
- data/lib/reflex/focus_event.rb +4 -4
- data/lib/reflex/frame_event.rb +5 -5
- data/lib/reflex/helper.rb +20 -20
- data/lib/reflex/image_view.rb +2 -2
- data/lib/reflex/key_event.rb +5 -5
- data/lib/reflex/model.rb +22 -22
- data/lib/reflex/model_owner.rb +7 -7
- data/lib/reflex/model_view.rb +1 -1
- data/lib/reflex/module.rb +5 -5
- data/lib/reflex/pointer_event.rb +12 -12
- data/lib/reflex/polygon_shape.rb +2 -2
- data/lib/reflex/reflex.rb +3 -3
- data/lib/reflex/scroll_event.rb +1 -1
- data/lib/reflex/selector.rb +4 -4
- data/lib/reflex/shape.rb +13 -13
- data/lib/reflex/style.rb +11 -11
- data/lib/reflex/style_length.rb +1 -1
- data/lib/reflex/text_view.rb +2 -2
- data/lib/reflex/timer.rb +2 -2
- data/lib/reflex/timer_event.rb +1 -1
- data/lib/reflex/update_event.rb +1 -1
- data/lib/reflex/view.rb +32 -32
- data/lib/reflex/wheel_event.rb +3 -3
- data/lib/reflex/window.rb +5 -5
- data/lib/reflexion.rb +17 -17
- data/reflex.gemspec +4 -4
- data/samples/reflexion/noise.rb +1 -1
- data/samples/tree.rb +1 -1
- data/src/ios/window.mm +1 -1
- data/src/osx/event.h +8 -0
- data/src/osx/event.mm +173 -1
- data/src/osx/native_window.mm +5 -1
- data/src/view.cpp +38 -10
- data/src/window.cpp +1 -1
- data/test/helper.rb +3 -3
- data/test/test_application.rb +1 -1
- data/test/test_capture_event.rb +6 -6
- data/test/test_event.rb +2 -2
- data/test/test_has_frame.rb +11 -11
- data/test/test_pointer_event.rb +13 -13
- data/test/test_reflex.rb +1 -1
- data/test/test_selector.rb +8 -8
- data/test/test_shape.rb +8 -8
- data/test/test_style.rb +13 -13
- data/test/test_style_length.rb +5 -5
- data/test/test_view.rb +30 -30
- data/test/test_window.rb +10 -10
- metadata +10 -10
data/include/reflex/defs.h
CHANGED
@@ -68,98 +68,89 @@ namespace Reflex
|
|
68
68
|
|
69
69
|
KEY_NONE = 0,
|
70
70
|
|
71
|
+
KEY_A,
|
72
|
+
KEY_B,
|
73
|
+
KEY_C,
|
74
|
+
KEY_D,
|
75
|
+
KEY_E,
|
76
|
+
KEY_F,
|
77
|
+
KEY_G,
|
78
|
+
KEY_H,
|
79
|
+
KEY_I,
|
80
|
+
KEY_J,
|
81
|
+
KEY_K,
|
82
|
+
KEY_L,
|
83
|
+
KEY_M,
|
84
|
+
KEY_N,
|
85
|
+
KEY_O,
|
86
|
+
KEY_P,
|
87
|
+
KEY_Q,
|
88
|
+
KEY_R,
|
89
|
+
KEY_S,
|
90
|
+
KEY_T,
|
91
|
+
KEY_U,
|
92
|
+
KEY_V,
|
93
|
+
KEY_W,
|
94
|
+
KEY_X,
|
95
|
+
KEY_Y,
|
96
|
+
KEY_Z,
|
97
|
+
|
98
|
+
KEY_0,
|
99
|
+
KEY_1,
|
100
|
+
KEY_2,
|
101
|
+
KEY_3,
|
102
|
+
KEY_4,
|
103
|
+
KEY_5,
|
104
|
+
KEY_6,
|
105
|
+
KEY_7,
|
106
|
+
KEY_8,
|
107
|
+
KEY_9,
|
108
|
+
|
109
|
+
KEY_MINUS,
|
110
|
+
KEY_EQUAL,
|
111
|
+
KEY_COMMA,
|
112
|
+
KEY_PERIOD,
|
113
|
+
KEY_SEMICOLON,
|
114
|
+
KEY_QUOTE,
|
115
|
+
KEY_SLASH,
|
116
|
+
KEY_BACKSLASH,
|
117
|
+
KEY_UNDERSCORE,
|
118
|
+
KEY_GRAVE,
|
119
|
+
KEY_YEN,
|
120
|
+
KEY_LBRACKET,
|
121
|
+
KEY_RBRACKET,
|
122
|
+
|
123
|
+
KEY_ENTER,
|
71
124
|
KEY_RETURN,
|
72
|
-
KEY_ENTER = KEY_RETURN,
|
73
|
-
KEY_ESCAPE,
|
74
125
|
KEY_SPACE,
|
75
|
-
KEY_BACKSPACE,
|
76
126
|
KEY_TAB,
|
127
|
+
KEY_DELETE,
|
128
|
+
KEY_BACKSPACE,
|
129
|
+
//KEY_INSERT,
|
130
|
+
KEY_ESCAPE,
|
77
131
|
|
78
132
|
KEY_LEFT,
|
79
|
-
KEY_UP,
|
80
133
|
KEY_RIGHT,
|
134
|
+
KEY_UP,
|
81
135
|
KEY_DOWN,
|
82
|
-
|
83
|
-
KEY_INSERT,
|
84
|
-
KEY_DELETE,
|
85
136
|
KEY_HOME,
|
86
137
|
KEY_END,
|
87
138
|
KEY_PAGEUP,
|
88
139
|
KEY_PAGEDOWN,
|
89
140
|
|
90
|
-
KEY_SHIFT,
|
91
141
|
KEY_LSHIFT,
|
92
142
|
KEY_RSHIFT,
|
93
|
-
|
94
|
-
KEY_CONTROL,
|
95
143
|
KEY_LCONTROL,
|
96
144
|
KEY_RCONTROL,
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
KEY_OPTION = KEY_ALT,
|
107
|
-
KEY_LOPTION = KEY_LALT,
|
108
|
-
KEY_ROPTION = KEY_RALT,
|
109
|
-
|
110
|
-
KEY_COMMAND = KEY_WIN,
|
111
|
-
KEY_LCOMMAND = KEY_LWIN,
|
112
|
-
KEY_RCOMMAND = KEY_RWIN,
|
113
|
-
|
114
|
-
KEY_CAPSLOCK,
|
115
|
-
KEY_NUMLOCK,
|
116
|
-
KEY_SCROLLLOCK,
|
117
|
-
|
118
|
-
KEY_PRINTSCREEN,
|
119
|
-
KEY_PAUSE,
|
120
|
-
KEY_BREAK,
|
121
|
-
|
122
|
-
KEY_SLEEP,
|
123
|
-
KEY_EXEC,//UTE,
|
124
|
-
KEY_HELP,
|
125
|
-
KEY_PRINT,
|
126
|
-
KEY_APPS,
|
127
|
-
KEY_SELECT,
|
128
|
-
KEY_CLEAR,
|
129
|
-
KEY_PLAY,
|
130
|
-
KEY_ZOOM,
|
131
|
-
|
132
|
-
KEY_IME_KANA,
|
133
|
-
KEY_IME_KANJI,
|
134
|
-
KEY_IME_JUNJA,
|
135
|
-
KEY_IME_PROCESS,
|
136
|
-
KEY_IME_ACCEPT,
|
137
|
-
KEY_IME_FINAL,
|
138
|
-
KEY_IME_CONVERT,
|
139
|
-
KEY_IME_NONCONVERT,
|
140
|
-
KEY_IME_MODECHANGE,
|
141
|
-
|
142
|
-
KEY_BROWSER_BACK,
|
143
|
-
KEY_BROWSER_FORWARD,
|
144
|
-
KEY_BROWSER_REFRESH,
|
145
|
-
KEY_BROWSER_STOP,
|
146
|
-
KEY_BROWSER_SEARCH,
|
147
|
-
KEY_BROWSER_FAVORITES,
|
148
|
-
KEY_BROWSER_HOME,
|
149
|
-
|
150
|
-
KEY_VOLUME_MUTE,
|
151
|
-
KEY_VOLUME_DOWN,
|
152
|
-
KEY_VOLUME_UP,
|
153
|
-
|
154
|
-
KEY_MEDIA_NEXT_TRACK,
|
155
|
-
KEY_MEDIA_PREV_TRACK,
|
156
|
-
KEY_MEDIA_STOP,
|
157
|
-
KEY_MEDIA_PLAY_PAUSE,
|
158
|
-
|
159
|
-
KEY_LAUNCH_MAIL,
|
160
|
-
KEY_LAUNCH_MEDIA_SELECT,
|
161
|
-
KEY_LAUNCH_APP1,
|
162
|
-
KEY_LAUNCH_APP2,
|
145
|
+
//KEY_LALT,
|
146
|
+
//KEY_RALT,
|
147
|
+
//KEY_LWIN,
|
148
|
+
//KEY_RWIN,
|
149
|
+
KEY_LCOMMAND,
|
150
|
+
KEY_RCOMMAND,
|
151
|
+
KEY_LOPTION,
|
152
|
+
KEY_ROPTION,
|
153
|
+
KEY_FUNCTION,
|
163
154
|
|
164
155
|
KEY_F1,
|
165
156
|
KEY_F2,
|
@@ -181,21 +172,82 @@ namespace Reflex
|
|
181
172
|
KEY_F18,
|
182
173
|
KEY_F19,
|
183
174
|
KEY_F20,
|
184
|
-
KEY_F21,
|
185
|
-
KEY_F22,
|
186
|
-
KEY_F23,
|
187
|
-
KEY_F24,
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
175
|
+
//KEY_F21,
|
176
|
+
//KEY_F22,
|
177
|
+
//KEY_F23,
|
178
|
+
//KEY_F24,
|
179
|
+
|
180
|
+
KEY_NUM_0,
|
181
|
+
KEY_NUM_1,
|
182
|
+
KEY_NUM_2,
|
183
|
+
KEY_NUM_3,
|
184
|
+
KEY_NUM_4,
|
185
|
+
KEY_NUM_5,
|
186
|
+
KEY_NUM_6,
|
187
|
+
KEY_NUM_7,
|
188
|
+
KEY_NUM_8,
|
189
|
+
KEY_NUM_9,
|
190
|
+
|
191
|
+
KEY_NUM_PLUS,
|
192
|
+
KEY_NUM_MINUS,
|
193
|
+
KEY_NUM_MULTIPLY,
|
194
|
+
KEY_NUM_DIVIDE,
|
195
|
+
KEY_NUM_EQUAL,
|
196
|
+
KEY_NUM_COMMA,
|
197
|
+
KEY_NUM_DECIMAL,
|
198
|
+
KEY_NUM_CLEAR,
|
199
|
+
|
200
|
+
KEY_CAPSLOCK,
|
201
|
+
//KEY_NUMLOCK,
|
202
|
+
//KEY_SCROLLLOCK,
|
203
|
+
|
204
|
+
//KEY_PRINTSCREEN,
|
205
|
+
//KEY_PAUSE,
|
206
|
+
//KEY_BREAK,
|
207
|
+
KEY_SECTION,
|
208
|
+
KEY_HELP,
|
209
|
+
|
210
|
+
KEY_IME_EISU,
|
211
|
+
KEY_IME_KANA,
|
212
|
+
//KEY_IME_KANJI,
|
213
|
+
//KEY_IME_JUNJA,
|
214
|
+
//KEY_IME_PROCESS,
|
215
|
+
//KEY_IME_ACCEPT,
|
216
|
+
//KEY_IME_FINAL,
|
217
|
+
//KEY_IME_CONVERT,
|
218
|
+
//KEY_IME_NONCONVERT,
|
219
|
+
//KEY_IME_MODECHANGE,
|
220
|
+
|
221
|
+
KEY_VOLUME_UP,
|
222
|
+
KEY_VOLUME_DOWN,
|
223
|
+
KEY_MUTE,
|
224
|
+
|
225
|
+
//KEY_SLEEP,
|
226
|
+
//KEY_EXEC,
|
227
|
+
//KEY_PRINT,
|
228
|
+
//KEY_APPS,
|
229
|
+
//KEY_SELECT,
|
230
|
+
//KEY_CLEAR,
|
231
|
+
//KEY_PLAY,
|
232
|
+
//KEY_ZOOM,
|
233
|
+
|
234
|
+
//KEY_BROWSER_BACK,
|
235
|
+
//KEY_BROWSER_FORWARD,
|
236
|
+
//KEY_BROWSER_REFRESH,
|
237
|
+
//KEY_BROWSER_STOP,
|
238
|
+
//KEY_BROWSER_SEARCH,
|
239
|
+
//KEY_BROWSER_FAVORITES,
|
240
|
+
//KEY_BROWSER_HOME,
|
241
|
+
|
242
|
+
//KEY_MEDIA_NEXT_TRACK,
|
243
|
+
//KEY_MEDIA_PREV_TRACK,
|
244
|
+
//KEY_MEDIA_STOP,
|
245
|
+
//KEY_MEDIA_PLAY_PAUSE,
|
246
|
+
|
247
|
+
//KEY_LAUNCH_MAIL,
|
248
|
+
//KEY_LAUNCH_MEDIA_SELECT,
|
249
|
+
//KEY_LAUNCH_APP1,
|
250
|
+
//KEY_LAUNCH_APP2,
|
199
251
|
|
200
252
|
};// KeyCode
|
201
253
|
|
data/lib/reflex/application.rb
CHANGED
@@ -18,19 +18,19 @@ module Reflex
|
|
18
18
|
|
19
19
|
universal_accessor :name
|
20
20
|
|
21
|
-
def initialize
|
21
|
+
def initialize(options = nil, &block)
|
22
22
|
super()
|
23
23
|
set options if options
|
24
24
|
@start_block = block if block
|
25
25
|
end
|
26
26
|
|
27
|
-
def self.start
|
27
|
+
def self.start(*args, &block)
|
28
28
|
new(*args, &block).start
|
29
29
|
end
|
30
30
|
|
31
31
|
private
|
32
32
|
|
33
|
-
def call_start_block
|
33
|
+
def call_start_block()
|
34
34
|
return unless @start_block
|
35
35
|
Xot::BlockUtil.instance_eval_or_block_call self, &@start_block
|
36
36
|
@start_block = nil
|
data/lib/reflex/autoinit.rb
CHANGED
data/lib/reflex/button.rb
CHANGED
@@ -13,21 +13,21 @@ module Reflex
|
|
13
13
|
|
14
14
|
attr_accessor :text
|
15
15
|
|
16
|
-
def initialize
|
16
|
+
def initialize(*args, &block)
|
17
17
|
self.data = false
|
18
18
|
super
|
19
19
|
self.text = self.name unless self.text
|
20
20
|
end
|
21
21
|
|
22
|
-
def content_bounds
|
22
|
+
def content_bounds()
|
23
23
|
f = window.painter.font
|
24
24
|
return f.width(@text) + 2, f.height + 2
|
25
25
|
end
|
26
26
|
|
27
|
-
def on_press
|
27
|
+
def on_press(e)
|
28
28
|
end
|
29
29
|
|
30
|
-
def on_draw
|
30
|
+
def on_draw(e)
|
31
31
|
e.painter.push fill: (pressing? ? :white : :none), stroke: :white do |p|
|
32
32
|
p.rect e.bounds
|
33
33
|
|
@@ -43,7 +43,7 @@ module Reflex
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
def on_pointer
|
46
|
+
def on_pointer(e)
|
47
47
|
case e.type
|
48
48
|
when :down
|
49
49
|
self.capture += [:pointer]
|
@@ -60,13 +60,13 @@ module Reflex
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
def on_data_update
|
63
|
+
def on_data_update(e)
|
64
64
|
on_press({}) if e.data
|
65
65
|
end
|
66
66
|
|
67
67
|
private
|
68
68
|
|
69
|
-
def pressing?
|
69
|
+
def pressing?()
|
70
70
|
capturing? :pointer
|
71
71
|
end
|
72
72
|
|
data/lib/reflex/capture_event.rb
CHANGED
@@ -10,25 +10,25 @@ module Reflex
|
|
10
10
|
|
11
11
|
class CaptureEvent < Event
|
12
12
|
|
13
|
-
def begin
|
13
|
+
def begin()
|
14
14
|
View.capture_flag.bits2symbols get_begin
|
15
15
|
end
|
16
16
|
|
17
|
-
def begin?
|
18
|
-
bits = View.capture_flag.symbols2bits
|
17
|
+
def begin?(*symbols)
|
18
|
+
bits = View.capture_flag.symbols2bits(*symbols)
|
19
19
|
(bits & get_begin) == bits
|
20
20
|
end
|
21
21
|
|
22
|
-
def end
|
22
|
+
def end()
|
23
23
|
View.capture_flag.bits2symbols get_end
|
24
24
|
end
|
25
25
|
|
26
|
-
def end?
|
27
|
-
bits = View.capture_flag.symbols2bits
|
26
|
+
def end?(*symbols)
|
27
|
+
bits = View.capture_flag.symbols2bits(*symbols)
|
28
28
|
(bits & get_end) == bits
|
29
29
|
end
|
30
30
|
|
31
|
-
def inspect
|
31
|
+
def inspect()
|
32
32
|
"#<Reflex::CaptureEvent begin:#{self.begin} end:#{self.end}}>"
|
33
33
|
end
|
34
34
|
|
data/lib/reflex/contact_event.rb
CHANGED
@@ -12,21 +12,21 @@ module Reflex
|
|
12
12
|
|
13
13
|
alias get_type type
|
14
14
|
|
15
|
-
const_symbol_reader :type, {
|
15
|
+
const_symbol_reader :type, **{
|
16
16
|
none: TYPE_NONE,
|
17
17
|
begin: TYPE_BEGIN,
|
18
18
|
end: TYPE_END
|
19
19
|
}
|
20
20
|
|
21
|
-
def begin?
|
21
|
+
def begin?()
|
22
22
|
get_type == TYPE_BEGIN
|
23
23
|
end
|
24
24
|
|
25
|
-
def end?
|
25
|
+
def end?()
|
26
26
|
get_type == TYPE_END
|
27
27
|
end
|
28
28
|
|
29
|
-
def inspect
|
29
|
+
def inspect()
|
30
30
|
"#<Reflex::ContactEvent type:#{type} shape:#{shape} view:#{view}>"
|
31
31
|
end
|
32
32
|
|
data/lib/reflex/draw_event.rb
CHANGED
@@ -10,11 +10,11 @@ module Reflex
|
|
10
10
|
|
11
11
|
class DrawEvent < Event
|
12
12
|
|
13
|
-
def paint
|
13
|
+
def paint(&block)
|
14
14
|
Xot::BlockUtil.instance_eval_or_block_call painter, &block if block
|
15
15
|
end
|
16
16
|
|
17
|
-
def inspect
|
17
|
+
def inspect()
|
18
18
|
"#<Reflex::DrawEvent painter:#{painter} bounds:#{bounds} dt:#{dt} fps:#{fps}>"
|
19
19
|
end
|
20
20
|
|
data/lib/reflex/ellipse_shape.rb
CHANGED
data/lib/reflex/focus_event.rb
CHANGED
@@ -12,21 +12,21 @@ module Reflex
|
|
12
12
|
|
13
13
|
alias get_type type
|
14
14
|
|
15
|
-
const_symbol_reader :type, {
|
15
|
+
const_symbol_reader :type, **{
|
16
16
|
none: TYPE_NONE,
|
17
17
|
focus: TYPE_FOCUS,
|
18
18
|
blur: TYPE_BLUR
|
19
19
|
}
|
20
20
|
|
21
|
-
def focus?
|
21
|
+
def focus?()
|
22
22
|
get_type == TYPE_FOCUS
|
23
23
|
end
|
24
24
|
|
25
|
-
def blur?
|
25
|
+
def blur?()
|
26
26
|
get_type == TYPE_BLUR
|
27
27
|
end
|
28
28
|
|
29
|
-
def inspect
|
29
|
+
def inspect()
|
30
30
|
"#<Reflex::FocusEvent type:#{type} current:#{current} last:#{last}>"
|
31
31
|
end
|
32
32
|
|