reflexion 0.1.20 → 0.1.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 218d0608702c70706afb48a61849b27fd36fc8a2efc6518da6ed54f66d7e0662
4
- data.tar.gz: ff0332f957a15deea1923575c042c970c9cc86b6da8279131faa91fafe6389af
3
+ metadata.gz: 3a92694d805e53936c602a5b7b4f686c39505f90683f039d021678dae013408a
4
+ data.tar.gz: 78b1cc8751399d48133827f757bd53dd8b165afb695da6b233d80134977274ba
5
5
  SHA512:
6
- metadata.gz: bbacfbdaf3ba3554bfa31a193f0b438b020f2327695f17ee5653953e29693138faa8d89840020b7c735e6474c776cd5c7df9924b59346048f58eafdae19212c8
7
- data.tar.gz: 5e38e12dd168b2ae77f5b427541ed68ed2b50599fba5264987d5819a96e1949b1f45fd4da8e07ce3a275f0c8eb07ca260978e36f693d65e2eb8c48525ef79b91
6
+ metadata.gz: e0086b7bcbc0f684dc3e94fe57fee7057e055708f338d22c11f6dea11dd9c36056079c2558c77bb24d8277b15758e86707a95c0c03ae9e21c35e8192385efe1f
7
+ data.tar.gz: 656414624e17e036e032b0904a7499c6fbb3846b96b8eac83bdf6c6ec6154e89fc93f73ca5d95ee340336830579546cc179342374a7624b8870af4c192ff97d4
@@ -84,6 +84,21 @@ VALUE get_frame(VALUE self)
84
84
  return value(THIS->frame());
85
85
  }
86
86
 
87
+ static
88
+ VALUE set_resizable(VALUE self, VALUE state)
89
+ {
90
+ CHECK;
91
+ THIS->set_resizable(to<bool>(state));
92
+ return value(THIS->is_resizable());
93
+ }
94
+
95
+ static
96
+ VALUE is_resizable(VALUE self)
97
+ {
98
+ CHECK;
99
+ return value(THIS->is_resizable());
100
+ }
101
+
87
102
  static
88
103
  VALUE hidden(VALUE self)
89
104
  {
@@ -239,6 +254,8 @@ Init_window ()
239
254
  rb_define_method(cWindow, "title", RUBY_METHOD_FUNC(get_title), 0);
240
255
  rb_define_method(cWindow, "frame=", RUBY_METHOD_FUNC(set_frame), -1);
241
256
  rb_define_method(cWindow, "frame", RUBY_METHOD_FUNC(get_frame), 0);
257
+ rb_define_method(cWindow, "resizable=", RUBY_METHOD_FUNC(set_resizable), 1);
258
+ cWindow.define_method("resizable?", is_resizable);
242
259
  rb_define_method(cWindow, "hidden", RUBY_METHOD_FUNC(hidden), 0);
243
260
  rb_define_method(cWindow, "root", RUBY_METHOD_FUNC(root), 0);
244
261
  rb_define_method(cWindow, "focus", RUBY_METHOD_FUNC(focus), 0);
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.20
1
+ 0.1.21
@@ -93,6 +93,23 @@ RUCY_DEF0(get_frame)
93
93
  }
94
94
  RUCY_END
95
95
 
96
+ static
97
+ RUCY_DEF1(set_resizable, state)
98
+ {
99
+ CHECK;
100
+ THIS->set_resizable(to<bool>(state));
101
+ return value(THIS->is_resizable());
102
+ }
103
+ RUCY_END
104
+
105
+ static
106
+ RUCY_DEF0(is_resizable)
107
+ {
108
+ CHECK;
109
+ return value(THIS->is_resizable());
110
+ }
111
+ RUCY_END
112
+
96
113
  static
97
114
  RUCY_DEF0(hidden)
98
115
  {
@@ -267,6 +284,8 @@ Init_window ()
267
284
  cWindow.define_method("title", get_title);
268
285
  cWindow.define_method("frame=", set_frame);
269
286
  cWindow.define_method("frame", get_frame);
287
+ cWindow.define_method("resizable=", set_resizable);
288
+ cWindow.define_method("resizable?", is_resizable);
270
289
  cWindow.define_method("hidden", hidden);
271
290
  cWindow.define_method("root", root);
272
291
  cWindow.define_method("focus", focus);
@@ -49,6 +49,10 @@ namespace Reflex
49
49
 
50
50
  virtual Bounds frame () const;
51
51
 
52
+ virtual void set_resizable (bool state = true);
53
+
54
+ virtual bool is_resizable () const;
55
+
52
56
  virtual bool hidden () const;
53
57
 
54
58
  virtual View* root ();
@@ -48,7 +48,8 @@ module Reflex
48
48
  :friction=, :friction,
49
49
  :restitution=, :restitution
50
50
 
51
- universal_accessor :title, :frame
51
+ universal_accessor :title, :frame,
52
+ resizable: {reader: :resizable?}
52
53
 
53
54
  def initialize (options = nil, &block)
54
55
  super()
@@ -28,10 +28,10 @@ Gem::Specification.new do |s|
28
28
  s.platform = Gem::Platform::RUBY
29
29
  s.required_ruby_version = '~> 2'
30
30
 
31
- s.add_runtime_dependency 'xot', '~> 0.1.20'
32
- s.add_runtime_dependency 'rucy', '~> 0.1.20'
33
- s.add_runtime_dependency 'beeps', '~> 0.1.20'
34
- s.add_runtime_dependency 'rays', '~> 0.1.20'
31
+ s.add_runtime_dependency 'xot', '~> 0.1.21'
32
+ s.add_runtime_dependency 'rucy', '~> 0.1.21'
33
+ s.add_runtime_dependency 'beeps', '~> 0.1.21'
34
+ s.add_runtime_dependency 'rays', '~> 0.1.21'
35
35
 
36
36
  s.files = `git ls-files`.split $/
37
37
  s.executables = s.files.grep(%r{^bin/}) {|f| File.basename f}
@@ -371,7 +371,7 @@ ReflexViewController_get_show_fun ()
371
371
  b.move_to(0, 0);
372
372
 
373
373
  if (win->painter())
374
- win->painter()->canvas(b, UIScreen.mainScreen.scale);
374
+ win->painter()->canvas(b, win->painter()->pixel_density());
375
375
 
376
376
  if (win->root())
377
377
  View_set_frame(win->root(), b);
@@ -130,6 +130,24 @@ namespace Reflex
130
130
  rect.size.height);
