glimmer-dsl-swt 4.22.2.1 → 4.22.2.5

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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/README.md +26 -12
  4. data/VERSION +1 -1
  5. data/docs/reference/GLIMMER_COMMAND.md +3 -1
  6. data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +145 -0
  7. data/docs/reference/GLIMMER_SAMPLES.md +17 -9
  8. data/glimmer-dsl-swt.gemspec +0 -0
  9. data/lib/glimmer/dsl/swt/exec_expression.rb +1 -2
  10. data/lib/glimmer/launcher.rb +7 -4
  11. data/lib/glimmer/rake_task/scaffold.rb +28 -15
  12. data/lib/glimmer/swt/image_proxy.rb +1 -0
  13. data/lib/glimmer/swt/layout_data_proxy.rb +4 -0
  14. data/samples/elaborate/calculator.rb +12 -12
  15. data/samples/elaborate/contact_manager.rb +26 -14
  16. data/samples/elaborate/game_of_life.rb +8 -8
  17. data/samples/elaborate/klondike_solitaire/view/action_panel.rb +2 -2
  18. data/samples/elaborate/klondike_solitaire/view/klondike_solitaire_menu_bar.rb +15 -10
  19. data/samples/elaborate/login.rb +16 -10
  20. data/samples/elaborate/mandelbrot_fractal.rb +26 -20
  21. data/samples/elaborate/meta_sample.rb +6 -6
  22. data/samples/elaborate/metronome.rb +4 -4
  23. data/samples/elaborate/snake/model/apple.rb +33 -0
  24. data/samples/elaborate/snake/model/game.rb +68 -0
  25. data/samples/elaborate/snake/model/snake.rb +95 -0
  26. data/samples/elaborate/snake/model/vertebra.rb +22 -0
  27. data/samples/elaborate/snake/presenter/cell.rb +27 -0
  28. data/samples/elaborate/snake/presenter/grid.rb +49 -0
  29. data/samples/elaborate/snake.rb +103 -0
  30. data/samples/elaborate/stock_ticker.rb +12 -12
  31. data/samples/elaborate/tetris.rb +10 -10
  32. data/samples/elaborate/timer.rb +36 -26
  33. data/samples/elaborate/user_profile.rb +53 -14
  34. data/samples/elaborate/weather.rb +2 -2
  35. data/samples/hello/hello_button.rb +3 -3
  36. data/samples/hello/hello_canvas_animation.rb +2 -2
  37. data/samples/hello/hello_color_dialog.rb +4 -4
  38. data/samples/hello/hello_custom_shell.rb +2 -2
  39. data/samples/hello/hello_dialog.rb +4 -4
  40. data/samples/hello/hello_directory_dialog.rb +2 -2
  41. data/samples/hello/hello_expand_bar.rb +4 -5
  42. data/samples/hello/hello_file_dialog.rb +2 -2
  43. data/samples/hello/hello_font_dialog.rb +2 -2
  44. data/samples/hello/hello_link.rb +5 -4
  45. data/samples/hello/hello_list_multi_selection.rb +3 -1
  46. data/samples/hello/hello_list_single_selection.rb +3 -1
  47. data/samples/hello/hello_menu_bar.rb +28 -28
  48. data/samples/hello/hello_message_box.rb +2 -2
  49. data/samples/hello/hello_pop_up_context_menu.rb +18 -8
  50. data/samples/hello/hello_shell.rb +16 -16
  51. data/samples/hello/hello_styled_text.rb +2 -2
  52. data/samples/hello/hello_table.rb +4 -4
  53. data/samples/hello/hello_tray_item.rb +2 -2
  54. metadata +9 -2
@@ -51,9 +51,9 @@ class HelloFileDialog
51
51
  button {
52
52
  text "Browse..."
53
53
 
54
- on_widget_selected {
54
+ on_widget_selected do
55
55
  self.selected_file = file_dialog.open
56
- }
56
+ end
57
57
  }
58
58
  }
59
59
  }
@@ -70,11 +70,11 @@ class HelloFontDialog
70
70
  button {
71
71
  text "Choose Font..."
72
72
 
73
- on_widget_selected {
73
+ on_widget_selected do
74
74
  self.selected_font_data = font_dialog {
75
75
  font_list [@selected_font_data]
76
76
  }.open
77
- }
77
+ end
78
78
  }
