glimmer-dsl-opal 0.16.2 → 0.17.0

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: 73ea5888d9b6351e59225c868c98bf3c5f8d7bf20e1314bf2289be1528cd5d65
4
- data.tar.gz: 0d5420f934e0d29a8fcdb15e68f2e30365f2d70d9d89e2dc19bbd24d14a91626
3
+ metadata.gz: 8ceab7c0ff7d7ef07cca7f798cfd6f1aa6d4e18b2aaa23d34ded024c491becec
4
+ data.tar.gz: cf4474df385496aad3d0519bd45f69cc51d185a0c7c60e0f941796bfd623cca7
5
5
  SHA512:
6
- metadata.gz: 79e7aae7f3b6e5342e2231f08330cf50e2c5574444b3f07c86b2166722e356e18ca6fb89a2ad21509951360432a42e8f6c449a19b5ff5737b08f521b8f473b79
7
- data.tar.gz: 6f4be96f8c26c160b0d8d8d2dfc92d40cfa95fc79a76cfe886567cd2f55671861adf9b19cfdbc5d1f6fa78a1ce516f7ab46c330bdef2821a1a312b8b165c91cc
6
+ metadata.gz: 99bb2e0b9a22b384eb78774d814ff9b15e6662d89f5e2ad402fc980da644cb3392b0c567d861b696ddbd77a889f40393b64ec8ed0059622114e1f703f52bfbb7
7
+ data.tar.gz: 4b3a76c993f70c32d0133678d5424ead94925836ffe1a45994879df165b008827bd5c9a6e8b107c32717bfeca82a86dad699363a9a36b640d2c1e5929eb91e38
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.17.0
4
+
5
+ - Support `menu` `visible` attribute to enable programmatic display of menu
6
+ - Support `arrow` widget
7
+ - Hello, Arrow! sample
8
+
3
9
  ## 0.16.2
4
10
 
