reflexion 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.doc/ext/reflex/application.cpp +54 -39
- data/.doc/ext/reflex/capture_event.cpp +87 -0
- data/.doc/ext/reflex/draw_event.cpp +103 -0
- data/.doc/ext/reflex/event.cpp +73 -0
- data/.doc/ext/reflex/focus_event.cpp +98 -0
- data/.doc/ext/reflex/frame_event.cpp +133 -0
- data/.doc/ext/reflex/image_view.cpp +74 -0
- data/.doc/ext/reflex/key_event.cpp +124 -0
- data/.doc/ext/reflex/native.cpp +45 -6
- data/.doc/ext/reflex/pointer_event.cpp +181 -0
- data/.doc/ext/reflex/reflex.cpp +17 -41
- data/.doc/ext/reflex/scroll_event.cpp +141 -0
- data/.doc/ext/reflex/selector.cpp +135 -0
- data/.doc/ext/reflex/style.cpp +253 -0
- data/.doc/ext/reflex/style_length.cpp +133 -0
- data/.doc/ext/reflex/style_length2.cpp +149 -0
- data/.doc/ext/reflex/style_length4.cpp +192 -0
- data/.doc/ext/reflex/update_event.cpp +77 -0
- data/.doc/ext/reflex/view.cpp +408 -88
- data/.doc/ext/reflex/wheel_event.cpp +146 -0
- data/.doc/ext/reflex/window.cpp +95 -92
- data/Rakefile +6 -5
- data/VERSION +1 -1
- data/ext/reflex/application.cpp +67 -49
- data/ext/reflex/capture_event.cpp +92 -0
- data/ext/reflex/draw_event.cpp +110 -0
- data/ext/reflex/event.cpp +77 -0
- data/ext/reflex/extconf.rb +18 -68
- data/ext/reflex/focus_event.cpp +104 -0
- data/ext/reflex/frame_event.cpp +143 -0
- data/ext/reflex/image_view.cpp +77 -0
- data/ext/reflex/key_event.cpp +133 -0
- data/ext/reflex/native.cpp +45 -6
- data/ext/reflex/pointer_event.cpp +195 -0
- data/ext/reflex/reflex.cpp +21 -47
- data/ext/reflex/scroll_event.cpp +152 -0
- data/ext/reflex/selector.cpp +144 -0
- data/ext/reflex/style.cpp +277 -0
- data/ext/reflex/style_length.cpp +140 -0
- data/ext/reflex/style_length2.cpp +157 -0
- data/ext/reflex/style_length4.cpp +204 -0
- data/ext/reflex/update_event.cpp +81 -0
- data/ext/reflex/view.cpp +469 -114
- data/ext/reflex/wheel_event.cpp +158 -0
- data/ext/reflex/window.cpp +130 -123
- data/include/reflex/application.h +12 -7
- data/include/reflex/defs.h +13 -89
- data/include/reflex/event.h +260 -0
- data/include/reflex/exception.h +17 -11
- data/include/reflex/image_view.h +45 -0
- data/include/reflex/reflex.h +2 -6
- data/include/reflex/ruby/application.h +40 -13
- data/include/reflex/ruby/event.h +72 -0
- data/include/reflex/ruby/image_view.h +25 -0
- data/include/reflex/ruby/selector.h +27 -0
- data/include/reflex/ruby/style.h +27 -0
- data/include/reflex/ruby/style_length.h +37 -0
- data/include/reflex/ruby/view.h +193 -38
- data/include/reflex/ruby/window.h +123 -39
- data/include/reflex/ruby.h +3 -2
- data/include/reflex/selector.h +64 -0
- data/include/reflex/style.h +144 -0
- data/include/reflex/style_length.h +147 -0
- data/include/reflex/view.h +182 -19
- data/include/reflex/window.h +35 -19
- data/include/reflex.h +7 -0
- data/lib/reflex/application.rb +14 -5
- data/lib/reflex/arc_shape.rb +20 -0
- data/lib/reflex/button.rb +75 -0
- data/lib/reflex/capture_event.rb +37 -0
- data/lib/reflex/color.rb +13 -0
- data/lib/reflex/color_space.rb +13 -0
- data/lib/reflex/draw_event.rb +19 -0
- data/lib/reflex/ellipse_shape.rb +20 -0
- data/lib/reflex/ext.rb +1 -1
- data/lib/reflex/flags.rb +18 -0
- data/lib/reflex/focus_event.rb +38 -0
- data/lib/reflex/font.rb +13 -0
- data/lib/reflex/frame_event.rb +42 -0
- data/lib/reflex/helper.rb +87 -30
- data/lib/reflex/image_view.rb +25 -0
- data/lib/reflex/key_event.rb +38 -0
- data/lib/reflex/line_shape.rb +20 -0
- data/lib/reflex/list_view.rb +15 -0
- data/lib/reflex/model.rb +149 -0
- data/lib/reflex/model_owner.rb +57 -0
- data/lib/reflex/model_view.rb +22 -0
- data/lib/reflex/module.rb +11 -7
- data/lib/reflex/pointer_event.rb +85 -0
- data/lib/reflex/rect_shape.rb +20 -0
- data/lib/reflex/reflex.rb +13 -2
- data/lib/reflex/scroll_event.rb +19 -0
- data/lib/reflex/selector.rb +31 -0
- data/lib/reflex/shader.rb +13 -0
- data/lib/reflex/shape.rb +34 -0
- data/lib/reflex/style.rb +55 -0
- data/lib/reflex/style_length.rb +30 -0
- data/lib/reflex/style_length2.rb +34 -0
- data/lib/reflex/style_length4.rb +38 -0
- data/lib/reflex/text_view.rb +55 -0
- data/lib/reflex/update_event.rb +19 -0
- data/lib/reflex/view.rb +38 -4
- data/lib/reflex/wheel_event.rb +19 -0
- data/lib/reflex/window.rb +7 -5
- data/lib/reflex.rb +38 -1
- data/lib/reflexion/include.rb +5 -0
- data/lib/reflexion.rb +100 -0
- data/reflex.gemspec +3 -4
- data/samples/app.rb +13 -0
- data/samples/bats.rb +91 -0
- data/samples/checker.rb +36 -0
- data/{examples/ruby/shapes.rb → samples/fans.rb} +12 -16
- data/samples/fps.rb +46 -0
- data/samples/grid.rb +60 -0
- data/{examples/ruby → samples}/hello.rb +14 -16
- data/samples/image.rb +44 -0
- data/samples/ios/hello/hello/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- data/samples/ios/hello/hello/Images.xcassets/LaunchImage.launchimage/Contents.json +51 -0
- data/samples/ios/hello/hello/en.lproj/InfoPlist.strings +2 -0
- data/samples/ios/hello/hello/hello-Info.plist +47 -0
- data/samples/ios/hello/hello/hello-Prefix.pch +10 -0
- data/samples/ios/hello/hello/main.cpp +79 -0
- data/samples/ios/hello/hello.xcodeproj/project.pbxproj +725 -0
- data/{examples/ruby → samples}/key.rb +11 -14
- data/samples/layout.rb +89 -0
- data/samples/model.rb +86 -0
- data/samples/osx/hello/hello/Images.xcassets/AppIcon.appiconset/Contents.json +58 -0
- data/samples/osx/hello/hello/en.lproj/Credits.rtf +29 -0
- data/samples/osx/hello/hello/en.lproj/InfoPlist.strings +2 -0
- data/samples/osx/hello/hello/hello-Info.plist +32 -0
- data/samples/osx/hello/hello/hello-Prefix.pch +3 -0
- data/samples/osx/hello/hello/main.cpp +79 -0
- data/samples/osx/hello/hello.xcodeproj/project.pbxproj +725 -0
- data/samples/reflexion/hello.rb +24 -0
- data/samples/reflexion/paint.rb +40 -0
- data/samples/reflexion/pulse.rb +34 -0
- data/samples/repl.rb +69 -0
- data/samples/shader.rb +41 -0
- data/samples/shapes.rb +30 -0
- data/{examples/ruby → samples}/text.rb +7 -8
- data/samples/tree.rb +71 -0
- data/samples/views.rb +41 -0
- data/samples/visuals.rb +22 -0
- data/src/event.cpp +225 -0
- data/src/exception.cpp +24 -15
- data/src/image_view.cpp +70 -0
- data/src/ios/app_delegate.h +17 -0
- data/src/ios/app_delegate.mm +120 -0
- data/src/ios/application.mm +116 -0
- data/src/{cocoa/applicationdata.h → ios/application_data.h} +6 -6
- data/src/ios/event.h +26 -0
- data/src/ios/event.mm +31 -0
- data/src/ios/native_window.h +37 -0
- data/src/ios/native_window.mm +220 -0
- data/src/ios/opengl_view.h +13 -0
- data/src/ios/opengl_view.mm +131 -0
- data/src/{cocoa → ios}/reflex.mm +8 -12
- data/src/ios/window.mm +303 -0
- data/src/ios/window_data.h +75 -0
- data/src/osx/app_delegate.h +17 -0
- data/src/{cocoa/cocoaapplication.mm → osx/app_delegate.mm} +90 -48
- data/src/osx/application.mm +132 -0
- data/src/osx/application_data.h +45 -0
- data/src/osx/event.h +42 -0
- data/src/osx/event.mm +112 -0
- data/src/osx/native_window.h +26 -0
- data/src/osx/native_window.mm +322 -0
- data/src/{cocoa/openglview.h → osx/opengl_view.h} +0 -4
- data/src/{cocoa/openglview.mm → osx/opengl_view.mm} +66 -23
- data/src/osx/reflex.mm +50 -0
- data/src/osx/window.mm +308 -0
- data/src/osx/window_data.h +75 -0
- data/src/selector.cpp +121 -0
- data/src/style.cpp +576 -0
- data/src/style_length.cpp +341 -0
- data/src/view.cpp +1228 -129
- data/src/win32/application.cpp +1 -1
- data/src/window.cpp +54 -26
- data/test/helper.rb +8 -4
- data/test/test_capture_event.rb +41 -0
- data/test/test_event.rb +20 -0
- data/test/test_has_frame.rb +45 -0
- data/test/test_model.rb +9 -0
- data/test/test_model_owner.rb +9 -0
- data/test/test_selector.rb +75 -0
- data/test/test_style.rb +70 -0
- data/test/test_style_length.rb +38 -0
- data/test/test_style_length2.rb +50 -0
- data/test/test_style_length4.rb +56 -0
- data/test/test_view.rb +97 -23
- data/test/test_window.rb +54 -46
- metadata +205 -84
- data/.doc/ext/reflex/defs.cpp +0 -8
- data/.doc/ext/reflex/key.cpp +0 -122
- data/.doc/ext/reflex/points.cpp +0 -151
- data/.gitignore +0 -14
- data/ChangeLog +0 -8
- data/examples/hello/.gitignore +0 -2
- data/examples/hello/Rakefile +0 -41
- data/examples/hello/main.cpp +0 -18
- data/examples/ruby/app.rb +0 -13
- data/examples/ruby/checker.rb +0 -41
- data/examples/ruby/fps.rb +0 -49
- data/examples/ruby/grid.rb +0 -65
- data/examples/ruby/views.rb +0 -88
- data/examples/ruby/visuals.rb +0 -27
- data/ext/reflex/defs.cpp +0 -8
- data/ext/reflex/key.cpp +0 -129
- data/ext/reflex/points.cpp +0 -161
- data/include/reflex/ruby/key.h +0 -39
- data/include/reflex/ruby/points.h +0 -39
- data/lib/reflex/visuals/string.rb +0 -53
- data/src/cocoa/application.mm +0 -101
- data/src/cocoa/cocoaapplication.h +0 -21
- data/src/cocoa/cocoawindow.h +0 -46
- data/src/cocoa/cocoawindow.mm +0 -230
- data/src/cocoa/defs.h +0 -34
- data/src/cocoa/defs.mm +0 -87
- data/src/cocoa/window.mm +0 -148
- data/src/cocoa/windowdata.h +0 -56
- data/src/defs.cpp +0 -47
- data/src/helper.h +0 -12
- data/src/reflex.cpp +0 -43
- /data/{README → README.md} +0 -0
data/include/reflex/defs.h
CHANGED
|
@@ -7,14 +7,6 @@
|
|
|
7
7
|
#include <rays/defs.h>
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
namespace Rucy
|
|
11
|
-
{
|
|
12
|
-
|
|
13
|
-
class Value;
|
|
14
|
-
|
|
15
|
-
}// Rucy
|
|
16
|
-
|
|
17
|
-
|
|
18
10
|
namespace Reflex
|
|
19
11
|
{
|
|
20
12
|
|
|
@@ -22,7 +14,7 @@ namespace Reflex
|
|
|
22
14
|
using namespace Rays;
|
|
23
15
|
|
|
24
16
|
|
|
25
|
-
enum
|
|
17
|
+
enum KeyCode
|
|
26
18
|
{
|
|
27
19
|
|
|
28
20
|
KEY_NONE = 0,
|
|
@@ -156,32 +148,30 @@ namespace Reflex
|
|
|
156
148
|
KEY_F34,
|
|
157
149
|
KEY_F35,
|
|
158
150
|
|
|
159
|
-
};//
|
|
151
|
+
};// KeyCode
|
|
160
152
|
|
|
161
153
|
|
|
162
|
-
enum
|
|
154
|
+
enum PointerType
|
|
163
155
|
{
|
|
164
156
|
|
|
165
|
-
|
|
157
|
+
POINTER_NONE = 0,
|
|
166
158
|
|
|
167
|
-
|
|
159
|
+
POINTER_MOUSE_LEFT = 0x1 << 0,
|
|
168
160
|
|
|
169
|
-
|
|
161
|
+
POINTER_MOUSE_RIGHT = 0x1 << 1,
|
|
170
162
|
|
|
171
|
-
|
|
163
|
+
POINTER_MOUSE_MIDDLE = 0x1 << 2,
|
|
172
164
|
|
|
173
|
-
|
|
165
|
+
POINTER_TOUCH = 0x1 << 3,
|
|
174
166
|
|
|
175
|
-
|
|
167
|
+
POINTER_PEN = 0x1 << 4,
|
|
176
168
|
|
|
177
|
-
|
|
169
|
+
POINTER_TYPE_LAST = POINTER_PEN,
|
|
178
170
|
|
|
179
|
-
|
|
171
|
+
};// PointType
|
|
180
172
|
|
|
181
|
-
};// PointTypes
|
|
182
173
|
|
|
183
|
-
|
|
184
|
-
enum Modifiers
|
|
174
|
+
enum Modifier
|
|
185
175
|
{
|
|
186
176
|
|
|
187
177
|
MOD_NONE = 0,
|
|
@@ -208,73 +198,7 @@ namespace Reflex
|
|
|
208
198
|
|
|
209
199
|
MOD_CAPS = 0x1 << 7,
|
|
210
200
|
|
|
211
|
-
};//
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
struct Key
|
|
215
|
-
{
|
|
216
|
-
|
|
217
|
-
String chars;
|
|
218
|
-
|
|
219
|
-
int code;
|
|
220
|
-
|
|
221
|
-
uint modifiers;
|
|
222
|
-
|
|
223
|
-
int repeat;
|
|
224
|
-
|
|
225
|
-
Key ();
|
|
226
|
-
|
|
227
|
-
Key (
|
|
228
|
-
const char* chars, int code,
|
|
229
|
-
uint modifiers = 0, int repeat = 0);
|
|
230
|
-
|
|
231
|
-
};// Key
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
struct Points
|
|
235
|
-
{
|
|
236
|
-
|
|
237
|
-
struct Point
|
|
238
|
-
{
|
|
239
|
-
|
|
240
|
-
coord x, y;
|
|
241
|
-
|
|
242
|
-
};// Point
|
|
243
|
-
|
|
244
|
-
enum {MAX = 10};
|
|
245
|
-
|
|
246
|
-
int type;
|
|
247
|
-
|
|
248
|
-
size_t size;
|
|
249
|
-
|
|
250
|
-
uint modifiers, count;
|
|
251
|
-
|
|
252
|
-
bool drag;
|
|
253
|
-
|
|
254
|
-
union
|
|
255
|
-
{
|
|
256
|
-
|
|
257
|
-
struct {coord x, y;};
|
|
258
|
-
|
|
259
|
-
Point points[MAX];
|
|
260
|
-
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
Points ();
|
|
264
|
-
|
|
265
|
-
Points (
|
|
266
|
-
int type, coord x, coord y,
|
|
267
|
-
uint modifiers = 0, uint count = 1, bool drag = false);
|
|
268
|
-
|
|
269
|
-
Points (
|
|
270
|
-
int type, const Point* points, size_t size,
|
|
271
|
-
uint modifiers = 0, uint count = 1, bool drag = false);
|
|
272
|
-
|
|
273
|
-
Point& operator [] (size_t i) {return points[i];}
|
|
274
|
-
|
|
275
|
-
const Point& operator [] (size_t i) const {return points[i];}
|
|
276
|
-
|
|
277
|
-
};// Points
|
|
201
|
+
};// Modifier
|
|
278
202
|
|
|
279
203
|
|
|
280
204
|
}// Reflex
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
// -*- c++ -*-
|
|
2
|
+
#pragma once
|
|
3
|
+
#ifndef __REFLEX_EVENT_H__
|
|
4
|
+
#define __REFLEX_EVENT_H__
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
#include <rays/point.h>
|
|
8
|
+
#include <rays/bounds.h>
|
|
9
|
+
#include <reflex/defs.h>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
namespace Rays
|
|
13
|
+
{
|
|
14
|
+
|
|
15
|
+
class Painter;
|
|
16
|
+
|
|
17
|
+
}// Rays
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
namespace Reflex
|
|
21
|
+
{
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class View;
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class Event
|
|
28
|
+
{
|
|
29
|
+
|
|
30
|
+
public:
|
|
31
|
+
|
|
32
|
+
struct Coord3 {coord x, y, z;};
|
|
33
|
+
|
|
34
|
+
Event ();
|
|
35
|
+
|
|
36
|
+
void block ();
|
|
37
|
+
|
|
38
|
+
bool is_blocked () const;
|
|
39
|
+
|
|
40
|
+
private:
|
|
41
|
+
|
|
42
|
+
bool blocked;
|
|
43
|
+
|
|
44
|
+
};// Event
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
struct UpdateEvent : public Event
|
|
48
|
+
{
|
|
49
|
+
|
|
50
|
+
float dt;
|
|
51
|
+
|
|
52
|
+
UpdateEvent (float dt = 0);
|
|
53
|
+
|
|
54
|
+
};// UpdateEvent
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
struct DrawEvent : public Event
|
|
58
|
+
{
|
|
59
|
+
|
|
60
|
+
View* view;
|
|
61
|
+
|
|
62
|
+
Painter* painter;
|
|
63
|
+
|
|
64
|
+
Bounds bounds;
|
|
65
|
+
|
|
66
|
+
float dt, fps;
|
|
67
|
+
|
|
68
|
+
DrawEvent (float dt = 0, float fps = 0);
|
|
69
|
+
|
|
70
|
+
};// DrawEvent
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
struct FrameEvent : public Event
|
|
74
|
+
{
|
|
75
|
+
|
|
76
|
+
Bounds frame;
|
|
77
|
+
|
|
78
|
+
coord dx, dy;
|
|
79
|
+
|
|
80
|
+
union
|
|
81
|
+
{
|
|
82
|
+
struct {coord dwidth, dheight;};
|
|
83
|
+
struct {coord dw, dh;};
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
FrameEvent (const Bounds& frame = 0, coord dx = 0, coord dy = 0, coord dwidth = 0, coord dheight = 0);
|
|
87
|
+
|
|
88
|
+
bool is_move () const;
|
|
89
|
+
|
|
90
|
+
bool is_resize () const;
|
|
91
|
+
|
|
92
|
+
};// FrameEvent
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
struct ScrollEvent : public Event
|
|
96
|
+
{
|
|
97
|
+
|
|
98
|
+
union
|
|
99
|
+
{
|
|
100
|
+
struct {coord x, y, z;};
|
|
101
|
+
Coord3 scroll_;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
union
|
|
105
|
+
{
|
|
106
|
+
struct {coord dx, dy, dz;};
|
|
107
|
+
Coord3 delta_;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
ScrollEvent ();
|
|
111
|
+
|
|
112
|
+
ScrollEvent (coord x, coord y, coord z, coord dx, coord dy, coord dz);
|
|
113
|
+
|
|
114
|
+
Rays::Point& scroll ();
|
|
115
|
+
|
|
116
|
+
const Rays::Point& scroll () const;
|
|
117
|
+
|
|
118
|
+
Rays::Point& delta ();
|
|
119
|
+
|
|
120
|
+
const Rays::Point& delta () const;
|
|
121
|
+
|
|
122
|
+
};// ScrollEvent
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
struct FocusEvent : public Event
|
|
126
|
+
{
|
|
127
|
+
|
|
128
|
+
enum Type {NONE = 0, FOCUS, BLUR};
|
|
129
|
+
|
|
130
|
+
Type type;
|
|
131
|
+
|
|
132
|
+
View *focus, *last;
|
|
133
|
+
|
|
134
|
+
FocusEvent ();
|
|
135
|
+
|
|
136
|
+
FocusEvent (Type type, View* focus, View* last);
|
|
137
|
+
|
|
138
|
+
};// FocusEvent
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
struct KeyEvent : public Event
|
|
142
|
+
{
|
|
143
|
+
|
|
144
|
+
enum Type {NONE = 0, DOWN, UP};
|
|
145
|
+
|
|
146
|
+
Type type;
|
|
147
|
+
|
|
148
|
+
String chars;
|
|
149
|
+
|
|
150
|
+
int code;
|
|
151
|
+
|
|
152
|
+
uint modifiers;
|
|
153
|
+
|
|
154
|
+
int repeat;
|
|
155
|
+
|
|
156
|
+
bool capture;
|
|
157
|
+
|
|
158
|
+
KeyEvent ();
|
|
159
|
+
|
|
160
|
+
KeyEvent (
|
|
161
|
+
Type type, const char* chars, int code,
|
|
162
|
+
uint modifiers = 0, int repeat = 0);
|
|
163
|
+
|
|
164
|
+
};// KeyEvent
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
struct PointerEvent : public Event
|
|
168
|
+
{
|
|
169
|
+
|
|
170
|
+
enum Type {NONE = 0, DOWN, UP, MOVE};
|
|
171
|
+
|
|
172
|
+
enum {MAX = 10};
|
|
173
|
+
|
|
174
|
+
Type type;
|
|
175
|
+
|
|
176
|
+
uint pointer_type;
|
|
177
|
+
|
|
178
|
+
size_t size;
|
|
179
|
+
|
|
180
|
+
uint modifiers, count;
|
|
181
|
+
|
|
182
|
+
bool drag, capture;
|
|
183
|
+
|
|
184
|
+
union
|
|
185
|
+
{
|
|
186
|
+
struct {coord x, y, z;};
|
|
187
|
+
Coord3 positions[MAX];
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
PointerEvent ();
|
|
191
|
+
|
|
192
|
+
PointerEvent (
|
|
193
|
+
Type type, uint pointer_type, coord x, coord y,
|
|
194
|
+
uint modifiers = 0, uint count = 1, bool drag = false);
|
|
195
|
+
|
|
196
|
+
PointerEvent (
|
|
197
|
+
Type type, uint pointer_type, const Rays::Point* positions, size_t size,
|
|
198
|
+
uint modifiers = 0, uint count = 1, bool drag = false);
|
|
199
|
+
|
|
200
|
+
Rays::Point& position (size_t i = 0);
|
|
201
|
+
|
|
202
|
+
const Rays::Point& position (size_t i = 0) const;
|
|
203
|
+
|
|
204
|
+
Rays::Point& operator [] (size_t i);
|
|
205
|
+
|
|
206
|
+
const Rays::Point& operator [] (size_t i) const;
|
|
207
|
+
|
|
208
|
+
};// PointerEvent
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
struct WheelEvent : public Event
|
|
212
|
+
{
|
|
213
|
+
|
|
214
|
+
union
|
|
215
|
+
{
|
|
216
|
+
struct {coord dx, dy, dz;};
|
|
217
|
+
Coord3 delta_;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
union
|
|
221
|
+
{
|
|
222
|
+
struct {coord x, y, z;};
|
|
223
|
+
Coord3 position_;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
uint modifiers;
|
|
227
|
+
|
|
228
|
+
WheelEvent ();
|
|
229
|
+
|
|
230
|
+
WheelEvent (
|
|
231
|
+
coord dx, coord dy, coord dz, coord x = 0, coord y = 0, coord z = 0,
|
|
232
|
+
uint modifiers = 0);
|
|
233
|
+
|
|
234
|
+
Rays::Point& delta ();
|
|
235
|
+
|
|
236
|
+
const Rays::Point& delta () const;
|
|
237
|
+
|
|
238
|
+
Rays::Point& position ();
|
|
239
|
+
|
|
240
|
+
const Rays::Point& position () const;
|
|
241
|
+
|
|
242
|
+
};// WheelEvent
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
struct CaptureEvent : public Event
|
|
246
|
+
{
|
|
247
|
+
|
|
248
|
+
uint begin, end;
|
|
249
|
+
|
|
250
|
+
CaptureEvent ();
|
|
251
|
+
|
|
252
|
+
CaptureEvent (uint begin, uint end);
|
|
253
|
+
|
|
254
|
+
};// CaptureEvent
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
}// Reflex
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
#endif//EOH
|
data/include/reflex/exception.h
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
#define __REFLEX_EXCEPTION_H__
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
#include <
|
|
7
|
+
#include <xot/exception.h>
|
|
8
8
|
#include <reflex/defs.h>
|
|
9
9
|
|
|
10
10
|
|
|
@@ -12,27 +12,33 @@ namespace Reflex
|
|
|
12
12
|
{
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
class
|
|
15
|
+
class ReflexError : public Xot::XotError
|
|
16
16
|
{
|
|
17
|
+
typedef Xot::XotError Super;
|
|
18
|
+
public: ReflexError (const char* str = NULL);
|
|
19
|
+
};
|
|
17
20
|
|
|
18
|
-
typedef std::runtime_error Super;
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
class LayoutError : public ReflexError
|
|
23
|
+
{
|
|
24
|
+
typedef ReflexError Super;
|
|
25
|
+
public: LayoutError (const char* str = NULL);
|
|
26
|
+
};
|
|
21
27
|
|
|
22
|
-
ReflexException (const char* format = NULL, ...);
|
|
23
28
|
|
|
24
|
-
|
|
29
|
+
namespace ErrorFunctions
|
|
30
|
+
{
|
|
25
31
|
|
|
26
|
-
|
|
32
|
+
using namespace Xot::ErrorFunctions;
|
|
27
33
|
|
|
28
|
-
|
|
34
|
+
void reflex_error (const char* file, int line, const char* format = NULL, ...);
|
|
29
35
|
|
|
30
|
-
|
|
36
|
+
void layout_error (const char* file, int line, const char* format = NULL, ...);
|
|
31
37
|
|
|
32
|
-
}
|
|
38
|
+
}// ErrorFunctions
|
|
33
39
|
|
|
34
40
|
|
|
35
|
-
|
|
41
|
+
using namespace ErrorFunctions;
|
|
36
42
|
|
|
37
43
|
|
|
38
44
|
}// Reflex
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// -*- c++ -*-
|
|
2
|
+
#pragma once
|
|
3
|
+
#ifndef __REFLEX_IMAGE_VIEW_H__
|
|
4
|
+
#define __REFLEX_IMAGE_VIEW_H__
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
#include <xot/pimpl.h>
|
|
8
|
+
#include <rays/image.h>
|
|
9
|
+
#include <reflex/view.h>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
namespace Reflex
|
|
13
|
+
{
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class ImageView : public View
|
|
17
|
+
{
|
|
18
|
+
|
|
19
|
+
typedef View Super;
|
|
20
|
+
|
|
21
|
+
public:
|
|
22
|
+
|
|
23
|
+
ImageView (const char* name = NULL);
|
|
24
|
+
|
|
25
|
+
~ImageView ();
|
|
26
|
+
|
|
27
|
+
void set_image (Image image);
|
|
28
|
+
|
|
29
|
+
Image get_image () const;
|
|
30
|
+
|
|
31
|
+
Rays::Point content_size () const;
|
|
32
|
+
|
|
33
|
+
void on_draw (DrawEvent* e);
|
|
34
|
+
|
|
35
|
+
struct Data;
|
|
36
|
+
|
|
37
|
+
Xot::PImpl<Data> self;
|
|
38
|
+
|
|
39
|
+
};// ImageView
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
}// Reflex
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
#endif//EOH
|
data/include/reflex/reflex.h
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
#include <rucy/class.h>
|
|
9
9
|
#include <rucy/extension.h>
|
|
10
10
|
#include <reflex/application.h>
|
|
11
|
+
#include <reflex/ruby/event.h>
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
namespace Reflex
|
|
@@ -24,28 +25,40 @@ namespace Reflex
|
|
|
24
25
|
|
|
25
26
|
public:
|
|
26
27
|
|
|
27
|
-
virtual
|
|
28
|
+
virtual void start ()
|
|
28
29
|
{
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
RUCY_SYM(start);
|
|
31
|
+
this->value.call(start);
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
virtual
|
|
34
|
+
virtual void quit ()
|
|
34
35
|
{
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
RUCY_SYM(quit);
|
|
37
|
+
this->value.call(quit);
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
virtual
|
|
40
|
+
virtual void on_start (Event* e)
|
|
40
41
|
{
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
RUCY_SYM(on_start);
|
|
43
|
+
this->value.call(on_start, Rucy::value(e));
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
virtual
|
|
46
|
+
virtual void on_quit (Event* e)
|
|
46
47
|
{
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
RUCY_SYM(on_quit);
|
|
49
|
+
this->value.call(on_quit, Rucy::value(e));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
virtual void on_preference (Event* e)
|
|
53
|
+
{
|
|
54
|
+
RUCY_SYM(on_preference);
|
|
55
|
+
this->value.call(on_preference, Rucy::value(e));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
virtual void on_about (Event* e)
|
|
59
|
+
{
|
|
60
|
+
RUCY_SYM(on_about);
|
|
61
|
+
this->value.call(on_about, Rucy::value(e));
|
|
49
62
|
}
|
|
50
63
|
|
|
51
64
|
};// RubyApplication
|
|
@@ -54,7 +67,21 @@ namespace Reflex
|
|
|
54
67
|
}// Reflex
|
|
55
68
|
|
|
56
69
|
|
|
57
|
-
|
|
70
|
+
RUCY_DECLARE_WRAPPER_VALUE_FROM_TO(Reflex::Application)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
namespace Rucy
|
|
74
|
+
{
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
inline Value
|
|
78
|
+
value (Reflex::Application::Ref& ref, Value klass = Reflex::application_class())
|
|
79
|
+
{
|
|
80
|
+
return value(ref.get(), klass);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
}// Rucy
|
|
58
85
|
|
|
59
86
|
|
|
60
87
|
#endif//EOH
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// -*- c++ -*-
|
|
2
|
+
#pragma once
|
|
3
|
+
#ifndef __REFLEX_RUBY_EVENT_H__
|
|
4
|
+
#define __REFLEX_RUBY_EVENT_H__
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
#include <rucy/rucy.h>
|
|
8
|
+
#include <rucy/class.h>
|
|
9
|
+
#include <rucy/extension.h>
|
|
10
|
+
#include <reflex/event.h>
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
namespace Reflex
|
|
14
|
+
{
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
Rucy::Class event_class ();
|
|
18
|
+
// class Reflex::Event
|
|
19
|
+
|
|
20
|
+
Rucy::Class update_event_class ();
|
|
21
|
+
// class Reflex::UpdateEvent
|
|
22
|
+
|
|
23
|
+
Rucy::Class draw_event_class ();
|
|
24
|
+
// class Reflex::DrawEvent
|
|
25
|
+
|
|
26
|
+
Rucy::Class frame_event_class ();
|
|
27
|
+
// class Reflex::FrameEvent
|
|
28
|
+
|
|
29
|
+
Rucy::Class scroll_event_class ();
|
|
30
|
+
// class Reflex::ScrollEvent
|
|
31
|
+
|
|
32
|
+
Rucy::Class focus_event_class ();
|
|
33
|
+
// class Reflex::FocusEvent
|
|
34
|
+
|
|
35
|
+
Rucy::Class key_event_class ();
|
|
36
|
+
// class Reflex::KeyEvent
|
|
37
|
+
|
|
38
|
+
Rucy::Class pointer_event_class ();
|
|
39
|
+
// class Reflex::PointerEvent
|
|
40
|
+
|
|
41
|
+
Rucy::Class wheel_event_class ();
|
|
42
|
+
// class Reflex::WheelEvent
|
|
43
|
+
|
|
44
|
+
Rucy::Class capture_event_class ();
|
|
45
|
+
// class Reflex::CaptureEvent
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
}// Reflex
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
RUCY_DECLARE_VALUE_FROM_TO(Reflex::Event)
|
|
52
|
+
|
|
53
|
+
RUCY_DECLARE_VALUE_FROM_TO(Reflex::UpdateEvent)
|
|
54
|
+
|
|
55
|
+
RUCY_DECLARE_VALUE_FROM_TO(Reflex::DrawEvent)
|
|
56
|
+
|
|
57
|
+
RUCY_DECLARE_VALUE_FROM_TO(Reflex::FrameEvent)
|
|
58
|
+
|
|
59
|
+
RUCY_DECLARE_VALUE_FROM_TO(Reflex::ScrollEvent)
|
|
60
|
+
|
|
61
|
+
RUCY_DECLARE_VALUE_FROM_TO(Reflex::FocusEvent)
|
|
62
|
+
|
|
63
|
+
RUCY_DECLARE_VALUE_FROM_TO(Reflex::KeyEvent)
|
|
64
|
+
|
|
65
|
+
RUCY_DECLARE_VALUE_FROM_TO(Reflex::PointerEvent)
|
|
66
|
+
|
|
67
|
+
RUCY_DECLARE_VALUE_FROM_TO(Reflex::WheelEvent)
|
|
68
|
+
|
|
69
|
+
RUCY_DECLARE_VALUE_FROM_TO(Reflex::CaptureEvent)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
#endif//EOH
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// -*- c++ -*-
|
|
2
|
+
#pragma once
|
|
3
|
+
#ifndef __REFLEX_RUBY_IMAGE_VIEW_H__
|
|
4
|
+
#define __REFLEX_RUBY_IMAGE_VIEW_H__
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
#include <reflex/image_view.h>
|
|
8
|
+
#include <reflex/ruby/view.h>
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
namespace Reflex
|
|
12
|
+
{
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
Rucy::Class image_view_class ();
|
|
16
|
+
// class Reflex::ImageView
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
}// Reflex
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
RUCY_DECLARE_WRAPPER_VALUE_FROM_TO(Reflex::ImageView)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
#endif//EOH
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// -*- c++ -*-
|
|
2
|
+
#pragma once
|
|
3
|
+
#ifndef __REFLEX_RUBY_SELECTOR_H__
|
|
4
|
+
#define __REFLEX_RUBY_SELECTOR_H__
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
#include <rucy/rucy.h>
|
|
8
|
+
#include <rucy/class.h>
|
|
9
|
+
#include <rucy/extension.h>
|
|
10
|
+
#include <reflex/selector.h>
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
namespace Reflex
|
|
14
|
+
{
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
Rucy::Class selector_class ();
|
|
18
|
+
// class Reflex::Selector
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
}// Reflex
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
RUCY_DECLARE_VALUE_FROM_TO(Reflex::Selector)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
#endif//EOH
|