glimmer-dsl-opal 0.19.1 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/README.md +104 -2
- data/VERSION +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_cursor.rb +58 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_scale.rb +55 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_slider.rb +56 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_spinner.rb +78 -0
- data/lib/glimmer/swt/c_tab_item_proxy.rb +2 -2
- data/lib/glimmer/swt/scale_proxy.rb +98 -0
- data/lib/glimmer/swt/shell_proxy.rb +3 -0
- data/lib/glimmer/swt/slider_proxy.rb +100 -0
- data/lib/glimmer/swt/spinner_proxy.rb +211 -0
- data/lib/glimmer/swt/swt_proxy.rb +10 -6
- data/lib/glimmer/swt/text_proxy.rb +0 -1
- data/lib/glimmer/swt/widget_proxy.rb +63 -10
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 167c3eec05fdb361d6e3f28d47ee672ee0e835264da34e017c3f72fbd04ac900
|
4
|
+
data.tar.gz: ae462638ff85959876a28c4ccd69a04ccd6c3bd4ac543428b400ecd8fe5666c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6435a394aaa0d03b39aaebacd4ef7b9bbea9b7ae6cd2f82b5573fc533e5d7ea5c795ee57fb7a70305b4c32f3bf1cfdeeed596387d5e8ac025cc741ab3977ece
|
7
|
+
data.tar.gz: c4dbcc37ac1c17c9ed6438f75940c34cda97194018e4b5dfb98d16354503cd6059cff762c6eaacf5d59c8897183083c50179597b572d5a8ead9241e3474a88e5
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,26 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.22.0
|
4
|
+
|
5
|
+
- Support widget `cursor` attribute
|
6
|
+
- Hello, Cursor! sample
|
7
|
+
|
8
|
+
## 0.21.0
|
9
|
+
|
10
|
+
- Support `scale` widget
|
11
|
+
- Hello, Scale!
|
12
|
+
- Support `slider` widget
|
13
|
+
- Hello, Slider!
|
14
|
+
|
15
|
+
## 0.20.1
|
16
|
+
|
17
|
+
- Support `spinner` automatic insertion of decimal point when `digits` attribute is specified
|
18
|
+
|
19
|
+
## 0.20.0
|
20
|
+
|
21
|
+
- Support `spinner` widget (leaving out automatic insertion of decimal point when digits are specified)
|
22
|
+
- Hello, Spinner! sample
|
23
|
+
|
3
24
|
## 0.19.1
|
4
25
|
|
5
26
|
- Fix widget `font` property support for both `:bold` and `:italic` styles at the same time
|
data/README.md
CHANGED
@@ -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.
|
146
|
+
**Alpha Version** 0.22.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)
|
@@ -165,6 +165,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
|
165
165
|
- [Hello, Combo!](#hello-combo)
|
166
166
|
- [Hello, Composite!](#hello-composite)
|
167
167
|
- [Hello, Computed!](#hello-computed)
|
168
|
+
- [Hello, Cursor!](#hello-cursor)
|
168
169
|
- [Hello, Layout!](#hello-layout)
|
169
170
|
- [Hello, List Single Selection!](#hello-list-single-selection)
|
170
171
|
- [Hello, List Multi Selection!](#hello-list-multi-selection)
|
@@ -261,7 +262,7 @@ gem 'opal', '1.0.4'
|
|
261
262
|
gem 'opal-rails', '1.1.2'
|
262
263
|
gem 'opal-async', '~> 1.2.0'
|
263
264
|
gem 'opal-jquery', '~> 0.4.4'
|
264
|
-
gem 'glimmer-dsl-opal', '~> 0.
|
265
|
+
gem 'glimmer-dsl-opal', '~> 0.22.0'
|
265
266
|
gem 'glimmer-dsl-xml', '~> 1.2.0', require: false
|
266
267
|
gem 'glimmer-dsl-css', '~> 1.2.0', require: false
|
267
268
|
|
@@ -663,6 +664,32 @@ You should see "Hello, Computed!"
|
|
663
664
|
|
664
665
|
![Glimmer DSL for Opal Hello Computed](images/glimmer-dsl-opal-hello-computed.png)
|
665
666
|
|
667
|
+
#### Hello, Cursor!
|
668
|
+
|
669
|
+
Add the following require statement to `app/assets/javascripts/application.rb`
|
670
|
+
|
671
|
+
|
672
|
+
```ruby
|
673
|
+
require 'glimmer-dsl-opal/samples/hello/hello_cursor'
|
674
|
+
```
|
675
|
+
|
676
|
+
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
677
|
+
|
678
|
+
![Glimmer DSL for SWT Hello Cursor](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-cursor.gif)
|
679
|
+
|
680
|
+
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
681
|
+
|
682
|
+
Start the Rails server:
|
683
|
+
```
|
684
|
+
rails s
|
685
|
+
```
|
686
|
+
|
687
|
+
Visit `http://localhost:3000`
|
688
|
+
|
689
|
+
You should see "Hello, Cursor!"
|
690
|
+
|
691
|
+
![Glimmer DSL for Opal Hello Cursor](images/glimmer-dsl-opal-hello-cursor.gif)
|
692
|
+
|
666
693
|
#### Hello, Layout!
|
667
694
|
|
668
695
|
Add the following require statement to `app/assets/javascripts/application.rb`
|
@@ -799,6 +826,81 @@ You should see "Hello, Arrow!"
|
|
799
826
|
|
800
827
|
![Glimmer DSL for Opal Hello Arrow](images/glimmer-dsl-opal-hello-arrow-item-selected.png)
|
801
828
|
|
829
|
+
#### Hello, Scale!
|
830
|
+
|
831
|
+
Add the following require statement to `app/assets/javascripts/application.rb`
|
832
|
+
|
833
|
+
```ruby
|
834
|
+
require 'glimmer-dsl-opal/samples/hello/hello_scale'
|
835
|
+
```
|
836
|
+
|
837
|
+
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
838
|
+
|
839
|
+
![Glimmer DSL for SWT Hello Scale](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-scale.png)
|
840
|
+
|
841
|
+
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
842
|
+
|
843
|
+
Start the Rails server:
|
844
|
+
```
|
845
|
+
rails s
|
846
|
+
```
|
847
|
+
|
848
|
+
Visit `http://localhost:3000`
|
849
|
+
|
850
|
+
You should see "Hello, Scale!"
|
851
|
+
|
852
|
+
![Glimmer DSL for Opal Hello Scale](images/glimmer-dsl-opal-hello-scale.png)
|
853
|
+
|
854
|
+
#### Hello, Slider!
|
855
|
+
|
856
|
+
Add the following require statement to `app/assets/javascripts/application.rb`
|
857
|
+
|
858
|
+
```ruby
|
859
|
+
require 'glimmer-dsl-opal/samples/hello/hello_slider'
|
860
|
+
```
|
861
|
+
|
862
|
+
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
863
|
+
|
864
|
+
![Glimmer DSL for SWT Hello Slider](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-slider.png)
|
865
|
+
|
866
|
+
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
867
|
+
|
868
|
+
Start the Rails server:
|
869
|
+
```
|
870
|
+
rails s
|
871
|
+
```
|
872
|
+
|
873
|
+
Visit `http://localhost:3000`
|
874
|
+
|
875
|
+
You should see "Hello, Slider!"
|
876
|
+
|
877
|
+
![Glimmer DSL for Opal Hello Slider](images/glimmer-dsl-opal-hello-slider.png)
|
878
|
+
|
879
|
+
#### Hello, Spinner!
|
880
|
+
|
881
|
+
Add the following require statement to `app/assets/javascripts/application.rb`
|
882
|
+
|
883
|
+
```ruby
|
884
|
+
require 'glimmer-dsl-opal/samples/hello/hello_spinner'
|
885
|
+
```
|
886
|
+
|
887
|
+
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
888
|
+
|
889
|
+
![Glimmer DSL for SWT Hello Spinner](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-spinner.png)
|
890
|
+
|
891
|
+
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
892
|
+
|
893
|
+
Start the Rails server:
|
894
|
+
```
|
895
|
+
rails s
|
896
|
+
```
|
897
|
+
|
898
|
+
Visit `http://localhost:3000`
|
899
|
+
|
900
|
+
You should see "Hello, Spinner!"
|
901
|
+
|
902
|
+
![Glimmer DSL for Opal Hello Spinner](images/glimmer-dsl-opal-hello-spinner.png)
|
903
|
+
|
802
904
|
#### Hello, Browser!
|
803
905
|
|
804
906
|
Add the following require statement to `app/assets/javascripts/application.rb`
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.22.0
|
@@ -0,0 +1,58 @@
|
|
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
|
+
class HelloCursor
|
23
|
+
include Glimmer::UI::CustomShell
|
24
|
+
|
25
|
+
attr_accessor :selected_cursor
|
26
|
+
|
27
|
+
# This method matches the name of the :selected_cursor property by convention
|
28
|
+
def selected_cursor_options
|
29
|
+
Glimmer::SWT::SWTProxy.cursor_options
|
30
|
+
end
|
31
|
+
|
32
|
+
after_body do
|
33
|
+
observe(self, :selected_cursor) {
|
34
|
+
body_root.cursor = selected_cursor
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
body {
|
39
|
+
shell {
|
40
|
+
grid_layout
|
41
|
+
|
42
|
+
text 'Hello, Cursor!'
|
43
|
+
cursor :wait
|
44
|
+
|
45
|
+
label {
|
46
|
+
text 'Please select a cursor style and see it change the mouse cursor (varies per platform):'
|
47
|
+
font style: :bold
|
48
|
+
cursor :no
|
49
|
+
}
|
50
|
+
radio_group {
|
51
|
+
grid_layout 5, true
|
52
|
+
selection <=> [self, :selected_cursor]
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
HelloCursor.launch
|
@@ -0,0 +1,55 @@
|
|
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
|
+
class HelloScale
|
23
|
+
include Glimmer::UI::CustomShell
|
24
|
+
|
25
|
+
attr_accessor :value
|
26
|
+
|
27
|
+
before_body do
|
28
|
+
@value = 50
|
29
|
+
end
|
30
|
+
|
31
|
+
body {
|
32
|
+
shell {
|
33
|
+
row_layout(:vertical) {
|
34
|
+
fill true
|
35
|
+
center true
|
36
|
+
}
|
37
|
+
|
38
|
+
text 'Hello, Scale!'
|
39
|
+
|
40
|
+
label(:center) {
|
41
|
+
text <= [self, :value]
|
42
|
+
}
|
43
|
+
|
44
|
+
scale { # optionally takes :vertical or :horizontal (default) SWT style
|
45
|
+
minimum 0
|
46
|
+
maximum 100
|
47
|
+
selection <=> [self, :value]
|
48
|
+
}
|
49
|
+
|
50
|
+
}
|
51
|
+
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
HelloScale.launch
|
@@ -0,0 +1,56 @@
|
|
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
|
+
class HelloSlider
|
23
|
+
include Glimmer::UI::CustomShell
|
24
|
+
|
25
|
+
attr_accessor :value
|
26
|
+
|
27
|
+
before_body do
|
28
|
+
@value = 50
|
29
|
+
end
|
30
|
+
|
31
|
+
body {
|
32
|
+
shell {
|
33
|
+
row_layout(:vertical) {
|
34
|
+
fill true
|
35
|
+
center true
|
36
|
+
}
|
37
|
+
|
38
|
+
text 'Hello, Slider!'
|
39
|
+
|
40
|
+
label(:center) {
|
41
|
+
text <= [self, :value]
|
42
|
+
}
|
43
|
+
|
44
|
+
slider { # optionally takes :vertical or :horizontal (default) SWT style
|
45
|
+
minimum 0
|
46
|
+
maximum 110 # leave room for 10 extra (slider stops at 100)
|
47
|
+
page_increment 10 # page increment occurs when clicking area between slider and beginning or end
|
48
|
+
selection <=> [self, :value]
|
49
|
+
}
|
50
|
+
|
51
|
+
}
|
52
|
+
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
HelloSlider.launch
|
@@ -0,0 +1,78 @@
|
|
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
|
+
class HelloSpinner
|
23
|
+
class Person
|
24
|
+
attr_accessor :donation
|
25
|
+
end
|
26
|
+
|
27
|
+
include Glimmer::UI::CustomShell
|
28
|
+
|
29
|
+
before_body do
|
30
|
+
@person = Person.new
|
31
|
+
@person.donation = 500 # in cents
|
32
|
+
end
|
33
|
+
|
34
|
+
body {
|
35
|
+
shell {
|
36
|
+
grid_layout
|
37
|
+
|
38
|
+
text 'Hello, Spinner!'
|
39
|
+
|
40
|
+
label {
|
41
|
+
text 'Please select the amount you would like to donate to the poor:'
|
42
|
+
}
|
43
|
+
|
44
|
+
composite {
|
45
|
+
grid_layout 3, false
|
46
|
+
|
47
|
+
label {
|
48
|
+
layout_data {
|
49
|
+
width_hint 240
|
50
|
+
}
|
51
|
+
text 'Amount:'
|
52
|
+
font style: :bold
|
53
|
+
}
|
54
|
+
|
55
|
+
label {
|
56
|
+
text '$'
|
57
|
+
}
|
58
|
+
|
59
|
+
spinner {
|
60
|
+
digits 2 # digits after the decimal point
|
61
|
+
minimum 100 # minimum value (including digits after the decimal point)
|
62
|
+
maximum 15000 # maximum value (including digits after the decimal point)
|
63
|
+
increment 500 # increment on up and down (including digits after the decimal point)
|
64
|
+
page_increment 5000 # page increment on page up and page down (including digits after the decimal point)
|
65
|
+
selection <=> [@person, :donation] # selection must be set last if other properties are configured to ensure value is within bounds
|
66
|
+
}
|
67
|
+
|
68
|
+
label {
|
69
|
+
layout_data(:fill, :center, true, false)
|
70
|
+
text <=> [@person, :donation, on_read: ->(value) { "Thank you for your donation of $#{"%.2f" % (value.to_f / 100.0)}"}]
|
71
|
+
}
|
72
|
+
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
HelloSpinner.launch
|
@@ -52,8 +52,8 @@ module Glimmer
|
|
52
52
|
def font=(value)
|
53
53
|
@font = value.is_a?(FontProxy) ? value : FontProxy.new(self, value)
|
54
54
|
tab_dom_element.css('font-family', @font.name) unless @font.nil?
|
55
|
-
tab_dom_element.css('font-style', 'italic') if @font&.style == :italic || @font&.style
|
56
|
-
tab_dom_element.css('font-weight', 'bold') if @font&.style == :bold || @font&.style
|
55
|
+
tab_dom_element.css('font-style', 'italic') if @font&.style == :italic || [@font&.style].flatten.compact.include?(:italic)
|
56
|
+
tab_dom_element.css('font-weight', 'bold') if @font&.style == :bold || [@font&.style].flatten.compact.include?(:bold)
|
57
57
|
tab_dom_element.css('font-size', "#{@font.height}px") unless @font.nil?
|
58
58
|
end
|
59
59
|
|
@@ -0,0 +1,98 @@
|
|
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
|
+
|
24
|
+
module Glimmer
|
25
|
+
module SWT
|
26
|
+
class ScaleProxy < WidgetProxy
|
27
|
+
attr_reader :selection, :minimum, :maximum, :increment
|
28
|
+
|
29
|
+
def initialize(parent, args, block)
|
30
|
+
super(parent, args, block)
|
31
|
+
dom_element.slider
|
32
|
+
end
|
33
|
+
|
34
|
+
def selection=(value)
|
35
|
+
old_value = @selection.to_f
|
36
|
+
@selection = value.to_f
|
37
|
+
dom_element.slider('option', 'value', @selection)
|
38
|
+
end
|
39
|
+
alias set_selection selection=
|
40
|
+
|
41
|
+
def minimum=(value)
|
42
|
+
@minimum = value.to_f
|
43
|
+
dom_element.slider('option', 'min', @minimum)
|
44
|
+
end
|
45
|
+
|
46
|
+
def maximum=(value)
|
47
|
+
@maximum = value.to_f
|
48
|
+
dom_element.slider('option', 'max', @maximum)
|
49
|
+
end
|
50
|
+
|
51
|
+
def increment=(value)
|
52
|
+
@increment = value.to_f
|
53
|
+
dom_element.slider('option', 'step', @increment)
|
54
|
+
end
|
55
|
+
|
56
|
+
def element
|
57
|
+
'div'
|
58
|
+
end
|
59
|
+
|
60
|
+
def observation_request_to_event_mapping
|
61
|
+
{
|
62
|
+
'on_widget_selected' => [
|
63
|
+
{
|
64
|
+
event: 'change',
|
65
|
+
event_handler: -> (event_listener) {
|
66
|
+
-> (event) {
|
67
|
+
self.selection = dom_element.slider('option', 'value')
|
68
|
+
event_listener.call(event)
|
69
|
+
}
|
70
|
+
}
|
71
|
+
},
|
72
|
+
{
|
73
|
+
event: 'slidestop',
|
74
|
+
event_handler: -> (event_listener) {
|
75
|
+
-> (event) {
|
76
|
+
self.selection = dom_element.slider('option', 'value')
|
77
|
+
event_listener.call(event)
|
78
|
+
}
|
79
|
+
}
|
80
|
+
},
|
81
|
+
],
|
82
|
+
}
|
83
|
+
end
|
84
|
+
|
85
|
+
def dom
|
86
|
+
scale_selection = @selection
|
87
|
+
scale_id = id
|
88
|
+
scale_style = css
|
89
|
+
scale_class = name
|
90
|
+
options = {type: 'text', id: scale_id, style: scale_style, class: scale_class, value: scale_selection}
|
91
|
+
options = options.merge('disabled': 'disabled') unless @enabled
|
92
|
+
@dom ||= html {
|
93
|
+
div(options)
|
94
|
+
}.to_s
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,100 @@
|
|
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
|
+
|
24
|
+
module Glimmer
|
25
|
+
module SWT
|
26
|
+
class SliderProxy < WidgetProxy
|
27
|
+
attr_reader :selection, :minimum, :maximum, :page_increment
|
28
|
+
|
29
|
+
def initialize(parent, args, block)
|
30
|
+
super(parent, args, block)
|
31
|
+
dom_element.slider
|
32
|
+
self.page_increment = 10 # default page increment
|
33
|
+
end
|
34
|
+
|
35
|
+
def selection=(value)
|
36
|
+
old_value = @selection.to_f
|
37
|
+
@selection = value.to_f
|
38
|
+
dom_element.slider('option', 'value', @selection)
|
39
|
+
end
|
40
|
+
alias set_selection selection=
|
41
|
+
|
42
|
+
def minimum=(value)
|
43
|
+
@minimum = value.to_f
|
44
|
+
dom_element.slider('option', 'min', @minimum)
|
45
|
+
end
|
46
|
+
|
47
|
+
def maximum=(value)
|
48
|
+
# being compatible with slider quirk in Glimmer DSL for SWT (does not reach max yet max - 10)
|
49
|
+
@maximum = value.to_f - 10
|
50
|
+
dom_element.slider('option', 'max', @maximum)
|
51
|
+
end
|
52
|
+
|
53
|
+
def page_increment=(value)
|
54
|
+
@page_increment = value.to_f
|
55
|
+
dom_element.slider('option', 'step', @page_increment)
|
56
|
+
end
|
57
|
+
|
58
|
+
def element
|
59
|
+
'div'
|
60
|
+
end
|
61
|
+
|
62
|
+
def observation_request_to_event_mapping
|
63
|
+
{
|
64
|
+
'on_widget_selected' => [
|
65
|
+
{
|
66
|
+
event: 'change',
|
67
|
+
event_handler: -> (event_listener) {
|
68
|
+
-> (event) {
|
69
|
+
self.selection = dom_element.slider('option', 'value')
|
70
|
+
event_listener.call(event)
|
71
|
+
}
|
72
|
+
}
|
73
|
+
},
|
74
|
+
{
|
75
|
+
event: 'slidestop',
|
76
|
+
event_handler: -> (event_listener) {
|
77
|
+
-> (event) {
|
78
|
+
self.selection = dom_element.slider('option', 'value')
|
79
|
+
event_listener.call(event)
|
80
|
+
}
|
81
|
+
}
|
82
|
+
},
|
83
|
+
],
|
84
|
+
}
|
85
|
+
end
|
86
|
+
|
87
|
+
def dom
|
88
|
+
slider_selection = @selection
|
89
|
+
slider_id = id
|
90
|
+
slider_style = css
|
91
|
+
slider_class = name
|
92
|
+
options = {type: 'text', id: slider_id, style: slider_style, class: slider_class, value: slider_selection}
|
93
|
+
options = options.merge('disabled': 'disabled') unless @enabled
|
94
|
+
@dom ||= html {
|
95
|
+
div(options)
|
96
|
+
}.to_s
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,211 @@
|
|
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
|
+
|
24
|
+
module Glimmer
|
25
|
+
module SWT
|
26
|
+
class SpinnerProxy < WidgetProxy
|
27
|
+
attr_reader :minimum, :maximum, :increment, :page_increment, :digits
|
28
|
+
|
29
|
+
def initialize(parent, args, block)
|
30
|
+
super(parent, args, block)
|
31
|
+
@increment = 1
|
32
|
+
@digits = 0
|
33
|
+
dom_element.spinner
|
34
|
+
end
|
35
|
+
|
36
|
+
def selection=(value, format_digits: true)
|
37
|
+
old_value = @selection.to_f
|
38
|
+
if @selection.nil?
|
39
|
+
@selection = value.to_f / divider
|
40
|
+
else
|
41
|
+
@selection = value.to_f
|
42
|
+
end
|
43
|
+
if value.to_i != old_value.to_i
|
44
|
+
if format_digits && @digits.to_i > 0
|
45
|
+
new_value = "%0.#{@digits.to_i}f" % @selection
|
46
|
+
dom_element.value = new_value
|
47
|
+
else
|
48
|
+
dom_element.value = @selection if @selection != 0
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
alias set_selection selection=
|
53
|
+
|
54
|
+
def selection
|
55
|
+
@selection && @selection * divider
|
56
|
+
end
|
57
|
+
|
58
|
+
def text=(value)
|
59
|
+
self.selection = value.to_f
|
60
|
+
end
|
61
|
+
|
62
|
+
def text
|
63
|
+
self.selection.to_s
|
64
|
+
end
|
65
|
+
|
66
|
+
def minimum=(value)
|
67
|
+
@minimum = value.to_f / divider
|
68
|
+
dom_element.spinner('option', 'min', @minimum)
|
69
|
+
end
|
70
|
+
|
71
|
+
def maximum=(value)
|
72
|
+
@maximum = value.to_f / divider
|
73
|
+
dom_element.spinner('option', 'max', @maximum)
|
74
|
+
end
|
75
|
+
|
76
|
+
def increment=(value)
|
77
|
+
@increment = value.to_f / divider
|
78
|
+
dom_element.spinner('option', 'step', @increment)
|
79
|
+
end
|
80
|
+
|
81
|
+
def page_increment=(value)
|
82
|
+
@page_increment = value.to_f / (@increment * divider)
|
83
|
+
dom_element.spinner('option', 'page', @page_increment)
|
84
|
+
end
|
85
|
+
|
86
|
+
def divider
|
87
|
+
('1' + '0'*@digits.to_i).to_f
|
88
|
+
end
|
89
|
+
|
90
|
+
def digits=(value)
|
91
|
+
@digits = value
|
92
|
+
dom_element.spinner('option', 'numberFormat', "n") if @digits.to_i > 0
|
93
|
+
end
|
94
|
+
|
95
|
+
def element
|
96
|
+
'input'
|
97
|
+
end
|
98
|
+
|
99
|
+
def observation_request_to_event_mapping
|
100
|
+
{
|
101
|
+
'on_widget_selected' => [
|
102
|
+
{
|
103
|
+
event: 'change',
|
104
|
+
event_handler: -> (event_listener) {
|
105
|
+
-> (event) {
|
106
|
+
self.selection = event.target.value
|
107
|
+
event_listener.call(event)
|
108
|
+
}
|
109
|
+
}
|
110
|
+
},
|
111
|
+
{
|
112
|
+
event: 'keyup',
|
113
|
+
event_handler: -> (event_listener) {
|
114
|
+
-> (event) {
|
115
|
+
@keyup = true # ensures spinstop event does not set selection if caused by key up entry
|
116
|
+
}
|
117
|
+
}
|
118
|
+
},
|
119
|
+
{
|
120
|
+
event: 'spin',
|
121
|
+
event_handler: -> (event_listener) {
|
122
|
+
-> (event) {
|
123
|
+
@keyup = false
|
124
|
+
}
|
125
|
+
}
|
126
|
+
},
|
127
|
+
{
|
128
|
+
event: 'spinstop',
|
129
|
+
event_handler: -> (event_listener) {
|
130
|
+
-> (event) {
|
131
|
+
self.set_selection(event.target.value, format_digits: !@keyup)
|
132
|
+
@keyup = false
|
133
|
+
event_listener.call(event)
|
134
|
+
}
|
135
|
+
}
|
136
|
+
},
|
137
|
+
],
|
138
|
+
'on_modify_text' => {
|
139
|
+
event: 'keyup',
|
140
|
+
event_handler: -> (event_listener) {
|
141
|
+
-> (event) {
|
142
|
+
# TODO consider unifying this event handler with on_key_pressed by relying on its result instead of hooking another keyup event
|
143
|
+
if @last_key_pressed_event.nil? || @last_key_pressed_event.doit
|
144
|
+
self.text = event.target.value
|
145
|
+
event_listener.call(event)
|
146
|
+
else
|
147
|
+
# TODO Fix doit false, it's not stopping input
|
148
|
+
event.prevent
|
149
|
+
event.prevent_default
|
150
|
+
event.stop_propagation
|
151
|
+
event.stop_immediate_propagation
|
152
|
+
end
|
153
|
+
}
|
154
|
+
}
|
155
|
+
},
|
156
|
+
'on_key_pressed' => {
|
157
|
+
event: 'keydown',
|
158
|
+
event_handler: -> (event_listener) {
|
159
|
+
-> (event) {
|
160
|
+
@last_key_pressed_event = event
|
161
|
+
self.text = event.target.value
|
162
|
+
# TODO generalize this solution to all widgets that support key presses
|
163
|
+
# TODO support event.location once DOM3 is supported by opal-jquery
|
164
|
+
event.define_singleton_method(:keyCode) {event.which}
|
165
|
+
event.define_singleton_method(:key_code, &event.method(:keyCode))
|
166
|
+
event.define_singleton_method(:character) {event.which.chr}
|
167
|
+
event.define_singleton_method(:stateMask) do
|
168
|
+
state_mask = 0
|
169
|
+
state_mask |= SWTProxy[:alt] if event.alt_key
|
170
|
+
state_mask |= SWTProxy[:ctrl] if event.ctrl_key
|
171
|
+
state_mask |= SWTProxy[:shift] if event.shift_key
|
172
|
+
state_mask |= SWTProxy[:command] if event.meta_key
|
173
|
+
state_mask
|
174
|
+
end
|
175
|
+
event.define_singleton_method(:state_mask, &event.method(:stateMask))
|
176
|
+
doit = true
|
177
|
+
event.define_singleton_method(:doit=) do |value|
|
178
|
+
doit = value
|
179
|
+
end
|
180
|
+
event.define_singleton_method(:doit) { doit }
|
181
|
+
event_listener.call(event)
|
182
|
+
|
183
|
+
# TODO Fix doit false, it's not stopping input
|
184
|
+
unless doit
|
185
|
+
event.prevent
|
186
|
+
event.prevent_default
|
187
|
+
event.stop_propagation
|
188
|
+
event.stop_immediate_propagation
|
189
|
+
end
|
190
|
+
|
191
|
+
doit
|
192
|
+
}
|
193
|
+
}
|
194
|
+
},
|
195
|
+
}
|
196
|
+
end
|
197
|
+
|
198
|
+
def dom
|
199
|
+
text_text = @text
|
200
|
+
text_id = id
|
201
|
+
text_style = css
|
202
|
+
text_class = name
|
203
|
+
options = {type: 'text', id: text_id, style: text_style, class: text_class, value: text_text, style: 'min-width: 27px;'}
|
204
|
+
options = options.merge('disabled': 'disabled') unless @enabled
|
205
|
+
@dom ||= html {
|
206
|
+
input(options)
|
207
|
+
}.to_s
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2020-2021 Andy Maleh
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -27,8 +27,8 @@ module Glimmer
|
|
27
27
|
# Proxy for org.eclipse.swt.SWT
|
28
28
|
#
|
29
29
|
# Follows the Proxy Design Pattern
|
30
|
-
class SWTProxy
|
31
|
-
include StyleConstantizable
|
30
|
+
class SWTProxy
|
31
|
+
include StyleConstantizable
|
32
32
|
|
33
33
|
class << self
|
34
34
|
def constant_source_class
|
@@ -42,12 +42,16 @@ module Glimmer
|
|
42
42
|
def extra_styles
|
43
43
|
EXTRA_STYLES
|
44
44
|
end
|
45
|
+
|
46
|
+
def cursor_options
|
47
|
+
[:wait, :sizenwse, :appstarting, :no, :sizenesw, :sizeall, :help, :sizee, :sizewe, :sizen, :sizes, :sizew, :cross, :sizese, :ibeam, :arrow, :sizesw, :uparrow, :hand, :sizenw, :sizene, :sizens]
|
48
|
+
end
|
45
49
|
end
|
46
50
|
|
47
51
|
EXTRA_STYLES = {
|
48
52
|
NO_RESIZE: self[:shell_trim, :resize!, :max!],
|
49
53
|
NO_SORT: -7,
|
50
|
-
}
|
54
|
+
}
|
51
55
|
end
|
52
56
|
end
|
53
57
|
end
|
@@ -81,7 +81,6 @@ module Glimmer
|
|
81
81
|
text_id = id
|
82
82
|
text_style = css
|
83
83
|
text_class = name
|
84
|
-
# TODO support password field
|
85
84
|
options = {type: 'text', id: text_id, style: text_style, class: text_class, value: text_text, style: 'min-width: 27px;'}
|
86
85
|
options = options.merge('disabled': 'disabled') unless @enabled
|
87
86
|
options = options.merge(type: 'password') if has_style?(:password)
|
@@ -31,7 +31,32 @@ module Glimmer
|
|
31
31
|
include Glimmer
|
32
32
|
include PropertyOwner
|
33
33
|
|
34
|
-
|
34
|
+
SWT_CURSOR_TO_CSS_CURSOR_MAP = {
|
35
|
+
wait: 'wait',
|
36
|
+
sizenwse: 'nwse-resize',
|
37
|
+
appstarting: 'progress',
|
38
|
+
no: 'no-drop',
|
39
|
+
sizenesw: 'nesw-resize',
|
40
|
+
sizeall: 'all-scroll',
|
41
|
+
help: 'help',
|
42
|
+
sizee: 'e-resize',
|
43
|
+
sizewe: 'ew-resize',
|
44
|
+
sizen: 'n-resize',
|
45
|
+
sizes: 's-resize',
|
46
|
+
sizew: 'w-resize',
|
47
|
+
cross: 'crosshair',
|
48
|
+
sizese: 'se-resize',
|
49
|
+
ibeam: 'text',
|
50
|
+
arrow: 'default',
|
51
|
+
sizesw: 'sw-resize',
|
52
|
+
uparrow: 'alias',
|
53
|
+
hand: 'grab',
|
54
|
+
sizenw: 'nw-resize',
|
55
|
+
sizene: 'ne-resize',
|
56
|
+
sizens: 'ns-resize',
|
57
|
+
}
|
58
|
+
|
59
|
+
attr_reader :parent, :args, :path, :children, :enabled, :foreground, :background, :font, :focus, :disposed?, :rendered, :cursor
|
35
60
|
attr_accessor :menu, :menu_requested, :menu_x, :menu_y
|
36
61
|
alias isDisposed disposed?
|
37
62
|
alias is_disposed disposed?
|
@@ -237,11 +262,16 @@ module Glimmer
|
|
237
262
|
def font=(value)
|
238
263
|
@font = value.is_a?(FontProxy) ? value : FontProxy.new(self, value)
|
239
264
|
dom_element.css('font-family', @font.name) unless @font.nil?
|
240
|
-
dom_element.css('font-style', 'italic') if @font&.style == :italic || @font&.style
|
241
|
-
dom_element.css('font-weight', 'bold') if @font&.style == :bold || @font&.style
|
265
|
+
dom_element.css('font-style', 'italic') if @font&.style == :italic || [@font&.style].flatten.compact.include?(:italic)
|
266
|
+
dom_element.css('font-weight', 'bold') if @font&.style == :bold || [@font&.style].flatten.compact.include?(:bold)
|
242
267
|
dom_element.css('font-size', "#{@font.height}px") unless @font.nil?
|
243
268
|
end
|
244
269
|
|
270
|
+
def cursor=(value)
|
271
|
+
@cursor = value
|
272
|
+
dom_element.css('cursor', css_cursor)
|
273
|
+
end
|
274
|
+
|
245
275
|
def focus=(value)
|
246
276
|
@focus = value
|
247
277
|
dom_element.focus # TODO consider if a delay or async_exec is needed here
|
@@ -851,6 +881,27 @@ module Glimmer
|
|
851
881
|
# }
|
852
882
|
# end,
|
853
883
|
# },
|
884
|
+
ScaleProxy => {
|
885
|
+
:selection => lambda do |observer|
|
886
|
+
on_widget_selected { |selection_event|
|
887
|
+
observer.call(selection)
|
888
|
+
}
|
889
|
+
end
|
890
|
+
},
|
891
|
+
SliderProxy => {
|
892
|
+
:selection => lambda do |observer|
|
893
|
+
on_widget_selected { |selection_event|
|
894
|
+
observer.call(selection)
|
895
|
+
}
|
896
|
+
end
|
897
|
+
},
|
898
|
+
SpinnerProxy => {
|
899
|
+
:selection => lambda do |observer|
|
900
|
+
on_widget_selected { |selection_event|
|
901
|
+
observer.call(selection)
|
902
|
+
}
|
903
|
+
end
|
904
|
+
},
|
854
905
|
TextProxy => {
|
855
906
|
:text => lambda do |observer|
|
856
907
|
on_modify_text { |modify_event|
|
@@ -943,17 +994,16 @@ module Glimmer
|
|
943
994
|
# observer.call(getSelection)
|
944
995
|
# }
|
945
996
|
# end
|
946
|
-
# },
|
947
|
-
# Java::OrgEclipseSwtWidgets::Spinner => {
|
948
|
-
# :selection => lambda do |observer|
|
949
|
-
# on_widget_selected { |selection_event|
|
950
|
-
# observer.call(getSelection)
|
951
|
-
# }
|
952
|
-
# end
|
953
997
|
# },
|
954
998
|
}
|
955
999
|
end
|
956
1000
|
|
1001
|
+
private
|
1002
|
+
|
1003
|
+
def css_cursor
|
1004
|
+
SWT_CURSOR_TO_CSS_CURSOR_MAP[@cursor]
|
1005
|
+
end
|
1006
|
+
|
957
1007
|
end
|
958
1008
|
end
|
959
1009
|
end
|
@@ -983,7 +1033,10 @@ require 'glimmer/swt/table_item_proxy'
|
|
983
1033
|
require 'glimmer/swt/table_proxy'
|
984
1034
|
require 'glimmer/swt/text_proxy'
|
985
1035
|
require 'glimmer/swt/radio_proxy'
|
1036
|
+
require 'glimmer/swt/scale_proxy'
|
986
1037
|
require 'glimmer/swt/scrolled_composite_proxy'
|
1038
|
+
require 'glimmer/swt/slider_proxy'
|
1039
|
+
require 'glimmer/swt/spinner_proxy'
|
987
1040
|
require 'glimmer/swt/styled_text_proxy'
|
988
1041
|
|
989
1042
|
require 'glimmer/dsl/opal/widget_expression'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-opal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -294,6 +294,7 @@ files:
|
|
294
294
|
- lib/glimmer-dsl-opal/samples/hello/hello_combo.rb
|
295
295
|
- lib/glimmer-dsl-opal/samples/hello/hello_composite.rb
|
296
296
|
- lib/glimmer-dsl-opal/samples/hello/hello_computed.rb
|
297
|
+
- lib/glimmer-dsl-opal/samples/hello/hello_cursor.rb
|
297
298
|
- lib/glimmer-dsl-opal/samples/hello/hello_custom_shell.rb
|
298
299
|
- lib/glimmer-dsl-opal/samples/hello/hello_custom_widget.rb
|
299
300
|
- lib/glimmer-dsl-opal/samples/hello/hello_date_time.rb
|
@@ -307,6 +308,9 @@ files:
|
|
307
308
|
- lib/glimmer-dsl-opal/samples/hello/hello_pop_up_context_menu.rb
|
308
309
|
- lib/glimmer-dsl-opal/samples/hello/hello_radio.rb
|
309
310
|
- lib/glimmer-dsl-opal/samples/hello/hello_radio_group.rb
|
311
|
+
- lib/glimmer-dsl-opal/samples/hello/hello_scale.rb
|
312
|
+
- lib/glimmer-dsl-opal/samples/hello/hello_slider.rb
|
313
|
+
- lib/glimmer-dsl-opal/samples/hello/hello_spinner.rb
|
310
314
|
- lib/glimmer-dsl-opal/samples/hello/hello_tab.rb
|
311
315
|
- lib/glimmer-dsl-opal/samples/hello/hello_table.rb
|
312
316
|
- lib/glimmer-dsl-opal/samples/hello/hello_table/baseball_park.png
|
@@ -418,8 +422,11 @@ files:
|
|
418
422
|
- lib/glimmer/swt/property_owner.rb
|
419
423
|
- lib/glimmer/swt/radio_proxy.rb
|
420
424
|
- lib/glimmer/swt/row_layout_proxy.rb
|
425
|
+
- lib/glimmer/swt/scale_proxy.rb
|
421
426
|
- lib/glimmer/swt/scrolled_composite_proxy.rb
|
422
427
|
- lib/glimmer/swt/shell_proxy.rb
|
428
|
+
- lib/glimmer/swt/slider_proxy.rb
|
429
|
+
- lib/glimmer/swt/spinner_proxy.rb
|
423
430
|
- lib/glimmer/swt/style_constantizable.rb
|
424
431
|
- lib/glimmer/swt/styled_text_proxy.rb
|
425
432
|
- lib/glimmer/swt/swt_proxy.rb
|