5
11
  - Support `grid_layout` `margin_top`, `margin_right`, `margin_bottom`, and `margin_left` attributes
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for Opal 0.16.2 (Pure Ruby Web GUI)
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for Opal 0.17.0 (Pure Ruby Web GUI)
2
2
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-opal.svg)](http://badge.fury.io/rb/glimmer-dsl-opal)
3
3
  [![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
4
 
@@ -143,7 +143,7 @@ Hello, Table! Game Booked
143
143
 
144
144
  NOTE: Glimmer DSL for Opal is an alpha project. Please help make better by contributing, adopting for small or low risk projects, and providing feedback. It is still an early alpha, so the more feedback and issues you report the better.
145
145
 
146
- **Alpha Version** 0.16.2 only supports bare-minimum capabilities for the included [samples](https://github.com/AndyObtiva/glimmer-dsl-opal#samples) (originally written for [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt))
146
+ **Alpha Version** 0.17.0 only supports bare-minimum capabilities for the included [samples](https://github.com/AndyObtiva/glimmer-dsl-opal#samples) (originally written for [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt))
147
147
 
148
148
  Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
149
149
  - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
@@ -153,7 +153,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
153
153
 
154
154
  ## Table of Contents
155
155
 
156
- - [Glimmer DSL for Opal 0.16.2 (Pure Ruby Web GUI)](#-glimmer-dsl-for-opal-0162-pure-ruby-web-gui)
156
+ - [Glimmer DSL for Opal 0.17.0 (Pure Ruby Web GUI)](#-glimmer-dsl-for-opal-0170-pure-ruby-web-gui)
157
157
  - [Principles](#principles)
158
158
  - [Background](#background)
159
159
  - [Pre-requisites](#pre-requisites)
@@ -257,7 +257,7 @@ gem 'opal', '1.0.4'
257
257
  gem 'opal-rails', '1.1.2'
258
258
  gem 'opal-async', '~> 1.2.0'
259
259
  gem 'opal-jquery', '~> 0.4.4'
260
- gem 'glimmer-dsl-opal', '~> 0.16.2'
260
+ gem 'glimmer-dsl-opal', '~> 0.17.0'
261
261
  gem 'glimmer-dsl-xml', '~> 1.2.0', require: false
262
262
  gem 'glimmer-dsl-css', '~> 1.2.0', require: false
263
263
 
@@ -321,6 +321,7 @@ shell {
321
321
  The following keywords from [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) have fully functional partial support in Opal:
322
322
 
323
323
  Widgets:
324
+ - `arrow`: featured in [Hello, Arrow!](#hello-arrow)
324
325
  - `button`: featured in [Hello, Checkbox!](#hello-checkbox) / [Hello, Button!](#hello-button) / [Hello, Table!](#hello-table) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, Message Box!](#hello-message-box) / [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Hello, Group!](#hello-group) / [Hello, Combo!](#hello-combo) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Contact Manager](#contact-manager) / [Tic Tac Toe](#tic-tac-toe) / [Login](#login)
325
326
  - `browser`: featured in [Hello, Browser!](#hello-browser)
326
327
  - `calendar`: featured in [Hello, Date Time!](#hello-date-time)
@@ -759,6 +760,39 @@ You should see "Hello, List Multi Selection!"
759
760
 
760
761
  ![Glimmer DSL for Opal Hello List Multi Selection](images/glimmer-dsl-opal-hello-list-multi-selection.png)
761
762
 
763
+ #### Hello, Arrow!
764
+
765
+ Add the following require statement to `app/assets/javascripts/application.rb`
766
+
767
+ ```ruby
768
+ require 'glimmer-dsl-opal/samples/hello/hello_arrow'
769
+ ```
770
+
771
+ Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
772
+
773
+ ![Glimmer DSL for SWT Hello Arrow](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-arrow.png)
774
+
775
+ ![Glimmer DSL for SWT Hello Arrow](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-arrow-menu.png)
776
+
777
+ ![Glimmer DSL for SWT Hello Arrow](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-arrow-item-selected.png)
778
+
779
+ Glimmer app on the web (using `glimmer-dsl-opal` gem):
780
+
781
+ Start the Rails server:
782
+ ```
783
+ rails s
784
+ ```
785
+
786
+ Visit `http://localhost:3000`
787
+
788
+ You should see "Hello, Arrow!"
789
+
790
+ ![Glimmer DSL for Opal Hello Arrow](images/glimmer-dsl-opal-hello-arrow.png)
791
+
792
+ ![Glimmer DSL for Opal Hello Arrow](images/glimmer-dsl-opal-hello-arrow-menu.png)
793
+
794
+ ![Glimmer DSL for Opal Hello Arrow](images/glimmer-dsl-opal-hello-arrow-item-selected.png)
795
+
762
796
  #### Hello, Browser!
763
797
 
764
798
  Add the following require statement to `app/assets/javascripts/application.rb`
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.16.2
1
+ 0.17.0
@@ -0,0 +1,65 @@
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ include Glimmer
23
+
24
+ shell {
25
+ row_layout(:vertical) {
26
+ fill true
27
+ center true
28
+ }
29
+
30
+ text 'Hello, Arrow!'
31
+
32
+ label(:center) {
33
+ text 'Click the arrow to get a menu.'
34
+ }
35
+
36
+ arrow { # can be customized by passing `:arrow` SWT style + `:left`, `:right`, `:up`, or `:down` (default)
37
+ @menu = menu {
38
+ menu_item {
39
+ text 'Item &1'
40
+
41
+ on_widget_selected do
42
+ message_box {
43
+ text 'Item 1'
44
+ message 'Item 1 selected!'
45
+ }.open
46
+ end
47
+ }
48
+ menu_item {
49
+ text 'Item &2'
50
+
51
+ on_widget_selected do
52
+ message_box {
53
+ text 'Item 2'
54
+ message 'Item 2 selected!'
55
+ }.open
56
+ end
57
+ }
58
+ }
59
+
60
+ on_widget_selected do |event|
61
+ event.widget.menu.visible = true
62
+ end
63
+ }
64
+
65
+ }.open
@@ -37,6 +37,9 @@ module Glimmer
37
37
  if parent.is_a?(Glimmer::SWT::WidgetProxy)
38
38
  return true
39
39
  else
40
+ puts 'parent'
41
+ puts parent.class
42
+ puts parent
40
43
  raise Glimmer::Error, "menu may only be nested under a widget (like shell or another menu)!"
41
44
  end
42
45
  end
@@ -0,0 +1,42 @@
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ require 'glimmer/swt/widget_proxy'
23
+ require 'glimmer/swt/button_proxy'
24
+
25
+ module Glimmer
26
+ module SWT
27
+ class ArrowProxy < ButtonProxy
28
+ def initialize(parent, args, block)
29
+ if args.to_a.include?(:left)
30
+ @text = '<'
31
+ elsif args.to_a.include?(:right)
32
+ @text = '>'
33
+ elsif args.to_a.include?(:up)
34
+ @text = '^'
35
+ else
36
+ @text = 'v'
37
+ end
38
+ super(parent, args, block)
39
+ end
40
+ end
41
+ end
42
+ end
@@ -1,3 +1,24 @@
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
1
22
  require 'glimmer/swt/widget_proxy'
2
23
  require 'glimmer/swt/radio_proxy'
3
24
  require 'glimmer/swt/checkbox_proxy'
@@ -11,6 +32,8 @@ module Glimmer
11
32
  RadioProxy.new(parent, args, block)
12
33
  elsif args.to_a.include?(:check)
13
34
  CheckboxProxy.new(parent, args, block)
35
+ elsif args.to_a.include?(:arrow)
36
+ ArrowProxy.new(parent, args, block)
14
37
  else
15
38
  new(parent, args, block)
16
39
  end
@@ -29,9 +52,21 @@ module Glimmer
29
52
  end
30
53
 
31
54
  def observation_request_to_event_mapping
55
+ myself = self
32
56
  {
33
57
  'on_widget_selected' => {
34
- event: 'click'
58
+ event: 'click',
59
+ event_handler: -> (event_listener) {
60
+ -> (event) {
61
+ event.define_singleton_method(:widget) {myself}
62
+ doit = true
63
+ event.define_singleton_method(:doit=) do |value|
64
+ doit = value
65
+ end
66
+ event.define_singleton_method(:doit) { doit }
67
+ event_listener.call(event)
68
+ }
69
+ }
35
70
  },
36
71
  }
37
72
  end
@@ -218,6 +218,21 @@ module Glimmer
218
218
  end
219
219
  end
220
220
 
221
+ def visible=(value)
222
+ @visible = value
223
+ if @visible
224
+ parent.menu_requested = true
225
+ parent.dom_element.css('position', 'relative')
226
+ render
227
+ dom_element.css('position', 'absolute')
228
+ dom_element.css('left', parent.menu_x - parent.dom_element.offset.left)
229
+ dom_element.css('top', parent.menu_y - parent.dom_element.offset.top)
230
+ parent.menu_requested = false
231
+ else
232
+ close
233
+ end
234
+ end
235
+
221
236
  def render(custom_parent_dom_element: nil, brand_new: false)
222
237
  # TODO attach to top nav bar if parent is shell
223
238
  # TODO attach listener to parent to display on right click
@@ -226,7 +241,7 @@ module Glimmer
226
241
  if root_menu? && !bar?
227
242
  `$(#{path}).menu();`
228
243
  @close_event_handler = lambda do |event|
229
- close if event.target.parents('.ui-menu').empty?
244
+ close if event.target != parent.dom_element && event.target.parents('.ui-menu').empty?
230
245
  end
231
246
  Element['body'].on('click', &@close_event_handler)
232
247
  end
@@ -236,6 +251,7 @@ module Glimmer
236
251
  def close
237
252
  dom_element.remove
238
253
  Element['body'].off('click', &@close_event_handler)
254
+ @visible = false
239
255
  end
240
256
 
241
257
  def root_menu?
@@ -31,8 +31,8 @@ module Glimmer
31
31
  include Glimmer
32
32
  include PropertyOwner
33
33
 
34
- attr_reader :parent, :args, :path, :children, :enabled, :foreground, :background, :font, :focus, :disposed?, :rendered, :menu_requested
35
- attr_accessor :menu
34
+ attr_reader :parent, :args, :path, :children, :enabled, :foreground, :background, :font, :focus, :disposed?, :rendered
35
+ attr_accessor :menu, :menu_requested, :menu_x, :menu_y
36
36
  alias isDisposed disposed?
37
37
  alias is_disposed disposed?
38
38
  alias rendered? rendered
@@ -133,17 +133,16 @@ module Glimmer
133
133
  # Executes at the closing of a parent widget curly braces after all children/properties have been added/set
134
134
  def post_add_content
135
135
  if !menu.nil? && !is_a?(MenuProxy) && !is_a?(MenuItemProxy)
136
- on_mouse_down { |mouse_event|
136
+ # TODO consider in the future retaining listener registrations to deregister on unsetting of the menu
137
+ on_mouse_move do |mouse_event|
138
+ self.menu_x = mouse_event.x
139
+ self.menu_y = mouse_event.y
140
+ end
141
+ on_mouse_down do |mouse_event|
137
142
  if mouse_event.button == 3 # right-click
138
- @menu_requested = true
139
- dom_element.css('position', 'relative')
140
- menu&.render
141
- menu.dom_element.css('position', 'absolute')
142
- menu.dom_element.css('left', mouse_event.x - parent.get_layout&.margin_width.to_i) # TODO - parent.get_layout&.margin_left.to_i)
143
- menu.dom_element.css('top', mouse_event.y - parent.get_layout&.margin_height.to_i - 5) # TODO - parent.get_layout&.margin_top.to_i)
144
- @menu_requested = false
143
+ menu.visible = true
145
144
  end
146
- }
145
+ end
147
146
  end
148
147
  end
149
148
 
@@ -321,10 +320,12 @@ module Glimmer
321
320
  end
322
321
 
323
322
  def default_observation_request_to_event_mapping
323
+ myself = self
324
324
  mouse_event_handler = -> (event_listener) {
325
325
  -> (event) {
326
326
  # TODO generalize this solution to all widgets that support key presses
327
327
  # TODO support event.location once DOM3 is supported by opal-jquery
328
+ event.define_singleton_method(:widget) {myself}
328
329
  event.define_singleton_method(:button, &event.method(:which))
329
330
  event.define_singleton_method(:count) {1} # TODO support double-click count of 2 in the future by using ondblclick
330
331
  event.define_singleton_method(:x, &event.method(:page_x))
@@ -345,6 +346,31 @@ module Glimmer
345
346
  # event.prevent
346
347
  # event.stop
347
348
  # event.stop_immediate
349
+ # end
350
+ }
351
+ }
352
+ mouse_move_event_handler = -> (event_listener) {
353
+ -> (event) {
354
+ # TODO generalize this solution to all widgets that support key presses
355
+ # TODO support event.location once DOM3 is supported by opal-jquery
356
+ event.define_singleton_method(:widget) {myself}
357
+ event.define_singleton_method(:button, &event.method(:which))
358
+ event.define_singleton_method(:count) {1} # TODO support double-click count of 2 in the future by using ondblclick
359
+ event.define_singleton_method(:x, &event.method(:page_x))
360
+ event.define_singleton_method(:y, &event.method(:page_y))
361
+ doit = true
362
+ event.define_singleton_method(:doit=) do |value|
363
+ doit = value
364
+ end
365
+ event.define_singleton_method(:doit) { doit }
366
+
367
+ event_listener.call(event)
368
+
369
+ # TODO Imlement doit properly for all different kinds of events
370
+ # unless doit
371
+ # event.prevent
372
+ # event.stop
373
+ # event.stop_immediate
348
374
  # end
349
375
  }
350
376
  }
@@ -352,6 +378,7 @@ module Glimmer
352
378
  -> (event) {
353
379
  # TODO generalize this solution to all widgets that support key presses
354
380
  # TODO support event.location once DOM3 is supported by opal-jquery
381
+ event.define_singleton_method(:widget) {myself}
355
382
  event.define_singleton_method(:button, &event.method(:which))
356
383
  event.define_singleton_method(:count) {1} # TODO support double-click count of 2 in the future by using ondblclick
357
384
  event.define_singleton_method(:x, &event.method(:page_x))
@@ -366,7 +393,6 @@ module Glimmer
366
393
  event.prevent
367
394
  event_listener.call(event)
368
395
  end
369
-
370
396
  # TODO Imlement doit properly for all different kinds of events
371
397
  # unless doit
372
398
  # event.prevent
@@ -382,6 +408,12 @@ module Glimmer
382
408
  'on_focus_lost' => {
383
409
  event: 'blur',
384
410
  },
411
+ 'on_mouse_move' => [
412
+ {
413
+ event: 'mousemove',
414
+ event_handler: mouse_move_event_handler,
415
+ },
416
+ ],
385
417
  'on_mouse_up' => [
386
418
  {
387
419
  event: 'mouseup',
@@ -428,6 +460,7 @@ module Glimmer
428
460
  -> (event) {
429
461
  # TODO generalize this solution to all widgets that support key presses
430
462
  # TODO support event.location once DOM3 is supported by opal-jquery
463
+ event.define_singleton_method(:widget) {myself}
431
464
  event.define_singleton_method(:keyCode) {event.which}
432
465
  event.define_singleton_method(:key_code, &event.method(:keyCode))
433
466
  event.define_singleton_method(:character) {event.which.chr}
@@ -464,6 +497,7 @@ module Glimmer
464
497
  -> (event) {
465
498
  # TODO generalize this solution to all widgets that support key presses
466
499
  # TODO support event.location once DOM3 is supported by opal-jquery
500
+ event.define_singleton_method(:widget) {myself}
467
501
  event.define_singleton_method(:keyCode) {event.which}
468
502
  event.define_singleton_method(:key_code, &event.method(:keyCode))
469
503
  event.define_singleton_method(:character) {event.which.chr}
@@ -500,6 +534,7 @@ module Glimmer
500
534
  -> (event) {
501
535
  # TODO generalize this solution to all widgets that support key presses
502
536
  # TODO support event.location once DOM3 is supported by opal-jquery
537
+ event.define_singleton_method(:widget) {myself}
503
538
  event.define_singleton_method(:keyCode) {event.which}
504
539
  event.define_singleton_method(:key_code, &event.method(:keyCode))
505
540
  event.define_singleton_method(:character) {event.which.chr}
@@ -536,6 +571,7 @@ module Glimmer
536
571
  -> (event) {
537
572
  # TODO generalize this solution to all widgets that support key presses
538
573
  # TODO support event.location once DOM3 is supported by opal-jquery
574
+ event.define_singleton_method(:widget) {myself}
539
575
  event.define_singleton_method(:keyCode) {event.which}
540
576
  event.define_singleton_method(:key_code, &event.method(:keyCode))
541
577
  event.define_singleton_method(:character) {event.which.chr}
@@ -924,6 +960,7 @@ end
924
960
  require 'glimmer/swt/display_proxy'
925
961
  require 'glimmer/swt/browser_proxy'
926
962
  require 'glimmer/swt/button_proxy'
963
+ require 'glimmer/swt/arrow_proxy'
927
964
  require 'glimmer/swt/combo_proxy'
928
965
  require 'glimmer/swt/checkbox_proxy'
929
966
  require 'glimmer/swt/composite_proxy'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-opal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.2
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
@@ -284,6 +284,7 @@ files:
284
284
  - lib/glimmer-dsl-opal/samples/elaborate/tic_tac_toe/board.rb
285
285
  - lib/glimmer-dsl-opal/samples/elaborate/tic_tac_toe/cell.rb
286
286
  - lib/glimmer-dsl-opal/samples/elaborate/weather.rb
287
+ - lib/glimmer-dsl-opal/samples/hello/hello_arrow.rb
287
288
  - lib/glimmer-dsl-opal/samples/hello/hello_browser.rb
288
289
  - lib/glimmer-dsl-opal/samples/hello/hello_button.rb
289
290
  - lib/glimmer-dsl-opal/samples/hello/hello_checkbox.rb
@@ -370,6 +371,7 @@ files:
370
371
  - lib/glimmer/dsl/opal/widget_listener_expression.rb
371
372
  - lib/glimmer/engine.rb
372
373
  - lib/glimmer/swt.rb
374
+ - lib/glimmer/swt/arrow_proxy.rb
373
375
  - lib/glimmer/swt/browser_proxy.rb
374
376
  - lib/glimmer/swt/button_proxy.rb
375
377
  - lib/glimmer/swt/checkbox_proxy.rb