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.
Files changed (225) hide show
  1. checksums.yaml +7 -0
  2. data/.doc/ext/reflex/application.cpp +54 -39
  3. data/.doc/ext/reflex/capture_event.cpp +87 -0
  4. data/.doc/ext/reflex/draw_event.cpp +103 -0
  5. data/.doc/ext/reflex/event.cpp +73 -0
  6. data/.doc/ext/reflex/focus_event.cpp +98 -0
  7. data/.doc/ext/reflex/frame_event.cpp +133 -0
  8. data/.doc/ext/reflex/image_view.cpp +74 -0
  9. data/.doc/ext/reflex/key_event.cpp +124 -0
  10. data/.doc/ext/reflex/native.cpp +45 -6
  11. data/.doc/ext/reflex/pointer_event.cpp +181 -0
  12. data/.doc/ext/reflex/reflex.cpp +17 -41
  13. data/.doc/ext/reflex/scroll_event.cpp +141 -0
  14. data/.doc/ext/reflex/selector.cpp +135 -0
  15. data/.doc/ext/reflex/style.cpp +253 -0
  16. data/.doc/ext/reflex/style_length.cpp +133 -0
  17. data/.doc/ext/reflex/style_length2.cpp +149 -0
  18. data/.doc/ext/reflex/style_length4.cpp +192 -0
  19. data/.doc/ext/reflex/update_event.cpp +77 -0
  20. data/.doc/ext/reflex/view.cpp +408 -88
  21. data/.doc/ext/reflex/wheel_event.cpp +146 -0
  22. data/.doc/ext/reflex/window.cpp +95 -92
  23. data/Rakefile +6 -5
  24. data/VERSION +1 -1
  25. data/ext/reflex/application.cpp +67 -49
  26. data/ext/reflex/capture_event.cpp +92 -0
  27. data/ext/reflex/draw_event.cpp +110 -0
  28. data/ext/reflex/event.cpp +77 -0
  29. data/ext/reflex/extconf.rb +18 -68
  30. data/ext/reflex/focus_event.cpp +104 -0
  31. data/ext/reflex/frame_event.cpp +143 -0
  32. data/ext/reflex/image_view.cpp +77 -0
  33. data/ext/reflex/key_event.cpp +133 -0
  34. data/ext/reflex/native.cpp +45 -6
  35. data/ext/reflex/pointer_event.cpp +195 -0
  36. data/ext/reflex/reflex.cpp +21 -47
  37. data/ext/reflex/scroll_event.cpp +152 -0
  38. data/ext/reflex/selector.cpp +144 -0
  39. data/ext/reflex/style.cpp +277 -0
  40. data/ext/reflex/style_length.cpp +140 -0
  41. data/ext/reflex/style_length2.cpp +157 -0
  42. data/ext/reflex/style_length4.cpp +204 -0
  43. data/ext/reflex/update_event.cpp +81 -0
  44. data/ext/reflex/view.cpp +469 -114
  45. data/ext/reflex/wheel_event.cpp +158 -0
  46. data/ext/reflex/window.cpp +130 -123
  47. data/include/reflex/application.h +12 -7
  48. data/include/reflex/defs.h +13 -89
  49. data/include/reflex/event.h +260 -0
  50. data/include/reflex/exception.h +17 -11
  51. data/include/reflex/image_view.h +45 -0
  52. data/include/reflex/reflex.h +2 -6
  53. data/include/reflex/ruby/application.h +40 -13
  54. data/include/reflex/ruby/event.h +72 -0
  55. data/include/reflex/ruby/image_view.h +25 -0
  56. data/include/reflex/ruby/selector.h +27 -0
  57. data/include/reflex/ruby/style.h +27 -0
  58. data/include/reflex/ruby/style_length.h +37 -0
  59. data/include/reflex/ruby/view.h +193 -38
  60. data/include/reflex/ruby/window.h +123 -39
  61. data/include/reflex/ruby.h +3 -2
  62. data/include/reflex/selector.h +64 -0
  63. data/include/reflex/style.h +144 -0
  64. data/include/reflex/style_length.h +147 -0
  65. data/include/reflex/view.h +182 -19
  66. data/include/reflex/window.h +35 -19
  67. data/include/reflex.h +7 -0
  68. data/lib/reflex/application.rb +14 -5
  69. data/lib/reflex/arc_shape.rb +20 -0
  70. data/lib/reflex/button.rb +75 -0
  71. data/lib/reflex/capture_event.rb +37 -0
  72. data/lib/reflex/color.rb +13 -0
  73. data/lib/reflex/color_space.rb +13 -0
  74. data/lib/reflex/draw_event.rb +19 -0
  75. data/lib/reflex/ellipse_shape.rb +20 -0
  76. data/lib/reflex/ext.rb +1 -1
  77. data/lib/reflex/flags.rb +18 -0
  78. data/lib/reflex/focus_event.rb +38 -0
  79. data/lib/reflex/font.rb +13 -0
  80. data/lib/reflex/frame_event.rb +42 -0
  81. data/lib/reflex/helper.rb +87 -30
  82. data/lib/reflex/image_view.rb +25 -0
  83. data/lib/reflex/key_event.rb +38 -0
  84. data/lib/reflex/line_shape.rb +20 -0
  85. data/lib/reflex/list_view.rb +15 -0
  86. data/lib/reflex/model.rb +149 -0
  87. data/lib/reflex/model_owner.rb +57 -0
  88. data/lib/reflex/model_view.rb +22 -0
  89. data/lib/reflex/module.rb +11 -7
  90. data/lib/reflex/pointer_event.rb +85 -0
  91. data/lib/reflex/rect_shape.rb +20 -0
  92. data/lib/reflex/reflex.rb +13 -2
  93. data/lib/reflex/scroll_event.rb +19 -0
  94. data/lib/reflex/selector.rb +31 -0
  95. data/lib/reflex/shader.rb +13 -0
  96. data/lib/reflex/shape.rb +34 -0
  97. data/lib/reflex/style.rb +55 -0
  98. data/lib/reflex/style_length.rb +30 -0
  99. data/lib/reflex/style_length2.rb +34 -0
  100. data/lib/reflex/style_length4.rb +38 -0
  101. data/lib/reflex/text_view.rb +55 -0
  102. data/lib/reflex/update_event.rb +19 -0
  103. data/lib/reflex/view.rb +38 -4
  104. data/lib/reflex/wheel_event.rb +19 -0
  105. data/lib/reflex/window.rb +7 -5
  106. data/lib/reflex.rb +38 -1
  107. data/lib/reflexion/include.rb +5 -0
  108. data/lib/reflexion.rb +100 -0
  109. data/reflex.gemspec +3 -4
  110. data/samples/app.rb +13 -0
  111. data/samples/bats.rb +91 -0
  112. data/samples/checker.rb +36 -0
  113. data/{examples/ruby/shapes.rb → samples/fans.rb} +12 -16
  114. data/samples/fps.rb +46 -0
  115. data/samples/grid.rb +60 -0
  116. data/{examples/ruby → samples}/hello.rb +14 -16
  117. data/samples/image.rb +44 -0
  118. data/samples/ios/hello/hello/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  119. data/samples/ios/hello/hello/Images.xcassets/LaunchImage.launchimage/Contents.json +51 -0
  120. data/samples/ios/hello/hello/en.lproj/InfoPlist.strings +2 -0
  121. data/samples/ios/hello/hello/hello-Info.plist +47 -0
  122. data/samples/ios/hello/hello/hello-Prefix.pch +10 -0
  123. data/samples/ios/hello/hello/main.cpp +79 -0
  124. data/samples/ios/hello/hello.xcodeproj/project.pbxproj +725 -0
  125. data/{examples/ruby → samples}/key.rb +11 -14
  126. data/samples/layout.rb +89 -0
  127. data/samples/model.rb +86 -0
  128. data/samples/osx/hello/hello/Images.xcassets/AppIcon.appiconset/Contents.json +58 -0
  129. data/samples/osx/hello/hello/en.lproj/Credits.rtf +29 -0
  130. data/samples/osx/hello/hello/en.lproj/InfoPlist.strings +2 -0
  131. data/samples/osx/hello/hello/hello-Info.plist +32 -0
  132. data/samples/osx/hello/hello/hello-Prefix.pch +3 -0
  133. data/samples/osx/hello/hello/main.cpp +79 -0
  134. data/samples/osx/hello/hello.xcodeproj/project.pbxproj +725 -0
  135. data/samples/reflexion/hello.rb +24 -0
  136. data/samples/reflexion/paint.rb +40 -0
  137. data/samples/reflexion/pulse.rb +34 -0
  138. data/samples/repl.rb +69 -0
  139. data/samples/shader.rb +41 -0
  140. data/samples/shapes.rb +30 -0
  141. data/{examples/ruby → samples}/text.rb +7 -8
  142. data/samples/tree.rb +71 -0
  143. data/samples/views.rb +41 -0
  144. data/samples/visuals.rb +22 -0
  145. data/src/event.cpp +225 -0
  146. data/src/exception.cpp +24 -15
  147. data/src/image_view.cpp +70 -0
  148. data/src/ios/app_delegate.h +17 -0
  149. data/src/ios/app_delegate.mm +120 -0
  150. data/src/ios/application.mm +116 -0
  151. data/src/{cocoa/applicationdata.h → ios/application_data.h} +6 -6
  152. data/src/ios/event.h +26 -0
  153. data/src/ios/event.mm +31 -0
  154. data/src/ios/native_window.h +37 -0
  155. data/src/ios/native_window.mm +220 -0
  156. data/src/ios/opengl_view.h +13 -0
  157. data/src/ios/opengl_view.mm +131 -0
  158. data/src/{cocoa → ios}/reflex.mm +8 -12
  159. data/src/ios/window.mm +303 -0
  160. data/src/ios/window_data.h +75 -0
  161. data/src/osx/app_delegate.h +17 -0
  162. data/src/{cocoa/cocoaapplication.mm → osx/app_delegate.mm} +90 -48
  163. data/src/osx/application.mm +132 -0
  164. data/src/osx/application_data.h +45 -0
  165. data/src/osx/event.h +42 -0
  166. data/src/osx/event.mm +112 -0
  167. data/src/osx/native_window.h +26 -0
  168. data/src/osx/native_window.mm +322 -0
  169. data/src/{cocoa/openglview.h → osx/opengl_view.h} +0 -4
  170. data/src/{cocoa/openglview.mm → osx/opengl_view.mm} +66 -23
  171. data/src/osx/reflex.mm +50 -0
  172. data/src/osx/window.mm +308 -0
  173. data/src/osx/window_data.h +75 -0
  174. data/src/selector.cpp +121 -0
  175. data/src/style.cpp +576 -0
  176. data/src/style_length.cpp +341 -0
  177. data/src/view.cpp +1228 -129
  178. data/src/win32/application.cpp +1 -1
  179. data/src/window.cpp +54 -26
  180. data/test/helper.rb +8 -4
  181. data/test/test_capture_event.rb +41 -0
  182. data/test/test_event.rb +20 -0
  183. data/test/test_has_frame.rb +45 -0
  184. data/test/test_model.rb +9 -0
  185. data/test/test_model_owner.rb +9 -0
  186. data/test/test_selector.rb +75 -0
  187. data/test/test_style.rb +70 -0
  188. data/test/test_style_length.rb +38 -0
  189. data/test/test_style_length2.rb +50 -0
  190. data/test/test_style_length4.rb +56 -0
  191. data/test/test_view.rb +97 -23
  192. data/test/test_window.rb +54 -46
  193. metadata +205 -84
  194. data/.doc/ext/reflex/defs.cpp +0 -8
  195. data/.doc/ext/reflex/key.cpp +0 -122
  196. data/.doc/ext/reflex/points.cpp +0 -151
  197. data/.gitignore +0 -14
  198. data/ChangeLog +0 -8
  199. data/examples/hello/.gitignore +0 -2
  200. data/examples/hello/Rakefile +0 -41
  201. data/examples/hello/main.cpp +0 -18
  202. data/examples/ruby/app.rb +0 -13
  203. data/examples/ruby/checker.rb +0 -41
  204. data/examples/ruby/fps.rb +0 -49
  205. data/examples/ruby/grid.rb +0 -65
  206. data/examples/ruby/views.rb +0 -88
  207. data/examples/ruby/visuals.rb +0 -27
  208. data/ext/reflex/defs.cpp +0 -8
  209. data/ext/reflex/key.cpp +0 -129
  210. data/ext/reflex/points.cpp +0 -161
  211. data/include/reflex/ruby/key.h +0 -39
  212. data/include/reflex/ruby/points.h +0 -39
  213. data/lib/reflex/visuals/string.rb +0 -53
  214. data/src/cocoa/application.mm +0 -101
  215. data/src/cocoa/cocoaapplication.h +0 -21
  216. data/src/cocoa/cocoawindow.h +0 -46
  217. data/src/cocoa/cocoawindow.mm +0 -230
  218. data/src/cocoa/defs.h +0 -34
  219. data/src/cocoa/defs.mm +0 -87
  220. data/src/cocoa/window.mm +0 -148
  221. data/src/cocoa/windowdata.h +0 -56
  222. data/src/defs.cpp +0 -47
  223. data/src/helper.h +0 -12
  224. data/src/reflex.cpp +0 -43
  225. /data/{README → README.md} +0 -0
