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
@@ -0,0 +1,27 @@
1
+ // -*- c++ -*-
2
+ #pragma once
3
+ #ifndef __REFLEX_RUBY_STYLE_H__
4
+ #define __REFLEX_RUBY_STYLE_H__
5
+
6
+
7
+ #include <rucy/rucy.h>
8
+ #include <rucy/class.h>
9
+ #include <rucy/extension.h>
10
+ #include <reflex/style.h>
11
+
12
+
13
+ namespace Reflex
14
+ {
15
+
16
+
17
+ Rucy::Class style_class ();
18
+ // class Reflex::Style
19
+
20
+
21
+ }// Reflex
22
+
23
+
24
+ RUCY_DECLARE_VALUE_FROM_TO(Reflex::Style)
25
+
26
+
27
+ #endif//EOH
@@ -0,0 +1,37 @@
1
+ // -*- c++ -*-
2
+ #pragma once
3
+ #ifndef __REFLEX_RUBY_STYLE_LENGTH_H__
4
+ #define __REFLEX_RUBY_STYLE_LENGTH_H__
5
+
6
+
7
+ #include <rucy/rucy.h>
8
+ #include <rucy/class.h>
9
+ #include <rucy/extension.h>
10
+ #include <reflex/style.h>
11
+
12
+
13
+ namespace Reflex
14
+ {
15
+
16
+
17
+ Rucy::Class style_length_class ();
18
+ // class Reflex::StyleLength
19
+
20
+ Rucy::Class style_length2_class ();
21
+ // class Reflex::StyleLength2
22
+
23
+ Rucy::Class style_length4_class ();
24
+ // class Reflex::StyleLength4
25
+
26
+
27
+ }// Reflex
28
+
29
+
30
+ RUCY_DECLARE_VALUE_FROM_TO(Reflex::StyleLength)
31
+
32
+ RUCY_DECLARE_VALUE_FROM_TO(Reflex::StyleLength2)
33
+
34
+ RUCY_DECLARE_VALUE_FROM_TO(Reflex::StyleLength4)
35
+
36
+
37
+ #endif//EOH
@@ -7,11 +7,8 @@
7
7
  #include <rucy/rucy.h>
8
8
  #include <rucy/class.h>
9
9
  #include <rucy/extension.h>
10
- #include <rays/ruby/bounds.h>
11
- #include <rays/ruby/painter.h>
12
10
  #include <reflex/view.h>
13
- #include <reflex/ruby/key.h>
14
- #include <reflex/ruby/points.h>
11
+ #include <reflex/ruby/event.h>
15
12
 
16
13
 
17
14
  namespace Reflex
@@ -28,70 +25,214 @@ namespace Reflex
28
25
 
29
26
  public:
30
27
 