79
79
 
80
80
  }
@@ -47,11 +47,12 @@ class HelloLink
47
47
  Just keep clicking <a href="all links">links</a> to find out!
48
48
  MULTI_LINE_STRING
49
49
 
50
- on_widget_selected { |selection_event|
50
+ on_widget_selected do |selection_event|
51
51
  # This retrieves the clicked link href (or contained text if no href is set)
52
52
  @selected_link = selection_event.text
53
- }
54
- on_mouse_up { |mouse_event|
53
+ end
54
+
55
+ on_mouse_up do |mouse_event|
55
56
  unless @selected_link.nil?
56
57
  @help_shell.close unless @help_shell.nil? || @help_shell.disposed?
57
58
  @help_shell = shell(:no_trim) {
@@ -79,7 +80,7 @@ class HelloLink
79
80
  }
80
81
  @help_shell.open
81
82
  end
82
- }
83
+ end
83
84
  }
84
85
  }
85
86
  }
@@ -69,7 +69,9 @@ class HelloListMultiSelection
69
69
  button {
70
70
  text 'Reset Selections To Default Values'
71
71
 
72
- on_widget_selected { @person.reset_provinces! }
72
+ on_widget_selected do
73
+ @person.reset_provinces!
74
+ end
73
75
  }
74
76
  }
75
77
  }
@@ -54,7 +54,9 @@ class HelloListSingleSelection
54
54
  button {
55
55
  text 'Reset Selection To Default Value'
56
56
 
57
- on_widget_selected { @person.reset_country! }
57
+ on_widget_selected do
58
+ @person.reset_country!
59
+ end
58
60
  }
59
61
  }
60
62
  }
@@ -45,52 +45,52 @@ shell {
45
45
  text '&New'
46
46
  accelerator :command, :N
47
47
 
48
- on_widget_selected {
48
+ on_widget_selected do
49
49
  message_box {
50
50
  text 'New'
51
51
  message 'New file created.'
52
52
  }.open
53
- }
53
+ end
54
54
  }
55
55
  menu_item {
56
56
  text '&Open...'
57
57
  accelerator :command, :O
58
58
 
59
- on_widget_selected {
59
+ on_widget_selected do
60
60
  message_box {
61
61
  text 'Open'
62
62
  message 'Opening File...'
63
63
  }.open
64
- }
64
+ end
65
65
  }
66
66
  menu {
67
67
  text 'Open &Recent'
68
68
  menu_item {
69
69
  text 'File 1'
70
- on_widget_selected {
70
+ on_widget_selected do
71
71
  message_box {
72
72
  text 'File 1'
73
73
  message 'File 1 Contents'
74
74
  }.open
75
- }
75
+ end
76
76
  }
77
77
  menu_item {
78
78
  text 'File 2'
79
- on_widget_selected {
79
+ on_widget_selected do
80
80
  message_box {
81
81
  text 'File 2'
82
82
  message 'File 2 Contents'
83
83
  }.open
84
- }
84
+ end
85
85
  }
86
86
  }
87
87
  menu_item(:separator)
88
88
  menu_item {
89
89
  text 'E&xit'
90
90
 
91
- on_widget_selected {
91
+ on_widget_selected do
92
92
  exit(0)
93
- }
93
+ end
94
94
  }
95
95
  }
