glimmer-dsl-swt 4.21.2.2 → 4.22.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/README.md +19 -13
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +179 -92
- data/docs/reference/GLIMMER_SAMPLES.md +13 -0
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/glimmer/data_binding/widget_binding.rb +2 -2
- data/lib/glimmer/dsl/swt/data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/sync_call_expression.rb +38 -0
- data/lib/glimmer/rake_task/package.rb +5 -3
- data/lib/glimmer/swt/custom/drawable.rb +4 -2
- data/lib/glimmer/swt/shell_proxy.rb +1 -1
- data/lib/glimmer/swt/widget_proxy.rb +9 -3
- data/lib/glimmer/ui/custom_widget.rb +4 -2
- data/samples/elaborate/battleship/view/cell.rb +10 -2
- data/samples/hello/hello_drag_and_drop.rb +1 -1
- 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 +7 -5
@@ -111,6 +111,7 @@ include Glimmer
|
|
111
111
|
|
112
112
|
shell {
|
113
113
|
text "Glimmer"
|
114
|
+
|
114
115
|
label {
|
115
116
|
text "Hello, World!"
|
116
117
|
}
|
@@ -131,6 +132,7 @@ class HelloWorld
|
|
131
132
|
# the following are GUI DSL keywords (shell, text, and label) used in the instance scope
|
132
133
|
shell {
|
133
134
|
text "Glimmer"
|
135
|
+
|
134
136
|
label {
|
135
137
|
text "Hello, World!"
|
136
138
|
foreground COLOR_FOREGROUND_DEFAULT
|
@@ -210,6 +212,7 @@ For example, if we were to revisit `samples/hello/hello_world.rb` above (you may
|
|
210
212
|
```ruby
|
211
213
|
shell {
|
212
214
|
text "Glimmer"
|
215
|
+
|
213
216
|
label {
|
214
217
|
text "Hello, World!"
|
215
218
|
}
|
@@ -223,6 +226,7 @@ Note that `shell` instantiates the outer shell **widget**, in other words, the w
|
|
223
226
|
```ruby
|
224
227
|
# ...
|
225
228
|
text "Glimmer" # text property of shell
|
229
|
+
|
226
230
|
label { # label widget declaration as content of shell
|
227
231
|
text "Hello, World!" # text property of label
|
228
232
|
}
|
@@ -268,15 +272,19 @@ Example from [hello_tab.rb](samples/hello/hello_tab.rb) sample (you may copy/pas
|
|
268
272
|
```ruby
|
269
273
|
shell {
|
270
274
|
text "Hello, Tab!"
|
275
|
+
|
271
276
|
tab_folder {
|
272
277
|
tab_item {
|
273
278
|
text "English"
|
279
|
+
|
274
280
|
label {
|
275
281
|
text "Hello, World!"
|
276
282
|
}
|
277
283
|
}
|
284
|
+
|
278
285
|
tab_item {
|
279
286
|
text "French"
|
287
|
+
|
280
288
|
label {
|
281
289
|
text "Bonjour Univers!"
|
282
290
|
}
|
@@ -294,63 +302,63 @@ If you are an advanced user of Glimmer DSL for SWT and need more widgets, check
|
|
294
302
|
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
303
|
|
296
304
|
**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)
|
305
|
+
- `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)
|
306
|
+
- `browser`: featured in [Hello, Browser!](/docs/reference/GLIMMER_SAMPLES.md#hello-browser)
|
307
|
+
- `calendar`: featured in [Hello, Date Time!](/docs/reference/GLIMMER_SAMPLES.md#hello-date-time)
|
308
|
+
- `checkbox`: featured in [Hello, Checkbox Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox-group) / [Hello, Checkbox!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox)
|
309
|
+
- `checkbox_group`: featured in [Hello, Checkbox Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox-group)
|
310
|
+
- `combo`: featured in [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Hello, Combo!](/docs/reference/GLIMMER_SAMPLES.md#hello-combo)
|
311
|
+
- `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)
|
312
|
+
- `cool_bar`: featured in [Hello, Cool Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-cool-bar)
|
313
|
+
- `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)
|
314
|
+
- `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)
|
315
|
+
- `group`: featured in [Hello, Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-group) / [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager)
|
316
|
+
- `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)
|
317
|
+
- `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)
|
318
|
+
- `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)
|
319
|
+
- `menu_bar`: featured in [Hello, Menu Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-menu-bar)
|
320
|
+
- `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)
|
321
|
+
- `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)
|
322
|
+
- `radio`: featured in [Hello, Radio!](/docs/reference/GLIMMER_SAMPLES.md#hello-radio) / [Hello, Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-group)
|
323
|
+
- `radio_group`: featured in [Hello, Radio Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-radio-group)
|
316
324
|
- `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)
|
325
|
+
- `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)
|
326
|
+
- `tab_folder`: featured in [Hello, Tab!](/docs/reference/GLIMMER_SAMPLES.md#hello-tab)
|
327
|
+
- `tab_item`: featured in [Hello, Tab!](/docs/reference/GLIMMER_SAMPLES.md#hello-tab)
|
328
|
+
- `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)
|
329
|
+
- `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)
|
330
|
+
- `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)
|
331
|
+
- `time`: featured in [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Hello, Date Time!](/docs/reference/GLIMMER_SAMPLES.md#hello-date-time)
|
324
332
|
- `tool_bar`: featured in [Hello, Tool Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-tool-bar)
|
325
333
|
- `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)
|
334
|
+
- 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)
|
335
|
+
- 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
336
|
|
329
337
|
**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)
|
338
|
+
- `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)
|
339
|
+
- `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)
|
340
|
+
- `fill_layout`: featured in [Hello, Layout!](/docs/reference/GLIMMER_SAMPLES.md#hello-layout) / [Hello, Custom Widget!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-widget)
|
341
|
+
- `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
342
|
|
335
343
|
**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)
|
344
|
+
- `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)
|
345
|
+
- `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
346
|
- `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)
|
347
|
+
- `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
348
|
|
341
349
|
**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)
|
350
|
+
- `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)
|
351
|
+
- `observe`: featured in [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Tic Tac Toe](/docs/reference/GLIMMER_SAMPLES.md#tic-tac-toe)
|
352
|
+
- `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
353
|
- `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)
|
354
|
+
- `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
355
|
- `on_key_released` (and SWT alias `on_swt_keyup`)
|
348
356
|
- `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)
|
357
|
+
- `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
358
|
|
351
359
|
**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)
|
360
|
+
- `display`: featured in [Tic Tac Toe](/docs/reference/GLIMMER_SAMPLES.md#tic-tac-toe)
|
361
|
+
- `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
362
|
- `sync_exec`: executes a block on the event loop synchronously (usually from another thread)
|
355
363
|
- `timer_exec`: executes a block after a delay of time has passed
|
356
364
|
- `auto_exec`: executes a block on the event loop synchronously only when needed (when running from a thread other than GUI thread)
|
@@ -400,12 +408,14 @@ Example (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
|
|
400
408
|
@shell = shell {
|
401
409
|
text "Application"
|
402
410
|
row_layout
|
411
|
+
|
403
412
|
@label1 = label {
|
404
413
|
text "Hello,"
|
405
414
|
}
|
406
415
|
}
|
407
416
|
@shell.content {
|
408
417
|
minimum_size 130, 130
|
418
|
+
|
409
419
|
label {
|
410
420
|
text "World!"
|
411
421
|
}
|
@@ -448,7 +458,7 @@ Dialog is a variation on Shell. It is basically a shell that is modal (blocks wh
|
|
448
458
|
|
449
459
|
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
460
|
|
451
|
-
Check out [Hello, Dialog!](GLIMMER_SAMPLES.md#hello-dialog) sample to learn more.
|
461
|
+
Check out [Hello, Dialog!](/docs/reference/GLIMMER_SAMPLES.md#hello-dialog) sample to learn more.
|
452
462
|
|
453
463
|
##### message_box
|
454
464
|
|
@@ -461,8 +471,10 @@ include Glimmer
|
|
461
471
|
|
462
472
|
@shell = shell {
|
463
473
|
text 'Hello, Message Box!'
|
474
|
+
|
464
475
|
button {
|
465
476
|
text 'Please Click To Win a Surprise'
|
477
|
+
|
466
478
|
on_widget_selected do
|
467
479
|
message_box(@shell) {
|
468
480
|
text 'Surprise'
|
@@ -502,6 +514,7 @@ automatically uses the `display` created earlier without having to explicitly ho
|
|
502
514
|
```ruby
|
503
515
|
@display = display {
|
504
516
|
cursor_location 300, 300
|
517
|
+
|
505
518
|
on_swt_keydown do
|
506
519
|
# ...
|
507
520
|
end
|
@@ -519,7 +532,7 @@ Although SWT Display is not technically a widget, it has similar APIs and DSL su
|
|
519
532
|
|
520
533
|
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
534
|
|
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).
|
535
|
+
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
536
|
|
524
537
|
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
538
|
Glimmer automatically detects if you're running in a different thread and uses `Display.syncExec` automatically using its own enhanced `auto_exec`
|
@@ -535,21 +548,22 @@ Example (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
|
|
535
548
|
```
|
536
549
|
@shell = shell {
|
537
550
|
text 'Glimmer'
|
551
|
+
|
538
552
|
@label = label {
|
539
553
|
text 'Hello, World!'
|
540
554
|
}
|
541
555
|
}
|
542
556
|
|
543
|
-
Thread.new
|
544
|
-
[:red, :dark_green, :blue].cycle
|
545
|
-
async_exec
|
557
|
+
Thread.new do
|
558
|
+
[:red, :dark_green, :blue].cycle do |color|
|
559
|
+
async_exec do
|
546
560
|
@label.content {
|
547
561
|
foreground color if @shell.visible?
|
548
562
|
}
|
549
|
-
|
563
|
+
end
|
550
564
|
sleep(1)
|
551
|
-
|
552
|
-
|
565
|
+
end
|
566
|
+
end
|
553
567
|
|
554
568
|
@shell.open
|
555
569
|
```
|
@@ -558,6 +572,10 @@ Thread.new {
|
|
558
572
|
|
559
573
|
`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
574
|
|
575
|
+
##### sync_call
|
576
|
+
|
577
|
+
`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.
|
578
|
+
|
561
579
|
##### auto_exec
|
562
580
|
|
563
581
|
`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 +645,10 @@ shell {
|
|
627
645
|
}
|
628
646
|
menu {
|
629
647
|
text 'Open &Recent'
|
648
|
+
|
630
649
|
menu_item {
|
631
650
|
text 'File 1'
|
651
|
+
|
632
652
|
on_widget_selected do
|
633
653
|
message_box {
|
634
654
|
text 'File 1'
|
@@ -636,8 +656,10 @@ shell {
|
|
636
656
|
}.open
|
637
657
|
end
|
638
658
|
}
|
659
|
+
|
639
660
|
menu_item {
|
640
661
|
text 'File 2'
|
662
|
+
|
641
663
|
on_widget_selected do
|
642
664
|
message_box {
|
643
665
|
text 'File 2'
|
@@ -646,7 +668,9 @@ shell {
|
|
646
668
|
end
|
647
669
|
}
|
648
670
|
}
|
671
|
+
|
649
672
|
menu_item(:separator)
|
673
|
+
|
650
674
|
menu_item {
|
651
675
|
text 'E&xit'
|
652
676
|
|
@@ -657,19 +681,23 @@ shell {
|
|
657
681
|
}
|
658
682
|
menu {
|
659
683
|
text '&Edit'
|
684
|
+
|
660
685
|
menu_item {
|
661
686
|
text 'Cut'
|
662
687
|
accelerator :command, :X
|
663
688
|
}
|
689
|
+
|
664
690
|
menu_item {
|
665
691
|
text 'Copy'
|
666
692
|
accelerator :command, :C
|
667
693
|
}
|
694
|
+
|
668
695
|
menu_item {
|
669
696
|
text 'Paste'
|
670
697
|
accelerator :command, :V
|
671
698
|
}
|
672
699
|
}
|
700
|
+
|
673
701
|
menu {
|
674
702
|
text '&Options'
|
675
703
|
|
@@ -681,6 +709,7 @@ shell {
|
|
681
709
|
@select_multiple_menu.enabled = true
|
682
710
|
end
|
683
711
|
}
|
712
|
+
|
684
713
|
@select_one_menu = menu {
|
685
714
|
text '&Select One'
|
686
715
|
enabled false
|
@@ -688,13 +717,16 @@ shell {
|
|
688
717
|
menu_item(:radio) {
|
689
718
|
text 'Option 1'
|
690
719
|
}
|
720
|
+
|
691
721
|
menu_item(:radio) {
|
692
722
|
text 'Option 2'
|
693
723
|
}
|
724
|
+
|
694
725
|
menu_item(:radio) {
|
695
726
|
text 'Option 3'
|
696
727
|
}
|
697
728
|
}
|
729
|
+
|
698
730
|
@select_multiple_menu = menu {
|
699
731
|
text '&Select Multiple'
|
700
732
|
enabled false
|
@@ -702,18 +734,23 @@ shell {
|
|
702
734
|
menu_item(:check) {
|
703
735
|
text 'Option 4'
|
704
736
|
}
|
737
|
+
|
705
738
|
menu_item(:check) {
|
706
739
|
text 'Option 5'
|
707
740
|
}
|
741
|
+
|
708
742
|
menu_item(:check) {
|
709
743
|
text 'Option 6'
|
710
744
|
}
|
711
745
|
}
|
712
746
|
}
|
747
|
+
|
713
748
|
menu {
|
714
749
|
text '&Format'
|
750
|
+
|
715
751
|
menu {
|
716
752
|
text '&Background Color'
|
753
|
+
|
717
754
|
COLORS.each { |color_style|
|
718
755
|
menu_item(:radio) {
|
719
756
|
text color_style.to_s.split('_').map(&:capitalize).join(' ')
|
@@ -724,8 +761,10 @@ shell {
|
|
724
761
|
}
|
725
762
|
}
|
726
763
|
}
|
764
|
+
|
727
765
|
menu {
|
728
766
|
text 'Foreground &Color'
|
767
|
+
|
729
768
|
COLORS.each { |color_style|
|
730
769
|
menu_item(:radio) {
|
731
770
|
text color_style.to_s.split('_').map(&:capitalize).join(' ')
|
@@ -737,8 +776,10 @@ shell {
|
|
737
776
|
}
|
738
777
|
}
|
739
778
|
}
|
779
|
+
|
740
780
|
menu {
|
741
781
|
text '&View'
|
782
|
+
|
742
783
|
menu_item(:radio) {
|
743
784
|
text 'Small'
|
744
785
|
|
@@ -747,6 +788,7 @@ shell {
|
|
747
788
|
@label.parent.pack
|
748
789
|
end
|
749
790
|
}
|
791
|
+
|
750
792
|
menu_item(:radio) {
|
751
793
|
text 'Medium'
|
752
794
|
selection true
|
@@ -756,6 +798,7 @@ shell {
|
|
756
798
|
@label.parent.pack
|
757
799
|
end
|
758
800
|
}
|
801
|
+
|
759
802
|
menu_item(:radio) {
|
760
803
|
text 'Large'
|
761
804
|
|
@@ -765,8 +808,10 @@ shell {
|
|
765
808
|
end
|
766
809
|
}
|
767
810
|
}
|
811
|
+
|
768
812
|
menu {
|
769
813
|
text '&Help'
|
814
|
+
|
770
815
|
menu_item {
|
771
816
|
text '&Manual'
|
772
817
|
accelerator :command, :shift, :M
|
@@ -778,6 +823,7 @@ shell {
|
|
778
823
|
}.open
|
779
824
|
end
|
780
825
|
}
|
826
|
+
|
781
827
|
menu_item {
|
782
828
|
text '&Tutorial'
|
783
829
|
accelerator :command, :shift, :T
|
@@ -789,7 +835,9 @@ shell {
|
|
789
835
|
}.open
|
790
836
|
end
|
791
837
|
}
|
838
|
+
|
792
839
|
menu_item(:separator)
|
840
|
+
|
793
841
|
menu_item {
|
794
842
|
text '&Report an Issue...'
|
795
843
|
|
@@ -825,10 +873,13 @@ shell {
|
|
825
873
|
menu {
|
826
874
|
menu {
|
827
875
|
text '&History'
|
876
|
+
|
828
877
|
menu {
|
829
878
|
text '&Recent'
|
879
|
+
|
830
880
|
menu_item {
|
831
881
|
text 'File 1'
|
882
|
+
|
832
883
|
on_widget_selected do
|
833
884
|
message_box {
|
834
885
|
text 'File 1'
|
@@ -836,8 +887,10 @@ shell {
|
|
836
887
|
}.open
|
837
888
|
end
|
838
889
|
}
|
890
|
+
|
839
891
|
menu_item {
|
840
892
|
text 'File 2'
|
893
|
+
|
841
894
|
on_widget_selected do
|
842
895
|
message_box {
|
843
896
|
text 'File 2'
|
@@ -846,10 +899,13 @@ shell {
|
|
846
899
|
end
|
847
900
|
}
|
848
901
|
}
|
902
|
+
|
849
903
|
menu {
|
850
904
|
text '&Archived'
|
905
|
+
|
851
906
|
menu_item {
|
852
907
|
text 'File 3'
|
908
|
+
|
853
909
|
on_widget_selected do
|
854
910
|
message_box {
|
855
911
|
text 'File 3'
|
@@ -857,8 +913,10 @@ shell {
|
|
857
913
|
}.open
|
858
914
|
end
|
859
915
|
}
|
916
|
+
|
860
917
|
menu_item {
|
861
918
|
text 'File 4'
|
919
|
+
|
862
920
|
on_widget_selected do
|
863
921
|
message_box {
|
864
922
|
text 'File 4'
|
@@ -1006,7 +1064,7 @@ shell {
|
|
1006
1064
|
}.open
|
1007
1065
|
```
|
1008
1066
|
|
1009
|
-
You may check out a more full-fledged example in [Hello, Sash Form!](GLIMMER_SAMPLES.md#hello-sash-form)
|
1067
|
+
You may check out a more full-fledged example in [Hello, Sash Form!](/docs/reference/GLIMMER_SAMPLES.md#hello-sash-form)
|
1010
1068
|
|
1011
1069
|
![Hello Sash Form](/images/glimmer-hello-sash-form.png)
|
1012
1070
|
|
@@ -1321,12 +1379,16 @@ This sets the shell `cursor` to that of `SWT::CURSOR_APPSTARTING`
|
|
1321
1379
|
|
1322
1380
|
### Layouts
|
1323
1381
|
|
1324
|
-
Glimmer lays widgets out visually using SWT layouts, which can only be set on composite widget and subclasses.
|
1382
|
+
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
1383
|
|
1326
1384
|
The most common SWT layouts are:
|
1327
|
-
- `FillLayout
|
1328
|
-
- `RowLayout
|
1329
|
-
- `GridLayout
|
1385
|
+
- [`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.
|
1386
|
+
- [`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
|
1387
|
+
- [`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.
|
1388
|
+
|
1389
|
+
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.
|
1390
|
+
|
1391
|
+
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
1392
|
|
1331
1393
|
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
1394
|
|
@@ -1483,6 +1545,23 @@ composite {
|
|
1483
1545
|
# ...
|
1484
1546
|
```
|
1485
1547
|
|
1548
|
+
```ruby
|
1549
|
+
# ...
|
1550
|
+
composite {
|
1551
|
+
grid_layout 3, false # grid layout with 3 columns not of equal width
|
1552
|
+
label {
|
1553
|
+
# layout data with explicit setting of properties instead of relying on arguments
|
1554
|
+
layout_data {
|
1555
|
+
horizontal_alignment :fill # could be :beginning, :center or :end too
|
1556
|
+
vertical_alignment :center # could be :beginning, :fill, or :end too
|
1557
|
+
grab_excess_horizontal_space true
|
1558
|
+
grab_excess_vertical_space false
|
1559
|
+
}
|
1560
|
+
}
|
1561
|
+
}
|
1562
|
+
# ...
|
1563
|
+
```
|
1564
|
+
|
1486
1565
|
```ruby
|
1487
1566
|
# ...
|
1488
1567
|
composite {
|
@@ -1708,7 +1787,7 @@ shell {
|
|
1708
1787
|
}.open
|
1709
1788
|
```
|
1710
1789
|
|
1711
|
-
Learn more at the [Hello, Canvas! Sample](GLIMMER_SAMPLES.md#hello-canvas).
|
1790
|
+
Learn more at the [Hello, Canvas! Sample](/docs/reference/GLIMMER_SAMPLES.md#hello-canvas).
|
1712
1791
|
|
1713
1792
|
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
1793
|
|
@@ -1767,7 +1846,7 @@ If you specify the `width` and `height` parameters as `:max`, they get calculate
|
|
1767
1846
|
|
1768
1847
|
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
1848
|
|
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:
|
1849
|
+
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
1850
|
|
1772
1851
|
```ruby
|
1773
1852
|
rectangle(205, 50, 88, 96) {
|
@@ -1789,7 +1868,7 @@ Check [Hello, Canvas!](GLIMMER_SAMPLES.md#hello-canvas) for an example that nest
|
|
1789
1868
|
|
1790
1869
|
#### Shapes inside a Widget
|
1791
1870
|
|
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`.
|
1871
|
+
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
1872
|
|
1794
1873
|
#### Shapes inside an Image
|
1795
1874
|
|
@@ -1939,7 +2018,7 @@ They are implemented with the help of the highly robust Java built-in shape geom
|
|
1939
2018
|
- `Shape#x_end` : right-most included x coordinate
|
1940
2019
|
- `Shape#y_end` : bottom-most included y coordinate
|
1941
2020
|
|
1942
|
-
Check [Hello, Canvas!](GLIMMER_SAMPLES.md#hello-canvas) for an example.
|
2021
|
+
Check [Hello, Canvas!](/docs/reference/GLIMMER_SAMPLES.md#hello-canvas) for an example.
|
1943
2022
|
|
1944
2023
|
|
1945
2024
|
#### Pixel Graphics
|
@@ -2157,7 +2236,7 @@ shell {
|
|
2157
2236
|
|
2158
2237
|
![Canvas Path Example](/images/glimmer-example-canvas-path.png)
|
2159
2238
|
|
2160
|
-
Learn more at the [Hello, Canvas Path!](GLIMMER_SAMPLES.md#hello-canvas-path) and [Stock Ticker](GLIMMER_SAMPLES.md#stock-ticker) samples.
|
2239
|
+
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
2240
|
|
2162
2241
|
![Stock Ticker](/images/glimmer-stock-ticker.gif)
|
2163
2242
|
|
@@ -2252,7 +2331,7 @@ transform(1, 1, 4, 2, 2, 4).
|
|
2252
2331
|
translate(3, 7)
|
2253
2332
|
```
|
2254
2333
|
|
2255
|
-
Learn more at the [Hello, Canvas Transform! Sample](GLIMMER_SAMPLES.md#hello-canvas-transform).
|
2334
|
+
Learn more at the [Hello, Canvas Transform! Sample](/docs/reference/GLIMMER_SAMPLES.md#hello-canvas-transform).
|
2256
2335
|
|
2257
2336
|
### Canvas Animation DSL
|
2258
2337
|
|
@@ -2321,7 +2400,7 @@ API of Animation Object (returned from `animation` keyword):
|
|
2321
2400
|
- `#cycle_limited?` returns true if `cycle_count` is specified
|
2322
2401
|
- `#duration_limited?` returns true if `duration_limit` is specified
|
2323
2402
|
|
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.
|
2403
|
+
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
2404
|
|
2326
2405
|
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
2406
|
|
@@ -2329,63 +2408,71 @@ If there is anything missing you would like added to the Glimmer Animation DSL t
|
|
2329
2408
|
|
2330
2409
|
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
2410
|
|
2332
|
-
The [Glimmer Tetris](GLIMMER_SAMPLES.md#tetris) sample provides a good example of that.
|
2411
|
+
The [Glimmer Tetris](/docs/reference/GLIMMER_SAMPLES.md#tetris) sample provides a good example of that.
|
2333
2412
|
|
2334
2413
|
### Data-Binding
|
2335
2414
|
|
2336
|
-
Data-binding is done with `bind`
|
2415
|
+
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
2416
|
|
2338
2417
|
#### General Examples
|
2339
2418
|
|
2419
|
+
`text <=> [contact, :first_name]`
|
2420
|
+
|
2421
|
+
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).
|
2422
|
+
|
2340
2423
|
`text bind(contact, :first_name)`
|
2341
2424
|
|
2342
|
-
This example binds the text property of a widget like `label` to the first name of a contact model.
|
2425
|
+
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
2426
|
|
2344
|
-
`text
|
2427
|
+
`text <=> [contact, 'address.street']`
|
2345
2428
|
|
2346
2429
|
This example binds the text property of a widget like `label` to the nested street of
|
2347
2430
|
the address of a contact. This is called nested property data binding.
|
2348
2431
|
|
2349
|
-
`text
|
2432
|
+
`text <=> [contact, 'address.street', on_read: :upcase, on_write: :downcase]`
|
2350
2433
|
|
2351
2434
|
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
2435
|
|
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] })`
|
2436
|
+
`text <=> [contact, 'address.street', on_read: ->(s) { s[0..10] }]`
|
2362
2437
|
|
2363
2438
|
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
2439
|
|
2365
2440
|
`text bind(contact, 'address.street') { |s| s[0..10] }`
|
2366
2441
|
|
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.
|
2442
|
+
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
2443
|
|
2369
|
-
`text
|
2444
|
+
`text <= [contact, 'address.street']`
|
2370
2445
|
|
2371
2446
|
This is read-ohly data-binding. It doesn't update contact.address.street when widget text property is changed.
|
2372
2447
|
|
2373
|
-
`text bind(contact, '
|
2448
|
+
`text bind(contact, 'address.street', read_only: true)`
|
2449
|
+
|
2450
|
+
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).
|
2451
|
+
|
2452
|
+
`text <=> [contact, 'addresses[1].street']`
|
2374
2453
|
|
2375
2454
|
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
2455
|
|
2377
|
-
`text
|
2456
|
+
`text <=> [contact, :age, computed_by: :date_of_birth]`
|
2378
2457
|
|
2379
2458
|
This example demonstrates computed value data binding whereby the value of `age` depends on changes to `date_of_birth`.
|
2380
2459
|
|
2381
|
-
`text
|
2460
|
+
`text <=> [contact, :name, computed_by: [:first_name, :last_name]]`
|
2382
2461
|
|
2383
2462
|
This example demonstrates computed value data binding whereby the value of `name` depends on changes to both `first_name` and `last_name`.
|
2384
2463
|
|
2385
|
-
`text
|
2464
|
+
`text <=> [contact, 'profiles[0].name', computed_by: ['profiles[0].first_name', 'profiles[0].last_name']]`
|
2386
2465
|
|
2387
2466
|
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
2467
|
|
2468
|
+
`text <=> [contact, 'address.street', sync_exec: true]`
|
2469
|
+
|
2470
|
+
This example forces GUI updates via [sync_exec](#sync_exec) assuming they are coming from another thread (different from the GUI thread)
|
2471
|
+
|
2472
|
+
`text <=> [contact, 'address.street', async_exec: true]`
|
2473
|
+
|
2474
|
+
This example forces GUI updates via [async_exec](#async_exec) assuming they are coming from another thread (different from the GUI thread)
|
2475
|
+
|
2389
2476
|
Example from [samples/hello/hello_combo.rb](samples/hello_combo.rb) sample (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
|
2390
2477
|
|
2391
2478
|
#### Shine
|
@@ -2714,7 +2801,7 @@ shell {
|
|
2714
2801
|
}
|
2715
2802
|
```
|
2716
2803
|
|
2717
|
-
Check out [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) for an actual example including table editors.
|
2804
|
+
Check out [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) for an actual example including table editors.
|
2718
2805
|
|
2719
2806
|
[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
2807
|
|
@@ -2722,7 +2809,7 @@ Check out [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) for an actual example
|
|
2722
2809
|
|
2723
2810
|
Glimmer automatically adds sorting support to the SWT `Table` widget.
|
2724
2811
|
|
2725
|
-
Check out the [Contact Manager](GLIMMER_SAMPLES.md#contact-manager) sample for an example.
|
2812
|
+
Check out the [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager) sample for an example.
|
2726
2813
|
You may click on any column and it will sort by ascending order first and descending if you click again.
|
2727
2814
|
|
2728
2815
|
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 +2908,7 @@ This finds the root node. The array is a Java array. This enables easy passing o
|
|
2821
2908
|
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
2909
|
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
2910
|
|
2824
|
-
Learn more at the [Hello, Tree!](GLIMMER_SAMPLES.md#hello-tree) and [Gladiator](GLIMMER_SAMPLES.md#gladiator) samples.
|
2911
|
+
Learn more at the [Hello, Tree!](/docs/reference/GLIMMER_SAMPLES.md#hello-tree) and [Gladiator](/docs/reference/GLIMMER_SAMPLES.md#gladiator) samples.
|
2825
2912
|
|
2826
2913
|
#### DateTime
|
2827
2914
|
|
@@ -2844,7 +2931,7 @@ You can data-bind any of these properties:
|
|
2844
2931
|
- `minutes bind(model, :property)`: produces an integer
|
2845
2932
|
- `seconds bind(model, :property)`: produces an integer
|
2846
2933
|
|
2847
|
-
Learn more at the [Hello, Date Time!](GLIMMER_SAMPLES.md#hello-date-time) sample.
|
2934
|
+
Learn more at the [Hello, Date Time!](/docs/reference/GLIMMER_SAMPLES.md#hello-date-time) sample.
|
2848
2935
|
|
2849
2936
|
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
2937
|
|
@@ -3230,7 +3317,7 @@ The `checkboxes` property returns the list of nested `checkbox` widgets.
|
|
3230
3317
|
|
3231
3318
|
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
3319
|
|
3233
|
-
You may see an example at the [Hello, Checkbox Group!](GLIMMER_SAMPLES.md#hello-checkbox-group) sample.
|
3320
|
+
You may see an example at the [Hello, Checkbox Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-checkbox-group) sample.
|
3234
3321
|
|
3235
3322
|
![Hello Checkbox Group](/images/glimmer-hello-checkbox-group.png)
|
3236
3323
|
|
@@ -3265,7 +3352,7 @@ radio_group { |radio_group_proxy|
|
|
3265
3352
|
# ...
|
3266
3353
|
```
|
3267
3354
|
|
3268
|
-
You may see another example at the [Hello, Radio Group!](GLIMMER_SAMPLES.md#hello-radio-group) sample.
|
3355
|
+
You may see another example at the [Hello, Radio Group!](/docs/reference/GLIMMER_SAMPLES.md#hello-radio-group) sample.
|
3269
3356
|
|
3270
3357
|
##### Code Text Custom Widget
|
3271
3358
|
|
@@ -3529,7 +3616,7 @@ This adds some default keyboard shortcuts:
|
|
3529
3616
|
|
3530
3617
|
If you prefer it to be vanilla with no default key event listeners, then pass the `default_behavior: false` option.
|
3531
3618
|
|
3532
|
-
Learn more at [Hello, Code Text!](GLIMMER_SAMPLES.md#hello-code-text)
|
3619
|
+
Learn more at [Hello, Code Text!](/docs/reference/GLIMMER_SAMPLES.md#hello-code-text)
|
3533
3620
|
|
3534
3621
|
##### Video Custom Custom Widget
|
3535
3622
|
|
@@ -3544,7 +3631,7 @@ Simply install the [glimmer-cw-video](https://rubygems.org/gems/glimmer-cw-video
|
|
3544
3631
|
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
3632
|
[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
3633
|
|
3547
|
-
Also, you may check out [Hello, Custom Widget!](GLIMMER_SAMPLES.md#hello-custom-widget) for another example.
|
3634
|
+
Also, you may check out [Hello, Custom Widget!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-widget) for another example.
|
3548
3635
|
|
3549
3636
|
### Custom Shells
|
3550
3637
|
|
@@ -3615,7 +3702,7 @@ shell { |app_shell|
|
|
3615
3702
|
|
3616
3703
|
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
3704
|
|
3618
|
-
You may check out [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell) for another example.
|
3705
|
+
You may check out [Hello, Custom Shell!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shell) for another example.
|
3619
3706
|
|
3620
3707
|
### Drag and Drop
|
3621
3708
|
|
@@ -3641,7 +3728,7 @@ As a second option, you may customize the data being transferred through drag an
|
|
3641
3728
|
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
3729
|
4. Read `event.data` and consume it (e.g. change widget text) inside the `on_drop` event handler block.
|
3643
3730
|
|
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)):
|
3731
|
+
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
3732
|
|
3646
3733
|
```ruby
|
3647
3734
|
class Location
|