31
- virtual bool show ()
28
+ RUCY_OVERRIDE_BEGIN(Rucy::ClassWrapper<T>)
29
+
30
+ RUCY_OVERRIDE_ID(content_size)
31
+ RUCY_OVERRIDE_ID(on_attach)
32
+ RUCY_OVERRIDE_ID(on_detach)
33
+ RUCY_OVERRIDE_ID(on_update)
34
+ RUCY_OVERRIDE_ID(on_draw)
35
+ RUCY_OVERRIDE_ID(on_move)
36
+ RUCY_OVERRIDE_ID(on_resize)
37
+ RUCY_OVERRIDE_ID(on_scroll)
38
+ RUCY_OVERRIDE_ID(on_focus)
39
+ RUCY_OVERRIDE_ID(on_blur)
40
+ RUCY_OVERRIDE_ID(on_key)
41
+ RUCY_OVERRIDE_ID(on_key_down)
42
+ RUCY_OVERRIDE_ID(on_key_up)
43
+ RUCY_OVERRIDE_ID(on_pointer)
44
+ RUCY_OVERRIDE_ID(on_pointer_down)
45
+ RUCY_OVERRIDE_ID(on_pointer_up)
46
+ RUCY_OVERRIDE_ID(on_pointer_move)
47
+ RUCY_OVERRIDE_ID(on_wheel)
48
+ RUCY_OVERRIDE_ID(on_capture)
49
+
50
+ RUCY_OVERRIDE_END
51
+
52
+ virtual void show ()
53
+ {
54
+ RUCY_SYM(show);
55
+ this->value.call(show);
56
+ }
57
+
58
+ virtual void hide ()
59
+ {
60
+ RUCY_SYM(hide);
61
+ this->value.call(hide);
62
+ }
63
+
64
+ virtual Point content_size () const
65
+ {
66
+ RUCY_SYM(content_size);
67
+ if (RUCY_IS_OVERRIDDEN(content_size, view_class()))
68
+ {
69
+ Rucy::Value ret = this->value.call(content_size);
70
+ return ret.is_nil() ? Super::content_size() : Rucy::to<Point>(ret);
71
+ }
72
+ else
73
+ return Super::content_size();
74
+ }
75
+
76
+ virtual void on_attach (Event* e)
77
+ {
78
+ RUCY_SYM(on_attach);
79
+ if (RUCY_IS_OVERRIDDEN(on_attach, view_class()))
80
+ this->value.call(on_attach, Rucy::value(e));
81
+ else
82
+ Super::on_attach(e);
83
+ }
84
+
85
+ virtual void on_detach (Event* e)
86
+ {
87
+ RUCY_SYM(on_detach);
88
+ if (RUCY_IS_OVERRIDDEN(on_detach, view_class()))
89
+ this->value.call(on_detach, Rucy::value(e));
90
+ else
91
+ Super::on_detach(e);
92
+ }
93
+
94
+ virtual void on_update (UpdateEvent* e)
95
+ {
96
+ RUCY_SYM(on_update);
97
+ if (RUCY_IS_OVERRIDDEN(on_update, view_class()))
98
+ this->value.call(on_update, Rucy::value(e));
99
+ else
100
+ Super::on_update(e);
101
+ }
102
+
103
+ virtual void on_draw (DrawEvent* e)
32
104
  {
33
- SYM(show);
34
- return this->value.call(show);
105
+ RUCY_SYM(on_draw);
106
+ if (RUCY_IS_OVERRIDDEN(on_draw, view_class()))
107
+ this->value.call(on_draw, Rucy::value(e));
108
+ else
109
+ Super::on_draw(e);
35
110
  }
36
111
 
37
- virtual bool hide ()
112
+ virtual void on_move (FrameEvent* e)
38
113
  {
39
- SYM(hide);
40
- return this->value.call(hide);
114
+ RUCY_SYM(on_move);
115
+ if (RUCY_IS_OVERRIDDEN(on_move, view_class()))
116
+ this->value.call(on_move, Rucy::value(e));
117
+ else
118
+ Super::on_move(e);
41
119
  }
42
120
 
43
- virtual void update (float dt)
121
+ virtual void on_resize (FrameEvent* e)
44
122
  {
45
- SYM(update);
46
- this->value.call(update, dt);
123
+ RUCY_SYM(on_resize);
124
+ if (RUCY_IS_OVERRIDDEN(on_resize, view_class()))
125
+ this->value.call(on_resize, Rucy::value(e));
126
+ else
127
+ Super::on_resize(e);
47
128
  }
48
129
 
49
- virtual void draw (Painter* p, const Bounds& b)
130
+ virtual void on_scroll (ScrollEvent* e)
50
131
  {
51
- SYM(draw);
52
- this->value.call(draw, Rucy::value(p), Rucy::value(b));
132
+ RUCY_SYM(on_scroll);
133
+ if (RUCY_IS_OVERRIDDEN(on_scroll, view_class()))
134
+ this->value.call(on_scroll, Rucy::value(e));
135
+ else
136
+ Super::on_scroll(e);
53
137
  }
54
138
 
55
- virtual void moved (coord dx, coord dy)
139
+ virtual void on_focus (FocusEvent* e)
56
140
  {
57
- SYM(moved);
58
- this->value.call(moved, dx, dy);
141
+ RUCY_SYM(on_focus);
142
+ if (RUCY_IS_OVERRIDDEN(on_focus, view_class()))
143
+ this->value.call(on_focus, Rucy::value(e));
144
+ else
145
+ Super::on_focus(e);
59
146
  }