@@ -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 KeyCodes
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
- };// KeyCodes
151
+ };// KeyCode
160
152
 
161
153
 
162
- enum PointTypes
154
+ enum PointerType
163
155
  {
164
156
 
165
- POINT_NONE = 0,
157
+ POINTER_NONE = 0,
166
158
 
167
- POINT_MOUSE_LEFT = 0x1 << 0,
159
+ POINTER_MOUSE_LEFT = 0x1 << 0,
168
160
 
169
- POINT_MOUSE_RIGHT = 0x1 << 1,
161
+ POINTER_MOUSE_RIGHT = 0x1 << 1,
170
162
 
171
- POINT_MOUSE_MIDDLE = 0x1 << 2,
163
+ POINTER_MOUSE_MIDDLE = 0x1 << 2,
172
164
 
173
- POINT_TOUCH = 0x1 << 3,
165
+ POINTER_TOUCH = 0x1 << 3,
174
166
 
175
- MOUSE_LEFT = POINT_MOUSE_LEFT,
167
+ POINTER_PEN = 0x1 << 4,
176
168
 
177
- MOUSE_RIGHT = POINT_MOUSE_RIGHT,
169
+ POINTER_TYPE_LAST = POINTER_PEN,
178
170
 
179
- MOUSE_MIDDLE = POINT_MOUSE_MIDDLE
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
- };// Modifiers
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
@@ -4,7 +4,7 @@
4
4
  #define __REFLEX_EXCEPTION_H__
