reflexion 0.1.19 → 0.1.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/.doc/ext/reflex/contact_event.cpp +6 -6
  3. data/.doc/ext/reflex/event.cpp +9 -1
  4. data/.doc/ext/reflex/focus_event.cpp +6 -6
  5. data/.doc/ext/reflex/key_event.cpp +211 -13
  6. data/.doc/ext/reflex/native.cpp +2 -0
  7. data/.doc/ext/reflex/pointer.cpp +158 -0
  8. data/.doc/ext/reflex/pointer_event.cpp +31 -90
  9. data/.doc/ext/reflex/selector.cpp +8 -0
  10. data/.doc/ext/reflex/view.cpp +57 -0
  11. data/.doc/ext/reflex/window.cpp +41 -0
  12. data/VERSION +1 -1
  13. data/ext/reflex/contact_event.cpp +6 -6
  14. data/ext/reflex/event.cpp +11 -2
  15. data/ext/reflex/focus_event.cpp +6 -6
  16. data/ext/reflex/key_event.cpp +212 -13
  17. data/ext/reflex/native.cpp +2 -0
  18. data/ext/reflex/pointer.cpp +170 -0
  19. data/ext/reflex/pointer_event.cpp +30 -95
  20. data/ext/reflex/selector.cpp +9 -0
  21. data/ext/reflex/view.cpp +67 -3
  22. data/ext/reflex/window.cpp +49 -3
  23. data/include/reflex/defs.h +140 -106
  24. data/include/reflex/event.h +26 -27
  25. data/include/reflex/pointer.h +107 -0
  26. data/include/reflex/ruby/pointer.h +41 -0
  27. data/include/reflex/ruby/view.h +9 -0
  28. data/include/reflex/ruby/window.h +9 -0
  29. data/include/reflex/selector.h +1 -1
  30. data/include/reflex/view.h +6 -4
  31. data/include/reflex/window.h +14 -8
  32. data/lib/reflex/application.rb +3 -3
  33. data/lib/reflex/autoinit.rb +1 -1
  34. data/lib/reflex/button.rb +7 -7
  35. data/lib/reflex/capture_event.rb +7 -7
  36. data/lib/reflex/contact_event.rb +4 -4
  37. data/lib/reflex/draw_event.rb +2 -2
  38. data/lib/reflex/ellipse_shape.rb +2 -2
  39. data/lib/reflex/focus_event.rb +4 -4
  40. data/lib/reflex/frame_event.rb +5 -5
  41. data/lib/reflex/helper.rb +20 -20
  42. data/lib/reflex/image_view.rb +2 -2
  43. data/lib/reflex/key_event.rb +6 -6
  44. data/lib/reflex/model.rb +22 -22
  45. data/lib/reflex/model_owner.rb +7 -7
  46. data/lib/reflex/model_view.rb +1 -1
  47. data/lib/reflex/module.rb +5 -5
  48. data/lib/reflex/pointer.rb +107 -0
  49. data/lib/reflex/pointer_event.rb +16 -54
  50. data/lib/reflex/polygon_shape.rb +2 -2
  51. data/lib/reflex/reflex.rb +3 -3
  52. data/lib/reflex/scroll_event.rb +1 -1
  53. data/lib/reflex/selector.rb +4 -4
  54. data/lib/reflex/shape.rb +13 -13
  55. data/lib/reflex/style.rb +11 -11
  56. data/lib/reflex/style_length.rb +1 -1
  57. data/lib/reflex/text_view.rb +2 -2
  58. data/lib/reflex/timer.rb +2 -2
  59. data/lib/reflex/timer_event.rb +1 -1
  60. data/lib/reflex/update_event.rb +1 -1
  61. data/lib/reflex/view.rb +32 -32
  62. data/lib/reflex/wheel_event.rb +3 -3
  63. data/lib/reflex/window.rb +7 -6
  64. data/lib/reflex.rb +1 -0
  65. data/lib/reflexion.rb +17 -17
  66. data/reflex.gemspec +5 -5
  67. data/samples/reflexion/noise.rb +1 -1
  68. data/samples/tree.rb +1 -1
  69. data/src/event.cpp +189 -37
  70. data/src/event.h +32 -0
  71. data/src/ios/event.h +15 -3
  72. data/src/ios/event.mm +126 -11
  73. data/src/ios/view_controller.mm +50 -22
  74. data/src/ios/window.mm +18 -0
  75. data/src/osx/event.h +14 -3
  76. data/src/osx/event.mm +213 -23
  77. data/src/osx/native_window.mm +84 -17
  78. data/src/osx/window.mm +22 -0
  79. data/src/pointer.cpp +203 -0
  80. data/src/pointer.h +26 -0
  81. data/src/selector.cpp +1 -1
  82. data/src/view.cpp +103 -64
  83. data/src/view.h +0 -4
  84. data/src/window.cpp +334 -98
  85. data/src/window.h +28 -3
  86. data/test/helper.rb +3 -3
  87. data/test/test_application.rb +1 -1
  88. data/test/test_capture_event.rb +6 -6
  89. data/test/test_event.rb +18 -4
  90. data/test/test_has_frame.rb +11 -11
  91. data/test/test_pointer.rb +149 -0
  92. data/test/test_pointer_event.rb +70 -104
  93. data/test/test_reflex.rb +1 -1
  94. data/test/test_selector.rb +15 -8
  95. data/test/test_shape.rb +8 -8
  96. data/test/test_style.rb +13 -13
  97. data/test/test_style_length.rb +5 -5
  98. data/test/test_view.rb +57 -30
  99. data/test/test_window.rb +45 -26
  100. metadata +46 -35