131
131
  }
132
132
 
133
+ void
134
+ Window_set_resizable (Window* window, bool state)
135
+ {
136
+ not_implemented_error(__FILE__, __LINE__);
137
+ }
138
+
139
+ bool
140
+ Window_is_resizable (const Window& window)
141
+ {
142
+ return false;
143
+ }
144
+
145
+ float
146
+ Window_get_pixel_density (const Window& window)
147
+ {
148
+ return UIScreen.mainScreen.scale;
149
+ }
150
+
133
151
 
134
152
  WindowData::WindowData ()
135
153
  {
@@ -250,7 +250,7 @@ static const NSUInteger WINDOW_STYLE_MASK =
250
250
  b.move_to(0, 0);
251
251
 
252
252
  if (win->painter())
253
- win->painter()->canvas(b, self.backingScaleFactor);
253
+ win->painter()->canvas(b, win->painter()->pixel_density());
254
254
 
255
255
  if (win->root())
256
256
  View_set_frame(win->root(), b);
@@ -112,6 +112,28 @@ namespace Reflex
112
112
  rect.size.height);
113
113
  }
114
114
 
115
+ void
116
+ Window_set_resizable (Window* window, bool state)
117
+ {
118
+ NativeWindow* native = get_native(window);
119
+ if (state)
120
+ native.styleMask |= NSResizableWindowMask;
121
+ else
122
+ native.styleMask &= ~NSResizableWindowMask;
123
+ }
124
+
125
+ bool
126
+ Window_is_resizable (const Window& window)
127
+ {
128
+ return get_native(&window).styleMask & NSResizableWindowMask;
129
+ }
130
+
131
+ float
132
+ Window_get_pixel_density (const Window& window)
133
+ {
134
+ return get_native(&window).backingScaleFactor;
135
+ }
136
+
115
137
 
116
138
  WindowData::WindowData ()
117
139
  {
@@ -133,7 +133,7 @@ namespace Reflex
133
133
  self->root->set_name(VIEW_TAG_ROOT);
134
134
  View_set_window(self->root.get(), this);
135
135
 
136
- self->painter.canvas(0, 0, 1, 1);
136
+ self->painter.canvas(0, 0, 1, 1, Window_get_pixel_density(*this));
137
137
  }
138
138
 
139
139
  Window::~Window ()
@@ -221,6 +221,18 @@ namespace Reflex
221
221
  return Window_get_frame(*this);
222
222
  }
223
223
 
224
+ void
225
+ Window::set_resizable (bool state)
226
+ {
227
+ Window_set_resizable(this, state);
228
+ }
229
+
230
+ bool
231
+ Window::is_resizable () const
232
+ {
233
+ Window_is_resizable(*this);
234
+ }
235
+
224
236
  bool
225
237
  Window::hidden () const
226
238
  {
@@ -78,10 +78,16 @@ namespace Reflex
78
78
 
79
79
  Bounds Window_get_frame (const Window& window);
80
80
 
81
+ void Window_set_resizable (Window* window, bool state);
82
+
83
+ bool Window_is_resizable (const Window& window);
84
+
81
85
  void Window_set_focus (Window* window, View* view);
82
86
 
83
87
  void Window_call_draw_event (Window* window, DrawEvent* event);
84
88
 
89
+ float Window_get_pixel_density (const Window& window);
90
+
85
91
 
86
92
  typedef View* (*Window_CreateRootViewFun) ();
87
93
 
@@ -68,6 +68,23 @@ class TestWindow < Test::Unit::TestCase
68
68
  w.frame = [bounds(1, 2, 3, 4, 5, 6)]; assert_equal [1, 2, 0, 4, 5, 0], w.frame.to_a(3)
69
69
  end
70
70
 
71
+ def test_resizable? ()
72
+ w = win
73
+ assert_true w.resizable?
74
+
75
+ w.resizable = false
76
+ assert_false w.resizable?
77
+
78
+ w.resizable = true
79
+ assert_true w.resizable?
80
+
81
+ w.resizable false
82
+ assert_false w.resizable?
83
+
84
+ w.resizable true
85
+ assert_true w.resizable?
86
+ end
87
+
71
88
  def test_title ()
72
89
  w = win
73
90
  assert_equal '', w.title
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reflexion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20
4
+ version: 0.1.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - xordog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-10 00:00:00.000000000 Z
11
+ date: 2020-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xot
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.1.20
19
+ version: 0.1.21
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.1.20
26
+ version: 0.1.21
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rucy
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.1.20
33
+ version: 0.1.21
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.1.20
40
+ version: 0.1.21
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: beeps
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.1.20
47
+ version: 0.1.21
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.1.20
54
+ version: 0.1.21
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rays
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.1.20
61
+ version: 0.1.21
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.1.20
68
+ version: 0.1.21
69
69
  description: This library helps you to develop interactive graphical user interface.
70
70
  email: xordog@gmail.com
71
71
  executables: []