60
147
 
61
- virtual void resized (coord dwidth, coord dheight)
148
+ virtual void on_blur (FocusEvent* e)
62
149
  {
63
- SYM(resized);
64
- this->value.call(resized, dwidth, dheight);
150
+ RUCY_SYM(on_blur);
151
+ if (RUCY_IS_OVERRIDDEN(on_blur, view_class()))
152
+ this->value.call(on_blur, Rucy::value(e));
153
+ else
154
+ Super::on_blur(e);
65
155
  }
66
156
 
67
- virtual void key_down (const Key& key)
157
+ virtual void on_key (KeyEvent* e)
68
158
  {
69
- SYM(key_down);
70
- this->value.call(key_down, Rucy::value(key));
159
+ RUCY_SYM(on_key);
160
+ if (RUCY_IS_OVERRIDDEN(on_key, view_class()))
161
+ this->value.call(on_key, Rucy::value(e));
162
+ else
163
+ Super::on_key(e);
71
164
  }
72
165
 
73
- virtual void key_up (const Key& key)
166
+ virtual void on_key_down (KeyEvent* e)
74
167
  {
75
- SYM(key_up);
76
- this->value.call(key_up, Rucy::value(key));
168
+ RUCY_SYM(on_key_down);
169
+ if (RUCY_IS_OVERRIDDEN(on_key_down, view_class()))
170
+ this->value.call(on_key_down, Rucy::value(e));
171
+ else
172
+ Super::on_key_down(e);
77
173
  }
78
174
 
79
- virtual void points_down (const Points& points)
175
+ virtual void on_key_up (KeyEvent* e)
80
176
  {
81
- SYM(points_down);
82
- this->value.call(points_down, Rucy::value(points));
177
+ RUCY_SYM(on_key_up);
178
+ if (RUCY_IS_OVERRIDDEN(on_key_up, view_class()))
179
+ this->value.call(on_key_up, Rucy::value(e));
180
+ else
181
+ Super::on_key_up(e);
83
182
  }
84
183
 
85
- virtual void points_up (const Points& points)
184
+ virtual void on_pointer (PointerEvent* e)
86
185
  {
87
- SYM(points_up);
88
- this->value.call(points_up, Rucy::value(points));
186
+ RUCY_SYM(on_pointer);
187
+ if (RUCY_IS_OVERRIDDEN(on_pointer, view_class()))
188
+ this->value.call(on_pointer, Rucy::value(e));
189
+ else
190
+ Super::on_pointer(e);
89
191
  }
90
192
 
91
- virtual void points_moved (const Points& points)
193
+ virtual void on_pointer_down (PointerEvent* e)
92
194
  {
93
- SYM(points_moved);
94
- this->value.call(points_moved, Rucy::value(points));
195
+ RUCY_SYM(on_pointer_down);
196
+ if (RUCY_IS_OVERRIDDEN(on_pointer_down, view_class()))
197
+ this->value.call(on_pointer_down, Rucy::value(e));
198
+ else
199
+ Super::on_pointer_down(e);
200
+ }
201
+
202
+ virtual void on_pointer_up (PointerEvent* e)
203
+ {
204
+ RUCY_SYM(on_pointer_up);
205
+ if (RUCY_IS_OVERRIDDEN(on_pointer_up, view_class()))
206
+ this->value.call(on_pointer_up, Rucy::value(e));
207
+ else
208
+ Super::on_pointer_up(e);
209
+ }
210
+
211
+ virtual void on_pointer_move (PointerEvent* e)
212
+ {
213
+ RUCY_SYM(on_pointer_move);
214
+ if (RUCY_IS_OVERRIDDEN(on_pointer_move, view_class()))
215
+ this->value.call(on_pointer_move, Rucy::value(e));
216
+ else
217
+ Super::on_pointer_move(e);
218
+ }
219
+
220
+ virtual void on_wheel (WheelEvent* e)
221
+ {
222
+ RUCY_SYM(on_wheel);
223
+ if (RUCY_IS_OVERRIDDEN(on_wheel, view_class()))
224
+ this->value.call(on_wheel, Rucy::value(e));
225
+ else
226
+ Super::on_wheel(e);
227
+ }
228
+
229
+ virtual void on_capture (CaptureEvent* e)
230
+ {
231
+ RUCY_SYM(on_capture);
232
+ if (RUCY_IS_OVERRIDDEN(on_capture, view_class()))
233
+ this->value.call(on_capture, Rucy::value(e));
234
+ else
235
+ Super::on_capture(e);
95
236
  }
