reflexion 0.1.39 → 0.1.41
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 +4 -4
- data/.doc/ext/reflex/native.cpp +2 -0
- data/.doc/ext/reflex/screen.cpp +53 -0
- data/.doc/ext/reflex/view.cpp +22 -0
- data/.doc/ext/reflex/window.cpp +70 -12
- data/ChangeLog.md +15 -0
- data/VERSION +1 -1
- data/ext/reflex/native.cpp +2 -0
- data/ext/reflex/screen.cpp +55 -0
- data/ext/reflex/view.cpp +38 -14
- data/ext/reflex/window.cpp +76 -13
- data/include/reflex/ruby/screen.h +40 -0
- data/include/reflex/screen.h +43 -0
- data/include/reflex/view.h +3 -1
- data/include/reflex/window.h +21 -3
- data/lib/reflex/contact_event.rb +1 -1
- data/lib/reflex/screen.rb +21 -0
- data/lib/reflex/view.rb +3 -2
- data/lib/reflex/window.rb +3 -1
- data/lib/reflex.rb +1 -0
- data/reflex.gemspec +11 -14
- data/src/body.cpp +14 -0
- data/src/body.h +4 -0
- data/src/osx/native_window.mm +10 -10
- data/src/osx/screen.h +21 -0
- data/src/osx/screen.mm +58 -0
- data/src/osx/window.h +4 -0
- data/src/osx/window.mm +35 -9
- data/src/view.cpp +13 -2
- data/src/window.cpp +23 -7
- data/src/window.h +6 -2
- data/test/test_event.rb +4 -0
- data/test/test_screen.rb +18 -0
- data/test/test_view.rb +20 -6
- data/test/test_window.rb +48 -6
- metadata +23 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b412c2e913baaeacdd4afff628c339c01a6ce7359572901d6193fc97d772a426
|
4
|
+
data.tar.gz: f8cba434ac873919a9bd75ea5c5e08d0436eb672313e60541d5634b210b81b76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b6f7fd46e08e459010a98facf5c8e800c326f93d0482b0649c4f20a6bc54537947e5e3316285db7e759870c7739c68ab5284fba8f4640fb88e5dc02c106b598
|
7
|
+
data.tar.gz: a30e5f7bde2f8f9b09ff0e76847d2bbbfefe9187e3888224409ebfe04a72c05e36387ab4a976f0dd385f1ead5aa749d1ba8478182030e73058879792b0ca051e
|
data/.doc/ext/reflex/native.cpp
CHANGED
@@ -32,6 +32,7 @@ void Init_reflex_rect_shape ();
|
|
32
32
|
void Init_reflex_ellipse_shape ();
|
33
33
|
|
34
34
|
void Init_reflex_application ();
|
35
|
+
void Init_reflex_screen ();
|
35
36
|
void Init_reflex_window ();
|
36
37
|
void Init_reflex_view ();
|
37
38
|
|
@@ -80,6 +81,7 @@ extern "C" void
|
|
80
81
|
Init_reflex_ellipse_shape();
|
81
82
|
|
82
83
|
Init_reflex_application();
|
84
|
+
Init_reflex_screen();
|
83
85
|
Init_reflex_window();
|
84
86
|
Init_reflex_view();
|
85
87
|
|
@@ -0,0 +1,53 @@
|
|
1
|
+
#include "reflex/ruby/screen.h"
|
2
|
+
|
3
|
+
|
4
|
+
#include <rays/ruby/bounds.h>
|
5
|
+
#include "defs.h"
|
6
|
+
|
7
|
+
|
8
|
+
RUCY_DEFINE_VALUE_FROM_TO(Reflex::Screen)
|
9
|
+
|
10
|
+
#define THIS to<Reflex::Screen*>(self)
|
11
|
+
|
12
|
+
#define CHECK RUCY_CHECK_OBJECT(Reflex::Screen, self)
|
13
|
+
|
14
|
+
|
15
|
+
static
|
16
|
+
VALUE alloc(VALUE klass)
|
17
|
+
{
|
18
|
+
Reflex::reflex_error(__FILE__, __LINE__, "can not instantiate Screen class.");
|
19
|
+
}
|
20
|
+
|
21
|
+
static
|
22
|
+
VALUE get_frame(VALUE self)
|
23
|
+
{
|
24
|
+
CHECK;
|
25
|
+
return value(THIS->frame());
|
26
|
+
}
|
27
|
+
|
28
|
+
|
29
|
+
static Class cScreen;
|
30
|
+
|
31
|
+
void
|
32
|
+
Init_reflex_screen ()
|
33
|
+
{
|
34
|
+
Module mReflex = rb_define_module("Reflex");
|
35
|
+
|
36
|
+
cScreen = rb_define_class_under(mReflex, "Screen", rb_cObject);
|
37
|
+
rb_define_alloc_func(cScreen, alloc);
|
38
|
+
rb_define_method(cScreen, "frame", RUBY_METHOD_FUNC(get_frame), 0);
|
39
|
+
}
|
40
|
+
|
41
|
+
|
42
|
+
namespace Reflex
|
43
|
+
{
|
44
|
+
|
45
|
+
|
46
|
+
Class
|
47
|
+
screen_class ()
|
48
|
+
{
|
49
|
+
return cScreen;
|
50
|
+
}
|
51
|
+
|
52
|
+
|
53
|
+
}// Reflex
|
data/.doc/ext/reflex/view.cpp
CHANGED
@@ -617,6 +617,26 @@ VALUE get_scroll_to_fit(VALUE self)
|
|
617
617
|
return value(THIS->has_flag(Reflex::View::FLAG_SCROLL_TO_FIT));
|
618
618
|
}
|
619
619
|
|
620
|
+
static
|
621
|
+
VALUE set_fix_angle(VALUE self, VALUE fix)
|
622
|
+
{
|
623
|
+
CHECK;
|
624
|
+
|
625
|
+
if (fix)
|
626
|
+
THIS-> add_flag(Reflex::View::FLAG_FIX_ANGLE);
|
627
|
+
else
|
628
|
+
THIS->remove_flag(Reflex::View::FLAG_FIX_ANGLE);
|
629
|
+
|
630
|
+
return fix;
|
631
|
+
}
|
632
|
+
|
633
|
+
static
|
634
|
+
VALUE get_fix_angle(VALUE self)
|
635
|
+
{
|
636
|
+
CHECK;
|
637
|
+
return value(THIS->has_flag(Reflex::View::FLAG_FIX_ANGLE));
|
638
|
+
}
|
639
|
+
|
620
640
|
static
|
621
641
|
VALUE parent(VALUE self)
|
622
642
|
{
|
@@ -1134,6 +1154,8 @@ Init_reflex_view ()
|
|
1134
1154
|
cView.define_method("resize_to_fit?", get_resize_to_fit);
|
1135
1155
|
rb_define_method(cView, "scroll_to_fit=", RUBY_METHOD_FUNC(set_scroll_to_fit), 1);
|
1136
1156
|
cView.define_method("scroll_to_fit?", get_scroll_to_fit);
|
1157
|
+
rb_define_method(cView, "fix_angle=", RUBY_METHOD_FUNC(set_fix_angle), 1);
|
1158
|
+
cView.define_method("fix_angle?", get_fix_angle);
|
1137
1159
|
rb_define_method(cView, "parent", RUBY_METHOD_FUNC(parent), 0);
|
1138
1160
|
rb_define_method(cView, "window", RUBY_METHOD_FUNC(window), 0);
|
1139
1161
|
|
data/.doc/ext/reflex/window.cpp
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
#include <rays/ruby/bounds.h>
|
5
5
|
#include <rays/ruby/painter.h>
|
6
|
+
#include "reflex/ruby/screen.h"
|
6
7
|
#include "reflex/ruby/view.h"
|
7
8
|
#include "defs.h"
|
8
9
|
|
@@ -38,6 +39,13 @@ VALUE hide(VALUE self)
|
|
38
39
|
return self;
|
39
40
|
}
|
40
41
|
|
42
|
+
static
|
43
|
+
VALUE hidden(VALUE self)
|
44
|
+
{
|
45
|
+
CHECK;
|
46
|
+
return value(THIS->hidden());
|
47
|
+
}
|
48
|
+
|
41
49
|
static
|
42
50
|
VALUE close(VALUE self)
|
43
51
|
{
|
@@ -98,44 +106,89 @@ VALUE get_frame(VALUE self)
|
|
98
106
|
return value(THIS->frame());
|
99
107
|
}
|
100
108
|
|
109
|
+
static
|
110
|
+
VALUE set_closable(VALUE self, VALUE state)
|
111
|
+
{
|
112
|
+
CHECK;
|
113
|
+
|
114
|
+
if (state)
|
115
|
+
THIS-> add_flag(Reflex::Window::FLAG_CLOSABLE);
|
116
|
+
else
|
117
|
+
THIS->remove_flag(Reflex::Window::FLAG_CLOSABLE);
|
118
|
+
|
119
|
+
return state;
|
120
|
+
}
|
121
|
+
|
122
|
+
static
|
123
|
+
VALUE is_closable(VALUE self)
|
124
|
+
{
|
125
|
+
CHECK;
|
126
|
+
return value(THIS->has_flag(Reflex::Window::FLAG_CLOSABLE));
|
127
|
+
}
|
128
|
+
|
129
|
+
static
|
130
|
+
VALUE set_minimizable(VALUE self, VALUE state)
|
131
|
+
{
|
132
|
+
CHECK;
|
133
|
+
|
134
|
+
if (state)
|
135
|
+
THIS-> add_flag(Reflex::Window::FLAG_MINIMIZABLE);
|
136
|
+
else
|
137
|
+
THIS->remove_flag(Reflex::Window::FLAG_MINIMIZABLE);
|
138
|
+
|
139
|
+
return state;
|
140
|
+
}
|
141
|
+
|
142
|
+
static
|
143
|
+
VALUE is_minimizable(VALUE self)
|
144
|
+
{
|
145
|
+
CHECK;
|
146
|
+
return value(THIS->has_flag(Reflex::Window::FLAG_MINIMIZABLE));
|
147
|
+
}
|
148
|
+
|
101
149
|
static
|
102
150
|
VALUE set_resizable(VALUE self, VALUE state)
|
103
151
|
{
|
104
152
|
CHECK;
|
105
|
-
|
106
|
-
|
153
|
+
|
154
|
+
if (state)
|
155
|
+
THIS-> add_flag(Reflex::Window::FLAG_RESIZABLE);
|
156
|
+
else
|
157
|
+
THIS->remove_flag(Reflex::Window::FLAG_RESIZABLE);
|
158
|
+
|
159
|
+
return state;
|
107
160
|
}
|
108
161
|
|
109
162
|
static
|
110
163
|
VALUE is_resizable(VALUE self)
|
111
164
|
{
|
112
165
|
CHECK;
|
113
|
-
return value(THIS->
|
166
|
+
return value(THIS->has_flag(Reflex::Window::FLAG_RESIZABLE));
|
114
167
|
}
|
115
168
|
|
116
169
|
static
|
117
|
-
VALUE
|
170
|
+
VALUE get_screen(VALUE self)
|
118
171
|
{
|
119
172
|
CHECK;
|
120
|
-
return value(THIS->
|
173
|
+
return value(THIS->screen());
|
121
174
|
}
|
122
175
|
|
123
176
|
static
|
124
|
-
VALUE
|
177
|
+
VALUE get_root(VALUE self)
|
125
178
|
{
|
126
179
|
CHECK;
|
127
180
|
return value(THIS->root());
|
128
181
|
}
|
129
182
|
|
130
183
|
static
|
131
|
-
VALUE
|
184
|
+
VALUE get_focus(VALUE self)
|
132
185
|
{
|
133
186
|
CHECK;
|
134
187
|
return value(THIS->focus());
|
135
188
|
}
|
136
189
|
|
137
190
|
static
|
138
|
-
VALUE
|
191
|
+
VALUE get_painter(VALUE self)
|
139
192
|
{
|
140
193
|
CHECK;
|
141
194
|
return value(THIS->painter());
|
@@ -277,12 +330,17 @@ Init_reflex_window ()
|
|
277
330
|
rb_define_method(cWindow, "title", RUBY_METHOD_FUNC(get_title), 0);
|
278
331
|
rb_define_method(cWindow, "frame=", RUBY_METHOD_FUNC(set_frame), -1);
|
279
332
|
rb_define_method(cWindow, "frame", RUBY_METHOD_FUNC(get_frame), 0);
|
333
|
+
rb_define_method(cWindow, "closable=", RUBY_METHOD_FUNC(set_closable), 1);
|
334
|
+
cWindow.define_method("closable?", is_closable);
|
335
|
+
rb_define_method(cWindow, "minimizable=", RUBY_METHOD_FUNC(set_minimizable), 1);
|
336
|
+
cWindow.define_method("minimizable?", is_minimizable);
|
280
337
|
rb_define_method(cWindow, "resizable=", RUBY_METHOD_FUNC(set_resizable), 1);
|
281
|
-
cWindow.define_method("resizable?",
|
338
|
+
cWindow.define_method("resizable?", is_resizable);
|
282
339
|
rb_define_method(cWindow, "hidden", RUBY_METHOD_FUNC(hidden), 0);
|
283
|
-
rb_define_method(cWindow, "
|
284
|
-
rb_define_method(cWindow, "
|
285
|
-
rb_define_method(cWindow, "
|
340
|
+
rb_define_method(cWindow, "screen", RUBY_METHOD_FUNC(get_screen), 0);
|
341
|
+
rb_define_method(cWindow, "root", RUBY_METHOD_FUNC(get_root), 0);
|
342
|
+
rb_define_method(cWindow, "focus", RUBY_METHOD_FUNC(get_focus), 0);
|
343
|
+
rb_define_method(cWindow, "painter", RUBY_METHOD_FUNC(get_painter), 0);
|
286
344
|
rb_define_method(cWindow, "on_show", RUBY_METHOD_FUNC(on_show), 1);
|
287
345
|
rb_define_method(cWindow, "on_hide", RUBY_METHOD_FUNC(on_hide), 1);
|
288
346
|
rb_define_method(cWindow, "on_close", RUBY_METHOD_FUNC(on_close), 1);
|
data/ChangeLog.md
CHANGED
@@ -1,6 +1,21 @@
|
|
1
1
|
# reflex ChangeLog
|
2
2
|
|
3
3
|
|
4
|
+
## [v0.1.41] - 2023-05-29
|
5
|
+
|
6
|
+
- Add Reflex::Screen class
|
7
|
+
- Add Window#closable and Window#minimizable accessors
|
8
|
+
- Fix that non-closable, non-minimizable, or non-resizable buttons raise error on clicking them
|
9
|
+
|
10
|
+
|
11
|
+
## [v0.1.40] - 2023-05-27
|
12
|
+
|
13
|
+
- required_ruby_version >= 3.0.0
|
14
|
+
- Add FLAG_FIX_ANGLE
|
15
|
+
- Add spec.license
|
16
|
+
- Fix crash on calling ContactEvent#inspect
|
17
|
+
|
18
|
+
|
4
19
|
## [v0.1.39] - 2023-05-18
|
5
20
|
|
6
21
|
- Event#block has a bool parameter, which defaults to true
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.41
|
data/ext/reflex/native.cpp
CHANGED
@@ -32,6 +32,7 @@ void Init_reflex_rect_shape ();
|
|
32
32
|
void Init_reflex_ellipse_shape ();
|
33
33
|
|
34
34
|
void Init_reflex_application ();
|
35
|
+
void Init_reflex_screen ();
|
35
36
|
void Init_reflex_window ();
|
36
37
|
void Init_reflex_view ();
|
37
38
|
|
@@ -80,6 +81,7 @@ extern "C" void
|
|
80
81
|
Init_reflex_ellipse_shape();
|
81
82
|
|
82
83
|
Init_reflex_application();
|
84
|
+
Init_reflex_screen();
|
83
85
|
Init_reflex_window();
|
84
86
|
Init_reflex_view();
|
85
87
|
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#include "reflex/ruby/screen.h"
|
2
|
+
|
3
|
+
|
4
|
+
#include <rays/ruby/bounds.h>
|
5
|
+
#include "defs.h"
|
6
|
+
|
7
|
+
|
8
|
+
RUCY_DEFINE_VALUE_FROM_TO(Reflex::Screen)
|
9
|
+
|
10
|
+
#define THIS to<Reflex::Screen*>(self)
|
11
|
+
|
12
|
+
#define CHECK RUCY_CHECK_OBJECT(Reflex::Screen, self)
|
13
|
+
|
14
|
+
|
15
|
+
static
|
16
|
+
RUCY_DEF_ALLOC(alloc, klass)
|
17
|
+
{
|
18
|
+
Reflex::reflex_error(__FILE__, __LINE__, "can not instantiate Screen class.");
|
19
|
+
}
|
20
|
+
RUCY_END
|
21
|
+
|
22
|
+
static
|
23
|
+
RUCY_DEF0(get_frame)
|
24
|
+
{
|
25
|
+
CHECK;
|
26
|
+
return value(THIS->frame());
|
27
|
+
}
|
28
|
+
RUCY_END
|
29
|
+
|
30
|
+
|
31
|
+
static Class cScreen;
|
32
|
+
|
33
|
+
void
|
34
|
+
Init_reflex_screen ()
|
35
|
+
{
|
36
|
+
Module mReflex = define_module("Reflex");
|
37
|
+
|
38
|
+
cScreen = mReflex.define_class("Screen");
|
39
|
+
cScreen.define_alloc_func(alloc);
|
40
|
+
cScreen.define_method("frame", get_frame);
|
41
|
+
}
|
42
|
+
|
43
|
+
|
44
|
+
namespace Reflex
|
45
|
+
{
|
46
|
+
|
47
|
+
|
48
|
+
Class
|
49
|
+
screen_class ()
|
50
|
+
{
|
51
|
+
return cScreen;
|
52
|
+
}
|
53
|
+
|
54
|
+
|
55
|
+
}// Reflex
|
data/ext/reflex/view.cpp
CHANGED
@@ -675,6 +675,28 @@ RUCY_DEF0(get_scroll_to_fit)
|
|
675
675
|
}
|
676
676
|
RUCY_END
|
677
677
|
|
678
|
+
static
|
679
|
+
RUCY_DEF1(set_fix_angle, fix)
|
680
|
+
{
|
681
|
+
CHECK;
|
682
|
+
|
683
|
+
if (fix)
|
684
|
+
THIS-> add_flag(Reflex::View::FLAG_FIX_ANGLE);
|
685
|
+
else
|
686
|
+
THIS->remove_flag(Reflex::View::FLAG_FIX_ANGLE);
|
687
|
+
|
688
|
+
return fix;
|
689
|
+
}
|
690
|
+
RUCY_END
|
691
|
+
|
692
|
+
static
|
693
|
+
RUCY_DEF0(get_fix_angle)
|
694
|
+
{
|
695
|
+
CHECK;
|
696
|
+
return value(THIS->has_flag(Reflex::View::FLAG_FIX_ANGLE));
|
697
|
+
}
|
698
|
+
RUCY_END
|
699
|
+
|
678
700
|
static
|
679
701
|
RUCY_DEF0(parent)
|
680
702
|
{
|
@@ -1206,25 +1228,25 @@ Init_reflex_view ()
|
|
1206
1228
|
cView.define_method("from_screen", from_screen);
|
1207
1229
|
cView.define_method( "to_screen", to_screen);
|
1208
1230
|
|
1209
|
-
cView.define_method("add_child", add_child);
|
1231
|
+
cView.define_method( "add_child", add_child);
|
1210
1232
|
cView.define_method("remove_child", remove_child);
|
1211
|
-
cView.define_method("clear_children", clear_children);
|
1212
|
-
cView.define_method("find_children", find_children);
|
1213
|
-
cView.define_method("each_child", each_child);
|
1233
|
+
cView.define_method( "clear_children", clear_children);
|
1234
|
+
cView.define_method( "find_children", find_children);
|
1235
|
+
cView.define_method( "each_child", each_child);
|
1214
1236
|
|
1215
|
-
cView.define_method("add_style", add_style);
|
1237
|
+
cView.define_method( "add_style", add_style);
|
1216
1238
|
cView.define_method("remove_style", remove_style);
|
1217
|
-
cView.define_method("get_style", get_style);
|
1218
|
-
cView.define_method("find_styles", find_styles);
|
1219
|
-
cView.define_method("each_style", each_style);
|
1239
|
+
cView.define_method( "get_style", get_style);
|
1240
|
+
cView.define_method( "find_styles", find_styles);
|
1241
|
+
cView.define_method( "each_style", each_style);
|
1220
1242
|
|
1221
|
-
cView.define_method("shape=",
|
1222
|
-
cView.define_method("shape",
|
1223
|
-
cView.define_method("add_shape", add_shape);
|
1243
|
+
cView.define_method( "shape=", set_shape);
|
1244
|
+
cView.define_method( "shape", get_shape);
|
1245
|
+
cView.define_method( "add_shape", add_shape);
|
1224
1246
|
cView.define_method("remove_shape", remove_shape);
|
1225
|
-
cView.define_method("clear_shapes", clear_shapes);
|
1226
|
-
cView.define_method("find_shapes", find_shapes);
|
1227
|
-
cView.define_method("each_shape", each_shape);
|
1247
|
+
cView.define_method( "clear_shapes", clear_shapes);
|
1248
|
+
cView.define_method( "find_shapes", find_shapes);
|
1249
|
+
cView.define_method( "each_shape", each_shape);
|
1228
1250
|
|
1229
1251
|
cView.define_method("filter=", set_filter);
|
1230
1252
|
cView.define_method("filter", get_filter);
|
@@ -1252,6 +1274,8 @@ Init_reflex_view ()
|
|
1252
1274
|
cView.define_method("resize_to_fit?", get_resize_to_fit);
|
1253
1275
|
cView.define_method("scroll_to_fit=", set_scroll_to_fit);
|
1254
1276
|
cView.define_method("scroll_to_fit?", get_scroll_to_fit);
|
1277
|
+
cView.define_method("fix_angle=", set_fix_angle);
|
1278
|
+
cView.define_method("fix_angle?", get_fix_angle);
|
1255
1279
|
cView.define_method("parent", parent);
|
1256
1280
|
cView.define_method("window", window);
|
1257
1281
|
|
data/ext/reflex/window.cpp
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
#include <rays/ruby/bounds.h>
|
5
5
|
#include <rays/ruby/painter.h>
|
6
|
+
#include "reflex/ruby/screen.h"
|
6
7
|
#include "reflex/ruby/view.h"
|
7
8
|
#include "defs.h"
|
8
9
|
|
@@ -41,6 +42,14 @@ RUCY_DEF0(hide)
|
|
41
42
|
}
|
42
43
|
RUCY_END
|
43
44
|
|
45
|
+
static
|
46
|
+
RUCY_DEF0(hidden)
|
47
|
+
{
|
48
|
+
CHECK;
|
49
|
+
return value(THIS->hidden());
|
50
|
+
}
|
51
|
+
RUCY_END
|
52
|
+
|
44
53
|
static
|
45
54
|
RUCY_DEF0(close)
|
46
55
|
{
|
@@ -109,12 +118,61 @@ RUCY_DEF0(get_frame)
|
|
109
118
|
}
|
110
119
|
RUCY_END
|
111
120
|
|
121
|
+
static
|
122
|
+
RUCY_DEF1(set_closable, state)
|
123
|
+
{
|
124
|
+
CHECK;
|
125
|
+
|
126
|
+
if (state)
|
127
|
+
THIS-> add_flag(Reflex::Window::FLAG_CLOSABLE);
|
128
|
+
else
|
129
|
+
THIS->remove_flag(Reflex::Window::FLAG_CLOSABLE);
|
130
|
+
|
131
|
+
return state;
|
132
|
+
}
|
133
|
+
RUCY_END
|
134
|
+
|
135
|
+
static
|
136
|
+
RUCY_DEF0(is_closable)
|
137
|
+
{
|
138
|
+
CHECK;
|
139
|
+
return value(THIS->has_flag(Reflex::Window::FLAG_CLOSABLE));
|
140
|
+
}
|
141
|
+
RUCY_END
|
142
|
+
|
143
|
+
static
|
144
|
+
RUCY_DEF1(set_minimizable, state)
|
145
|
+
{
|
146
|
+
CHECK;
|
147
|
+
|
148
|
+
if (state)
|
149
|
+
THIS-> add_flag(Reflex::Window::FLAG_MINIMIZABLE);
|
150
|
+
else
|
151
|
+
THIS->remove_flag(Reflex::Window::FLAG_MINIMIZABLE);
|
152
|
+
|
153
|
+
return state;
|
154
|
+
}
|
155
|
+
RUCY_END
|
156
|
+
|
157
|
+
static
|
158
|
+
RUCY_DEF0(is_minimizable)
|
159
|
+
{
|
160
|
+
CHECK;
|
161
|
+
return value(THIS->has_flag(Reflex::Window::FLAG_MINIMIZABLE));
|
162
|
+
}
|
163
|
+
RUCY_END
|
164
|
+
|
112
165
|
static
|
113
166
|
RUCY_DEF1(set_resizable, state)
|
114
167
|
{
|
115
168
|
CHECK;
|
116
|
-
|
117
|
-
|
169
|
+
|
170
|
+
if (state)
|
171
|
+
THIS-> add_flag(Reflex::Window::FLAG_RESIZABLE);
|
172
|
+
else
|
173
|
+
THIS->remove_flag(Reflex::Window::FLAG_RESIZABLE);
|
174
|
+
|
175
|
+
return state;
|
118
176
|
}
|
119
177
|
RUCY_END
|
120
178
|
|
@@ -122,20 +180,20 @@ static
|
|
122
180
|
RUCY_DEF0(is_resizable)
|
123
181
|
{
|
124
182
|
CHECK;
|
125
|
-
return value(THIS->
|
183
|
+
return value(THIS->has_flag(Reflex::Window::FLAG_RESIZABLE));
|
126
184
|
}
|
127
185
|
RUCY_END
|
128
186
|
|
129
187
|
static
|
130
|
-
RUCY_DEF0(
|
188
|
+
RUCY_DEF0(get_screen)
|
131
189
|
{
|
132
190
|
CHECK;
|
133
|
-
return value(THIS->
|
191
|
+
return value(THIS->screen());
|
134
192
|
}
|
135
193
|
RUCY_END
|
136
194
|
|
137
195
|
static
|
138
|
-
RUCY_DEF0(
|
196
|
+
RUCY_DEF0(get_root)
|
139
197
|
{
|
140
198
|
CHECK;
|
141
199
|
return value(THIS->root());
|
@@ -143,7 +201,7 @@ RUCY_DEF0(root)
|
|
143
201
|
RUCY_END
|
144
202
|
|
145
203
|
static
|
146
|
-
RUCY_DEF0(
|
204
|
+
RUCY_DEF0(get_focus)
|
147
205
|
{
|
148
206
|
CHECK;
|
149
207
|
return value(THIS->focus());
|
@@ -151,7 +209,7 @@ RUCY_DEF0(focus)
|
|
151
209
|
RUCY_END
|
152
210
|
|
153
211
|
static
|
154
|
-
RUCY_DEF0(
|
212
|
+
RUCY_DEF0(get_painter)
|
155
213
|
{
|
156
214
|
CHECK;
|
157
215
|
return value(THIS->painter());
|
@@ -310,12 +368,17 @@ Init_reflex_window ()
|
|
310
368
|
cWindow.define_method("title", get_title);
|
311
369
|
cWindow.define_method("frame=", set_frame);
|
312
370
|
cWindow.define_method("frame", get_frame);
|
313
|
-
cWindow.define_method("
|
314
|
-
cWindow.define_method("
|
371
|
+
cWindow.define_method("closable=", set_closable);
|
372
|
+
cWindow.define_method("closable?", is_closable);
|
373
|
+
cWindow.define_method("minimizable=", set_minimizable);
|
374
|
+
cWindow.define_method("minimizable?", is_minimizable);
|
375
|
+
cWindow.define_method("resizable=", set_resizable);
|
376
|
+
cWindow.define_method("resizable?", is_resizable);
|
315
377
|
cWindow.define_method("hidden", hidden);
|
316
|
-
cWindow.define_method("
|
317
|
-
cWindow.define_method("
|
318
|
-
cWindow.define_method("
|
378
|
+
cWindow.define_method("screen", get_screen);
|
379
|
+
cWindow.define_method("root", get_root);
|
380
|
+
cWindow.define_method("focus", get_focus);
|
381
|
+
cWindow.define_method("painter", get_painter);
|
319
382
|
cWindow.define_method("on_show", on_show);
|
320
383
|
cWindow.define_method("on_hide", on_hide);
|
321
384
|
cWindow.define_method("on_close", on_close);
|
@@ -0,0 +1,40 @@
|
|
1
|
+
// -*- c++ -*-
|
2
|
+
#pragma once
|
3
|
+
#ifndef __REFLEX_RUBY_SCREEN_H__
|
4
|
+
#define __REFLEX_RUBY_SCREEN_H__
|
5
|
+
|
6
|
+
|
7
|
+
#include <rucy/class.h>
|
8
|
+
#include <rucy/extension.h>
|
9
|
+
#include <reflex/screen.h>
|
10
|
+
|
11
|
+
|
12
|
+
RUCY_DECLARE_VALUE_FROM_TO(Reflex::Screen)
|
13
|
+
|
14
|
+
|
15
|
+
namespace Reflex
|
16
|
+
{
|
17
|
+
|
18
|
+
|
19
|
+
Rucy::Class screen_class ();
|
20
|
+
// class Reflex::Screen
|
21
|
+
|
22
|
+
|
23
|
+
}// Reflex
|
24
|
+
|
25
|
+
|
26
|
+
namespace Rucy
|
27
|
+
{
|
28
|
+
|
29
|
+
|
30
|
+
template <> inline Class
|
31
|
+
get_ruby_class<Reflex::Screen> ()
|
32
|
+
{
|
33
|
+
return Reflex::screen_class();
|
34
|
+
}
|
35
|
+
|
36
|
+
|
37
|
+
}// Rucy
|
38
|
+
|
39
|
+
|
40
|
+
#endif//EOH
|
@@ -0,0 +1,43 @@
|
|
1
|
+
// -*- c++ -*-
|
2
|
+
#pragma once
|
3
|
+
#ifndef __REFLEX_SCREEN_H__
|
4
|
+
#define __REFLEX_SCREEN_H__
|
5
|
+
|
6
|
+
|
7
|
+
#include <xot/pimpl.h>
|
8
|
+
#include <rays/bounds.h>
|
9
|
+
#include <reflex/defs.h>
|
10
|
+
|
11
|
+
|
12
|
+
namespace Reflex
|
13
|
+
{
|
14
|
+
|
15
|
+
|
16
|
+
class Screen
|
17
|
+
{
|
18
|
+
|
19
|
+
typedef Screen This;
|
20
|
+
|
21
|
+
public:
|
22
|
+
|
23
|
+
Screen ();
|
24
|
+
|
25
|
+
virtual ~Screen ();
|
26
|
+
|
27
|
+
virtual Bounds frame () const;
|
28
|
+
|
29
|
+
operator bool () const;
|
30
|
+
|
31
|
+
bool operator ! () const;
|
32
|
+
|
33
|
+
struct Data;
|
34
|
+
|
35
|
+
Xot::PSharedImpl<Data> self;
|
36
|
+
|
37
|
+
};// Screen
|
38
|
+
|
39
|
+
|
40
|
+
}// Reflex
|
41
|
+
|
42
|
+
|
43
|
+
#endif//EOH
|