glimmer-dsl-swt 4.20.2.1 → 4.20.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/README.md +6 -6
  4. data/VERSION +1 -1
  5. data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +5 -2
  6. data/docs/reference/GLIMMER_SAMPLES.md +23 -0
  7. data/glimmer-dsl-swt.gemspec +0 -0
  8. data/lib/glimmer-dsl-swt.rb +1 -0
  9. data/lib/glimmer/data_binding/table_items_binding.rb +1 -0
  10. data/lib/glimmer/dsl/swt/bind_expression.rb +5 -25
  11. data/lib/glimmer/dsl/swt/custom_widget_expression.rb +1 -1
  12. data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +1 -1
  13. data/lib/glimmer/dsl/swt/shine_data_binding_expression.rb +0 -2
  14. data/lib/glimmer/rake_task/scaffold.rb +2 -2
  15. data/lib/glimmer/swt/custom/checkbox_group.rb +1 -1
  16. data/lib/glimmer/swt/custom/radio_group.rb +2 -1
  17. data/lib/glimmer/swt/proxy_properties.rb +5 -5
  18. data/lib/glimmer/swt/widget_proxy.rb +3 -0
  19. data/lib/glimmer/ui/custom_shape.rb +1 -1
  20. data/lib/glimmer/ui/custom_widget.rb +1 -1
  21. data/samples/elaborate/calculator.rb +1 -1
  22. data/samples/elaborate/contact_manager.rb +1 -1
  23. data/samples/elaborate/meta_sample.rb +5 -5
  24. data/samples/elaborate/tetris/view/bevel.rb +11 -11
  25. data/samples/elaborate/tetris/view/block.rb +1 -1
  26. data/samples/elaborate/tetris/view/high_score_dialog.rb +3 -3
  27. data/samples/elaborate/tetris/view/score_lane.rb +3 -3
  28. data/samples/elaborate/tetris/view/tetris_menu_bar.rb +9 -9
  29. data/samples/elaborate/timer.rb +9 -9
  30. data/samples/elaborate/weather.rb +8 -4
  31. data/samples/hello/hello_c_tab.rb +9 -9
  32. data/samples/hello/hello_checkbox_group.rb +1 -1
  33. data/samples/hello/hello_code_text.rb +3 -3
  34. data/samples/hello/hello_computed.rb +20 -2
  35. data/samples/hello/hello_cool_bar.rb +1 -1
  36. data/samples/hello/hello_cursor.rb +1 -1
  37. data/samples/hello/hello_custom_shell.rb +17 -11
  38. data/samples/hello/hello_directory_dialog.rb +1 -1
  39. data/samples/hello/hello_label.rb +194 -0
  40. data/samples/hello/hello_radio_group.rb +2 -2
  41. data/samples/hello/hello_table.rb +1 -1
  42. data/samples/hello/hello_tool_bar.rb +1 -1
  43. data/samples/hello/{hello_c_tab → images}/denmark.png +0 -0
  44. data/samples/hello/{hello_c_tab → images}/finland.png +0 -0
  45. data/samples/hello/{hello_c_tab → images}/france.png +0 -0
  46. data/samples/hello/{hello_c_tab → images}/germany.png +0 -0
  47. data/samples/hello/{hello_c_tab → images}/italy.png +0 -0
  48. data/samples/hello/{hello_c_tab → images}/mexico.png +0 -0
  49. data/samples/hello/{hello_c_tab → images}/netherlands.png +0 -0
  50. data/samples/hello/{hello_c_tab → images}/norway.png +0 -0
  51. data/samples/hello/{hello_c_tab → images}/usa.png +0 -0
  52. metadata +54 -36
  53. data/lib/glimmer/data_binding/shine.rb +0 -63
  54. data/samples/elaborate/timer/alarm1.wav +0 -0
  55. data/samples/hello/hello_computed/contact.rb +0 -42
@@ -44,7 +44,7 @@ class HelloDirectoryDialog
44
44
 
45
45
  label {
46
46
  layout_data :fill, :center, true, false
47
- text bind(self, :selected_directory)
47
+ text <= [self, :selected_directory]
48
48
  font height: 14
49
49
  }
50
50
 