96
237
 
97
238
  };// RubyView
@@ -100,7 +241,21 @@ namespace Reflex
100
241
  }// Reflex
101
242
 
102
243
 
103
- RUCY_WRAPPER_VALUE_FROM_TO(Reflex::View, Reflex::view_class())
244
+ RUCY_DECLARE_WRAPPER_VALUE_FROM_TO(Reflex::View)
245
+
246
+
247
+ namespace Rucy
248
+ {
249
+
250
+
251
+ inline Value
252
+ value (Reflex::View::Ref& ref, Value klass = Reflex::view_class())
253
+ {
254
+ return value(ref.get(), klass);
255
+ }
256
+
257
+
258
+ }// Rucy
104
259
 
105
260
 
106
261
  #endif//EOH
@@ -8,8 +8,7 @@
8
8
  #include <rucy/class.h>
9
9
  #include <rucy/extension.h>
10
10
  #include <reflex/window.h>
11
- #include <reflex/ruby/key.h>
12
- #include <reflex/ruby/points.h>
11
+ #include <reflex/ruby/event.h>
13
12
 
14
13
 
15
14
  namespace Reflex
@@ -26,76 +25,147 @@ namespace Reflex
26
25
 
27
26
  public:
28
27
 
29
- virtual bool show ()
28
+ RUCY_OVERRIDE_BEGIN(Rucy::ClassWrapper<T>)
29
+
30
+ RUCY_OVERRIDE_ID(on_update)
31
+ RUCY_OVERRIDE_ID(on_draw)
32
+ RUCY_OVERRIDE_ID(on_move)
33
+ RUCY_OVERRIDE_ID(on_resize)
34
+ RUCY_OVERRIDE_ID(on_key)
35
+ RUCY_OVERRIDE_ID(on_key_down)
36
+ RUCY_OVERRIDE_ID(on_key_up)
37
+ RUCY_OVERRIDE_ID(on_pointer)
38
+ RUCY_OVERRIDE_ID(on_pointer_down)
39
+ RUCY_OVERRIDE_ID(on_pointer_up)
40
+ RUCY_OVERRIDE_ID(on_pointer_move)
41
+ RUCY_OVERRIDE_ID(on_wheel)
42
+
43
+ RUCY_OVERRIDE_END
44
+
45
+ virtual void show ()
46
+ {
47
+ RUCY_SYM(show);
48
+ this->value.call(show);
49
+ }
50
+
51
+ virtual void hide ()
52
+ {
53
+ RUCY_SYM(hide);
54
+ this->value.call(hide);
55
+ }
56
+
57
+ virtual void close ()
58
+ {
59
+ RUCY_SYM(close);
60
+ this->value.call(close);
61
+ }
62
+
63
+ virtual void on_update (UpdateEvent* e)
30
64
  {
31
- SYM(show);
32
- return this->value.call(show);
65
+ RUCY_SYM(on_update);
66
+ if (RUCY_IS_OVERRIDDEN(on_update, window_class()))
67
+ this->value.call(on_update, Rucy::value(e));
68
+ else
69
+ Super::on_update(e);
33
70
  }
34
71
 
35
- virtual bool hide ()
72
+ virtual void on_draw (DrawEvent* e)
36
73
  {
37
- SYM(hide);
38
- return this->value.call(hide);
74
+ RUCY_SYM(on_draw);
75
+ if (RUCY_IS_OVERRIDDEN(on_draw, window_class()))
76
+ this->value.call(on_draw, Rucy::value(e));
77
+ else
78
+ Super::on_draw(e);
39
79
  }
