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/.doc/ext/reflex/view.cpp
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
#include "reflex/ruby/view.h"
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
#include <vector>
|
|
4
5
|
#include <rucy.h>
|
|
5
|
-
#include <
|
|
6
|
-
#include
|
|
6
|
+
#include <rays/ruby/point.h>
|
|
7
|
+
#include <rays/ruby/bounds.h>
|
|
8
|
+
#include "reflex/ruby/window.h"
|
|
9
|
+
#include "reflex/ruby/selector.h"
|
|
10
|
+
#include "reflex/ruby/style.h"
|
|
7
11
|
|
|
8
12
|
|
|
9
13
|
using namespace Rucy;
|
|
@@ -13,43 +17,36 @@ using Reflex::coord;
|
|
|
13
17
|
|
|
14
18
|
static Class cView;
|
|
15
19
|
|
|
20
|
+
RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Reflex::View, cView)
|
|
16
21
|
|
|
17
|
-
|
|
18
|
-
{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Class
|
|
22
|
-
view_class ()
|
|
23
|
-
{
|
|
24
|
-
return cView;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}// Reflex
|
|
29
|
-
|
|
22
|
+
#define THIS to<Reflex::View*>(self)
|
|
30
23
|
|
|
31
|
-
|
|
24
|
+
#define CHECK RUCY_CHECK_OBJECT(Reflex::View, cView, self)
|
|
32
25
|
|
|
26
|
+
#define CALL(fun) RUCY_WRAPPER_CALL(Reflex::View, THIS, fun)
|
|
33
27
|
|
|
34
|
-
#define THIS to<Reflex::View*>(self)
|
|
35
28
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
template <typename T>
|
|
30
|
+
static inline Value
|
|
31
|
+
array (T begin, T end)
|
|
32
|
+
{
|
|
33
|
+
std::vector<Value> v;
|
|
34
|
+
for (T it = begin; it != end; ++it) v.push_back(value(*it));
|
|
35
|
+
return value(v.size(), &v[0]);
|
|
36
|
+
}
|
|
39
37
|
|
|
40
38
|
|
|
41
39
|
static
|
|
42
40
|
VALUE alloc(VALUE klass)
|
|
43
41
|
{
|
|
44
|
-
return value(new RubyView
|
|
42
|
+
return value(new Reflex::RubyView<Reflex::View>, klass);
|
|
45
43
|
}
|
|
46
44
|
|
|
47
45
|
static
|
|
48
46
|
VALUE show(VALUE self)
|
|
49
47
|
{
|
|
50
48
|
CHECK;
|
|
51
|
-
|
|
52
|
-
reflex_error("failed to show view.");
|
|
49
|
+
CALL(show());
|
|
53
50
|
return self;
|
|
54
51
|
}
|
|
55
52
|
|
|
@@ -57,17 +54,22 @@ static
|
|
|
57
54
|
VALUE hide(VALUE self)
|
|
58
55
|
{
|
|
59
56
|
CHECK;
|
|
60
|
-
|
|
61
|
-
reflex_error("failed to hide view.");
|
|
57
|
+
CALL(hide());
|
|
62
58
|
return self;
|
|
63
59
|
}
|
|
64
60
|
|
|
61
|
+
static
|
|
62
|
+
VALUE hidden(VALUE self)
|
|
63
|
+
{
|
|
64
|
+
CHECK;
|
|
65
|
+
return value(THIS->hidden());
|
|
66
|
+
}
|
|
67
|
+
|
|
65
68
|
static
|
|
66
69
|
VALUE redraw(VALUE self)
|
|
67
70
|
{
|
|
68
71
|
CHECK;
|
|
69
|
-
|
|
70
|
-
reflex_error("failed to redraw view.");
|
|
72
|
+
THIS->redraw();
|
|
71
73
|
return self;
|
|
72
74
|
}
|
|
73
75
|
|
|
@@ -75,145 +77,409 @@ static
|
|
|
75
77
|
VALUE add_child(VALUE self, VALUE child)
|
|
76
78
|
{
|
|
77
79
|
CHECK;
|
|
80
|
+
THIS->add_child(to<Reflex::View*>(child));
|
|
81
|
+
return child;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static
|
|
85
|
+
VALUE remove_child(VALUE self, VALUE child)
|
|
86
|
+
{
|
|
87
|
+
CHECK;
|
|
88
|
+
THIS->remove_child(to<Reflex::View*>(child));
|
|
89
|
+
return child;
|
|
90
|
+
}
|
|
78
91
|
|
|
79
|
-
|
|
80
|
-
|
|
92
|
+
static
|
|
93
|
+
VALUE find_children(VALUE self)
|
|
94
|
+
{
|
|
95
|
+
CHECK;
|
|
96
|
+
check_arg_count(__FILE__, __LINE__, "View#find_children", argc, 1, 2);
|
|
81
97
|
|
|
82
|
-
|
|
83
|
-
reflex_error("failed to add child view.");
|
|
98
|
+
bool recursive = (argc >= 2) ? to<bool>(argv[1]) : false;
|
|
84
99
|
|
|
85
|
-
|
|
100
|
+
Reflex::View::ChildList children;
|
|
101
|
+
THIS->find_children(&children, to<Reflex::Selector>(argv[0]), recursive);
|
|
102
|
+
return array(children.begin(), children.end());
|
|
86
103
|
}
|
|
87
104
|
|
|
88
105
|
static
|
|
89
|
-
VALUE
|
|
106
|
+
VALUE each_child(VALUE self)
|
|
90
107
|
{
|
|
91
108
|
CHECK;
|
|
92
109
|
|
|
93
|
-
|
|
94
|
-
|
|
110
|
+
Value ret;
|
|
111
|
+
Reflex::View::child_iterator end = THIS->child_end();
|
|
112
|
+
for (Reflex::View::child_iterator it = THIS->child_begin(); it != end; ++it)
|
|
113
|
+
ret = rb_yield(value(it->get()));
|
|
114
|
+
return ret;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
static
|
|
118
|
+
VALUE add_style(VALUE self, VALUE style)
|
|
119
|
+
{
|
|
120
|
+
CHECK;
|
|
121
|
+
THIS->add_style(to<Reflex::Style&>(style));
|
|
122
|
+
return style;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
static
|
|
126
|
+
VALUE remove_style(VALUE self, VALUE style)
|
|
127
|
+
{
|
|
128
|
+
CHECK;
|
|
129
|
+
THIS->remove_style(to<Reflex::Style&>(style));
|
|
130
|
+
return style;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
static
|
|
134
|
+
VALUE get_style(VALUE self)
|
|
135
|
+
{
|
|
136
|
+
CHECK;
|
|
137
|
+
check_arg_count(__FILE__, __LINE__, "View#get_style", argc, 0, 1);
|
|
138
|
+
|
|
139
|
+
if (argc == 0)
|
|
140
|
+
return value(THIS->style());
|
|
141
|
+
else
|
|
142
|
+
return value(THIS->get_style(to<Reflex::Selector>(argv[0])));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
static
|
|
146
|
+
VALUE find_styles(VALUE self)
|
|
147
|
+
{
|
|
148
|
+
CHECK;
|
|
149
|
+
check_arg_count(__FILE__, __LINE__, "View#find_styles", argc, 1, 2);
|
|
95
150
|
|
|
96
|
-
|
|
97
|
-
reflex_error("failed to remove child view.");
|
|
151
|
+
bool recursive = (argc >= 2) ? to<bool>(argv[1]) : false;
|
|
98
152
|
|
|
153
|
+
Reflex::View::StyleList styles;
|
|
154
|
+
THIS->find_styles(&styles, to<Reflex::Selector>(argv[0]), recursive);
|
|
155
|
+
return array(styles.begin(), styles.end());
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
static
|
|
159
|
+
VALUE each_style(VALUE self)
|
|
160
|
+
{
|
|
161
|
+
CHECK;
|
|
162
|
+
|
|
163
|
+
Value ret;
|
|
164
|
+
Reflex::View::style_iterator end = THIS->style_end();
|
|
165
|
+
for (Reflex::View::style_iterator it = THIS->style_begin(); it != end; ++it)
|
|
166
|
+
ret = rb_yield(value(*it));
|
|
167
|
+
return ret;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
static
|
|
171
|
+
VALUE focus(VALUE self)
|
|
172
|
+
{
|
|
173
|
+
CHECK;
|
|
174
|
+
check_arg_count(__FILE__, __LINE__, "View#focus", argc, 0, 1);
|
|
175
|
+
|
|
176
|
+
bool state = (argc >= 1) ? to<bool>(argv[0]) : true;
|
|
177
|
+
|
|
178
|
+
THIS->focus(state);
|
|
99
179
|
return self;
|
|
100
180
|
}
|
|
101
181
|
|
|
102
182
|
static
|
|
103
|
-
VALUE
|
|
183
|
+
VALUE blur(VALUE self)
|
|
104
184
|
{
|
|
105
185
|
CHECK;
|
|
106
|
-
|
|
107
|
-
|
|
186
|
+
THIS->blur();
|
|
187
|
+
return self;
|
|
188
|
+
}
|
|
108
189
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
190
|
+
static
|
|
191
|
+
VALUE has_focus(VALUE self)
|
|
192
|
+
{
|
|
193
|
+
CHECK;
|
|
194
|
+
return value(THIS->has_focus());
|
|
195
|
+
}
|
|
112
196
|
|
|
113
|
-
|
|
114
|
-
|
|
197
|
+
static
|
|
198
|
+
VALUE resize_to_fit(VALUE self)
|
|
199
|
+
{
|
|
200
|
+
CHECK;
|
|
201
|
+
THIS->resize_to_fit();
|
|
202
|
+
return self;
|
|
203
|
+
}
|
|
115
204
|
|
|
116
|
-
|
|
205
|
+
static
|
|
206
|
+
VALUE content_size(VALUE self)
|
|
207
|
+
{
|
|
208
|
+
CHECK;
|
|
209
|
+
return value(THIS->content_size());
|
|
117
210
|
}
|
|
118
211
|
|
|
119
212
|
static
|
|
120
213
|
VALUE set_name(VALUE self, VALUE name)
|
|
121
214
|
{
|
|
122
215
|
CHECK;
|
|
123
|
-
|
|
124
|
-
reflex_error("failed to set the name of view.");
|
|
125
|
-
return name;
|
|
216
|
+
THIS->set_name(name.is_nil() ? NULL : name.c_str());
|
|
126
217
|
}
|
|
127
218
|
|
|
128
219
|
static
|
|
129
220
|
VALUE get_name(VALUE self)
|
|
130
221
|
{
|
|
131
222
|
CHECK;
|
|
132
|
-
|
|
133
|
-
if (!s) reflex_error("failed to get name of view.");
|
|
134
|
-
return value(s);
|
|
223
|
+
return THIS->name() ? value(THIS->name()) : nil();
|
|
135
224
|
}
|
|
136
225
|
|
|
137
226
|
static
|
|
138
|
-
VALUE
|
|
227
|
+
VALUE add_tag(VALUE self, VALUE tag)
|
|
139
228
|
{
|
|
140
229
|
CHECK;
|
|
141
|
-
|
|
142
|
-
|
|
230
|
+
THIS->add_tag(tag.c_str());
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
static
|
|
234
|
+
VALUE remove_tag(VALUE self, VALUE tag)
|
|
235
|
+
{
|
|
236
|
+
CHECK;
|
|
237
|
+
THIS->remove_tag(tag.c_str());
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
static
|
|
241
|
+
VALUE each_tag(VALUE self)
|
|
242
|
+
{
|
|
243
|
+
CHECK;
|
|
244
|
+
|
|
245
|
+
Value ret;
|
|
246
|
+
Reflex::View::tag_iterator end = THIS->tag_end();
|
|
247
|
+
for (Reflex::View::tag_iterator it = THIS->tag_begin(); it != end; ++it)
|
|
248
|
+
ret = rb_yield(value(*it));
|
|
249
|
+
return ret;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
static
|
|
253
|
+
VALUE set_selector(VALUE self, VALUE selector)
|
|
254
|
+
{
|
|
255
|
+
CHECK;
|
|
256
|
+
THIS->set_selector(to<Reflex::Selector>(selector));
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
static
|
|
260
|
+
VALUE get_selector(VALUE self)
|
|
261
|
+
{
|
|
262
|
+
CHECK;
|
|
263
|
+
return value(THIS->selector());
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
static
|
|
267
|
+
VALUE set_frame(VALUE self, VALUE arg)
|
|
268
|
+
{
|
|
269
|
+
CHECK;
|
|
270
|
+
THIS->set_frame(to<Rays::Bounds>(arg));
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
static
|
|
274
|
+
VALUE get_frame(VALUE self)
|
|
275
|
+
{
|
|
276
|
+
CHECK;
|
|
277
|
+
return value(THIS->frame());
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
static
|
|
281
|
+
VALUE set_capture(VALUE self, VALUE types)
|
|
282
|
+
{
|
|
283
|
+
CHECK;
|
|
284
|
+
THIS->set_capture(to<uint>(types));
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
static
|
|
288
|
+
VALUE get_capture(VALUE self)
|
|
289
|
+
{
|
|
290
|
+
CHECK;
|
|
291
|
+
return value(THIS->capture());
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
static
|
|
295
|
+
VALUE scroll_to(VALUE self)
|
|
296
|
+
{
|
|
297
|
+
CHECK;
|
|
298
|
+
check_arg_count(__FILE__, __LINE__, "View#scroll_to", argc, 1, 2, 3);
|
|
299
|
+
|
|
300
|
+
if (argv[0].is_kind_of(Rays::point_class()))
|
|
301
|
+
THIS->scroll_to(to<Rays::Point&>(argv[0]));
|
|
302
|
+
else
|
|
143
303
|
{
|
|
144
|
-
|
|
304
|
+
const Rays::Point& p = THIS->scroll();
|
|
305
|
+
coord x = (argc >= 1 && argv[0]) ? to<coord>(argv[0]) : p.x;
|
|
306
|
+
coord y = (argc >= 2 && argv[1]) ? to<coord>(argv[1]) : p.y;
|
|
307
|
+
coord z = (argc >= 3 && argv[2]) ? to<coord>(argv[2]) : p.z;
|
|
308
|
+
THIS->scroll_to(x, y, z);
|
|
145
309
|
}
|
|
146
|
-
|
|
310
|
+
|
|
311
|
+
return self;
|
|
147
312
|
}
|
|
148
313
|
|
|
149
314
|
static
|
|
150
|
-
VALUE
|
|
315
|
+
VALUE scroll_by(VALUE self)
|
|
151
316
|
{
|
|
152
317
|
CHECK;
|
|
153
|
-
|
|
318
|
+
check_arg_count(__FILE__, __LINE__, "View#scroll_by", argc, 1, 2, 3);
|
|
319
|
+
|
|
320
|
+
if (argv[0].is_kind_of(Rays::point_class()))
|
|
321
|
+
THIS->scroll_by(to<Rays::Point&>(argv[0]));
|
|
322
|
+
else
|
|
323
|
+
{
|
|
324
|
+
coord x = (argc >= 1 && argv[0]) ? to<coord>(argv[0]) : 0;
|
|
325
|
+
coord y = (argc >= 2 && argv[1]) ? to<coord>(argv[1]) : 0;
|
|
326
|
+
coord z = (argc >= 3 && argv[2]) ? to<coord>(argv[2]) : 0;
|
|
327
|
+
THIS->scroll_by(x, y, z);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
return self;
|
|
154
331
|
}
|
|
155
332
|
|
|
156
333
|
static
|
|
157
|
-
VALUE
|
|
334
|
+
VALUE get_scroll(VALUE self)
|
|
158
335
|
{
|
|
159
336
|
CHECK;
|
|
160
|
-
return value(THIS->
|
|
337
|
+
return value(THIS->scroll());
|
|
161
338
|
}
|
|
162
339
|
|
|
163
340
|
static
|
|
164
341
|
VALUE parent(VALUE self)
|
|
165
342
|
{
|
|
166
343
|
CHECK;
|
|
344
|
+
return value(THIS->parent());
|
|
345
|
+
}
|
|
167
346
|
|
|
168
|
-
|
|
169
|
-
|
|
347
|
+
static
|
|
348
|
+
VALUE window(VALUE self)
|
|
349
|
+
{
|
|
350
|
+
CHECK;
|
|
351
|
+
return value(THIS->window());
|
|
352
|
+
}
|
|
170
353
|
|
|
171
|
-
|
|
354
|
+
static
|
|
355
|
+
VALUE on_attach(VALUE self, VALUE event)
|
|
356
|
+
{
|
|
357
|
+
CHECK;
|
|
358
|
+
CALL(on_attach(to<Reflex::Event*>(event)));
|
|
172
359
|
}
|
|
173
360
|
|
|
174
361
|
static
|
|
175
|
-
VALUE
|
|
362
|
+
VALUE on_detach(VALUE self, VALUE event)
|
|
176
363
|
{
|
|
177
364
|
CHECK;
|
|
365
|
+
CALL(on_detach(to<Reflex::Event*>(event)));
|
|
366
|
+
}
|
|
178
367
|
|
|
179
|
-
|
|
180
|
-
|
|
368
|
+
static
|
|
369
|
+
VALUE on_update(VALUE self, VALUE event)
|
|
370
|
+
{
|
|
371
|
+
CHECK;
|
|
372
|
+
CALL(on_update(to<Reflex::UpdateEvent*>(event)));
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
static
|
|
376
|
+
VALUE on_draw(VALUE self, VALUE event)
|
|
377
|
+
{
|
|
378
|
+
CHECK;
|
|
379
|
+
CALL(on_draw(to<Reflex::DrawEvent*>(event)));
|
|
380
|
+
}
|
|
181
381
|
|
|
182
|
-
|
|
382
|
+
static
|
|
383
|
+
VALUE on_move(VALUE self, VALUE event)
|
|
384
|
+
{
|
|
385
|
+
CHECK;
|
|
386
|
+
CALL(on_move(to<Reflex::FrameEvent*>(event)));
|
|
183
387
|
}
|
|
184
388
|
|
|
185
389
|
static
|
|
186
|
-
VALUE
|
|
390
|
+
VALUE on_resize(VALUE self, VALUE event)
|
|
187
391
|
{
|
|
188
392
|
CHECK;
|
|
189
|
-
CALL(
|
|
190
|
-
return self;
|
|
393
|
+
CALL(on_resize(to<Reflex::FrameEvent*>(event)));
|
|
191
394
|
}
|
|
192
395
|
|
|
193
396
|
static
|
|
194
|
-
VALUE
|
|
397
|
+
VALUE on_scroll(VALUE self, VALUE event)
|
|
195
398
|
{
|
|
196
399
|
CHECK;
|
|
197
|
-
CALL(
|
|
198
|
-
return self;
|
|
400
|
+
CALL(on_scroll(to<Reflex::ScrollEvent*>(event)));
|
|
199
401
|
}
|
|
200
402
|
|
|
201
403
|
static
|
|
202
|
-
VALUE
|
|
404
|
+
VALUE on_focus(VALUE self, VALUE event)
|
|
203
405
|
{
|
|
204
406
|
CHECK;
|
|
205
|
-
CALL(
|
|
206
|
-
return self;
|
|
407
|
+
CALL(on_focus(to<Reflex::FocusEvent*>(event)));
|
|
207
408
|
}
|
|
208
409
|
|
|
209
410
|
static
|
|
210
|
-
VALUE
|
|
411
|
+
VALUE on_blur(VALUE self, VALUE event)
|
|
211
412
|
{
|
|
212
413
|
CHECK;
|
|
213
|
-
CALL(
|
|
214
|
-
|
|
414
|
+
CALL(on_blur(to<Reflex::FocusEvent*>(event)));
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
static
|
|
418
|
+
VALUE on_key(VALUE self, VALUE event)
|
|
419
|
+
{
|
|
420
|
+
CHECK;
|
|
421
|
+
CALL(on_key(to<Reflex::KeyEvent*>(event)));
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
static
|
|
425
|
+
VALUE on_key_down(VALUE self, VALUE event)
|
|
426
|
+
{
|
|
427
|
+
CHECK;
|
|
428
|
+
CALL(on_key_down(to<Reflex::KeyEvent*>(event)));
|
|
215
429
|
}
|
|
216
430
|
|
|
431
|
+
static
|
|
432
|
+
VALUE on_key_up(VALUE self, VALUE event)
|
|
433
|
+
{
|
|
434
|
+
CHECK;
|
|
435
|
+
CALL(on_key_up(to<Reflex::KeyEvent*>(event)));
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
static
|
|
439
|
+
VALUE on_pointer(VALUE self, VALUE event)
|
|
440
|
+
{
|
|
441
|
+
CHECK;
|
|
442
|
+
CALL(on_pointer(to<Reflex::PointerEvent*>(event)));
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
static
|
|
446
|
+
VALUE on_pointer_down(VALUE self, VALUE event)
|
|
447
|
+
{
|
|
448
|
+
CHECK;
|
|
449
|
+
CALL(on_pointer_down(to<Reflex::PointerEvent*>(event)));
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
static
|
|
453
|
+
VALUE on_pointer_up(VALUE self, VALUE event)
|
|
454
|
+
{
|
|
455
|
+
CHECK;
|
|
456
|
+
CALL(on_pointer_up(to<Reflex::PointerEvent*>(event)));
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
static
|
|
460
|
+
VALUE on_pointer_move(VALUE self, VALUE event)
|
|
461
|
+
{
|
|
462
|
+
CHECK;
|
|
463
|
+
CALL(on_pointer_move(to<Reflex::PointerEvent*>(event)));
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
static
|
|
467
|
+
VALUE on_wheel(VALUE self, VALUE event)
|
|
468
|
+
{
|
|
469
|
+
CHECK;
|
|
470
|
+
CALL(on_wheel(to<Reflex::WheelEvent*>(event)));
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
static
|
|
474
|
+
VALUE on_capture(VALUE self, VALUE event)
|
|
475
|
+
{
|
|
476
|
+
CHECK;
|
|
477
|
+
CALL(on_capture(to<Reflex::CaptureEvent*>(event)));
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
static
|
|
481
|
+
RUCY_DEF_clear_override_flags(cof, Reflex::View, cView);
|
|
482
|
+
|
|
217
483
|
|
|
218
484
|
void
|
|
219
485
|
Init_view ()
|
|
@@ -224,19 +490,73 @@ Init_view ()
|
|
|
224
490
|
rb_define_alloc_func(cView, alloc);
|
|
225
491
|
rb_define_method(cView, "show", RUBY_METHOD_FUNC(show), 0);
|
|
226
492
|
rb_define_method(cView, "hide", RUBY_METHOD_FUNC(hide), 0);
|
|
493
|
+
cView.define_method("hidden?", hidden);
|
|
227
494
|
rb_define_method(cView, "redraw", RUBY_METHOD_FUNC(redraw), 0);
|
|
228
495
|
rb_define_method(cView, "add_child", RUBY_METHOD_FUNC(add_child), 1);
|
|
229
496
|
rb_define_method(cView, "remove_child", RUBY_METHOD_FUNC(remove_child), 1);
|
|
230
|
-
rb_define_method(cView, "
|
|
497
|
+
rb_define_method(cView, "find_children", RUBY_METHOD_FUNC(find_children), -1);
|
|
498
|
+
rb_define_method(cView, "each_child", RUBY_METHOD_FUNC(each_child), 0);
|
|
499
|
+
rb_define_method(cView, "add_style", RUBY_METHOD_FUNC(add_style), 1);
|
|
500
|
+
rb_define_method(cView, "remove_style", RUBY_METHOD_FUNC(remove_style), 1);
|
|
501
|
+
rb_define_method(cView, "get_style", RUBY_METHOD_FUNC(get_style), -1);
|
|
502
|
+
rb_define_method(cView, "find_styles", RUBY_METHOD_FUNC(find_styles), -1);
|
|
503
|
+
rb_define_method(cView, "each_style", RUBY_METHOD_FUNC(each_style), 0);
|
|
504
|
+
rb_define_method(cView, "focus", RUBY_METHOD_FUNC(focus), -1);
|
|
505
|
+
rb_define_method(cView, "blur", RUBY_METHOD_FUNC(blur), 0);
|
|
506
|
+
cView.define_method("focus?", has_focus);
|
|
507
|
+
rb_define_method(cView, "resize_to_fit", RUBY_METHOD_FUNC(resize_to_fit), 0);
|
|
508
|
+
rb_define_method(cView, "content_size", RUBY_METHOD_FUNC(content_size), 0);
|
|
231
509
|
rb_define_method(cView, "name=", RUBY_METHOD_FUNC(set_name), 1);
|
|
232
510
|
rb_define_method(cView, "name", RUBY_METHOD_FUNC(get_name), 0);
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
rb_define_method(cView, "
|
|
511
|
+
rb_define_method(cView, "add_tag", RUBY_METHOD_FUNC(add_tag), 1);
|
|
512
|
+
rb_define_method(cView, "remove_tag", RUBY_METHOD_FUNC(remove_tag), 1);
|
|
513
|
+
rb_define_method(cView, "each_tag", RUBY_METHOD_FUNC(each_tag), 0);
|
|
514
|
+
rb_define_method(cView, "selector=", RUBY_METHOD_FUNC(set_selector), 1);
|
|
515
|
+
rb_define_method(cView, "selector", RUBY_METHOD_FUNC(get_selector), 0);
|
|
516
|
+
rb_define_private_method(cView, "set_frame", RUBY_METHOD_FUNC(set_frame), 1);
|
|
517
|
+
rb_define_private_method(cView, "get_frame", RUBY_METHOD_FUNC(get_frame), 0);
|
|
518
|
+
rb_define_method(cView, "scroll_to", RUBY_METHOD_FUNC(scroll_to), -1);
|
|
519
|
+
rb_define_method(cView, "scroll_by", RUBY_METHOD_FUNC(scroll_by), -1);
|
|
520
|
+
rb_define_method(cView, "scroll", RUBY_METHOD_FUNC(get_scroll), 0);
|
|
521
|
+
rb_define_method(cView, "set_capture", RUBY_METHOD_FUNC(set_capture), 1);
|
|
522
|
+
rb_define_method(cView, "get_capture", RUBY_METHOD_FUNC(get_capture), 0);
|
|
236
523
|
rb_define_method(cView, "parent", RUBY_METHOD_FUNC(parent), 0);
|
|
237
524
|
rb_define_method(cView, "window", RUBY_METHOD_FUNC(window), 0);
|
|
238
|
-
rb_define_method(cView, "
|
|
239
|
-
rb_define_method(cView, "
|
|
240
|
-
rb_define_method(cView, "
|
|
241
|
-
rb_define_method(cView, "
|
|
525
|
+
rb_define_method(cView, "on_attach", RUBY_METHOD_FUNC(on_attach), 1);
|
|
526
|
+
rb_define_method(cView, "on_detach", RUBY_METHOD_FUNC(on_detach), 1);
|
|
527
|
+
rb_define_method(cView, "on_update", RUBY_METHOD_FUNC(on_update), 1);
|
|
528
|
+
rb_define_method(cView, "on_draw", RUBY_METHOD_FUNC(on_draw), 1);
|
|
529
|
+
rb_define_method(cView, "on_move", RUBY_METHOD_FUNC(on_move), 1);
|
|
530
|
+
rb_define_method(cView, "on_resize", RUBY_METHOD_FUNC(on_resize), 1);
|
|
531
|
+
rb_define_method(cView, "on_scroll", RUBY_METHOD_FUNC(on_scroll), 1);
|
|
532
|
+
rb_define_method(cView, "on_focus", RUBY_METHOD_FUNC(on_focus), 1);
|
|
533
|
+
rb_define_method(cView, "on_blur", RUBY_METHOD_FUNC(on_blur), 1);
|
|
534
|
+
rb_define_method(cView, "on_key", RUBY_METHOD_FUNC(on_key), 1);
|
|
535
|
+
rb_define_method(cView, "on_key_down", RUBY_METHOD_FUNC(on_key_down), 1);
|
|
536
|
+
rb_define_method(cView, "on_key_up", RUBY_METHOD_FUNC(on_key_up), 1);
|
|
537
|
+
rb_define_method(cView, "on_pointer", RUBY_METHOD_FUNC(on_pointer), 1);
|
|
538
|
+
rb_define_method(cView, "on_pointer_down", RUBY_METHOD_FUNC(on_pointer_down), 1);
|
|
539
|
+
rb_define_method(cView, "on_pointer_up", RUBY_METHOD_FUNC(on_pointer_up), 1);
|
|
540
|
+
rb_define_method(cView, "on_pointer_move", RUBY_METHOD_FUNC(on_pointer_move), 1);
|
|
541
|
+
rb_define_method(cView, "on_wheel", RUBY_METHOD_FUNC(on_wheel), 1);
|
|
542
|
+
rb_define_method(cView, "on_capture", RUBY_METHOD_FUNC(on_capture), 1);
|
|
543
|
+
cView.define_const("CAPTURE_NONE", Reflex::View::CAPTURE_NONE);
|
|
544
|
+
cView.define_const("CAPTURE_KEY", Reflex::View::CAPTURE_KEY);
|
|
545
|
+
cView.define_const("CAPTURE_POINTER", Reflex::View::CAPTURE_POINTER);
|
|
546
|
+
cView.define_const("CAPTURE_ALL", Reflex::View::CAPTURE_ALL);
|
|
547
|
+
|
|
242
548
|
}
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
namespace Reflex
|
|
552
|
+
{
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
Class
|
|
556
|
+
view_class ()
|
|
557
|
+
{
|
|
558
|
+
return cView;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
}// Reflex
|