@@ -0,0 +1,194 @@
1
+ # Copyright (c) 2007-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-dsl-swt'
23
+
24
+ class HelloGroup
25
+ include Glimmer::UI::CustomShell
26
+
27
+ body {
28
+ shell {
29
+ text 'Hello, Label!'
30
+
31
+ tab_folder {
32
+ tab_item {
33
+ text 'left-aligned'
34
+
35
+ grid_layout 2, true
36
+
37
+ 1.upto(3) do |n|
38
+ label(:left) { # :left is default in English, so it is unnecessary
39
+ layout_data :fill, :center, true, false
40
+ text "Field #{n}"
41
+ }
42
+ text {
43
+ layout_data :fill, :center, true, false
44
+ text "Enter Field #{n}"
45
+ }
46
+ end
47
+ }
48
+
49
+ tab_item {
50
+ text 'center-aligned'
51
+
52
+ grid_layout 2, true
53
+
54
+ 1.upto(3) do |n|
55
+ label(:center) {
56
+ layout_data :fill, :center, true, false
57
+ text "Field #{n}"
58
+ }
59
+ text {
60
+ layout_data :fill, :center, true, false
61
+ text "Enter Field #{n}"
62
+ }
63
+ end
64
+ }
65
+
66
+ tab_item {
67
+ text 'right-aligned'
68
+
69
+ grid_layout 2, true
70
+
71
+ 1.upto(3) do |n|
72
+ label(:right) {
73
+ layout_data :fill, :center, true, false
74
+ text "Field #{n}"
75
+ }
76
+ text {
77
+ layout_data :fill, :center, true, false
78
+ text "Enter Field #{n}"
79
+ }
80
+ end
81
+ }
82
+
83
+ tab_item {
84
+ text 'images'
85
+
86
+ grid_layout 2, true
87
+
88
+ ['denmark', 'finland', 'norway'].each do |image_name|
89
+ label {
90
+ layout_data :fill, :center, true, false
91
+ image File.expand_path("images/#{image_name}.png", __dir__)
92
+ }
93
+ text {
94
+ layout_data :fill, :center, true, false
95
+ text "Enter Field #{image_name.capitalize}"
96
+ }
97
+ end
98
+ }
99
+
100
+ tab_item {
101
+ text 'background images'
102
+
103
+ grid_layout 2, true
104
+
105
+ ['italy', 'france', 'mexico'].each do |image_name|
106
+ label {
107
+ layout_data :center, :center, true, false
108
+ background_image File.expand_path("images/#{image_name}.png", __dir__)
109
+ text image_name.capitalize
110
+ font height: 26, style: :bold
111
+ }
112
+ text {
113
+ layout_data :fill, :center, true, false
114
+ text "Enter Field #{image_name.capitalize}"
115
+ }
116
+ end
117
+ }
118
+
119
+ tab_item {
120
+ text 'horizontal separator'
121
+
122
+ grid_layout 2, true
123
+
124
+ label {
125
+ layout_data :fill, :center, true, false
126
+ text "Field 1"
127
+ }
128
+ text {
129
+ layout_data :fill, :center, true, false
130
+ text "Enter Field 1"
131
+ }
132
+
133
+ label(:separator, :horizontal) {
134
+ layout_data(:fill, :center, true, false) {
135
+ horizontal_span 2
136
+ }
137
+ }
138
+
139
+ label {
140
+ layout_data :fill, :center, true, false
141
+ text "Field 2"
142
+ }
143
+ text {
144
+ layout_data :fill, :center, true, false
145
+ text "Enter Field 2"
146
+ }
147
+ }
148
+
149
+ tab_item {
150
+ text 'vertical separator'
151
+
152
+ grid_layout 3, true
153
+
154
+ label {
155
+ layout_data :fill, :center, true, false
156
+ text "Field 1"
157
+ }
158
+ label(:separator, :vertical) {
159
+ layout_data(:center, :center, false, false) {
160
+ vertical_span 3
161
+ }
162
+ }
163
+ text {
164
+ layout_data :fill, :center, true, false
165
+ text "Enter Field 1"
166
+ }
167
+
168
+ label {
169
+ layout_data :fill, :center, true, false
170
+ text "Field 2"
171
+ }
172
+ text {
173
+ layout_data :fill, :center, true, false
174
+ text "Enter Field 2"
175
+ }
176
+
177
+ label {
178
+ layout_data :fill, :center, true, false
179
+ text "Field 3"
180
+ }
181
+ text {
182
+ layout_data :fill, :center, true, false
183
+ text "Enter Field 3"
184
+ }
185
+ }
186
+
187
+ }
188
+
189
+ }
190
+
191
+ }
192
+ end
193
+
194
+ HelloGroup.launch
@@ -64,7 +64,7 @@ class HelloRadioGroup
64
64
 