96
96
  menu {
@@ -114,10 +114,10 @@ shell {
114
114
  menu_item(:radio) {
115
115
  text '&Enabled'
116
116
 
117
- on_widget_selected {
117
+ on_widget_selected do
118
118
  @select_one_menu.enabled = true
119
119
  @select_multiple_menu.enabled = true
120
- }
120
+ end
121
121
  }
122
122
  @select_one_menu = menu {
123
123
  text '&Select One'
@@ -156,9 +156,9 @@ shell {
156
156
  menu_item(:radio) {
157
157
  text color_style.to_s.split('_').map(&:capitalize).join(' ')
158
158
 
159
- on_widget_selected {
159
+ on_widget_selected do
160
160
  @label.background = color_style
161
- }
161
+ end
162
162
  }
163
163
  }
164
164
  }
@@ -168,9 +168,9 @@ shell {
168
168
  menu_item(:radio) {
169
169
  text color_style.to_s.split('_').map(&:capitalize).join(' ')
170
170
 
171
- on_widget_selected {
171
+ on_widget_selected do
172
172
  @label.foreground = color_style
173
- }
173
+ end
174
174
  }
175
175
  }
176
176
  }
@@ -180,27 +180,27 @@ shell {
180
180
  menu_item(:radio) {
181
181
  text 'Small'
182
182
 
183
- on_widget_selected {
183
+ on_widget_selected do
184
184
  @label.font = {height: 25}
185
185
  @label.parent.pack
186
- }
186
+ end
187
187
  }
188
188
  menu_item(:radio) {
189
189
  text 'Medium'
190
190
  selection true
191
191
 
192
- on_widget_selected {
192
+ on_widget_selected do
193
193
  @label.font = {height: 50}
194
194
  @label.parent.pack
195
- }
195
+ end
196
196
  }
197
197
  menu_item(:radio) {
198
198
  text 'Large'
199
199
 
200
- on_widget_selected {
200
+ on_widget_selected do
201
201
  @label.font = {height: 75}
202
202
  @label.parent.pack
203
- }
203
+ end
204
204
  }
205
205
  }
206
206
  menu {
@@ -209,34 +209,34 @@ shell {
209
209
  text '&Manual'
210
210
  accelerator :command, :shift, :M
211
211
 
212
- on_widget_selected {
212
+ on_widget_selected do
213
213
  message_box {
214
214
  text 'Manual'
215
215
  message 'Manual Contents'
216
216
  }.open
217
- }
217
+ end
218
218
  }
219
219
  menu_item {
220
220
  text '&Tutorial'
221
221
  accelerator :command, :shift, :T
222
222
 
223
- on_widget_selected {
223
+ on_widget_selected do
224
224
  message_box {
225
225
  text 'Tutorial'
226
226
  message 'Tutorial Contents'
227
227
  }.open
228
- }
228
+ end
229
229
  }
230
230
  menu_item(:separator)
231
231
  menu_item {
232
232
  text '&Report an Issue...'
233
233
 
234
- on_widget_selected {
234
+ on_widget_selected do
235
235
  message_box {
236
236
  text 'Report an Issue'
237
237
  message 'Reporting an issue...'
238
238
  }.open
239
- }
239
+ end
240
240
  }
241
241
  }
242
242
  }
@@ -29,11 +29,11 @@ shell {
29
29
  button {
30
30
  text 'Please Click To Win a Surprise'
31
31
 
32
- on_widget_selected {
32
+ on_widget_selected do
33
33
  message_box {
34
34
  text 'Surprise'
35
35
  message "Congratulations!\n\nYou won $1,000,000!"
36
36
  }.open
37
- }
37
+ end
38
38
  }
39
39
  }.open
@@ -38,46 +38,56 @@ shell {
38
38
  menu {
39
39
  menu {
40
40
  text '&History'
41
+
41
42
  menu {
42
43
  text '&Recent'
44
+
43
45
  menu_item {
44
46
  text 'File 1'
45
- on_widget_selected {
47
+
48
+ on_widget_selected do
46
49
  message_box {
47
50
  text 'File 1'
48
51
  message 'File 1 Contents'
49
52
  }.open
50
- }
53
+ end
51
54
  }
55
+
52
56
  menu_item {
53
57
  text 'File 2'
54
- on_widget_selected {
58
+
59
+ on_widget_selected do
55
60
  message_box {
56
61
  text 'File 2'
57
62
  message 'File 2 Contents'
58
63
  }.open
59
- }
64
+ end
60
65
  }
61
66
  }
67
+
62
68
  menu {
63
69
  text '&Archived'
70
+
64
71
  menu_item {
65
72
  text 'File 3'
66
- on_widget_selected {
73
+
74
+ on_widget_selected do
67
75
  message_box {
68
76
  text 'File 3'
69
77
  message 'File 3 Contents'
70
78
  }.open
71
- }
79
+ end
72
80
  }
81
+
73
82
  menu_item {
74
83
  text 'File 4'
75
- on_widget_selected {
84
+
85
+ on_widget_selected do
76
86
  message_box {
77
87
  text 'File 4'
78
88
  message 'File 4 Contents'
79
89
  }.open
80
- }
90
+ end
81
91
  }
82
92
  }
83
93
  }
@@ -37,7 +37,7 @@ class HelloShell
37
37
  }
38
38
  text "Nested Shell"
39
39
 
40
- on_widget_selected {
40
+ on_widget_selected do
41
41
  # build a nested shell, meaning a shell that specifies its parent shell (root_shell_proxy)
42
42
  shell(root_shell_proxy) {
43
43
  # shell has fill_layout(:horizontal) by default with no margins
@@ -48,7 +48,7 @@ class HelloShell
48
48
  text "Since this shell is nested, \nyou can hit ESC to close"
49
49
  }
50
50
  }.open
51
- }
51
+ end
52
52
  }