40
80
 
41
- virtual bool close ()
81
+ virtual void on_move (FrameEvent* e)
42
82
  {
43
- SYM(close);
44
- return this->value.call(close);
83
+ RUCY_SYM(on_move);
84
+ if (RUCY_IS_OVERRIDDEN(on_move, window_class()))
85
+ this->value.call(on_move, Rucy::value(e));
86
+ else
87
+ Super::on_move(e);
45
88
  }
46
89
 
47
- virtual void update (float dt)
90
+ virtual void on_resize (FrameEvent* e)
48
91
  {
49
- SYM(update);
50
- this->value.call(update, dt);
92
+ RUCY_SYM(on_resize);
93
+ if (RUCY_IS_OVERRIDDEN(on_resize, window_class()))
94
+ this->value.call(on_resize, Rucy::value(e));
95
+ else
96
+ Super::on_resize(e);
51
97
  }
52
98
 
53
- virtual void draw ()
99
+ virtual void on_key (KeyEvent* e)
54
100
  {
55
- SYM(draw);
56
- this->value.call(draw);
101
+ RUCY_SYM(on_key);
102
+ if (RUCY_IS_OVERRIDDEN(on_key, window_class()))
103
+ this->value.call(on_key, Rucy::value(e));
104
+ else
105
+ Super::on_key(e);
57
106
  }
58
107
 
59
- virtual void moved (coord x, coord y)
108
+ virtual void on_key_down (KeyEvent* e)
60
109
  {
61
- SYM(moved);
62
- this->value.call(moved, x, y);
110
+ RUCY_SYM(on_key_down);
111
+ if (RUCY_IS_OVERRIDDEN(on_key_down, window_class()))
112
+ this->value.call(on_key_down, Rucy::value(e));
113
+ else
114
+ Super::on_key_down(e);
63
115
  }
64
116
 
65
- virtual void resized (coord width, coord height)
117
+ virtual void on_key_up (KeyEvent* e)
66
118
  {
67
- SYM(resized);
68
- this->value.call(resized, width, height);
119
+ RUCY_SYM(on_key_up);
120
+ if (RUCY_IS_OVERRIDDEN(on_key_up, window_class()))
121
+ this->value.call(on_key_up, Rucy::value(e));
122
+ else
123
+ Super::on_key_up(e);
69
124
  }
70
125
 
71
- virtual void key_down (const Key& key)
126
+ virtual void on_pointer (PointerEvent* e)
72
127
  {
73
- SYM(key_down);
74
- this->value.call(key_down, Rucy::value(key));
128
+ RUCY_SYM(on_pointer);
129
+ if (RUCY_IS_OVERRIDDEN(on_pointer, window_class()))
130
+ this->value.call(on_pointer, Rucy::value(e));
131
+ else
132
+ Super::on_pointer(e);
75
133
  }
76
134
 
77
- virtual void key_up (const Key& key)
135
+ virtual void on_pointer_down (PointerEvent* e)
78
136
  {
79
- SYM(key_up);
80
- this->value.call(key_up, Rucy::value(key));
137
+ RUCY_SYM(on_pointer_down);
138
+ if (RUCY_IS_OVERRIDDEN(on_pointer_down, window_class()))
139
+ this->value.call(on_pointer_down, Rucy::value(e));
140
+ else
141
+ Super::on_pointer_down(e);
81
142
  }
82
143
 
83
- virtual void points_down (const Points& points)
144
+ virtual void on_pointer_up (PointerEvent* e)
84
145
  {
85
- SYM(points_down);
86
- this->value.call(points_down, Rucy::value(points));
146
+ RUCY_SYM(on_pointer_up);
147
+ if (RUCY_IS_OVERRIDDEN(on_pointer_up, window_class()))
148
+ this->value.call(on_pointer_up, Rucy::value(e));
149
+ else
150
+ Super::on_pointer_up(e);
87
151
  }