@@ -201,6 +201,15 @@ namespace Reflex
201
201
  Super::on_pointer_move(e);
202
202
  }
203
203
 
204
+ virtual void on_pointer_cancel (PointerEvent* e)
205
+ {
206
+ RUCY_SYM(on_pointer_cancel);
207
+ if (this->is_overridable())
208
+ this->value.call(on_pointer_cancel, Rucy::value(e));
209
+ else
210
+ Super::on_pointer_cancel(e);
211
+ }
212
+
204
213
  virtual void on_wheel (WheelEvent* e)
205
214
  {
206
215
  RUCY_SYM(on_wheel);
@@ -153,6 +153,15 @@ namespace Reflex
153
153
  Super::on_pointer_move(e);
154
154
  }
155
155
 
156
+ virtual void on_pointer_cancel (PointerEvent* e)
157
+ {
158
+ RUCY_SYM(on_pointer_cancel);
159
+ if (this->is_overridable())
160
+ this->value.call(on_pointer_cancel, Rucy::value(e));
161
+ else
162
+ Super::on_pointer_cancel(e);
163
+ }
164
+
156
165
  virtual void on_wheel (WheelEvent* e)
157
166
  {
158
167
  RUCY_SYM(on_wheel);
@@ -55,7 +55,7 @@ namespace Reflex
55
55
 
56
56
  const_iterator end () const;
57
57
 
58
- bool is_empty () const;
58
+ bool empty () const;
59
59
 
60
60
  friend bool operator == (const This& lhs, const This& rhs);
61
61
 
@@ -364,13 +364,15 @@ namespace Reflex
364
364
 
365
365
  virtual void on_key_up (KeyEvent* e);
366
366
 
367
- virtual void on_pointer (PointerEvent* e);
367
+ virtual void on_pointer (PointerEvent* e);
368
368
 
369
- virtual void on_pointer_down (PointerEvent* e);
369
+ virtual void on_pointer_down (PointerEvent* e);
370
370
 
371
- virtual void on_pointer_up (PointerEvent* e);
371
+ virtual void on_pointer_up (PointerEvent* e);
372
372
 
373
- virtual void on_pointer_move (PointerEvent* e);
373
+ virtual void on_pointer_move (PointerEvent* e);
374
+
375
+ virtual void on_pointer_cancel (PointerEvent* e);
374
376
 
375
377
  virtual void on_wheel (WheelEvent* e);
376
378
 
@@ -39,6 +39,10 @@ namespace Reflex
39
39
 
40
40
  virtual void redraw ();
41
41
 
42
+ virtual Point from_screen (const Point& point) const;
43
+
44
+ virtual Point to_screen (const Point& point) const;
45
+
42
46
  virtual void set_title (const char* title);
43
47
 
44
48
  virtual const char* title () const;
@@ -49,6 +53,10 @@ namespace Reflex
49
53
 
50
54
  virtual Bounds frame () const;
51
55
 
56
+ virtual void set_resizable (bool state = true);
57
+
58
+ virtual bool is_resizable () const;
59
+
52
60
  virtual bool hidden () const;
53
61
 
54
62
  virtual View* root ();
@@ -63,10 +71,6 @@ namespace Reflex
63
71
 
64
72
  virtual const Painter* painter () const;
65
73
 
66
- virtual Point from_screen (const Point& point) const;
67
-
68
- virtual Point to_screen (const Point& point) const;
69
-
70
74
  virtual void on_show (Event* e);
71
75
 
72
76
  virtual void on_hide (Event* e);
@@ -87,13 +91,15 @@ namespace Reflex
87
91
 
88
92
  virtual void on_key_up (KeyEvent* e);
89
93
 
90
- virtual void on_pointer (PointerEvent* e);
94
+ virtual void on_pointer (PointerEvent* e);
95
+
96
+ virtual void on_pointer_down (PointerEvent* e);
91
97
 
92
- virtual void on_pointer_down (PointerEvent* e);
98
+ virtual void on_pointer_up (PointerEvent* e);
93
99
 
94
- virtual void on_pointer_up (PointerEvent* e);
100
+ virtual void on_pointer_move (PointerEvent* e);
95
101
 
96
- virtual void on_pointer_move (PointerEvent* e);
102
+ virtual void on_pointer_cancel (PointerEvent* e);
97
103
 
98
104
  virtual void on_wheel (WheelEvent* e);
99
105
 
@@ -18,19 +18,19 @@ module Reflex
18
18
 
19
19
  universal_accessor :name
20
20
 
21
- def initialize (options = nil, &block)
21
+ def initialize(options = nil, &block)
22
22
  super()
23
23
  set options if options
24
24
  @start_block = block if block
25
25
  end
26
26
 
27
- def self.start (*args, &block)
27
+ def self.start(*args, &block)
28
28
  new(*args, &block).start
29
29
  end
30
30
 
31
31
  private
32
32
 
33
- def call_start_block ()
33
+ def call_start_block()
34
34
  return unless @start_block
35
35
  Xot::BlockUtil.instance_eval_or_block_call self, &@start_block
36
36
  @start_block = nil
@@ -5,7 +5,7 @@ require 'rays/autoinit'
5
5
  require 'reflex/ext'
6
6
 
7
7
 
8
- unless $REFLEX_NOAUTOINIT
8
+ unless defined?($REFLEX_NOAUTOINIT) && $REFLEX_NOAUTOINIT
9
9
  Reflex.init!
10
10
  at_exit {Reflex.fin!}
11
11
  end
data/lib/reflex/button.rb CHANGED
@@ -13,21 +13,21 @@ module Reflex
13
13
 
14
14
  attr_accessor :text
15
15
 
16
- def initialize (*args, &block)
16
+ def initialize(*args, &block)
17
17
  self.data = false
18
18
  super
19
19
  self.text = self.name unless self.text
20
20
  end
21
21
 
22
- def content_bounds ()
22
+ def content_bounds()
23
23
  f = window.painter.font
24
24
  return f.width(@text) + 2, f.height + 2
25
25
  end
26
26
 
27
- def on_press (e)
27
+ def on_press(e)
28
28
  end
29
29
 
30
- def on_draw (e)
30
+ def on_draw(e)
31
31
  e.painter.push fill: (pressing? ? :white : :none), stroke: :white do |p|
32
32
  p.rect e.bounds
33
33
 
@@ -43,7 +43,7 @@ module Reflex
43
43
  end
44
44
  end
45
45
 
46
- def on_pointer (e)
46
+ def on_pointer(e)
47
47
  case e.type
48
48
  when :down
49
49
  self.capture += [:pointer]
@@ -60,13 +60,13 @@ module Reflex
60
60
  end
61
61
  end
62
62
 
63
- def on_data_update (e)
63
+ def on_data_update(e)
64
64
  on_press({}) if e.data
65
65
  end
66
66
 
67
67
  private
68
68
 
69
- def pressing? ()
69
+ def pressing?()
70
70
  capturing? :pointer
71
71
  end
72
72
 
@@ -10,25 +10,25 @@ module Reflex
10
10
 
11
11
  class CaptureEvent < Event
12
12
 
13
- def begin ()
13
+ def begin()
14
14
  View.capture_flag.bits2symbols get_begin
15
15
  end
16
16
 
17
- def begin? (*symbols)
18
- bits = View.capture_flag.symbols2bits *symbols
17
+ def begin?(*symbols)
18
+ bits = View.capture_flag.symbols2bits(*symbols)
19
19
  (bits & get_begin) == bits
20
20
  end
21
21
 
22
- def end ()
22
+ def end()
23
23
  View.capture_flag.bits2symbols get_end
24
24
  end
25
25
 
26
- def end? (*symbols)
27
- bits = View.capture_flag.symbols2bits *symbols
26
+ def end?(*symbols)
27
+ bits = View.capture_flag.symbols2bits(*symbols)
28
28
  (bits & get_end) == bits
29
29
  end
30
30
 
31
- def inspect ()
31
+ def inspect()
32
32
  "#<Reflex::CaptureEvent begin:#{self.begin} end:#{self.end}}>"
33
33
  end
34
34
 
@@ -12,21 +12,21 @@ module Reflex
12
12
 
13
13
  alias get_type type
14
14
 
15
- const_symbol_reader :type, {
15
+ const_symbol_reader :type, **{
16
16
  none: TYPE_NONE,
17
17
  begin: TYPE_BEGIN,
18
18
  end: TYPE_END
19
19
  }
20
20
 
21
- def begin? ()
21
+ def begin?()
22
22
  get_type == TYPE_BEGIN
23
23
  end
24
24
 
25
- def end? ()
25
+ def end?()
26
26
  get_type == TYPE_END
27
27
  end
28
28
 
29
- def inspect ()
29
+ def inspect()
30
30
  "#<Reflex::ContactEvent type:#{type} shape:#{shape} view:#{view}>"
31
31
  end
32
32
 
@@ -10,11 +10,11 @@ module Reflex
10
10
 
11
11
  class DrawEvent < Event
12
12
 
13
- def paint (&block)
13
+ def paint(&block)
14
14
  Xot::BlockUtil.instance_eval_or_block_call painter, &block if block
15
15
  end
16
16
 
17
- def inspect ()
17
+ def inspect()
18
18
  "#<Reflex::DrawEvent painter:#{painter} bounds:#{bounds} dt:#{dt} fps:#{fps}>"
19
19
  end
20
20
 
@@ -10,12 +10,12 @@ module Reflex
10
10
 
11
11
  class EllipseShape < Shape
12
12
 
13
- def angle= (range)
13
+ def angle=(range)
14
14
  angle_from range.min
15
15
  angle_to range.max
16
16
  end
17
17
 
18
- def angle ()
18
+ def angle()
19
19
  angle_from..angle_to
20
20
  end
21
21
 
@@ -12,21 +12,21 @@ module Reflex
12
12
 
13
13
  alias get_type type
14
14
 
15
- const_symbol_reader :type, {
15
+ const_symbol_reader :type, **{
16
16
  none: TYPE_NONE,
17
17
  focus: TYPE_FOCUS,
18
18
  blur: TYPE_BLUR
19
19
  }
20
20
 
21
- def focus? ()
21
+ def focus?()
22
22
  get_type == TYPE_FOCUS
23
23
  end
24
24
 
25
- def blur? ()
25
+ def blur?()
26
26
  get_type == TYPE_BLUR
27
27
  end
28
28
 
29
- def inspect ()
29
+ def inspect()
30
30
  "#<Reflex::FocusEvent type:#{type} current:#{current} last:#{last}>"
31
31
  end
32
32
 
@@ -13,26 +13,26 @@ module Reflex
13
13
  alias dh dheight
14
14
  alias dpos dposition
15
15
 
16
- def x ()
16
+ def x()
17
17
  frame.x
18
18
  end
19
19
 
20
- def y ()
20
+ def y()
21
21
  frame.y
22
22
  end
23
23
 
24
- def width ()
24
+ def width()
25
25
  frame.width
26
26
  end
27
27
 
28
- def height ()
28
+ def height()
29
29
  frame.height
30
30
  end
31
31
 
32
32
  alias w width
33
33
  alias h height
34
34
 
35
- def inspect ()
35
+ def inspect()
36
36
  "#<Reflex::FrameEvent x:#{x} y:#{y} w:#{w} h:#{h} dx:#{dx} dy:#{dy} dw:#{dw} dh:#{dh}>"
37
37
  end
38
38
 
data/lib/reflex/helper.rb CHANGED
@@ -14,7 +14,7 @@ module Reflex
14
14
 
15
15
  include Xot::Hookable
16
16
 
17
- def hook (name, &block)
17
+ def hook(name, &block)
18
18
  super "on_#{name}".intern, &block
19
19
  end
20
20
 
@@ -23,28 +23,28 @@ module Reflex
23
23
 
24
24
  module HasFrame
25
25
 
26
- def move_to (*args)
27
- self.frame = frame.move_to *args
26
+ def move_to(*args)
27
+ self.frame = frame.move_to(*args)
28
28
  self
29
29
  end
30
30
 
31
- def move_by (*args)
32
- self.frame = frame.move_by *args
31
+ def move_by(*args)
32
+ self.frame = frame.move_by(*args)
33
33
  self
34
34
  end
35
35
 
36
- def resize_to (*args)
37
- self.frame = frame.resize_to *args
36
+ def resize_to(*args)
37
+ self.frame = frame.resize_to(*args)
38
38
  self
39
39
  end
40
40
 
41
- def resize_by (*args)
42
- self.frame = frame.resize_by *args
41
+ def resize_by(*args)
42
+ self.frame = frame.resize_by(*args)
43
43
  self
44
44
  end
45
45
 
46
- def inset_by (*args)
47
- self.frame = frame.inset_by *args
46
+ def inset_by(*args)
47
+ self.frame = frame.inset_by(*args)
48
48
  self
49
49
  end
50
50
 
@@ -56,10 +56,10 @@ module Reflex
56
56
  position pos size center
57
57
  ].each do |name|
58
58
  class_eval <<-END
59
- def #{name} ()
59
+ def #{name}()
60
60
  frame.#{name}
61
61
  end
62
- def #{name}= (*args)
62
+ def #{name}=(*args)
63
63
  self.frame = frame.tap {|b| b.send :#{name}=, *args}
64
64
  #{name}
65
65
  end
@@ -73,27 +73,27 @@ module Reflex
73
73
 
74
74
  module HasTags
75
75
 
76
- def tag= (*tags)
76
+ def tag=(*tags)
77
77
  clear_tags
78
- tag *tags.flatten
78
+ tag(*tags.flatten)
79
79
  end
80
80
 
81
81
  alias tags= tag=
82
82
 
83
- def tag (*tags)
83
+ def tag(*tags)
84
84
  tags.each {|tag| add_tag tag}
85
85
  end
86
86
 
87
- def untag (*tags)
87
+ def untag(*tags)
88
88
  tags.each {|tag| remove_tag tag}
89
89
  end
90
90
 
91
- def tags ()
91
+ def tags()
92
92
  to_enum :each_tag
93
93
  end
94
94
 
95
- def clear_tags ()
96
- untag *tags.to_a
95
+ def clear_tags()
96
+ untag(*tags.to_a)
97
97
  end
98
98
 
99
99
  end# HasTags
@@ -11,11 +11,11 @@ module Reflex
11
11
 
12
12
  has_model
13
13
 
14
- def image= (image)
14
+ def image=(image)
15
15
  self.data = image
16
16
  end
17
17
 
18
- def on_data_update (e)
18
+ def on_data_update(e)
19
19
  set_image self.data
20
20
  end
21
21
 
@@ -12,26 +12,26 @@ module Reflex
12
12
 
13
13
  alias get_type type
14
14
 
15
- const_symbol_reader :type, {
15
+ const_symbol_reader :type, **{
16
16
  none: TYPE_NONE,
17
17
  down: TYPE_DOWN,
18
18
  up: TYPE_UP
19
19
  }
20
20
 
21
- def down? ()
21
+ def down?()
22
22
  get_type == TYPE_DOWN
23
23
  end
24
24
 
25
- def up? ()
25
+ def up?()
26
26
  get_type == TYPE_UP
27
27
  end
28
28
 
29
- def repeat? ()
29
+ def repeat?()
30
30
  repeat >= 1
31
31
  end
32
32
 
33
- def inspect ()
34
- "#<Reflex::KeyEvent type:#{type} chars:'#{chars}' code:#{code} mod:#{modifiers} repeat:#{repeat} capture?:#{capture?}>"
33
+ def inspect()
34
+ "#<Reflex::KeyEvent type:#{type} chars:'#{chars}' code:#{code} mod:#{modifiers} repeat:#{repeat} captured?:#{captured?}>"
35
35
  end
36
36
 
37
37
  end# KeyEvent
data/lib/reflex/model.rb CHANGED
@@ -18,12 +18,12 @@ module Reflex
18
18
 
19
19
  attr_reader :data
20
20
 
21
- def initialize (data = nil, &block)
21
+ def initialize(data = nil, &block)
22
22
  self.data = data if data
23
23
  Xot::BlockUtil.instance_eval_or_block_call self, &block if block
24
24
  end
25
25
 
26
- def data= (data)
26
+ def data=(data)
27
27
  skip, data = apply_filters(data).tap do |filtered|
28
28
  skip = filtered.nil? && !data.nil?
29
29
  break skip, filtered
@@ -35,79 +35,79 @@ module Reflex
35
35
  @data
36
36
  end
37
37
 
38
- def add_handler (handler)
38
+ def add_handler(handler)
39
39
  super
40
40
  invoke :attach, {}, only: handler
41
41
  end
42
42
 
43
- def remove_handler (handler)
43
+ def remove_handler(handler)
44
44
  invoke :detach, {}, only: handler
45
45
  super
46
46
  end
47
47
 
48
- def invoke (name, attributes = {}, options = {})
48
+ def invoke(name, attributes = {}, options = {})
49
49
  attributes[:data] ||= @data
50
50
  super "on_data_#{name}".intern, attributes, options
51
51
  end
52
52
 
53
- def add_filter (&block)
53
+ def add_filter(&block)
54
54
  (@filters ||= []).push block
55
55
  end
56
56
 
57
- def remove_filter (&block)
57
+ def remove_filter(&block)
58
58
  @filters.delete block if @filters
59
59
  end
60
60
 
61
61
  alias filter add_filter
62
62
 
63
- def validate (&block)
63
+ def validate(&block)
64
64
  filter {|data| block.call(data) ? data : nil}
65
65
  end
66
66
 
67
- def min= (min)
67
+ def min=(min)
68
68
  filter {|data| data < min ? min : data}
69
69
  end
70
70
 
71
- def max= (max)
71
+ def max=(max)
72
72
  filter {|data| data > max ? max : data}
73
73
  end
74
74
 
75
- def minmax= (range)
75
+ def minmax=(range)
76
76
  min, max = range.min, range.max
77
77
  filter {|data| data < min ? min : data > max ? max : data}
78
78
  end
79
79
 
80
- def int (defvar = nil)
80
+ def int(defvar = nil)
81
81
  call_symbols INT_SYMS
82
82
  end
83
83
 
84
- def float (defvar = nil)
84
+ def float(defvar = nil)
85
85
  call_symbols FLOAT_SYMS
86
86
  end
87
87
 
88
- def string (defvar = nil)
88
+ def string(defvar = nil)
89
89
  call_symbols STRING_SYMS
90
90
  end
91
91
 
92
- def [] (*args)
92
+ def [](*args)
93
93
  call_symbols ARRAY_GET_SYMS, *args
94
94
  end
95
95
 
96
- def []= (*args)
96
+ def []=(*args)
97
97
  ret = call_symbols ARRAY_SET_SYMS, *args
98
98
  invoke :update
99
99
  ret
100
100
  end
101
101
 
102
- def size ()
102
+ def size()
103
103
  call_symbols(ARRAY_SIZE_SYMS) || 0
104
104
  end
105
105
 
106
- def each (&block)
107
- data.each &block if block && data.respond_to?(:each)
106
+ def each(&block)
107
+ data.each(&block) if block && data.respond_to?(:each)
108
108
  end
109
109
 
110
- def inspect ()
110
+ def inspect()
111
111
  "#<Model data:#{@data.inspect}>"
112
112
  end
113
113
 
@@ -125,7 +125,7 @@ module Reflex
125
125
 
126
126
  ARRAY_SIZE_SYMS = [:size, :length]
127
127
 
128
- def apply_filters (data)
128
+ def apply_filters(data)
129
129
  return data unless @filters
130
130
  @filters.each do |filter|
131
131
  break if data.nil?
@@ -134,7 +134,7 @@ module Reflex
134
134
  data
135
135
  end
136
136
 
137
- def call_symbols (symbols, *args)
137
+ def call_symbols(symbols, *args)
138
138
  if dat = data
139
139
  symbols.each do |symbol|
140
140
  return dat.send symbol, *args if dat.respond_to? symbol
@@ -11,7 +11,7 @@ module Reflex
11
11
 
12
12
  attr_reader :model
13
13
 
14
- def model= (model)
14
+ def model=(model)
15
15
  return if model == @model
16
16
  @model.remove_handler self if @model
17
17
  @model = model
@@ -19,7 +19,7 @@ module Reflex
19
19
  model
20
20
  end
21
21
 
22
- def data= (data)
22
+ def data=(data)
23
23
  unless data.nil?
24
24
  self.model = Model.new unless @model
25
25
  @model.data = data
@@ -29,19 +29,19 @@ module Reflex
29
29
  data
30
30
  end
31
31
 
32
- def data ()
32
+ def data()
33
33
  @model ? @model.data : nil
34
34
  end
35
35
 
36
- def invoke (*args)
37
- @model.invoke *args if @model
36
+ def invoke(*args)
37
+ @model.invoke(*args) if @model
38
38
  end
39
39
 
40
- def on_data_attach (e)
40
+ def on_data_attach(e)
41
41
  invoke :update, {}, only: self
42
42
  end
43
43
 
44
- def on_data_detach (e)
44
+ def on_data_detach(e)
45
45
  invoke :update, {}, only: self
46
46
  end
47
47
 
@@ -11,7 +11,7 @@ module Reflex
11
11
 
12
12
  include ModelOwner
13
13
 
14
- def on_data_update (e)
14
+ def on_data_update(e)
15
15
  resize_to_fit
16
16
  redraw
17
17
  end