53
53
 
54
54
  button {
@@ -58,7 +58,7 @@ class HelloShell
58
58
  }
59
59
  text "Independent Shell"
60
60
 
61
- on_widget_selected {
61
+ on_widget_selected do
62
62
  # build an independent shell, meaning a shell that is independent of its parent
63
63
  shell {
64
64
  # shell has fill_layout(:horizontal) by default with no margins
@@ -69,7 +69,7 @@ class HelloShell
69
69
  text "Since this shell is independent, \nyou cannot close by hitting ESC"
70
70
  }
71
71
  }.open
72
- }
72
+ end
73
73
  }
74
74
 
75
75
  button {
@@ -79,7 +79,7 @@ class HelloShell
79
79
  }
80
80
  text "Close-Button Shell"
81
81
 
82
- on_widget_selected {
82
+ on_widget_selected do
83
83
  shell(:close) {
84
84
  # shell has fill_layout(:horizontal) by default with no margins
85
85
  text 'Nested Shell'
@@ -89,7 +89,7 @@ class HelloShell
89
89
  text "Shell with close button only\n(varies per platform)"
90
90
  }
91
91
  }.open
92
- }
92
+ end
93
93
  }
94
94
 
95
95
  button {
@@ -99,7 +99,7 @@ class HelloShell
99
99
  }
100
100
  text "Minimize-Button Shell"
101
101
 
102
- on_widget_selected {
102
+ on_widget_selected do
103
103
  # build a nested shell, meaning a shell that specifies its parent shell (root_shell_proxy)
104
104
  shell(root_shell_proxy, :min) {
105
105
  # shell has fill_layout(:horizontal) by default with no margins
@@ -110,7 +110,7 @@ class HelloShell
110
110
  text "Shell with minimize button only\n(varies per platform)"
111
111
  }
112
112
  }.open
113
- }
113
+ end
114
114
  }
115
115
 
116
116
  button {
@@ -120,7 +120,7 @@ class HelloShell
120
120
  }
121
121
  text "Maximize-Button Shell"
122
122
 
123
- on_widget_selected {
123
+ on_widget_selected do
124
124
  # build a nested shell, meaning a shell that specifies its parent shell (root_shell_proxy)
125
125
  shell(root_shell_proxy, :max) {
126
126
  # shell has fill_layout(:horizontal) by default with no margins
@@ -131,7 +131,7 @@ class HelloShell
131
131
  text "Shell with maximize button only\n(varies per platform)"
132
132
  }
133
133
  }.open
134
- }
134
+ end
135
135
  }
136
136
 
137
137
  button {
@@ -141,7 +141,7 @@ class HelloShell
141
141
  }
142
142
  text "Buttonless Shell"
143
143
 
144
- on_widget_selected {
144
+ on_widget_selected do
145
145
  # build a nested shell, meaning a shell that specifies its parent shell (root_shell_proxy)
146
146
  shell(root_shell_proxy, :title) {
147
147
  # shell has fill_layout(:horizontal) by default with no margins
@@ -152,7 +152,7 @@ class HelloShell
152
152
  text "Buttonless shell (title only)\n(varies per platform)"
153
153
  }
154
154
  }.open