88
152
 
89
- virtual void points_up (const Points& points)
153
+ virtual void on_pointer_move (PointerEvent* e)
90
154
  {
91
- SYM(points_up);
92
- this->value.call(points_up, Rucy::value(points));
155
+ RUCY_SYM(on_pointer_move);
156
+ if (RUCY_IS_OVERRIDDEN(on_pointer_move, window_class()))
157
+ this->value.call(on_pointer_move, Rucy::value(e));
158
+ else
159
+ Super::on_pointer_move(e);
93
160
  }
94
161
 
95
- virtual void points_moved (const Points& points)
162
+ virtual void on_wheel (WheelEvent* e)
96
163
  {
97
- SYM(points_moved);
98
- this->value.call(points_moved, Rucy::value(points));
164
+ RUCY_SYM(on_wheel);
165
+ if (RUCY_IS_OVERRIDDEN(on_wheel, window_class()))
166
+ this->value.call(on_wheel, Rucy::value(e));
167
+ else
168
+ Super::on_wheel(e);
99
169
  }
100
170
 
101
171
  };// RubyWindow
@@ -104,7 +174,21 @@ namespace Reflex
104
174
  }// Reflex
105
175
 
106
176
 
107
- RUCY_WRAPPER_VALUE_FROM_TO(Reflex::Window, Reflex::window_class())
177
+ RUCY_DECLARE_WRAPPER_VALUE_FROM_TO(Reflex::Window)
178
+
179
+
180
+ namespace Rucy
181
+ {
182
+
183
+
184
+ inline Value
185
+ value (Reflex::Window::Ref& ref, Value klass = Reflex::window_class())
186
+ {
187
+ return value(ref.get(), klass);
188
+ }
189
+
190
+
191
+ }// Rucy
108
192
 
109
193
 
110
194
  #endif//EOH
@@ -5,11 +5,12 @@
5
5
 
6
6
 
7
7
  #include <reflex/ruby/reflex.h>
8
- #include <reflex/ruby/key.h>
9
- #include <reflex/ruby/points.h>
10
8
  #include <reflex/ruby/application.h>
11
9
  #include <reflex/ruby/window.h>
12
10
  #include <reflex/ruby/view.h>
11
+ #include <reflex/ruby/selector.h>
12
+ #include <reflex/ruby/style.h>
13
+ #include <reflex/ruby/event.h>
13
14
 
14
15
 
15
16
  #endif//EOH
@@ -0,0 +1,64 @@
1
+ // -*- c++ -*-
2
+ #pragma once
3
+ #ifndef __REFLEX_SELECTOR_H__
4
+ #define __REFLEX_SELECTOR_H__
5
+
6
+
7
+ #include <set>
8
+ #include <xot/pimpl.h>
9
+ #include <xot/string.h>
10
+ #include <reflex/defs.h>
11
+
12
+
13
+ namespace Reflex
14
+ {
15
+
16
+
17
+ class Selector
18
+ {
19
+
20
+ typedef Selector This;
21
+
22
+ public:
23
+
24
+ typedef std::set<String> TagSet;
25
+
26
+ typedef TagSet:: iterator iterator;
27
+
28
+ typedef TagSet::const_iterator const_iterator;
29
+
30
+ Selector (const char* name = NULL);
31
+
32
+ void set_name (const char* name);
33
+
34
+ const char* name () const;
35
+
36
+ void add_tag (const char* tag);
37
+
38
+ void remove_tag (const char* tag);
39
+
40
+ iterator begin ();
41
+
42
+ const_iterator begin () const;
43
+
44
+ iterator end ();
45
+
46
+ const_iterator end () const;
47
+
48
+ bool match (const This& obj) const;
49
+
50
+ friend bool operator == (const This& lhs, const This& rhs);
51
+
52
+ friend bool operator != (const This& lhs, const This& rhs);
53
+
54
+ struct Data;
55
+
56
+ Xot::PImpl<Data, true> self;
57
+
58
+ };// Selector
59
+
60
+
61
+ }// Reflex
62
+
63
+
64
+ #endif//EOH