glimmer-dsl-swt 4.21.2.4 → 4.22.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +208 -167
- data/README.md +18 -11
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_COMMAND.md +2 -2
- data/docs/reference/GLIMMER_CONFIGURATION.md +14 -3
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +277 -112
- data/docs/reference/GLIMMER_SAMPLES.md +26 -0
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/ext/glimmer/config.rb +41 -24
- data/lib/glimmer/data_binding/observable_widget.rb +6 -6
- data/lib/glimmer/data_binding/widget_binding.rb +4 -3
- data/lib/glimmer/dsl/swt/observe_expression.rb +2 -1
- data/lib/glimmer/dsl/swt/sync_call_expression.rb +38 -0
- data/lib/glimmer/dsl/swt/transform_expression.rb +1 -1
- data/lib/glimmer/launcher.rb +15 -14
- data/lib/glimmer/rake_task/package.rb +5 -3
- data/lib/glimmer/rake_task/scaffold.rb +2 -14
- data/lib/glimmer/swt/color_proxy.rb +5 -5
- data/lib/glimmer/swt/custom/drawable.rb +8 -2
- data/lib/glimmer/swt/custom/shape/line.rb +0 -1
- data/lib/glimmer/swt/custom/shape/path.rb +2 -2
- data/lib/glimmer/swt/custom/shape/path_segment.rb +2 -2
- data/lib/glimmer/swt/custom/shape/point.rb +8 -1
- data/lib/glimmer/swt/custom/shape.rb +170 -69
- data/lib/glimmer/swt/display_proxy.rb +15 -10
- data/lib/glimmer/swt/image_proxy.rb +5 -5
- data/lib/glimmer/swt/message_box_proxy.rb +5 -5
- data/lib/glimmer/swt/shape_listener_proxy.rb +55 -0
- data/lib/glimmer/swt/shell_proxy.rb +1 -1
- data/lib/glimmer/swt/transform_proxy.rb +3 -3
- data/lib/glimmer/swt/tray_proxy.rb +4 -4
- data/lib/glimmer/swt/widget_proxy.rb +14 -10
- data/lib/glimmer/ui/custom_shape.rb +34 -10
- data/lib/glimmer/ui/custom_widget.rb +7 -10
- data/lib/glimmer-dsl-swt.rb +6 -2
- data/samples/elaborate/battleship/view/cell.rb +10 -2
- data/samples/elaborate/klondike_solitaire/model/column_pile.rb +0 -1
- data/samples/elaborate/klondike_solitaire/view/column_pile.rb +3 -16
- data/samples/elaborate/klondike_solitaire/view/dealing_pile.rb +1 -1
- data/samples/elaborate/klondike_solitaire/view/dealt_pile.rb +12 -5
- data/samples/elaborate/klondike_solitaire/view/empty_playing_card.rb +2 -1
- data/samples/elaborate/klondike_solitaire/view/foundation_pile.rb +2 -2
- data/samples/elaborate/klondike_solitaire/view/hidden_playing_card.rb +2 -2
- data/samples/elaborate/klondike_solitaire/view/klondike_solitaire_menu_bar.rb +60 -0
- data/samples/elaborate/klondike_solitaire/view/playing_card.rb +3 -2
- data/samples/elaborate/klondike_solitaire.rb +13 -55
- data/samples/elaborate/mandelbrot_fractal.rb +3 -1
- data/samples/elaborate/quarto/model/game.rb +124 -0
- data/samples/elaborate/quarto/model/piece/cube.rb +31 -0
- data/samples/elaborate/quarto/model/piece/cylinder.rb +31 -0
- data/samples/elaborate/quarto/model/piece.rb +70 -0
- data/samples/elaborate/quarto/view/available_pieces_area.rb +72 -0
- data/samples/elaborate/quarto/view/board.rb +65 -0
- data/samples/elaborate/quarto/view/cell.rb +85 -0
- data/samples/elaborate/quarto/view/cube.rb +73 -0
- data/samples/elaborate/quarto/view/cylinder.rb +72 -0
- data/samples/elaborate/quarto/view/message_box_panel.rb +114 -0
- data/samples/elaborate/quarto/view/piece.rb +56 -0
- data/samples/elaborate/quarto/view/selected_piece_area.rb +69 -0
- data/samples/elaborate/quarto.rb +190 -0
- data/samples/hello/hello_custom_widget.rb +23 -5
- data/samples/hello/hello_scrolled_composite.rb +95 -0
- data/samples/hello/hello_world.rb +1 -0
- data/vendor/swt/linux/swt.jar +0 -0
- data/vendor/swt/linux_aarch64/swt.jar +0 -0
- data/vendor/swt/mac/swt.jar +0 -0
- data/vendor/swt/mac_aarch64/swt.jar +0 -0
- data/vendor/swt/windows/swt.jar +0 -0
- metadata +21 -25
- data/bin/glimmer_runner.rb +0 -4
@@ -69,6 +69,7 @@ This guide should help you get started with Glimmer DSL for SWT. For more advanc
|
|
69
69
|
- [Class-Based Custom Widget Example](#class-based-custom-widget-example)
|
70
70
|
- [Custom Widget Lifecycle Hooks](#custom-widget-lifecycle-hooks)
|
71
71
|
- [Lifecycle Hooks Example](#lifecycle-hooks-example)
|
72
|
+
- [Custom Widget Listeners](#custom-widget-listeners)
|
72
73
|
- [Custom Widget API](#custom-widget-api)
|
73
74
|
- [Content/Options Example](#contentoptions-example)
|
74
75
|
- [Custom Widget Gotchas](#custom-widget-gotchas)
|
@@ -111,6 +112,7 @@ include Glimmer
|
|
111
112
|
|
112
113
|
shell {
|
113
114
|
text "Glimmer"
|
115
|
+
|
114
116
|
label {
|
115
117
|
text "Hello, World!"
|
116
118
|
}
|
@@ -131,6 +133,7 @@ class HelloWorld
|
|
131
133
|
# the following are GUI DSL keywords (shell, text, and label) used in the instance scope
|
132
134
|
shell {
|
133
135
|
text "Glimmer"
|
136
|
+
|
134
137
|
label {
|
135
138
|
text "Hello, World!"
|
136
139
|
foreground COLOR_FOREGROUND_DEFAULT
|
@@ -210,6 +213,7 @@ For example, if we were to revisit `samples/hello/hello_world.rb` above (you may
|
|
210
213
|
```ruby
|
211
214
|
shell {
|
212
215
|
text "Glimmer"
|
216
|
+
|
213
217
|
label {
|
214
218
|
text "Hello, World!"
|
215
219
|
}
|
@@ -223,6 +227,7 @@ Note that `shell` instantiates the outer shell **widget**, in other words, the w
|
|
223
227
|
```ruby
|
224
228
|
# ...
|
225
229
|
text "Glimmer" # text property of shell
|
230
|
+
|
226
231
|
label { # label widget declaration as content of shell
|
227
232
|
text "Hello, World!" # text property of label
|
228
233
|
}
|
@@ -268,15 +273,19 @@ Example from [hello_tab.rb](samples/hello/hello_tab.rb) sample (you may copy/pas
|
|
268
273
|
```ruby
|
269
274
|
shell {
|
270
275
|
text "Hello, Tab!"
|
276
|
+
|
271
277
|
tab_folder {
|
272
278
|
tab_item {
|
273
279
|
text "English"
|
280
|
+
|
274
281
|
label {
|
275
282
|
text "Hello, World!"
|
276
283
|
}
|
277
284
|
}
|
285
|
+
|
278
286
|
tab_item {
|
279
287
|
text "French"
|
288
|
+
|
280
289
|
label {
|
281
290
|
text "Bonjour Univers!"
|
282
291
|
}
|
@@ -294,63 +303,63 @@ If you are an advanced user of Glimmer DSL for SWT and need more widgets, check
|
|
294
303
|
This is not an exaustive list, but should give you a good start in learning Glimmer GUI DSL keywords, keeping in mind that the full list can be derived from the [SWT documentation](https://www.eclipse.org/swt/widgets/). More will be explained in the following sections.
|
295
304
|
|
296
305
|
**Widgets:**
|
297
|
-
- `button`: featured in [Hello, Checkbox!](GLIMMER_SAMPLES.md#hello-checkbox) / [Hello, Button!](GLIMMER_SAMPLES.md#hello-button) / [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Radio Group!](GLIMMER_SAMPLES.md#hello-radio-group) / [Hello, Radio!](GLIMMER_SAMPLES.md#hello-radio) / [Hello, Message Box!](GLIMMER_SAMPLES.md#hello-message-box) / [Hello, List Single Selection!](GLIMMER_SAMPLES.md#hello-list-single-selection) / [Hello, List Multi Selection!](GLIMMER_SAMPLES.md#hello-list-multi-selection) / [Hello, Group!](GLIMMER_SAMPLES.md#hello-group) / [Hello, Combo!](GLIMMER_SAMPLES.md#hello-combo) / [Hello, Checkbox Group!](GLIMMER_SAMPLES.md#hello-checkbox-group) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager) / [Tic Tac Toe](GLIMMER_SAMPLES.md#tic-tac-toe) / [Login](GLIMMER_SAMPLES.md#login)
|
298
|
-
- `browser`: featured in [Hello, Browser!](GLIMMER_SAMPLES.md#hello-browser)
|
299
|
-
- `calendar`: featured in [Hello, Date Time!](GLIMMER_SAMPLES.md#hello-date-time)
|
300
|
-
- `checkbox`: featured in [Hello, Checkbox Group!](GLIMMER_SAMPLES.md#hello-checkbox-group) / [Hello, Checkbox!](GLIMMER_SAMPLES.md#hello-checkbox)
|
301
|
-
- `checkbox_group`: featured in [Hello, Checkbox Group!](GLIMMER_SAMPLES.md#hello-checkbox-group)
|
302
|
-
- `combo`: featured in [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Combo!](GLIMMER_SAMPLES.md#hello-combo)
|
303
|
-
- `composite`: featured in [Hello, Composite!](GLIMMER_SAMPLES.md#hello-composite) / [Hello, Radio!](GLIMMER_SAMPLES.md#hello-radio) / [Hello, Computed!](GLIMMER_SAMPLES.md#hello-computed) / [Hello, Checkbox!](GLIMMER_SAMPLES.md#hello-checkbox) / [Tic Tac Toe](GLIMMER_SAMPLES.md#tic-tac-toe) / [Login](GLIMMER_SAMPLES.md#login) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager)
|
304
|
-
- `cool_bar`: featured in [Hello, Cool Bar!](GLIMMER_SAMPLES.md#hello-cool-bar)
|
305
|
-
- `date`: featured in [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Date Time!](GLIMMER_SAMPLES.md#hello-date-time) / [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell) / [Tic Tac Toe](GLIMMER_SAMPLES.md#tic-tac-toe)
|
306
|
-
- `date_drop_down`: featured in [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Date Time!](GLIMMER_SAMPLES.md#hello-date-time)
|
307
|
-
- `group`: featured in [Hello, Group!](GLIMMER_SAMPLES.md#hello-group) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager)
|
308
|
-
- `label`: featured in [Hello, Computed!](GLIMMER_SAMPLES.md#hello-computed) / [Hello, Checkbox Group!](GLIMMER_SAMPLES.md#hello-checkbox-group) / [Hello, Checkbox!](GLIMMER_SAMPLES.md#hello-checkbox) / [Hello, World!](GLIMMER_SAMPLES.md#hello-world) / [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Tab!](GLIMMER_SAMPLES.md#hello-tab) / [Hello, Radio Group!](GLIMMER_SAMPLES.md#hello-radio-group) / [Hello, Radio!](GLIMMER_SAMPLES.md#hello-radio) / [Hello, Pop Up Context Menu!](GLIMMER_SAMPLES.md#hello-pop-up-context-menu) / [Hello, Menu Bar!](GLIMMER_SAMPLES.md#hello-menu-bar) / [Hello, Date Time!](GLIMMER_SAMPLES.md#hello-date-time) / [Hello, Custom Widget!](GLIMMER_SAMPLES.md#hello-custom-widget) / [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager) / [Login](GLIMMER_SAMPLES.md#login)
|
309
|
-
- `list` (w/ optional `:multi` SWT style): featured in [Hello, List Single Selection!](GLIMMER_SAMPLES.md#hello-list-single-selection) / [Hello, List Multi Selection!](GLIMMER_SAMPLES.md#hello-list-multi-selection) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager)
|
310
|
-
- `menu`: featured in [Hello, Menu Bar!](GLIMMER_SAMPLES.md#hello-menu-bar) / [Hello, Pop Up Context Menu!](GLIMMER_SAMPLES.md#hello-pop-up-context-menu) / [Hello, Table!](GLIMMER_SAMPLES.md#hello-table)
|
311
|
-
- `menu_bar`: featured in [Hello, Menu Bar!](GLIMMER_SAMPLES.md#hello-menu-bar)
|
312
|
-
- `menu_item`: featured in [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Pop Up Context Menu!](GLIMMER_SAMPLES.md#hello-pop-up-context-menu) / [Hello, Menu Bar!](GLIMMER_SAMPLES.md#hello-menu-bar)
|
313
|
-
- `message_box`: featured in [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Pop Up Context Menu!](GLIMMER_SAMPLES.md#hello-pop-up-context-menu) / [Hello, Message Box!](GLIMMER_SAMPLES.md#hello-message-box) / [Hello, Menu Bar!](GLIMMER_SAMPLES.md#hello-menu-bar)
|
314
|
-
- `radio`: featured in [Hello, Radio!](GLIMMER_SAMPLES.md#hello-radio) / [Hello, Group!](GLIMMER_SAMPLES.md#hello-group)
|
315
|
-
- `radio_group`: featured in [Hello, Radio Group!](GLIMMER_SAMPLES.md#hello-radio-group)
|
306
|
+
- `button`: featured in [Hello, Checkbox!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox) / [Hello, Button!](/docs/reference/GLIMMER_SAMPLES.md#hello-button) / [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Hello, Radio Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-radio-group) / [Hello, Radio!](/docs/reference/GLIMMER_SAMPLES.md#hello-radio) / [Hello, Message Box!](/docs/reference/GLIMMER_SAMPLES.md#hello-message-box) / [Hello, List Single Selection!](/docs/reference/GLIMMER_SAMPLES.md#hello-list-single-selection) / [Hello, List Multi Selection!](/docs/reference/GLIMMER_SAMPLES.md#hello-list-multi-selection) / [Hello, Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-group) / [Hello, Combo!](/docs/reference/GLIMMER_SAMPLES.md#hello-combo) / [Hello, Checkbox Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox-group) / [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager) / [Tic Tac Toe](/docs/reference/GLIMMER_SAMPLES.md#tic-tac-toe) / [Login](/docs/reference/GLIMMER_SAMPLES.md#login)
|
307
|
+
- `browser`: featured in [Hello, Browser!](/docs/reference/GLIMMER_SAMPLES.md#hello-browser)
|
308
|
+
- `calendar`: featured in [Hello, Date Time!](/docs/reference/GLIMMER_SAMPLES.md#hello-date-time)
|
309
|
+
- `checkbox`: featured in [Hello, Checkbox Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox-group) / [Hello, Checkbox!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox)
|
310
|
+
- `checkbox_group`: featured in [Hello, Checkbox Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox-group)
|
311
|
+
- `combo`: featured in [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Hello, Combo!](/docs/reference/GLIMMER_SAMPLES.md#hello-combo)
|
312
|
+
- `composite`: featured in [Hello, Composite!](/docs/reference/GLIMMER_SAMPLES.md#hello-composite) / [Hello, Radio!](/docs/reference/GLIMMER_SAMPLES.md#hello-radio) / [Hello, Computed!](/docs/reference/GLIMMER_SAMPLES.md#hello-computed) / [Hello, Checkbox!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox) / [Tic Tac Toe](/docs/reference/GLIMMER_SAMPLES.md#tic-tac-toe) / [Login](/docs/reference/GLIMMER_SAMPLES.md#login) / [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager)
|
313
|
+
- `cool_bar`: featured in [Hello, Cool Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-cool-bar)
|
314
|
+
- `date`: featured in [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Hello, Date Time!](/docs/reference/GLIMMER_SAMPLES.md#hello-date-time) / [Hello, Custom Shell!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shell) / [Tic Tac Toe](/docs/reference/GLIMMER_SAMPLES.md#tic-tac-toe)
|
315
|
+
- `date_drop_down`: featured in [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Hello, Date Time!](/docs/reference/GLIMMER_SAMPLES.md#hello-date-time)
|
316
|
+
- `group`: featured in [Hello, Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-group) / [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager)
|
317
|
+
- `label`: featured in [Hello, Computed!](/docs/reference/GLIMMER_SAMPLES.md#hello-computed) / [Hello, Checkbox Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox-group) / [Hello, Checkbox!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox) / [Hello, World!](/docs/reference/GLIMMER_SAMPLES.md#hello-world) / [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Hello, Tab!](/docs/reference/GLIMMER_SAMPLES.md#hello-tab) / [Hello, Radio Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-radio-group) / [Hello, Radio!](/docs/reference/GLIMMER_SAMPLES.md#hello-radio) / [Hello, Pop Up Context Menu!](/docs/reference/GLIMMER_SAMPLES.md#hello-pop-up-context-menu) / [Hello, Menu Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-menu-bar) / [Hello, Date Time!](/docs/reference/GLIMMER_SAMPLES.md#hello-date-time) / [Hello, Custom Widget!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-widget) / [Hello, Custom Shell!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shell) / [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager) / [Login](/docs/reference/GLIMMER_SAMPLES.md#login)
|
318
|
+
- `list` (w/ optional `:multi` SWT style): featured in [Hello, List Single Selection!](/docs/reference/GLIMMER_SAMPLES.md#hello-list-single-selection) / [Hello, List Multi Selection!](/docs/reference/GLIMMER_SAMPLES.md#hello-list-multi-selection) / [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager)
|
319
|
+
- `menu`: featured in [Hello, Menu Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-menu-bar) / [Hello, Pop Up Context Menu!](/docs/reference/GLIMMER_SAMPLES.md#hello-pop-up-context-menu) / [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table)
|
320
|
+
- `menu_bar`: featured in [Hello, Menu Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-menu-bar)
|
321
|
+
- `menu_item`: featured in [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Hello, Pop Up Context Menu!](/docs/reference/GLIMMER_SAMPLES.md#hello-pop-up-context-menu) / [Hello, Menu Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-menu-bar)
|
322
|
+
- `message_box`: featured in [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Hello, Pop Up Context Menu!](/docs/reference/GLIMMER_SAMPLES.md#hello-pop-up-context-menu) / [Hello, Message Box!](/docs/reference/GLIMMER_SAMPLES.md#hello-message-box) / [Hello, Menu Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-menu-bar)
|
323
|
+
- `radio`: featured in [Hello, Radio!](/docs/reference/GLIMMER_SAMPLES.md#hello-radio) / [Hello, Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-group)
|
324
|
+
- `radio_group`: featured in [Hello, Radio Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-radio-group)
|
316
325
|
- `scrolled_composite`
|
317
|
-
- `shell`: featured in [Hello, Checkbox!](GLIMMER_SAMPLES.md#hello-checkbox) / [Hello, Button!](GLIMMER_SAMPLES.md#hello-button) / [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Tab!](GLIMMER_SAMPLES.md#hello-tab) / [Hello, Radio Group!](GLIMMER_SAMPLES.md#hello-radio-group) / [Hello, Radio!](GLIMMER_SAMPLES.md#hello-radio) / [Hello, List Single Selection!](GLIMMER_SAMPLES.md#hello-list-single-selection) / [Hello, List Multi Selection!](GLIMMER_SAMPLES.md#hello-list-multi-selection) / [Hello, Group!](GLIMMER_SAMPLES.md#hello-group) / [Hello, Date Time!](GLIMMER_SAMPLES.md#hello-date-time) / [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell) / [Hello, Computed!](GLIMMER_SAMPLES.md#hello-computed) / [Hello, Combo!](GLIMMER_SAMPLES.md#hello-combo) / [Hello, Checkbox Group!](GLIMMER_SAMPLES.md#hello-checkbox-group) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager) / [Tic Tac Toe](GLIMMER_SAMPLES.md#tic-tac-toe) / [Login](GLIMMER_SAMPLES.md#login)
|
318
|
-
- `tab_folder`: featured in [Hello, Tab!](GLIMMER_SAMPLES.md#hello-tab)
|
319
|
-
- `tab_item`: featured in [Hello, Tab!](GLIMMER_SAMPLES.md#hello-tab)
|
320
|
-
- `table`: featured in [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell) / [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager)
|
321
|
-
- `table_column`: featured in [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager)
|
322
|
-
- `text`: featured in [Hello, Computed!](GLIMMER_SAMPLES.md#hello-computed) / [Login](GLIMMER_SAMPLES.md#login) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager)
|
323
|
-
- `time`: featured in [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Date Time!](GLIMMER_SAMPLES.md#hello-date-time)
|
326
|
+
- `shell`: featured in [Hello, Checkbox!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox) / [Hello, Button!](/docs/reference/GLIMMER_SAMPLES.md#hello-button) / [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Hello, Tab!](/docs/reference/GLIMMER_SAMPLES.md#hello-tab) / [Hello, Radio Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-radio-group) / [Hello, Radio!](/docs/reference/GLIMMER_SAMPLES.md#hello-radio) / [Hello, List Single Selection!](/docs/reference/GLIMMER_SAMPLES.md#hello-list-single-selection) / [Hello, List Multi Selection!](/docs/reference/GLIMMER_SAMPLES.md#hello-list-multi-selection) / [Hello, Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-group) / [Hello, Date Time!](/docs/reference/GLIMMER_SAMPLES.md#hello-date-time) / [Hello, Custom Shell!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shell) / [Hello, Computed!](/docs/reference/GLIMMER_SAMPLES.md#hello-computed) / [Hello, Combo!](/docs/reference/GLIMMER_SAMPLES.md#hello-combo) / [Hello, Checkbox Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox-group) / [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager) / [Tic Tac Toe](/docs/reference/GLIMMER_SAMPLES.md#tic-tac-toe) / [Login](/docs/reference/GLIMMER_SAMPLES.md#login)
|
327
|
+
- `tab_folder`: featured in [Hello, Tab!](/docs/reference/GLIMMER_SAMPLES.md#hello-tab)
|
328
|
+
- `tab_item`: featured in [Hello, Tab!](/docs/reference/GLIMMER_SAMPLES.md#hello-tab)
|
329
|
+
- `table`: featured in [Hello, Custom Shell!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shell) / [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager)
|
330
|
+
- `table_column`: featured in [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Hello, Custom Shell!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shell) / [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager)
|
331
|
+
- `text`: featured in [Hello, Computed!](/docs/reference/GLIMMER_SAMPLES.md#hello-computed) / [Login](/docs/reference/GLIMMER_SAMPLES.md#login) / [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager)
|
332
|
+
- `time`: featured in [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Hello, Date Time!](/docs/reference/GLIMMER_SAMPLES.md#hello-date-time)
|
324
333
|
- `tool_bar`: featured in [Hello, Tool Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-tool-bar)
|
325
334
|
- `tool_item`: featured in [Hello, Tool Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-tool-bar)
|
326
|
-
- Glimmer::UI::CustomWidget: ability to define any keyword as a custom widget - featured in [Hello, Custom Widget!](GLIMMER_SAMPLES.md#hello-custom-widget)
|
327
|
-
- Glimmer::UI::CustomShell: ability to define any keyword as a custom shell (aka custom window) that opens in a new browser window (tab) automatically unless there is no shell open in the current browser window (tab) - featured in [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell)
|
335
|
+
- Glimmer::UI::CustomWidget: ability to define any keyword as a custom widget - featured in [Hello, Custom Widget!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-widget)
|
336
|
+
- Glimmer::UI::CustomShell: ability to define any keyword as a custom shell (aka custom window) that opens in a new browser window (tab) automatically unless there is no shell open in the current browser window (tab) - featured in [Hello, Custom Shell!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shell)
|
328
337
|
|
329
338
|
**Layouts:**
|
330
|
-
- `grid_layout`: featured in [Hello, Layout!](GLIMMER_SAMPLES.md#hello-layout) / [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell) / [Hello, Computed!](GLIMMER_SAMPLES.md#hello-computed) / [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Pop Up Context Menu!](GLIMMER_SAMPLES.md#hello-pop-up-context-menu) / [Hello, Menu Bar!](GLIMMER_SAMPLES.md#hello-menu-bar) / [Hello, List Single Selection!](GLIMMER_SAMPLES.md#hello-list-single-selection) / [Hello, List Multi Selection!](GLIMMER_SAMPLES.md#hello-list-multi-selection) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager) / [Login](GLIMMER_SAMPLES.md#login) / [Tic Tac Toe](GLIMMER_SAMPLES.md#tic-tac-toe)
|
331
|
-
- `row_layout`: featured in [Hello, Layout!](GLIMMER_SAMPLES.md#hello-layout) / [Hello, Radio Group!](GLIMMER_SAMPLES.md#hello-radio-group) / [Hello, Radio!](GLIMMER_SAMPLES.md#hello-radio) / [Hello, Group!](GLIMMER_SAMPLES.md#hello-group) / [Hello, Date Time!](GLIMMER_SAMPLES.md#hello-date-time) / [Hello, Combo!](GLIMMER_SAMPLES.md#hello-combo) / [Hello, Checkbox Group!](GLIMMER_SAMPLES.md#hello-checkbox-group) / [Hello, Checkbox!](GLIMMER_SAMPLES.md#hello-checkbox) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager)
|
332
|
-
- `fill_layout`: featured in [Hello, Layout!](GLIMMER_SAMPLES.md#hello-layout) / [Hello, Custom Widget!](GLIMMER_SAMPLES.md#hello-custom-widget)
|
333
|
-
- `layout_data`: featured in [Hello, Layout!](GLIMMER_SAMPLES.md#hello-layout) / [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell) / [Hello, Computed!](GLIMMER_SAMPLES.md#hello-computed) / [Tic Tac Toe](GLIMMER_SAMPLES.md#tic-tac-toe) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager)
|
339
|
+
- `grid_layout`: featured in [Hello, Layout!](/docs/reference/GLIMMER_SAMPLES.md#hello-layout) / [Hello, Custom Shell!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shell) / [Hello, Computed!](/docs/reference/GLIMMER_SAMPLES.md#hello-computed) / [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Hello, Pop Up Context Menu!](/docs/reference/GLIMMER_SAMPLES.md#hello-pop-up-context-menu) / [Hello, Menu Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-menu-bar) / [Hello, List Single Selection!](/docs/reference/GLIMMER_SAMPLES.md#hello-list-single-selection) / [Hello, List Multi Selection!](/docs/reference/GLIMMER_SAMPLES.md#hello-list-multi-selection) / [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager) / [Login](/docs/reference/GLIMMER_SAMPLES.md#login) / [Tic Tac Toe](/docs/reference/GLIMMER_SAMPLES.md#tic-tac-toe)
|
340
|
+
- `row_layout`: featured in [Hello, Layout!](/docs/reference/GLIMMER_SAMPLES.md#hello-layout) / [Hello, Radio Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-radio-group) / [Hello, Radio!](/docs/reference/GLIMMER_SAMPLES.md#hello-radio) / [Hello, Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-group) / [Hello, Date Time!](/docs/reference/GLIMMER_SAMPLES.md#hello-date-time) / [Hello, Combo!](/docs/reference/GLIMMER_SAMPLES.md#hello-combo) / [Hello, Checkbox Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox-group) / [Hello, Checkbox!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox) / [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager)
|
341
|
+
- `fill_layout`: featured in [Hello, Layout!](/docs/reference/GLIMMER_SAMPLES.md#hello-layout) / [Hello, Custom Widget!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-widget)
|
342
|
+
- `layout_data`: featured in [Hello, Layout!](/docs/reference/GLIMMER_SAMPLES.md#hello-layout) / [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Hello, Custom Shell!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shell) / [Hello, Computed!](/docs/reference/GLIMMER_SAMPLES.md#hello-computed) / [Tic Tac Toe](/docs/reference/GLIMMER_SAMPLES.md#tic-tac-toe) / [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager)
|
334
343
|
|
335
344
|
**Graphics/Style:**
|
336
|
-
- `color`: featured in [Hello, Custom Widget!](GLIMMER_SAMPLES.md#hello-custom-widget) / [Hello, Menu Bar!](GLIMMER_SAMPLES.md#hello-menu-bar)
|
337
|
-
- `font`: featured in [Hello, Checkbox Group!](GLIMMER_SAMPLES.md#hello-checkbox-group) / [Hello, Checkbox!](GLIMMER_SAMPLES.md#hello-checkbox) / [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Radio Group!](GLIMMER_SAMPLES.md#hello-radio-group) / [Hello, Radio!](GLIMMER_SAMPLES.md#hello-radio) / [Hello, Pop Up Context Menu!](GLIMMER_SAMPLES.md#hello-pop-up-context-menu) / [Hello, Menu Bar!](GLIMMER_SAMPLES.md#hello-menu-bar) / [Hello, Group!](GLIMMER_SAMPLES.md#hello-group) / [Hello, Date Time!](GLIMMER_SAMPLES.md#hello-date-time) / [Hello, Custom Widget!](GLIMMER_SAMPLES.md#hello-custom-widget) / [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager) / [Tic Tac Toe](GLIMMER_SAMPLES.md#tic-tac-toe)
|
345
|
+
- `color`: featured in [Hello, Custom Widget!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-widget) / [Hello, Menu Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-menu-bar)
|
346
|
+
- `font`: featured in [Hello, Checkbox Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox-group) / [Hello, Checkbox!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox) / [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Hello, Radio Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-radio-group) / [Hello, Radio!](/docs/reference/GLIMMER_SAMPLES.md#hello-radio) / [Hello, Pop Up Context Menu!](/docs/reference/GLIMMER_SAMPLES.md#hello-pop-up-context-menu) / [Hello, Menu Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-menu-bar) / [Hello, Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-group) / [Hello, Date Time!](/docs/reference/GLIMMER_SAMPLES.md#hello-date-time) / [Hello, Custom Widget!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-widget) / [Hello, Custom Shell!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shell) / [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager) / [Tic Tac Toe](/docs/reference/GLIMMER_SAMPLES.md#tic-tac-toe)
|
338
347
|
- `Point` class used in setting location on widgets
|
339
|
-
- `swt` and `SWT` class to set SWT styles on widgets - featured in [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell) / [Login](GLIMMER_SAMPLES.md#login) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager)
|
348
|
+
- `swt` and `SWT` class to set SWT styles on widgets - featured in [Hello, Custom Shell!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shell) / [Login](/docs/reference/GLIMMER_SAMPLES.md#login) / [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager)
|
340
349
|
|
341
350
|
**Data-Binding/Observers:**
|
342
|
-
- `bind`: featured in [Hello, Computed!](GLIMMER_SAMPLES.md#hello-computed) / [Hello, Combo!](GLIMMER_SAMPLES.md#hello-combo) / [Hello, Checkbox Group!](GLIMMER_SAMPLES.md#hello-checkbox-group) / [Hello, Checkbox!](GLIMMER_SAMPLES.md#hello-checkbox) / [Hello, Button!](GLIMMER_SAMPLES.md#hello-button) / [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Radio Group!](GLIMMER_SAMPLES.md#hello-radio-group) / [Hello, Radio!](GLIMMER_SAMPLES.md#hello-radio) / [Hello, List Single Selection!](GLIMMER_SAMPLES.md#hello-list-single-selection) / [Hello, List Multi Selection!](GLIMMER_SAMPLES.md#hello-list-multi-selection) / [Hello, Group!](GLIMMER_SAMPLES.md#hello-group) / [Hello, Date Time!](GLIMMER_SAMPLES.md#hello-date-time) / [Hello, Custom Widget!](GLIMMER_SAMPLES.md#hello-custom-widget) / [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell) / [Login](GLIMMER_SAMPLES.md#login) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager) / [Tic Tac Toe](GLIMMER_SAMPLES.md#tic-tac-toe)
|
343
|
-
- `observe`: featured in [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Tic Tac Toe](GLIMMER_SAMPLES.md#tic-tac-toe)
|
344
|
-
- `on_widget_selected`: featured in [Hello, Combo!](GLIMMER_SAMPLES.md#hello-combo) / [Hello, Checkbox Group!](GLIMMER_SAMPLES.md#hello-checkbox-group) / [Hello, Checkbox!](GLIMMER_SAMPLES.md#hello-checkbox) / [Hello, Button!](GLIMMER_SAMPLES.md#hello-button) / [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Radio Group!](GLIMMER_SAMPLES.md#hello-radio-group) / [Hello, Radio!](GLIMMER_SAMPLES.md#hello-radio) / [Hello, Pop Up Context Menu!](GLIMMER_SAMPLES.md#hello-pop-up-context-menu) / [Hello, Message Box!](GLIMMER_SAMPLES.md#hello-message-box) / [Hello, Menu Bar!](GLIMMER_SAMPLES.md#hello-menu-bar) / [Hello, List Single Selection!](GLIMMER_SAMPLES.md#hello-list-single-selection) / [Hello, List Multi Selection!](GLIMMER_SAMPLES.md#hello-list-multi-selection) / [Hello, Group!](GLIMMER_SAMPLES.md#hello-group) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager) / [Login](GLIMMER_SAMPLES.md#login) / [Tic Tac Toe](GLIMMER_SAMPLES.md#tic-tac-toe)
|
351
|
+
- `bind`: featured in [Hello, Computed!](/docs/reference/GLIMMER_SAMPLES.md#hello-computed) / [Hello, Combo!](/docs/reference/GLIMMER_SAMPLES.md#hello-combo) / [Hello, Checkbox Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox-group) / [Hello, Checkbox!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox) / [Hello, Button!](/docs/reference/GLIMMER_SAMPLES.md#hello-button) / [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Hello, Radio Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-radio-group) / [Hello, Radio!](/docs/reference/GLIMMER_SAMPLES.md#hello-radio) / [Hello, List Single Selection!](/docs/reference/GLIMMER_SAMPLES.md#hello-list-single-selection) / [Hello, List Multi Selection!](/docs/reference/GLIMMER_SAMPLES.md#hello-list-multi-selection) / [Hello, Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-group) / [Hello, Date Time!](/docs/reference/GLIMMER_SAMPLES.md#hello-date-time) / [Hello, Custom Widget!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-widget) / [Hello, Custom Shell!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shell) / [Login](/docs/reference/GLIMMER_SAMPLES.md#login) / [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager) / [Tic Tac Toe](/docs/reference/GLIMMER_SAMPLES.md#tic-tac-toe)
|
352
|
+
- `observe`: featured in [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Tic Tac Toe](/docs/reference/GLIMMER_SAMPLES.md#tic-tac-toe)
|
353
|
+
- `on_widget_selected`: featured in [Hello, Combo!](/docs/reference/GLIMMER_SAMPLES.md#hello-combo) / [Hello, Checkbox Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox-group) / [Hello, Checkbox!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox) / [Hello, Button!](/docs/reference/GLIMMER_SAMPLES.md#hello-button) / [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Hello, Radio Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-radio-group) / [Hello, Radio!](/docs/reference/GLIMMER_SAMPLES.md#hello-radio) / [Hello, Pop Up Context Menu!](/docs/reference/GLIMMER_SAMPLES.md#hello-pop-up-context-menu) / [Hello, Message Box!](/docs/reference/GLIMMER_SAMPLES.md#hello-message-box) / [Hello, Menu Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-menu-bar) / [Hello, List Single Selection!](/docs/reference/GLIMMER_SAMPLES.md#hello-list-single-selection) / [Hello, List Multi Selection!](/docs/reference/GLIMMER_SAMPLES.md#hello-list-multi-selection) / [Hello, Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-group) / [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager) / [Login](/docs/reference/GLIMMER_SAMPLES.md#login) / [Tic Tac Toe](/docs/reference/GLIMMER_SAMPLES.md#tic-tac-toe)
|
345
354
|
- `on_modify_text`
|
346
|
-
- `on_key_pressed` (and SWT alias `on_swt_keydown`) - featured in [Login](GLIMMER_SAMPLES.md#login) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager)
|
355
|
+
- `on_key_pressed` (and SWT alias `on_swt_keydown`) - featured in [Login](/docs/reference/GLIMMER_SAMPLES.md#login) / [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager)
|
347
356
|
- `on_key_released` (and SWT alias `on_swt_keyup`)
|
348
357
|
- `on_mouse_down` (and SWT alias `on_swt_mousedown`)
|
349
|
-
- `on_mouse_up` (and SWT alias `on_swt_mouseup`) - featured in [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager)
|
358
|
+
- `on_mouse_up` (and SWT alias `on_swt_mouseup`) - featured in [Hello, Custom Shell!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shell) / [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager)
|
350
359
|
|
351
360
|
**Event loop:**
|
352
|
-
- `display`: featured in [Tic Tac Toe](GLIMMER_SAMPLES.md#tic-tac-toe)
|
353
|
-
- `async_exec`: featured in [Hello, Custom Widget!](GLIMMER_SAMPLES.md#hello-custom-widget) / [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell)
|
361
|
+
- `display`: featured in [Tic Tac Toe](/docs/reference/GLIMMER_SAMPLES.md#tic-tac-toe)
|
362
|
+
- `async_exec`: featured in [Hello, Custom Widget!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-widget) / [Hello, Custom Shell!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shell)
|
354
363
|
- `sync_exec`: executes a block on the event loop synchronously (usually from another thread)
|
355
364
|
- `timer_exec`: executes a block after a delay of time has passed
|
356
365
|
- `auto_exec`: executes a block on the event loop synchronously only when needed (when running from a thread other than GUI thread)
|
@@ -400,12 +409,14 @@ Example (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
|
|
400
409
|
@shell = shell {
|
401
410
|
text "Application"
|
402
411
|
row_layout
|
412
|
+
|
403
413
|
@label1 = label {
|
404
414
|
text "Hello,"
|
405
415
|
}
|
406
416
|
}
|
407
417
|
@shell.content {
|
408
418
|
minimum_size 130, 130
|
419
|
+
|
409
420
|
label {
|
410
421
|
text "World!"
|
411
422
|
}
|
@@ -448,7 +459,7 @@ Dialog is a variation on Shell. It is basically a shell that is modal (blocks wh
|
|
448
459
|
|
449
460
|
Glimmer facilitates building dialogs by using the `dialog` keyword, which automatically adds the SWT.DIALOG_TRIM and SWT.APPLICATION_MODAL [widget styles](#widget-styles) needed for a dialog.
|
450
461
|
|
451
|
-
Check out [Hello, Dialog!](GLIMMER_SAMPLES.md#hello-dialog) sample to learn more.
|
462
|
+
Check out [Hello, Dialog!](/docs/reference/GLIMMER_SAMPLES.md#hello-dialog) sample to learn more.
|
452
463
|
|
453
464
|
##### message_box
|
454
465
|
|
@@ -461,8 +472,10 @@ include Glimmer
|
|
461
472
|
|
462
473
|
@shell = shell {
|
463
474
|
text 'Hello, Message Box!'
|
475
|
+
|
464
476
|
button {
|
465
477
|
text 'Please Click To Win a Surprise'
|
478
|
+
|
466
479
|
on_widget_selected do
|
467
480
|
message_box(@shell) {
|
468
481
|
text 'Surprise'
|
@@ -502,6 +515,7 @@ automatically uses the `display` created earlier without having to explicitly ho
|
|
502
515
|
```ruby
|
503
516
|
@display = display {
|
504
517
|
cursor_location 300, 300
|
518
|
+
|
505
519
|
on_swt_keydown do
|
506
520
|
# ...
|
507
521
|
end
|
@@ -519,7 +533,7 @@ Although SWT Display is not technically a widget, it has similar APIs and DSL su
|
|
519
533
|
|
520
534
|
Most of the time, you simply get away with Ruby [Threads](https://ruby-doc.org/core-2.5.7/Thread.html) and [Mutexes](https://ruby-doc.org/core-2.5.7/Mutex.html).
|
521
535
|
|
522
|
-
Otherwise, if you need more advanced concurrency, Glimmer includes the [concurrent-ruby gem](https://rubygems.org/gems/concurrent-ruby), which supports many helpful concurrency techniques such as [Thread Pools](http://ruby-concurrency.github.io/concurrent-ruby/master/file.thread_pools.html) (used in the [Mandelbrot Fractal](GLIMMER_SAMPLES.md#mandelbrot-fractal) sample).
|
536
|
+
Otherwise, if you need more advanced concurrency, Glimmer includes the [concurrent-ruby gem](https://rubygems.org/gems/concurrent-ruby), which supports many helpful concurrency techniques such as [Thread Pools](http://ruby-concurrency.github.io/concurrent-ruby/master/file.thread_pools.html) (used in the [Mandelbrot Fractal](/docs/reference/GLIMMER_SAMPLES.md#mandelbrot-fractal) sample).
|
523
537
|
|
524
538
|
One thing Glimmer DSL for SWT innovates over plain old SWT is not requiring developers to explicitly use `Display.syncExec` from threads other than the GUI threads.
|
525
539
|
Glimmer automatically detects if you're running in a different thread and uses `Display.syncExec` automatically using its own enhanced `auto_exec`
|
@@ -535,21 +549,22 @@ Example (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
|
|
535
549
|
```
|
536
550
|
@shell = shell {
|
537
551
|
text 'Glimmer'
|
552
|
+
|
538
553
|
@label = label {
|
539
554
|
text 'Hello, World!'
|
540
555
|
}
|
541
556
|
}
|
542
557
|
|
543
|
-
Thread.new
|
544
|
-
[:red, :dark_green, :blue].cycle
|
545
|
-
async_exec
|
558
|
+
Thread.new do
|
559
|
+
[:red, :dark_green, :blue].cycle do |color|
|
560
|
+
async_exec do
|
546
561
|
@label.content {
|
547
562
|
foreground color if @shell.visible?
|
548
563
|
}
|
549
|
-
|
564
|
+
end
|
550
565
|
sleep(1)
|
551
|
-
|
552
|
-
|
566
|
+
end
|
567
|
+
end
|
553
568
|
|
554
569
|
@shell.open
|
555
570
|
```
|
@@ -558,6 +573,10 @@ Thread.new {
|
|
558
573
|
|
559
574
|
`sync_exec {}` is required by SWT when running GUI update from a thread other than the GUI thread. In Glimmer, it is automatically invoked for you so that you wouldn't have to worry about it. It works just like `async_exec` except it executes the block synchronously at the earliest opportunity possible, waiting for the block to be finished.
|
560
575
|
|
576
|
+
##### sync_call
|
577
|
+
|
578
|
+
`sync_exec {}` is required by SWT when running GUI update from a thread other than the GUI thread. In Glimmer, it is automatically invoked for you so that you wouldn't have to worry about it. It works just like `async_exec` except it executes the block synchronously at the earliest opportunity possible, waiting for the block to be finished.
|
579
|
+
|
561
580
|
##### auto_exec
|
562
581
|
|
563
582
|
`auto_exec(override_sync_exec:, override_async_exec) {}` only executes code block with `sync_exec` when necessary (running from a thread other than the GUI thread). It is used automatically all over the Glimmer DSL for SWT codebase, so you wouldn't need it unless you grab a direct handle on `swt_widget` from a widget proxy.
|
@@ -627,8 +646,10 @@ shell {
|
|
627
646
|
}
|
628
647
|
menu {
|
629
648
|
text 'Open &Recent'
|
649
|
+
|
630
650
|
menu_item {
|
631
651
|
text 'File 1'
|
652
|
+
|
632
653
|
on_widget_selected do
|
633
654
|
message_box {
|
634
655
|
text 'File 1'
|
@@ -636,8 +657,10 @@ shell {
|
|
636
657
|
}.open
|
637
658
|
end
|
638
659
|
}
|
660
|
+
|
639
661
|
menu_item {
|
640
662
|
text 'File 2'
|
663
|
+
|
641
664
|
on_widget_selected do
|
642
665
|
message_box {
|
643
666
|
text 'File 2'
|
@@ -646,7 +669,9 @@ shell {
|
|
646
669
|
end
|
647
670
|
}
|
648
671
|
}
|
672
|
+
|
649
673
|
menu_item(:separator)
|
674
|
+
|
650
675
|
menu_item {
|
651
676
|
text 'E&xit'
|
652
677
|
|
@@ -657,19 +682,23 @@ shell {
|
|
657
682
|
}
|
658
683
|
menu {
|
659
684
|
text '&Edit'
|
685
|
+
|
660
686
|
menu_item {
|
661
687
|
text 'Cut'
|
662
688
|
accelerator :command, :X
|
663
689
|
}
|
690
|
+
|
664
691
|
menu_item {
|
665
692
|
text 'Copy'
|
666
693
|
accelerator :command, :C
|
667
694
|
}
|
695
|
+
|
668
696
|
menu_item {
|
669
697
|
text 'Paste'
|
670
698
|
accelerator :command, :V
|
671
699
|
}
|
672
700
|
}
|
701
|
+
|
673
702
|
menu {
|
674
703
|
text '&Options'
|
675
704
|
|
@@ -681,6 +710,7 @@ shell {
|
|
681
710
|
@select_multiple_menu.enabled = true
|
682
711
|
end
|
683
712
|
}
|
713
|
+
|
684
714
|
@select_one_menu = menu {
|
685
715
|
text '&Select One'
|
686
716
|
enabled false
|
@@ -688,13 +718,16 @@ shell {
|
|
688
718
|
menu_item(:radio) {
|
689
719
|
text 'Option 1'
|
690
720
|
}
|
721
|
+
|
691
722
|
menu_item(:radio) {
|
692
723
|
text 'Option 2'
|
693
724
|
}
|
725
|
+
|
694
726
|
menu_item(:radio) {
|
695
727
|
text 'Option 3'
|
696
728
|
}
|
697
729
|
}
|
730
|
+
|
698
731
|
@select_multiple_menu = menu {
|
699
732
|
text '&Select Multiple'
|
700
733
|
enabled false
|
@@ -702,18 +735,23 @@ shell {
|
|
702
735
|
menu_item(:check) {
|
703
736
|
text 'Option 4'
|
704
737
|
}
|
738
|
+
|
705
739
|
menu_item(:check) {
|
706
740
|
text 'Option 5'
|
707
741
|
}
|
742
|
+
|
708
743
|
menu_item(:check) {
|
709
744
|
text 'Option 6'
|
710
745
|
}
|
711
746
|
}
|
712
747
|
}
|
748
|
+
|
713
749
|
menu {
|
714
750
|
text '&Format'
|
751
|
+
|
715
752
|
menu {
|
716
753
|
text '&Background Color'
|
754
|
+
|
717
755
|
COLORS.each { |color_style|
|
718
756
|
menu_item(:radio) {
|
719
757
|
text color_style.to_s.split('_').map(&:capitalize).join(' ')
|
@@ -724,8 +762,10 @@ shell {
|
|
724
762
|
}
|
725
763
|
}
|
726
764
|
}
|
765
|
+
|
727
766
|
menu {
|
728
767
|
text 'Foreground &Color'
|
768
|
+
|
729
769
|
COLORS.each { |color_style|
|
730
770
|
menu_item(:radio) {
|
731
771
|
text color_style.to_s.split('_').map(&:capitalize).join(' ')
|
@@ -737,8 +777,10 @@ shell {
|
|
737
777
|
}
|
738
778
|
}
|
739
779
|
}
|
780
|
+
|
740
781
|
menu {
|
741
782
|
text '&View'
|
783
|
+
|
742
784
|
menu_item(:radio) {
|
743
785
|
text 'Small'
|
744
786
|
|
@@ -747,6 +789,7 @@ shell {
|
|
747
789
|
@label.parent.pack
|
748
790
|
end
|
749
791
|
}
|
792
|
+
|
750
793
|
menu_item(:radio) {
|
751
794
|
text 'Medium'
|
752
795
|
selection true
|
@@ -756,6 +799,7 @@ shell {
|
|
756
799
|
@label.parent.pack
|
757
800
|
end
|
758
801
|
}
|
802
|
+
|
759
803
|
menu_item(:radio) {
|
760
804
|
text 'Large'
|
761
805
|
|
@@ -765,8 +809,10 @@ shell {
|
|
765
809
|
end
|
766
810
|
}
|
767
811
|
}
|
812
|
+
|
768
813
|
menu {
|
769
814
|
text '&Help'
|
815
|
+
|
770
816
|
menu_item {
|
771
817
|
text '&Manual'
|
772
818
|
accelerator :command, :shift, :M
|
@@ -778,6 +824,7 @@ shell {
|
|
778
824
|
}.open
|
779
825
|
end
|
780
826
|
}
|
827
|
+
|
781
828
|
menu_item {
|
782
829
|
text '&Tutorial'
|
783
830
|
accelerator :command, :shift, :T
|
@@ -789,7 +836,9 @@ shell {
|
|
789
836
|
}.open
|
790
837
|
end
|
791
838
|
}
|
839
|
+
|
792
840
|
menu_item(:separator)
|
841
|
+
|
793
842
|
menu_item {
|
794
843
|
text '&Report an Issue...'
|
795
844
|
|
@@ -825,10 +874,13 @@ shell {
|
|
825
874
|
menu {
|
826
875
|
menu {
|
827
876
|
text '&History'
|
877
|
+
|
828
878
|
menu {
|
829
879
|
text '&Recent'
|
880
|
+
|
830
881
|
menu_item {
|
831
882
|
text 'File 1'
|
883
|
+
|
832
884
|
on_widget_selected do
|
833
885
|
message_box {
|
834
886
|
text 'File 1'
|
@@ -836,8 +888,10 @@ shell {
|
|
836
888
|
}.open
|
837
889
|
end
|
838
890
|
}
|
891
|
+
|
839
892
|
menu_item {
|
840
893
|
text 'File 2'
|
894
|
+
|
841
895
|
on_widget_selected do
|
842
896
|
message_box {
|
843
897
|
text 'File 2'
|
@@ -846,10 +900,13 @@ shell {
|
|
846
900
|
end
|
847
901
|
}
|
848
902
|
}
|
903
|
+
|
849
904
|
menu {
|
850
905
|
text '&Archived'
|
906
|
+
|
851
907
|
menu_item {
|
852
908
|
text 'File 3'
|
909
|
+
|
853
910
|
on_widget_selected do
|
854
911
|
message_box {
|
855
912
|
text 'File 3'
|
@@ -857,8 +914,10 @@ shell {
|
|
857
914
|
}.open
|
858
915
|
end
|
859
916
|
}
|
917
|
+
|
860
918
|
menu_item {
|
861
919
|
text 'File 4'
|
920
|
+
|
862
921
|
on_widget_selected do
|
863
922
|
message_box {
|
864
923
|
text 'File 4'
|
@@ -1006,7 +1065,7 @@ shell {
|
|
1006
1065
|
}.open
|
1007
1066
|
```
|
1008
1067
|
|
1009
|
-
You may check out a more full-fledged example in [Hello, Sash Form!](GLIMMER_SAMPLES.md#hello-sash-form)
|
1068
|
+
You may check out a more full-fledged example in [Hello, Sash Form!](/docs/reference/GLIMMER_SAMPLES.md#hello-sash-form)
|
1010
1069
|
|
1011
1070
|
![Hello Sash Form](/images/glimmer-hello-sash-form.png)
|
1012
1071
|
|
@@ -1049,6 +1108,8 @@ shell {
|
|
1049
1108
|
}.open
|
1050
1109
|
```
|
1051
1110
|
|
1111
|
+
This relies on Glimmer's [Multi-DSL Support](#multi-dsl-support) for building the HTML text using [Glimmer XML DSL](https://github.com/AndyObtiva/glimmer-dsl-xml).
|
1112
|
+
|
1052
1113
|
Learn more at the [SWT Browser widget](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/browser/Browser.html) API.
|
1053
1114
|
|
1054
1115
|
### Widget Styles
|
@@ -1321,12 +1382,16 @@ This sets the shell `cursor` to that of `SWT::CURSOR_APPSTARTING`
|
|
1321
1382
|
|
1322
1383
|
### Layouts
|
1323
1384
|
|
1324
|
-
Glimmer lays widgets out visually using SWT layouts, which can only be set on composite widget and subclasses.
|
1385
|
+
Glimmer lays widgets out visually using SWT layouts, configurable with many options (e.g. whether widgets are responsive to window sizing), which can only be set on composite widget and subclasses.
|
1325
1386
|
|
1326
1387
|
The most common SWT layouts are:
|
1327
|
-
- `FillLayout
|
1328
|
-
- `RowLayout
|
1329
|
-
- `GridLayout
|
1388
|
+
- [`fill_layout`](https://help.eclipse.org/latest/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/layout/FillLayout.html): lays widgets out in equal proportion horizontally or vertically with spacing/margin options. This is the ***default*** layout for ***shell*** (with `:horizontal` option) in Glimmer.
|
1389
|
+
- [`row_layout`](https://help.eclipse.org/latest/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/layout/RowLayout.html): lays widgets out horizontally or vertically in varying proportions with advanced spacing/margin/justify options
|
1390
|
+
- [`grid_layout`](https://help.eclipse.org/latest/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/layout/GridLayout.html): lays widgets out in a grid with advanced spacing/margin/alignment/indentation options. This is the **default** layout for **composite** in Glimmer. It is important to master.
|
1391
|
+
|
1392
|
+
Note that if you need to have widgets fill a `row_layout` and resize automatically upon window resize, you must nest `fill true` within. This is the automatic behavior of `fill_layout`. For `grid_layout`, you would have to add `layout_data :fill, :center, true, false` to a child that you want to fill all available space horizontally (whether initially or after window resize) and `layout_data :fill, :fill, true, true` if you want to fill all available space horizontally and vertically.
|
1393
|
+
|
1394
|
+
Do not be alarmed if widget sizes were kept fixed on resize of a window or change of text data. This is normal behavior that can always be overridden with options, such as `fill true` mentioned above. You need to [learn more about each layout](https://help.eclipse.org/latest/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/layout/package-summary.html) before you have mastered them enough for your needs. [Samples](/docs/reference/GLIMMER_SAMPLES.md) like [Hello, Layout!](/docs/reference/GLIMMER_SAMPLES.md#hello-layout) are greatly helpful in learning too.
|
1330
1395
|
|
1331
1396
|
In Glimmer DSL, just like widgets, layouts can be specified with lowercase underscored names followed by a block containing properties, also lowercase underscored names (e.g. `RowLayout` is `row_layout`).
|
1332
1397
|
|
@@ -1483,6 +1548,23 @@ composite {
|
|
1483
1548
|
# ...
|
1484
1549
|
```
|
1485
1550
|
|
1551
|
+
```ruby
|
1552
|
+
# ...
|
1553
|
+
composite {
|
1554
|
+
grid_layout 3, false # grid layout with 3 columns not of equal width
|
1555
|
+
label {
|
1556
|
+
# layout data with explicit setting of properties instead of relying on arguments
|
1557
|
+
layout_data {
|
1558
|
+
horizontal_alignment :fill # could be :beginning, :center or :end too
|
1559
|
+
vertical_alignment :center # could be :beginning, :fill, or :end too
|
1560
|
+
grab_excess_horizontal_space true
|
1561
|
+
grab_excess_vertical_space false
|
1562
|
+
}
|
1563
|
+
}
|
1564
|
+
}
|
1565
|
+
# ...
|
1566
|
+
```
|
1567
|
+
|
1486
1568
|
```ruby
|
1487
1569
|
# ...
|
1488
1570
|
composite {
|
@@ -1708,7 +1790,7 @@ shell {
|
|
1708
1790
|
}.open
|
1709
1791
|
```
|
1710
1792
|
|
1711
|
-
Learn more at the [Hello, Canvas! Sample](GLIMMER_SAMPLES.md#hello-canvas).
|
1793
|
+
Learn more at the [Hello, Canvas! Sample](/docs/reference/GLIMMER_SAMPLES.md#hello-canvas).
|
1712
1794
|
|
1713
1795
|
If you ever have special needs or optimizations, you could always default to direct SWT painting via [org.eclipse.swt.graphics.GC](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/GC.html) instead. Learn more at the [SWT Graphics Guide](https://www.eclipse.org/articles/Article-SWT-graphics/SWT_graphics.html) and [SWT Image Guide](https://www.eclipse.org/articles/Article-SWT-images/graphics-resources.html#Saving%20Images).
|
1714
1796
|
|
@@ -1767,7 +1849,7 @@ If you specify the `width` and `height` parameters as `:max`, they get calculate
|
|
1767
1849
|
|
1768
1850
|
Note that you could shift a shape off its centered position within its parent shape by setting `x` to `[:default, x_delta]` and `y` to `[:default, y_delta]`
|
1769
1851
|
|
1770
|
-
Check [Hello, Canvas!](GLIMMER_SAMPLES.md#hello-canvas) for an example that nests lines, points, a polyline, and an image within a drawn rectangle parent:
|
1852
|
+
Check [Hello, Canvas!](/docs/reference/GLIMMER_SAMPLES.md#hello-canvas) for an example that nests lines, points, a polyline, and an image within a drawn rectangle parent:
|
1771
1853
|
|
1772
1854
|
```ruby
|
1773
1855
|
rectangle(205, 50, 88, 96) {
|
@@ -1789,7 +1871,7 @@ Check [Hello, Canvas!](GLIMMER_SAMPLES.md#hello-canvas) for an example that nest
|
|
1789
1871
|
|
1790
1872
|
#### Shapes inside a Widget
|
1791
1873
|
|
1792
|
-
Keep in mind that the Shape DSL can be used inside any widget, not just `canvas`. Unlike shapes on a `canvas`, which are standalone graphics, when included in a widget, which already has its own look and feel, shapes are used as a decorative add-on that complements its look by getting painted on top of it. For example, shapes were used to decorate `composite` blocks in the [Tetris](GLIMMER_SAMPLES.md#tetris) sample to have a more bevel look. In summary, Shapes can be used in a hybrid approach (shapes inside a widget), not just standalone in a `canvas`.
|
1874
|
+
Keep in mind that the Shape DSL can be used inside any widget, not just `canvas`. Unlike shapes on a `canvas`, which are standalone graphics, when included in a widget, which already has its own look and feel, shapes are used as a decorative add-on that complements its look by getting painted on top of it. For example, shapes were used to decorate `composite` blocks in the [Tetris](/docs/reference/GLIMMER_SAMPLES.md#tetris) sample to have a more bevel look. In summary, Shapes can be used in a hybrid approach (shapes inside a widget), not just standalone in a `canvas`.
|
1793
1875
|
|
1794
1876
|
#### Shapes inside an Image
|
1795
1877
|
|
@@ -1939,7 +2021,7 @@ They are implemented with the help of the highly robust Java built-in shape geom
|
|
1939
2021
|
- `Shape#x_end` : right-most included x coordinate
|
1940
2022
|
- `Shape#y_end` : bottom-most included y coordinate
|
1941
2023
|
|
1942
|
-
Check [Hello, Canvas!](GLIMMER_SAMPLES.md#hello-canvas) for an example.
|
2024
|
+
Check [Hello, Canvas!](/docs/reference/GLIMMER_SAMPLES.md#hello-canvas) for an example.
|
1943
2025
|
|
1944
2026
|
|
1945
2027
|
#### Pixel Graphics
|
@@ -2157,7 +2239,7 @@ shell {
|
|
2157
2239
|
|
2158
2240
|
![Canvas Path Example](/images/glimmer-example-canvas-path.png)
|
2159
2241
|
|
2160
|
-
Learn more at the [Hello, Canvas Path!](GLIMMER_SAMPLES.md#hello-canvas-path) and [Stock Ticker](GLIMMER_SAMPLES.md#stock-ticker) samples.
|
2242
|
+
Learn more at the [Hello, Canvas Path!](/docs/reference/GLIMMER_SAMPLES.md#hello-canvas-path) and [Stock Ticker](/docs/reference/GLIMMER_SAMPLES.md#stock-ticker) samples.
|
2161
2243
|
|
2162
2244
|
![Stock Ticker](/images/glimmer-stock-ticker.gif)
|
2163
2245
|
|
@@ -2252,7 +2334,7 @@ transform(1, 1, 4, 2, 2, 4).
|
|
2252
2334
|
translate(3, 7)
|
2253
2335
|
```
|
2254
2336
|
|
2255
|
-
Learn more at the [Hello, Canvas Transform! Sample](GLIMMER_SAMPLES.md#hello-canvas-transform).
|
2337
|
+
Learn more at the [Hello, Canvas Transform! Sample](/docs/reference/GLIMMER_SAMPLES.md#hello-canvas-transform).
|
2256
2338
|
|
2257
2339
|
### Canvas Animation DSL
|
2258
2340
|
|
@@ -2321,7 +2403,7 @@ API of Animation Object (returned from `animation` keyword):
|
|
2321
2403
|
- `#cycle_limited?` returns true if `cycle_count` is specified
|
2322
2404
|
- `#duration_limited?` returns true if `duration_limit` is specified
|
2323
2405
|
|
2324
|
-
Learn more at the [Hello, Canvas Animation!](GLIMMER_SAMPLES.md#hello-canvas-animation) and [Hello, Canvas Animation Data Binding!](GLIMMER_SAMPLES.md#hello-canvas-animation-data-binding) samples.
|
2406
|
+
Learn more at the [Hello, Canvas Animation!](/docs/reference/GLIMMER_SAMPLES.md#hello-canvas-animation) and [Hello, Canvas Animation Data Binding!](/docs/reference/GLIMMER_SAMPLES.md#hello-canvas-animation-data-binding) samples.
|
2325
2407
|
|
2326
2408
|
If there is anything missing you would like added to the Glimmer Animation DSL that you saw available in the SWT APIs, you may [report an issue](https://github.com/AndyObtiva/glimmer-dsl-swt/issues) or implement yourself and [contribute](#contributing) via a Pull Request.
|
2327
2409
|
|
@@ -2329,63 +2411,71 @@ If there is anything missing you would like added to the Glimmer Animation DSL t
|
|
2329
2411
|
|
2330
2412
|
Animation could be alternatively implemented without the `animation` keyword through a loop that invokes model methods inside `sync_exec {}` (or `async_exec {}`), which indirectly cause updates to the GUI via data-binding.
|
2331
2413
|
|
2332
|
-
The [Glimmer Tetris](GLIMMER_SAMPLES.md#tetris) sample provides a good example of that.
|
2414
|
+
The [Glimmer Tetris](/docs/reference/GLIMMER_SAMPLES.md#tetris) sample provides a good example of that.
|
2333
2415
|
|
2334
2416
|
### Data-Binding
|
2335
2417
|
|
2336
|
-
Data-binding is done with `bind`
|
2418
|
+
Data-binding is done with either the [Shine](#shine) syntax `<=>` (bidirectional data-binding) & `<=` (unidirectional data-binding) or via the `bind` keyword, following widget property to bind and taking model and bindable attribute as arguments.
|
2337
2419
|
|
2338
2420
|
#### General Examples
|
2339
2421
|
|
2422
|
+
`text <=> [contact, :first_name]`
|
2423
|
+
|
2424
|
+
This example binds the text property of a widget like `label` to the first name of a contact model using Shine data-binding syntax (recommended).
|
2425
|
+
|
2340
2426
|
`text bind(contact, :first_name)`
|
2341
2427
|
|
2342
|
-
This example binds the text property of a widget like `label` to the first name of a contact model.
|
2428
|
+
This example binds the text property of a widget like `label` to the first name of a contact model (older style of data-binding, not recommended).
|
2343
2429
|
|
2344
|
-
`text
|
2430
|
+
`text <=> [contact, 'address.street']`
|
2345
2431
|
|
2346
2432
|
This example binds the text property of a widget like `label` to the nested street of
|
2347
2433
|
the address of a contact. This is called nested property data binding.
|
2348
2434
|
|
2349
|
-
`text
|
2435
|
+
`text <=> [contact, 'address.street', on_read: :upcase, on_write: :downcase]`
|
2350
2436
|
|
2351
2437
|
This example adds on the one above it by specifying converters on read and write of the model property, like in the case of a `text` widget. The text widget will then displays the street upper case and the model will store it lower case. When specifying converters, read and write operations must be symmetric (to avoid an infinite update loop between the widget and the model since the widget checks first if value changed before updating)
|
2352
2438
|
|
2353
|
-
`text
|
2354
|
-
|
2355
|
-
This example forces GUI updates via [sync_exec](#sync_exec) assuming they are coming from another thread (different from the GUI thread)
|
2356
|
-
|
2357
|
-
`text bind(contact, 'address.street', async_exec: true)`
|
2358
|
-
|
2359
|
-
This example forces GUI updates via [async_exec](#async_exec) assuming they are coming from another thread (different from the GUI thread)
|
2360
|
-
|
2361
|
-
`text bind(contact, 'address.street', on_read: lambda { |s| s[0..10] })`
|
2439
|
+
`text <=> [contact, 'address.street', on_read: ->(s) { s[0..10] }]`
|
2362
2440
|
|
2363
2441
|
This example also specifies a converter on read of the model property, but via a lambda, which truncates the street to 10 characters only. Note that the read and write operations are assymetric. This is fine in the case of formatting data for a read-only widget like `label`
|
2364
2442
|
|
2365
2443
|
`text bind(contact, 'address.street') { |s| s[0..10] }`
|
2366
2444
|
|
2367
|
-
This is a block shortcut version of the syntax above it. It facilitates formatting model data for read-only widgets since it's a very common view concern. It also saves the developer from having to create a separate formatter/presenter for the model when the view can be an active view that handles common simple formatting operations directly.
|
2445
|
+
This is a block shortcut version of the syntax above it. It facilitates formatting model data for read-only widgets since it's a very common view concern. It also saves the developer from having to create a separate formatter/presenter for the model when the view can be an active view that handles common simple formatting operations directly (older style of data-binding, not recommended).
|
2368
2446
|
|
2369
|
-
`text
|
2447
|
+
`text <= [contact, 'address.street']`
|
2370
2448
|
|
2371
2449
|
This is read-ohly data-binding. It doesn't update contact.address.street when widget text property is changed.
|
2372
2450
|
|
2373
|
-
`text bind(contact, '
|
2451
|
+
`text bind(contact, 'address.street', read_only: true)`
|
2452
|
+
|
2453
|
+
This is read-ohly data-binding. It doesn't update contact.address.street when widget text property is changed (older style of data-binding, not recommended).
|
2454
|
+
|
2455
|
+
`text <=> [contact, 'addresses[1].street']`
|
2374
2456
|
|
2375
2457
|
This example binds the text property of a widget like `label` to the nested indexed address street of a contact. This is called nested indexed property data binding.
|
2376
2458
|
|
2377
|
-
`text
|
2459
|
+
`text <=> [contact, :age, computed_by: :date_of_birth]`
|
2378
2460
|
|
2379
2461
|
This example demonstrates computed value data binding whereby the value of `age` depends on changes to `date_of_birth`.
|
2380
2462
|
|
2381
|
-
`text
|
2463
|
+
`text <=> [contact, :name, computed_by: [:first_name, :last_name]]`
|
2382
2464
|
|
2383
2465
|
This example demonstrates computed value data binding whereby the value of `name` depends on changes to both `first_name` and `last_name`.
|
2384
2466
|
|
2385
|
-
`text
|
2467
|
+
`text <=> [contact, 'profiles[0].name', computed_by: ['profiles[0].first_name', 'profiles[0].last_name']]`
|
2386
2468
|
|
2387
2469
|
This example demonstrates nested indexed computed value data binding whereby the value of `profiles[0].name` depends on changes to both nested `profiles[0].first_name` and `profiles[0].last_name`.
|
2388
2470
|
|
2471
|
+
`text <=> [contact, 'address.street', sync_exec: true]`
|
2472
|
+
|
2473
|
+
This example forces GUI updates via [sync_exec](#sync_exec) assuming they are coming from another thread (different from the GUI thread)
|
2474
|
+
|
2475
|
+
`text <=> [contact, 'address.street', async_exec: true]`
|
2476
|
+
|
2477
|
+
This example forces GUI updates via [async_exec](#async_exec) assuming they are coming from another thread (different from the GUI thread)
|
2478
|
+
|
2389
2479
|
Example from [samples/hello/hello_combo.rb](samples/hello_combo.rb) sample (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
|
2390
2480
|
|
2391
2481
|
#### Shine
|
@@ -2714,7 +2804,7 @@ shell {
|
|
2714
2804
|
}
|
2715
2805
|
```
|
2716
2806
|
|
2717
|
-
Check out [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) for an actual example including table editors.
|
2807
|
+
Check out [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) for an actual example including table editors.
|
2718
2808
|
|
2719
2809
|
[Are We There Yet?](#are-we-there-yet) is an actual production Glimmer application that takes full advantage of table capabilities, storing model data in a database via ActiveRecord. As such, it's an excellent demonstration of how to use Glimmer DSL for SWT with a database.
|
2720
2810
|
|
@@ -2722,7 +2812,7 @@ Check out [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) for an actual example
|
|
2722
2812
|
|
2723
2813
|
Glimmer automatically adds sorting support to the SWT `Table` widget.
|
2724
2814
|
|
2725
|
-
Check out the [Contact Manager](GLIMMER_SAMPLES.md#contact-manager) sample for an example.
|
2815
|
+
Check out the [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager) sample for an example.
|
2726
2816
|
You may click on any column and it will sort by ascending order first and descending if you click again.
|
2727
2817
|
|
2728
2818
|
Glimmer automatic table sorting supports `String`, `Integer`, and `Float` columns out of the box as well as any column data that is comparable.
|
@@ -2821,7 +2911,7 @@ This finds the root node. The array is a Java array. This enables easy passing o
|
|
2821
2911
|
To edit a tree, you must invoke `TreeProxy#edit_selected_tree_item` or `TreeProxy#edit_tree_item`. This automatically leverages the SWT TreeEditor custom class behind the scenes, displaying
|
2822
2912
|
a text widget to the user to change the selected or passed tree item text into something else. It automatically persists the change to `items` data-bound model on ENTER/FOCUS-OUT or cancels on ESC/NO-CHANGE.
|
2823
2913
|
|
2824
|
-
Learn more at the [Hello, Tree!](GLIMMER_SAMPLES.md#hello-tree) and [Gladiator](GLIMMER_SAMPLES.md#gladiator) samples.
|
2914
|
+
Learn more at the [Hello, Tree!](/docs/reference/GLIMMER_SAMPLES.md#hello-tree) and [Gladiator](/docs/reference/GLIMMER_SAMPLES.md#gladiator) samples.
|
2825
2915
|
|
2826
2916
|
#### DateTime
|
2827
2917
|
|
@@ -2844,7 +2934,7 @@ You can data-bind any of these properties:
|
|
2844
2934
|
- `minutes bind(model, :property)`: produces an integer
|
2845
2935
|
- `seconds bind(model, :property)`: produces an integer
|
2846
2936
|
|
2847
|
-
Learn more at the [Hello, Date Time!](GLIMMER_SAMPLES.md#hello-date-time) sample.
|
2937
|
+
Learn more at the [Hello, Date Time!](/docs/reference/GLIMMER_SAMPLES.md#hello-date-time) sample.
|
2848
2938
|
|
2849
2939
|
If you need a better widget with the ability to customize the date format pattern, check out the [Nebula CDateTime Glimmer Custom Widget](https://github.com/AndyObtiva/glimmer-cw-cdatetime-nebula)
|
2850
2940
|
|
@@ -3032,7 +3122,7 @@ Approach #1 is a casual Ruby-based approach. Approach #2 is the official Glimmer
|
|
3032
3122
|
|
3033
3123
|
A developer might start with approach #1 to eliminate duplication in a view and later upgrade it to approach #2 when needing to export a custom widget to make it available in many views.
|
3034
3124
|
|
3035
|
-
Class-based Custom Widgets
|
3125
|
+
Class-based Custom Widgets offer a number of benefits over method-based custom widgets, such as built-in support for passing SWT style, nested block of extra widgets and properties, and `before_body`/`after_body` hooks.
|
3036
3126
|
|
3037
3127
|
#### Simple Example
|
3038
3128
|
|
@@ -3130,6 +3220,100 @@ Notice how `Red::Composite` became `red__composite` with double-underscore, whic
|
|
3130
3220
|
|
3131
3221
|
Keep in mind that namespaces are not needed to be specified if the Custom Widget class has a unique name, not clashing with a basic SWT widget or another custom widget name.
|
3132
3222
|
|
3223
|
+
#### Custom Widget Listeners
|
3224
|
+
|
3225
|
+
If you need to declare a custom listener on a custom widget, you must override these methods:
|
3226
|
+
- `can_handle_observation_request?(event, &block)`: returns if an event is supported or delegates to super otherwise (to ensure continued support for built-in events)
|
3227
|
+
- `handle_observation_request(event, &block)`: handles event by storing the block in a list of block handlers to invoke at the right time in the custom widget code
|
3228
|
+
|
3229
|
+
Example (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
|
3230
|
+
|
3231
|
+
```ruby
|
3232
|
+
require 'glimmer-dsl-swt'
|
3233
|
+
|
3234
|
+
# This class declares a `greeting_label` custom widget (by convention)
|
3235
|
+
class GreetingLabel
|
3236
|
+
include Glimmer::UI::CustomWidget
|
3237
|
+
|
3238
|
+
# multiple options without default values
|
3239
|
+
options :name, :colors
|
3240
|
+
|
3241
|
+
# single option with default value
|
3242
|
+
option :greeting, default: 'Hello'
|
3243
|
+
|
3244
|
+
# internal attribute (not a custom widget option)
|
3245
|
+
attr_accessor :label_color
|
3246
|
+
|
3247
|
+
def can_handle_observation_request?(event, &block)
|
3248
|
+
event.to_s == 'on_color_changed' || super
|
3249
|
+
end
|
3250
|
+
|
3251
|
+
def handle_observation_request(event, &block)
|
3252
|
+
if event.to_s == 'on_color_changed'
|
3253
|
+
@color_changed_handlers ||= []
|
3254
|
+
@color_changed_handlers << block
|
3255
|
+
else
|
3256
|
+
super
|
3257
|
+
end
|
3258
|
+
end
|
3259
|
+
|
3260
|
+
before_body do
|
3261
|
+
@font = {height: 24, style: :bold}
|
3262
|
+
@label_color = :black
|
3263
|
+
end
|
3264
|
+
|
3265
|
+
after_body do
|
3266
|
+
return if colors.nil?
|
3267
|
+
|
3268
|
+
Thread.new {
|
3269
|
+
colors.cycle { |color|
|
3270
|
+
self.label_color = color
|
3271
|
+
@color_changed_handlers&.each {|handler| handler.call(color)}
|
3272
|
+
sleep(1)
|
3273
|
+
}
|
3274
|
+
}
|
3275
|
+
end
|
3276
|
+
|
3277
|
+
body {
|
3278
|
+
# pass received swt_style through to label to customize (e.g. :center to center text)
|
3279
|
+
label(swt_style) {
|
3280
|
+
text "#{greeting}, #{name}!"
|
3281
|
+
font @font
|
3282
|
+
foreground <=> [self, :label_color]
|
3283
|
+
}
|
3284
|
+
}
|
3285
|
+
|
3286
|
+
end
|
3287
|
+
|
3288
|
+
# including Glimmer enables the Glimmer DSL syntax, including auto-discovery of the `greeting_label` custom widget
|
3289
|
+
include Glimmer
|
3290
|
+
|
3291
|
+
shell {
|
3292
|
+
fill_layout :vertical
|
3293
|
+
|
3294
|
+
minimum_size 215, 215
|
3295
|
+
text 'Hello, Custom Widget!'
|
3296
|
+
|
3297
|
+
# custom widget options are passed in a hash
|
3298
|
+
greeting_label(name: 'Sean')
|
3299
|
+
|
3300
|
+
# pass :center SWT style followed by custom widget options hash
|
3301
|
+
greeting_label(:center, name: 'Laura', greeting: 'Aloha') #
|
3302
|
+
|
3303
|
+
greeting_label(:right, name: 'Rick') {
|
3304
|
+
# you can nest attributes under custom widgets just like any standard widget
|
3305
|
+
foreground :red
|
3306
|
+
}
|
3307
|
+
|
3308
|
+
# the colors option cycles between colors for the label foreground every second
|
3309
|
+
greeting_label(:center, name: 'Mary', greeting: 'Aloha', colors: [:red, :dark_green, :blue]) {
|
3310
|
+
on_color_changed do |color|
|
3311
|
+
puts "Label color changed: #{color}"
|
3312
|
+
end
|
3313
|
+
}
|
3314
|
+
}.open
|
3315
|
+
```
|
3316
|
+
|
3133
3317
|
#### Custom Widget API
|
3134
3318
|
|
3135
3319
|
Custom Widgets have the following attributes available to call from inside the `#body` method:
|
@@ -3230,7 +3414,7 @@ The `checkboxes` property returns the list of nested `checkbox` widgets.
|
|
3230
3414
|
|
3231
3415
|
When data-binding `selection`, the model property should have a matching property with `_options` suffix (e.g. `activities_options` for `activities`) to provide an `Array` of `String` objects for `checkbox` buttons.
|
3232
3416
|
|
3233
|
-
You may see an example at the [Hello, Checkbox Group!](GLIMMER_SAMPLES.md#hello-checkbox-group) sample.
|
3417
|
+
You may see an example at the [Hello, Checkbox Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox-group) sample.
|
3234
3418
|
|
3235
3419
|
![Hello Checkbox Group](/images/glimmer-hello-checkbox-group.png)
|
3236
3420
|
|
@@ -3265,7 +3449,7 @@ radio_group { |radio_group_proxy|
|
|
3265
3449
|
# ...
|
3266
3450
|
```
|
3267
3451
|
|
3268
|
-
You may see another example at the [Hello, Radio Group!](GLIMMER_SAMPLES.md#hello-radio-group) sample.
|
3452
|
+
You may see another example at the [Hello, Radio Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-radio-group) sample.
|
3269
3453
|
|
3270
3454
|
##### Code Text Custom Widget
|
3271
3455
|
|
@@ -3529,7 +3713,7 @@ This adds some default keyboard shortcuts:
|
|
3529
3713
|
|
3530
3714
|
If you prefer it to be vanilla with no default key event listeners, then pass the `default_behavior: false` option.
|
3531
3715
|
|
3532
|
-
Learn more at [Hello, Code Text!](GLIMMER_SAMPLES.md#hello-code-text)
|
3716
|
+
Learn more at [Hello, Code Text!](/docs/reference/GLIMMER_SAMPLES.md#hello-code-text)
|
3533
3717
|
|
3534
3718
|
##### Video Custom Custom Widget
|
3535
3719
|
|
@@ -3544,7 +3728,7 @@ Simply install the [glimmer-cw-video](https://rubygems.org/gems/glimmer-cw-video
|
|
3544
3728
|
This [Eclipse guide](https://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm) for how to write custom SWT widgets is also applicable to Glimmer Custom Widgets written in Ruby. I recommend reading it:
|
3545
3729
|
[https://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm](https://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm)
|
3546
3730
|
|
3547
|
-
Also, you may check out [Hello, Custom Widget!](GLIMMER_SAMPLES.md#hello-custom-widget) for another example.
|
3731
|
+
Also, you may check out [Hello, Custom Widget!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-widget) for another example.
|
3548
3732
|
|
3549
3733
|
### Custom Shells
|
3550
3734
|
|
@@ -3615,7 +3799,7 @@ shell { |app_shell|
|
|
3615
3799
|
|
3616
3800
|
If you use a Custom Shell as the top-level app shell, you may invoke the class method `.launch` instead to avoid building an app class yourself or including Glimmer into the top-level namespace (e.g. `Tetris.launch` instead of `include Glimmer; tetris.open`)
|
3617
3801
|
|
3618
|
-
You may check out [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell) for another example.
|
3802
|
+
You may check out [Hello, Custom Shell!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shell) for another example.
|
3619
3803
|
|
3620
3804
|
### Drag and Drop
|
3621
3805
|
|
@@ -3641,7 +3825,7 @@ As a second option, you may customize the data being transferred through drag an
|
|
3641
3825
|
3. On the drop target widget, add `on_drop` [DropTargetListener](https://help.eclipse.org/2020-03/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/dnd/DropTargetListener.html) event handler block at minimum (you may also add `on_drag_enter` [must set [`event.detail`](https://help.eclipse.org/2020-06/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/dnd/DropTargetEvent.html#detail) if added], `on_drag_over`, `on_drag_leave`, `on_drag_operation_changed` and `on_drop_accept` if needed)
|
3642
3826
|
4. Read `event.data` and consume it (e.g. change widget text) inside the `on_drop` event handler block.
|
3643
3827
|
|
3644
|
-
Example (taken from [samples/hello/hello_drag_and_drop.rb](GLIMMER_SAMPLES.md#hello-drag-and-drop) / you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
|
3828
|
+
Example (taken from [samples/hello/hello_drag_and_drop.rb](/docs/reference/GLIMMER_SAMPLES.md#hello-drag-and-drop) / you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
|
3645
3829
|
|
3646
3830
|
```ruby
|
3647
3831
|
class Location
|
@@ -3954,25 +4138,6 @@ You may run `glimmer` with the `--profile.graph` instead for a more detailed out
|
|
3954
4138
|
|
3955
4139
|
Learn more at the [JRuby Performance Profile WIKI page](https://github.com/jruby/jruby/wiki/Profiling-JRuby).
|
3956
4140
|
|
3957
|
-
##### SWT Browser Style Options
|
3958
|
-
|
3959
|
-
The `browser` widget can use a particular desktop browser by setting the SWT Style to:
|
3960
|
-
- `:webkit`: use the Webkit browser engine
|
3961
|
-
- `:chromium`: use the Chromium browser engine
|
3962
|
-
|
3963
|
-
Example using the Chromium browser (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
|
3964
|
-
|
3965
|
-
```ruby
|
3966
|
-
shell {
|
3967
|
-
minimum_size 1024, 860
|
3968
|
-
browser(:chromium) {
|
3969
|
-
url 'http://brightonresort.com/about'
|
3970
|
-
}
|
3971
|
-
}.open
|
3972
|
-
```
|
3973
|
-
|
3974
|
-
This relies on Glimmer's [Multi-DSL Support](#multi-dsl-support) for building the HTML text using [Glimmer XML DSL](https://github.com/AndyObtiva/glimmer-dsl-xml).
|
3975
|
-
|
3976
4141
|
## License
|
3977
4142
|
|
3978
4143
|
[MIT](LICENSE.txt)
|