155
- }
155
+ end
156
156
  }
157
157
 
158
158
  button {
@@ -162,7 +162,7 @@ class HelloShell
162
162
  }
163
163
  text "No Trim Shell"
164
164
 
165
- on_widget_selected {
165
+ on_widget_selected do
166
166
  # build a nested shell, meaning a shell that specifies its parent shell (root_shell_proxy)
167
167
  shell(root_shell_proxy, :no_trim) {
168
168
  # shell has fill_layout(:horizontal) by default with no margins
@@ -173,7 +173,7 @@ class HelloShell
173
173
  text "No trim shell, meaning no buttons or title bar.\n(varies per platform)"
174
174
  }
175
175
  }.open
176
- }
176
+ end
177
177
  }
178
178
 
179
179
  button {
@@ -183,7 +183,7 @@ class HelloShell
183
183
  }
184
184
  text "Always On Top Shell"
185
185
 
186
- on_widget_selected {
186
+ on_widget_selected do
187
187
  # build a nested shell, meaning a shell that specifies its parent shell (root_shell_proxy)
188
188
  shell(root_shell_proxy, :on_top) {
189
189
  # shell has fill_layout(:horizontal) by default with no margins
@@ -194,7 +194,7 @@ class HelloShell
194
194
  text "Always on top shell.\n(varies per platform)"
195
195
  }
196
196
  }.open
197
- }
197
+ end
198
198
  }
199
199
 
200
200
  }
@@ -76,7 +76,7 @@ shell {
76
76
  top_pixel <=> [@presenter, :top_pixel]
77
77
 
78
78
  # This demonstrates how to set styles via a listener
79
- on_line_get_style { |line_style_event|
79
+ on_line_get_style do |line_style_event|
80
80
  line_offset = line_style_event.lineOffset
81
81
  if @presenter.line_index_for_offset(line_offset) % 52 < 13
82
82
  line_size = line_style_event.lineText.size
@@ -99,7 +99,7 @@ shell {
99
99
  style_range.strikeout = true
100
100
  line_style_event.styles = [style_range].to_java(StyleRange)
101
101
  end
102
- }
102
+ end
103
103
  }
104
104
 
105
105
  composite {
@@ -262,9 +262,9 @@ class HelloTable
262
262
  menu_item {
263
263
  text 'Book'
264
264
 
265
- on_widget_selected {
265
+ on_widget_selected do
266
266
  book_selected_game
267
- }
267
+ end
268
268
  }
269
269
  }
270
270
  }
@@ -275,9 +275,9 @@ class HelloTable
275
275
  font height: 14
276
276
  enabled <= [BaseballGame, :selected_game]
277
277
 
278
- on_widget_selected {
278
+ on_widget_selected do
279
279
  book_selected_game
280
- }
280
+ end
281
281
  }
282
282
  }
283
283
  }
@@ -98,9 +98,9 @@ class HelloTrayItem
98
98
  menu_item {
99
99
  text 'Exit'
100
100
 
101
- on_widget_selected {
101
+ on_widget_selected do
102
102
  exit(0)
103
- }
103
+ end
104
104
  }
105
105
  }
106
106
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-swt
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.22.2.1
4
+ version: 4.22.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-25 00:00:00.000000000 Z
11
+ date: 2022-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -582,6 +582,13 @@ files:
582
582
  - samples/elaborate/quarto/view/message_box_panel.rb
583
583
  - samples/elaborate/quarto/view/piece.rb
584
584
  - samples/elaborate/quarto/view/selected_piece_area.rb
585
+ - samples/elaborate/snake.rb
586
+ - samples/elaborate/snake/model/apple.rb
587
+ - samples/elaborate/snake/model/game.rb
588
+ - samples/elaborate/snake/model/snake.rb
589
+ - samples/elaborate/snake/model/vertebra.rb
590
+ - samples/elaborate/snake/presenter/cell.rb
591
+ - samples/elaborate/snake/presenter/grid.rb
585
592
  - samples/elaborate/stock_ticker.rb
586
593
  - samples/elaborate/tetris.rb
587
594
  - samples/elaborate/tetris/model/block.rb