5
5
 
6
6
 
7
- #include <stdexcept>
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 ReflexException : public std::runtime_error
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
- public:
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
- ~ReflexException () throw();
29
+ namespace ErrorFunctions
30
+ {
25
31
 
26
- const char* what () const throw();
32
+ using namespace Xot::ErrorFunctions;
27
33
 
28
- private:
34
+ void reflex_error (const char* file, int line, const char* format = NULL, ...);
29
35
 
30
- String text;
36
+ void layout_error (const char* file, int line, const char* format = NULL, ...);
31
37
 
32
- };// ReflexException
38
+ }// ErrorFunctions
33
39
 
34
40
 
35
- void reflex_error (const char* format = NULL, ...);
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
@@ -11,13 +11,9 @@ namespace Reflex
11
11
  {
12
12
 
13
13
 
14
- bool init ();
14
+ void init ();
15
15
 
16
- bool fin ();
17
-
18
- bool run (const char* name = NULL);
19
-
20
- bool quit ();
16
+ void fin ();
21
17
 
22
18
 
23
19
  }// Reflex
@@ -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 bool run ()
28
+ virtual void start ()
28
29
  {
29
- SYM(run);
30
- return this->value.call(run);
30
+ RUCY_SYM(start);
31
+ this->value.call(start);
31
32
  }
32
33
 
33
- virtual bool quit ()
34
+ virtual void quit ()
34
35
  {
35
- SYM(quit);
36
- return this->value.call(quit);
36
+ RUCY_SYM(quit);
37
+ this->value.call(quit);
37
38
  }
38
39
 
39
- virtual bool preference ()
40
+ virtual void on_start (Event* e)
40
41
  {
41
- SYM(preference);
42
- return this->value.call(preference);
42
+ RUCY_SYM(on_start);
43
+ this->value.call(on_start, Rucy::value(e));
43
44
  }
44
45
 
45
- virtual bool about ()
46
+ virtual void on_quit (Event* e)
46
47
  {
47
- SYM(about);
48
- return this->value.call(about);
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
- RUCY_WRAPPER_VALUE_FROM_TO(Reflex::Application, Reflex::application_class())
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