65
65
  radio_group {
66
66
  row_layout :horizontal
67
- selection bind(@person, :gender)
67
+ selection <=> [@person, :gender]
68
68
  }
69
69
 
70
70
  label {
@@ -74,7 +74,7 @@ class HelloRadioGroup
74
74
 
75
75
  radio_group {
76
76
  row_layout :horizontal
77
- selection bind(@person, :age_group)
77
+ selection <=> [@person, :age_group]
78
78
  }
79
79
 
80
80
  button {
@@ -210,7 +210,7 @@ class HelloTable
210
210
  font height: 14
211
211
  }
212
212
 
213
- table { |table_proxy|
213
+ table(:editable) { |table_proxy|
214
214
  layout_data :fill, :fill, true, true
215
215
 
216
216
  table_column {
@@ -71,7 +71,7 @@ class HelloToolBar
71
71
  }
72
72
  # a combo can be nested in a tool_bar (it auto-generates a tool_item for itself behind the scenes)
73
73
  combo {
74
- selection bind(self, :font_size)
74
+ selection <=> [self, :font_size]
75
75
  }
76
76
  }
77
77
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,21 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-swt
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.20.2.1
4
+ version: 4.20.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-07 00:00:00.000000000 Z
11
+ date: 2021-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 1.3.1
18
+ version: 2.0.0
19
19
  name: glimmer
20
20
  prerelease: false
21
21
  type: :runtime
@@ -23,7 +23,7 @@ dependencies:
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.3.1
26
+ version: 2.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
@@ -104,6 +104,46 @@ dependencies:
104
104
  - - "<"
105
105
  - !ruby/object:Gem::Version
106
106
  version: 2.0.0
107
+ - !ruby/object:Gem::Dependency
108
+ requirement: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 1.1.7
113
+ - - "<"
114
+ - !ruby/object:Gem::Version
115
+ version: 2.0.0
116
+ name: concurrent-ruby
117
+ prerelease: false
118
+ type: :runtime
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: 1.1.7
124
+ - - "<"
125
+ - !ruby/object:Gem::Version
126
+ version: 2.0.0
127
+ - !ruby/object:Gem::Dependency
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: 0.8.5
133
+ - - "<"
134
+ - !ruby/object:Gem::Version
135
+ version: 2.0.0
136
+ name: jruby-win32ole
137
+ prerelease: false
138
+ type: :runtime
139
+ version_requirements: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: 0.8.5
144
+ - - "<"
145
+ - !ruby/object:Gem::Version
146
+ version: 2.0.0
107
147
  - !ruby/object:Gem::Dependency
108
148
  requirement: !ruby/object:Gem::Requirement
109
149
  requirements:
@@ -198,26 +238,6 @@ dependencies:
198
238
  - - "<"
199
239
  - !ruby/object:Gem::Version
200
240
  version: 4.0.0
201
- - !ruby/object:Gem::Dependency
202
- requirement: !ruby/object:Gem::Requirement
203
- requirements:
204
- - - ">="
205
- - !ruby/object:Gem::Version
206
- version: 0.8.5
207
- - - "<"
208
- - !ruby/object:Gem::Version
209
- version: 2.0.0
210
- name: jruby-win32ole
211
- prerelease: false
212
- type: :runtime
213
- version_requirements: !ruby/object:Gem::Requirement
214
- requirements:
215
- - - ">="
216
- - !ruby/object:Gem::Version
217
- version: 0.8.5
218
- - - "<"
219
- - !ruby/object:Gem::Version
220
- version: 2.0.0
221
241
  - !ruby/object:Gem::Dependency
222
242
  requirement: !ruby/object:Gem::Requirement
223
243
  requirements:
@@ -390,7 +410,6 @@ files:
390
410
  - lib/glimmer/Rakefile
391
411
  - lib/glimmer/data_binding/list_selection_binding.rb
392
412
  - lib/glimmer/data_binding/observable_widget.rb
393
- - lib/glimmer/data_binding/shine.rb
394
413
  - lib/glimmer/data_binding/table_items_binding.rb
395
414
  - lib/glimmer/data_binding/tree_items_binding.rb
396
415
  - lib/glimmer/data_binding/widget_binding.rb
@@ -542,7 +561,6 @@ files:
542
561
  - samples/elaborate/tic_tac_toe/board.rb
543
562
  - samples/elaborate/tic_tac_toe/cell.rb
544
563
  - samples/elaborate/timer.rb
545
- - samples/elaborate/timer/alarm1.wav
546
564
  - samples/elaborate/timer/sounds/alarm1.wav
547
565
  - samples/elaborate/user_profile.rb
548
566
  - samples/elaborate/weather.rb
@@ -550,15 +568,6 @@ files:
550
568
  - samples/hello/hello_button.rb
551
569
  - samples/hello/hello_c_combo.rb
552
570
  - samples/hello/hello_c_tab.rb
553
- - samples/hello/hello_c_tab/denmark.png
554
- - samples/hello/hello_c_tab/finland.png
555
- - samples/hello/hello_c_tab/france.png
556
- - samples/hello/hello_c_tab/germany.png
557
- - samples/hello/hello_c_tab/italy.png
558
- - samples/hello/hello_c_tab/mexico.png
559
- - samples/hello/hello_c_tab/netherlands.png
560
- - samples/hello/hello_c_tab/norway.png
561
- - samples/hello/hello_c_tab/usa.png
562
571
  - samples/hello/hello_canvas.rb
563
572
  - samples/hello/hello_canvas_animation.rb
564
573
  - samples/hello/hello_canvas_animation_data_binding.rb
@@ -572,7 +581,6 @@ files:
572
581
  - samples/hello/hello_combo.rb
573
582
  - samples/hello/hello_composite.rb
574
583
  - samples/hello/hello_computed.rb
575
- - samples/hello/hello_computed/contact.rb
576
584
  - samples/hello/hello_cool_bar.rb
577
585
  - samples/hello/hello_cursor.rb
578
586
  - samples/hello/hello_custom_shape.rb
@@ -586,6 +594,7 @@ files:
586
594
  - samples/hello/hello_file_dialog.rb
587
595
  - samples/hello/hello_font_dialog.rb
588
596
  - samples/hello/hello_group.rb
597
+ - samples/hello/hello_label.rb
589
598
  - samples/hello/hello_layout.rb
590
599
  - samples/hello/hello_link.rb
591
600
  - samples/hello/hello_list_multi_selection.rb
@@ -608,6 +617,15 @@ files:
608
617
  - samples/hello/hello_tool_bar.rb
609
618
  - samples/hello/hello_tree.rb
610
619
  - samples/hello/hello_world.rb
620
+ - samples/hello/images/denmark.png
621
+ - samples/hello/images/finland.png
622
+ - samples/hello/images/france.png
623
+ - samples/hello/images/germany.png
624
+ - samples/hello/images/italy.png
625
+ - samples/hello/images/mexico.png
626
+ - samples/hello/images/netherlands.png
627
+ - samples/hello/images/norway.png
628
+ - samples/hello/images/usa.png
611
629
  - sounds/metronome-down.wav
612
630
  - sounds/metronome-up.wav
613
631
  - vendor/swt/linux/swt.jar
@@ -1,63 +0,0 @@
1
- # Copyright (c) 2007-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
- module Glimmer
23
- module DataBinding
24
- class Shine
25
- include Glimmer
26
-
27
- def initialize(parent, parent_attribute)
28
- @parent = parent
29
- @parent_attribute = parent_attribute
30
- end
31
-
32
- alias original_compare <=>
33
-
34
- def <=>(other)
35
- if other.is_a?(Array)
36
- args_clone = other.clone
37
- @parent.editable = true if @parent.is_a?(Glimmer::SWT::TableProxy) # TODO consider a polymorphic way to perform this
38
- @parent.content {
39
- send(@parent_attribute, bind(*args_clone))
40
- }
41
- else # || other.is_a?(Hash) # TODO support hash e.g. {model: model_obj, attribute: :some_attribute, more-options...}
42
- original_compare(other)
43
- end
44
- end
45
-
46
- def <=(other)
47
- if other.is_a?(Array)
48
- args_clone = other.clone
49
- if args_clone.last.is_a?(Hash)
50
- args_clone.last[:read_only] = true
51
- else # || other.is_a?(Hash) # TODO support hash e.g. {model: model_obj, attribute: :some_attribute, more-options...}
52
- args_clone << {read_only: true}
53
- end
54
- # remove read_only from table to allow automatic sorting (but it remains non-editable)
55
- args_clone.last[:read_only] = false if @parent.is_a?(Glimmer::SWT::TableProxy) # TODO consider a polymorphic way to perform this
56
- @parent.content {
57
- send(@parent_attribute, bind(*args_clone))
58
- }
59
- end
60
- end
61
- end
62
- end
63
- end