glimmer-dsl-swt 4.17.10.8 → 4.18.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +52 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.md +529 -60
  5. data/RUBY_VERSION +1 -1
  6. data/VERSION +1 -1
  7. data/bin/girb +1 -1
  8. data/bin/girb_runner.rb +1 -1
  9. data/bin/glimmer +1 -1
  10. data/glimmer-dsl-swt.gemspec +58 -30
  11. data/lib/ext/glimmer.rb +1 -1
  12. data/lib/ext/glimmer/config.rb +7 -7
  13. data/lib/glimmer-dsl-swt.rb +3 -1
  14. data/lib/glimmer/Rakefile +1 -1
  15. data/lib/glimmer/data_binding/list_selection_binding.rb +1 -1
  16. data/lib/glimmer/data_binding/observable_widget.rb +1 -1
  17. data/lib/glimmer/data_binding/shine.rb +1 -1
  18. data/lib/glimmer/data_binding/table_items_binding.rb +1 -1
  19. data/lib/glimmer/data_binding/tree_items_binding.rb +1 -1
  20. data/lib/glimmer/data_binding/widget_binding.rb +1 -1
  21. data/lib/glimmer/dsl/swt/animation_expression.rb +43 -0
  22. data/lib/glimmer/dsl/swt/async_exec_expression.rb +1 -1
  23. data/lib/glimmer/dsl/swt/bind_expression.rb +1 -1
  24. data/lib/glimmer/dsl/swt/block_property_expression.rb +1 -1
  25. data/lib/glimmer/dsl/swt/checkbox_group_selection_data_binding_expression.rb +1 -1
  26. data/lib/glimmer/dsl/swt/color_expression.rb +1 -1
  27. data/lib/glimmer/dsl/swt/column_properties_expression.rb +1 -1
  28. data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +1 -1
  29. data/lib/glimmer/dsl/swt/cursor_expression.rb +1 -1
  30. data/lib/glimmer/dsl/swt/custom_widget_expression.rb +1 -1
  31. data/lib/glimmer/dsl/swt/data_binding_expression.rb +1 -1
  32. data/lib/glimmer/dsl/swt/dialog_expression.rb +1 -1
  33. data/lib/glimmer/dsl/swt/directory_dialog_expression.rb +1 -1
  34. data/lib/glimmer/dsl/swt/display_expression.rb +1 -1
  35. data/lib/glimmer/dsl/swt/dnd_expression.rb +1 -1
  36. data/lib/glimmer/dsl/swt/dsl.rb +5 -4
  37. data/lib/glimmer/dsl/swt/exec_expression.rb +5 -5
  38. data/lib/glimmer/dsl/swt/expand_item_expression.rb +1 -1
  39. data/lib/glimmer/dsl/swt/file_dialog_expression.rb +1 -1
  40. data/lib/glimmer/dsl/swt/font_expression.rb +8 -6
  41. data/lib/glimmer/dsl/swt/image_expression.rb +1 -1
  42. data/lib/glimmer/dsl/swt/layout_data_expression.rb +1 -1
  43. data/lib/glimmer/dsl/swt/layout_expression.rb +1 -1
  44. data/lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb +1 -1
  45. data/lib/glimmer/dsl/swt/menu_bar_expression.rb +1 -1
  46. data/lib/glimmer/dsl/swt/menu_expression.rb +1 -1
  47. data/lib/glimmer/dsl/swt/message_box_expression.rb +1 -1
  48. data/lib/glimmer/dsl/swt/observe_expression.rb +1 -1
  49. data/lib/glimmer/dsl/swt/property_expression.rb +4 -4
  50. data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +1 -1
  51. data/lib/glimmer/dsl/swt/rgb_expression.rb +1 -1
  52. data/lib/glimmer/dsl/swt/rgba_expression.rb +1 -1
  53. data/lib/glimmer/dsl/swt/shape_expression.rb +56 -0
  54. data/lib/glimmer/dsl/swt/shell_expression.rb +1 -1
  55. data/lib/glimmer/dsl/swt/swt_expression.rb +1 -1
  56. data/lib/glimmer/dsl/swt/sync_exec_expression.rb +1 -1
  57. data/lib/glimmer/dsl/swt/tab_item_expression.rb +1 -1
  58. data/lib/glimmer/dsl/swt/table_items_data_binding_expression.rb +1 -1
  59. data/lib/glimmer/dsl/swt/tree_items_data_binding_expression.rb +1 -1
  60. data/lib/glimmer/dsl/swt/tree_properties_expression.rb +1 -1
  61. data/lib/glimmer/dsl/swt/widget_expression.rb +7 -3
  62. data/lib/glimmer/dsl/swt/widget_listener_expression.rb +1 -1
  63. data/lib/glimmer/launcher.rb +1 -1
  64. data/lib/glimmer/rake_task.rb +1 -1
  65. data/lib/glimmer/rake_task/list.rb +6 -6
  66. data/lib/glimmer/rake_task/package.rb +1 -1
  67. data/lib/glimmer/rake_task/scaffold.rb +33 -34
  68. data/lib/glimmer/swt/color_proxy.rb +1 -1
  69. data/lib/glimmer/swt/cursor_proxy.rb +1 -1
  70. data/lib/glimmer/swt/custom/animation.rb +120 -0
  71. data/lib/glimmer/swt/custom/checkbox_group.rb +1 -1
  72. data/lib/glimmer/swt/custom/drawable.rb +43 -0
  73. data/lib/glimmer/swt/custom/radio_group.rb +1 -1
  74. data/lib/glimmer/swt/custom/shape.rb +154 -0
  75. data/lib/glimmer/swt/date_time_proxy.rb +1 -1
  76. data/lib/glimmer/swt/directory_dialog_proxy.rb +1 -1
  77. data/lib/glimmer/swt/display_proxy.rb +17 -1
  78. data/lib/glimmer/swt/dnd_proxy.rb +1 -1
  79. data/lib/glimmer/swt/expand_item_proxy.rb +1 -1
  80. data/lib/glimmer/swt/file_dialog_proxy.rb +1 -1
  81. data/lib/glimmer/swt/font_proxy.rb +4 -4
  82. data/lib/glimmer/swt/image_proxy.rb +12 -11
  83. data/lib/glimmer/swt/layout_data_proxy.rb +1 -1
  84. data/lib/glimmer/swt/layout_proxy.rb +8 -4
  85. data/lib/glimmer/swt/menu_proxy.rb +10 -5
  86. data/lib/glimmer/swt/message_box_proxy.rb +1 -1
  87. data/lib/glimmer/swt/packages.rb +1 -1
  88. data/lib/glimmer/swt/properties.rb +49 -0
  89. data/lib/glimmer/swt/sash_form_proxy.rb +2 -2
  90. data/lib/glimmer/swt/scrolled_composite_proxy.rb +1 -1
  91. data/lib/glimmer/swt/shell_proxy.rb +3 -2
  92. data/lib/glimmer/swt/style_constantizable.rb +9 -5
  93. data/lib/glimmer/swt/styled_text_proxy.rb +1 -1
  94. data/lib/glimmer/swt/swt_proxy.rb +1 -1
  95. data/lib/glimmer/swt/tab_item_proxy.rb +1 -1
  96. data/lib/glimmer/swt/table_column_proxy.rb +1 -1
  97. data/lib/glimmer/swt/table_proxy.rb +1 -1
  98. data/lib/glimmer/swt/tree_proxy.rb +26 -22
  99. data/lib/glimmer/swt/widget_listener_proxy.rb +1 -1
  100. data/lib/glimmer/swt/widget_proxy.rb +54 -28
  101. data/lib/glimmer/ui/custom_shell.rb +1 -1
  102. data/lib/glimmer/ui/custom_widget.rb +1 -1
  103. data/lib/glimmer/util/proc_tracker.rb +1 -1
  104. data/samples/elaborate/contact_manager.rb +1 -1
  105. data/samples/elaborate/contact_manager/contact.rb +1 -1
  106. data/samples/elaborate/contact_manager/contact_manager_presenter.rb +1 -1
  107. data/samples/elaborate/contact_manager/contact_repository.rb +1 -1
  108. data/samples/elaborate/login.rb +1 -1
  109. data/samples/elaborate/meta_sample.rb +40 -16
  110. data/samples/elaborate/tic_tac_toe.rb +2 -2
  111. data/samples/elaborate/tic_tac_toe/board.rb +1 -1
  112. data/samples/elaborate/tic_tac_toe/cell.rb +1 -1
  113. data/samples/elaborate/user_profile.rb +1 -1
  114. data/samples/hello/hello_browser.rb +1 -1
  115. data/samples/hello/hello_button.rb +1 -1
  116. data/samples/hello/hello_canvas.rb +43 -0
  117. data/samples/hello/hello_canvas_animation.rb +66 -0
  118. data/samples/hello/hello_checkbox.rb +1 -1
  119. data/samples/hello/hello_checkbox_group.rb +1 -1
  120. data/samples/hello/hello_combo.rb +1 -1
  121. data/samples/hello/hello_computed.rb +1 -1
  122. data/samples/hello/hello_computed/contact.rb +1 -1
  123. data/samples/hello/hello_custom_shell.rb +1 -1
  124. data/samples/hello/hello_custom_widget.rb +1 -1
  125. data/samples/hello/hello_date_time.rb +1 -1
  126. data/samples/hello/hello_dialog.rb +78 -0
  127. data/samples/hello/hello_directory_dialog.rb +1 -1
  128. data/samples/hello/hello_drag_and_drop.rb +1 -1
  129. data/samples/hello/hello_expand_bar.rb +1 -1
  130. data/samples/hello/hello_file_dialog.rb +1 -1
  131. data/samples/hello/hello_group.rb +1 -1
  132. data/samples/hello/hello_link.rb +1 -1
  133. data/samples/hello/hello_list_multi_selection.rb +1 -1
  134. data/samples/hello/hello_list_single_selection.rb +1 -1
  135. data/samples/hello/hello_menu_bar.rb +185 -29
  136. data/samples/hello/hello_message_box.rb +1 -1
  137. data/samples/hello/hello_pop_up_context_menu.rb +1 -1
  138. data/samples/hello/hello_radio.rb +1 -1
  139. data/samples/hello/hello_radio_group.rb +1 -1
  140. data/samples/hello/hello_sash_form.rb +1 -1
  141. data/samples/hello/hello_spinner.rb +1 -1
  142. data/samples/hello/hello_styled_text.rb +1 -1
  143. data/samples/hello/hello_tab.rb +1 -1
  144. data/samples/hello/hello_table.rb +1 -1
  145. data/samples/hello/hello_world.rb +1 -1
  146. data/vendor/swt/linux/swt.jar +0 -0
  147. data/vendor/swt/mac/swt.jar +0 -0
  148. data/vendor/swt/windows/swt.jar +0 -0
  149. metadata +54 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f86e6ce8dc5b52db4661c0cb5aa9d9bce7e0cc644408ae1536aed5d2ea25d0cd
4
- data.tar.gz: ccdbb42c7bebc81a2a73235ee80ef53ce6607810152ea66b6336e33490a8e83a
3
+ metadata.gz: 2aa85c5f6d4f5a71bbc9538f291fff86199d26219c7b919068b5be7f99fc4bfd
4
+ data.tar.gz: 4db3a940c06f112c309e822ce73b0a1e98317f87ae808c183f261d49d357c490
5
5
  SHA512:
6
- metadata.gz: 7d1e3ee58b861a453d79cca264749bcfc17f0efd4e490864aadec61a4b4269ad033cc49fbf291ccf8b9840ed54813130e8620a557d1f15c3c6c25883276ee6cb
7
- data.tar.gz: 7fb220ed34798e701839cf118e1a7df1ebf5492b938570a8ee7dd0ad6a0a624808f52fe74ac30d221f58e6269ff708dd6d71098b0251c3470d16fa2a5c472323
6
+ metadata.gz: 96d95b883f011fc5d706382c4a8f1eea500ccd9ad15bf1fb3c82e9c7509348d0dcd16ef4c99ef963eb3bb4760e63aca217d0f4ab43d404ea6c8fa636bdfc8adc
7
+ data.tar.gz: a5182246e7825790b8c63ed8b7506d0e35e93af1f5a2e60c8ad6e015cee6fb092357ef2ca842d6f4bcf432b9cc5676b8167ec2bb42ef6dde47d007e50e1c2ba0
@@ -1,5 +1,57 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.18.1.1
4
+
5
+ - Add smart defaults for round rectangle angles (defaults to 60 degrees angles)
6
+ - Add smart default for gradient rectangle vertical option
7
+ - Small update to Hello, Canvas! Sample
8
+ - Convert SWT style symbol to SWT style integer if method takes integer but receives a symbol (or string)
9
+ - Make polygon not require [] for its array args
10
+ - Allow cycle to receive splatted array as varargs
11
+ - Change references to `Display.setAppName` and `Display.setAppVersion` to `Display.app_name =` and `Display.app_version =`
12
+ - Default Glimmer app name to "Glimmer" (instead of previous "SWT") unless `Display.app_name = "Somename"` is set by consumer before instantiating first display
13
+ - Set default background to system widget background default for fill shapes
14
+ - Set default foreground to black for draw shapes
15
+ - Fix issue with shapes always requiring a block (even an empty one) to render
16
+ - Fix issue with animation requiring changes to canvas directly in addition to shapes
17
+ - Fix issue with `glimmer list:gems:dsl` command
18
+ - Fix issue with scaffolding still depending on git-glimmer despite being merged back to git gem
19
+
20
+ ### 4.18.1.0
21
+
22
+ - Canvas Shape DSL
23
+ - Hello, Canvas! Sample
24
+ - Animation DSL
25
+ - Hello, Canvas Animation! Sample
26
+ - Fixed issue with async_exec not working in ShellProxy when delegate widget is nil
27
+
28
+ ### 4.18.0.2
29
+
30
+ - Minor update on Hello, Dialog! Sample
31
+ - Upgrade to glimmer v1.0.7
32
+
33
+ ### 4.18.0.1
34
+
35
+ - Hello, Dialog! Sample
36
+ - Added Glimmer icon to Glimmer Meta-Sample (Sample of Samples)
37
+ - Upgrade Scaffolded projects to JRuby v9.2.14.0
38
+ - Switch back to official git gem v1.8.1 now that glimmer-git gem branch is merged into it
39
+ - Fix issue with not reporting exception encountered in editing a tree item if consumer code had a bug
40
+
41
+ ### 4.18.0.0
42
+
43
+ - Upgrade to SWT v4.18
44
+ - Upgrade to JRuby v9.2.14.0
45
+ - Apply all WidgetProxy property converters upon normal setting of properties too (not just in DSL) (like `some_widget.background = color_symbol`)
46
+ - Update Hello, Menu Bar! sample to show accelerators on menu items
47
+ - Have the `swt` keyword (SWTProxy) support accepting a string character (to build an accelerator style)
48
+ - Make accelerator property accept symbols and character directly (without swt)
49
+ - Write meta-sample changes to user directory to avoid permission issues
50
+ - Zero margin_left, margin_right, margin_top, margin_bottom in layouts given that margin_width and margin_height are set by default
51
+ - Prevent editing/launching meta-sample from Glimmer Meta-Sample
52
+ - Fix enablement on `menu` (as opposed to menu_item, where it works)
53
+ - Fix issue relating to background image scaling on resize of widget
54
+
3
55
  ### 4.17.10.8
4
56
 
5
57
  - Support editing sample code in the Glimmer Meta-Sample to enable experimentation and learning
@@ -1,4 +1,4 @@
1
- Copyright (c) 2007-2020 Andy Maleh
1
+ Copyright (c) 2007-2021 Andy Maleh
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
- # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.17.10.8
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.18.1.1
2
+
2
3
 
3
4
  ## JRuby Desktop Development GUI Framework
4
5
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
@@ -11,23 +12,23 @@
11
12
 
12
13
  (The Original Glimmer Library Since 2007. Beware of Imitators!)
13
14
 
14
- [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer) is a native-GUI cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster version of [Ruby](https://www.ruby-lang.org/en/). [Glimmer](https://github.com/AndyObtiva/glimmer)'s main innovation is a declarative [Ruby DSL](#glimmer-dsl-syntax) that enables productive and efficient authoring of desktop application user-interfaces while relying on the robust [Eclipse SWT library](https://www.eclipse.org/swt/). [Glimmer](https://rubygems.org/gems/glimmer) additionally innovates by having built-in [data-binding](#data-binding) support, which greatly facilitates synchronizing the GUI with domain models, thus achieving true decoupling of object oriented components and enabling developers to solve business problems (test-first) without worrying about GUI concerns. To get started quickly, [Glimmer](https://rubygems.org/gems/glimmer) offers [scaffolding](#scaffolding) options for [Apps](#in-production), [Gems](#custom-shell-gem), and [Custom Widgets](#custom-widgets). [Glimmer](https://rubygems.org/gems/glimmer) also includes native-executable [packaging](#packaging--distribution) support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in [Ruby](https://www.ruby-lang.org/en/) as truly native DMG/PKG/APP files on the [Mac](https://www.apple.com/ca/macos) + [App Store](https://developer.apple.com/macos/distribution/), MSI/EXE files on [Windows](https://www.microsoft.com/en-ca/windows), and [Gem Packaged Shell Scripts](#custom-shell-gem) on [Linux](https://www.linux.org/).
15
+ [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer) is a native-GUI cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster version of [Ruby](https://www.ruby-lang.org/en/). [Glimmer](https://github.com/AndyObtiva/glimmer)'s main innovation is a declarative [Ruby DSL](#glimmer-dsl-syntax) that enables productive and efficient authoring of desktop application user-interfaces while relying on the robust [Eclipse SWT library](https://www.eclipse.org/swt/). [Glimmer](https://rubygems.org/gems/glimmer) additionally innovates by having built-in [data-binding](#data-binding) support, which greatly facilitates synchronizing the GUI with domain models, thus achieving true decoupling of object oriented components and enabling developers to solve business problems (test-first) without worrying about GUI concerns, or alternatively drive development GUI-first, and then write clean business models (test-first) afterwards. Not only does Glimmer provide a large set of GUI [widgets](#widgets), but also supports drawing Canvas Graphics like [Shapes](#canvas-shape-dsl) and [Animations](#canvas-animation-dsl). To get started quickly, [Glimmer](https://rubygems.org/gems/glimmer) offers [scaffolding](#scaffolding) options for [Apps](#in-production), [Gems](#custom-shell-gem), and [Custom Widgets](#custom-widgets). [Glimmer](https://rubygems.org/gems/glimmer) also includes native-executable [packaging](#packaging--distribution) support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in [Ruby](https://www.ruby-lang.org/en/) as truly native DMG/PKG/APP files on the [Mac](https://www.apple.com/ca/macos) + [App Store](https://developer.apple.com/macos/distribution/), MSI/EXE files on [Windows](https://www.microsoft.com/en-ca/windows), and [Gem Packaged Shell Scripts](#custom-shell-gem) on [Linux](https://www.linux.org/).
15
16
 
16
17
  [Glimmer receives two updates per month](https://rubygems.org/gems/glimmer-dsl-swt/versions). You can trust [Glimmer](https://rubygems.org/gems/glimmer) with your Ruby desktop GUI development needs. Please make [Glimmer](https://rubygems.org/gems/glimmer) even better by providing feedback and [contributing](#contributing) when possible.
17
18
 
18
19
  Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT.
19
20
 
20
- [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) versions 4.17.x.y come with [SWT 4.17](https://download.eclipse.org/eclipse/downloads/drops4/R-4.17-202009021800/), which was released on September 2, 2020.
21
+ [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) versions 4.18.x.y come with [SWT 4.18](https://download.eclipse.org/eclipse/downloads/drops4/R-4.18-202012021800/), which was released on December 2, 2020.
21
22
 
22
23
  [<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
23
- Featured in<br />JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do)
24
+ Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) and [Chalmers/Gothenburg University Software Engineering Master's Lecture Material](http://www.cse.chalmers.se/~bergert/slides/guest_lecture_DSLs.pdf)
24
25
 
25
26
  Glimmer DSL gems:
26
- - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop GUI)
27
- - [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (Ruby Desktop GUI)
28
- - [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Web GUI Adapter for Desktop Apps)
27
+ - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
28
+ - [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)
29
29
  - [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
30
30
  - [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS
31
+ - [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
31
32
 
32
33
  ## Examples
33
34
 
@@ -266,6 +267,7 @@ Glimmer App:
266
267
  - [Glimmer GUI DSL Syntax](#glimmer-gui-dsl-syntax)
267
268
  - [DSL Auto-Expansion](#dsl-auto-expansion)
268
269
  - [Widgets](#widgets)
270
+ - [Glimmer GUI DSL Keywords](#glimmer-gui-dsl-keywords)
269
271
  - [SWT Proxies](#swt-proxies)
270
272
  - [Dialog](#dialog)
271
273
  - [Display](#display)
@@ -284,6 +286,8 @@ Glimmer App:
284
286
  - [Cursor](#cursor)
285
287
  - [Layouts](#layouts)
286
288
  - [Layout Data](#layout-data)
289
+ - [Canvas Shape DSL](#canvas-shape-dsl)
290
+ - [Canvas Animation DSL](#canvas-animation-dsl)
287
291
  - [Data-Binding](#data-binding)
288
292
  - [General Examples](#general-examples)
289
293
  - [Combo](#combo)
@@ -356,6 +360,9 @@ Glimmer App:
356
360
  - [Hello, Table!](#hello-table)
357
361
  - [Hello, Button!](#hello-button)
358
362
  - [Hello, Link!](#hello-link)
363
+ - [Hello, Dialog!](#hello-dialog)
364
+ - [Hello, Canvas!](#hello-canvas)
365
+ - [Hello, Canvas Animation!](#hello-canvas-animation)
359
366
  - [Elaborate Samples](#elaborate-samples)
360
367
  - [User Profile](#user-profile)
361
368
  - [Login](#login)
@@ -416,13 +423,13 @@ https://www.eclipse.org/swt/faq.php
416
423
  ## Pre-requisites
417
424
 
418
425
  - JDK 8u241 (1.8.0_241) (find at https://www.oracle.com/java/technologies/javase/javase8u211-later-archive-downloads.html)
419
- - JRuby 9.2.13.0 (supporting Ruby 2.5.x syntax) (get via [RVM](http://rvm.io) on Mac and Linux or find at [https://www.jruby.org/download](https://www.jruby.org/download) for Windows)
420
- - SWT 4.17 (already included in the [glimmer-dsl-swt](https://rubygems.org/gems/glimmer-dsl-swt) gem)
426
+ - JRuby 9.2.14.0 (supporting Ruby 2.5.x syntax) (get via [RVM](http://rvm.io) on Mac and Linux or find at [https://www.jruby.org/download](https://www.jruby.org/download) for Windows)
427
+ - SWT 4.18 (already included in the [glimmer-dsl-swt](https://rubygems.org/gems/glimmer-dsl-swt) gem)
421
428
 
422
429
  To obtain JRuby through [RVM](http://rvm.io), you may run:
423
430
 
424
431
  ```bash
425
- rvm install jruby-9.2.13.0
432
+ rvm install jruby-9.2.14.0
426
433
  ```
427
434
 
428
435
  Glimmer might still work on other versions of Java, JRuby and SWT, but there are no guarantees, so it is best to stick to the pre-requisites outlined above.
@@ -449,7 +456,8 @@ jgem install glimmer-dsl-swt
449
456
 
450
457
  Or this command if you want a specific version:
451
458
  ```
452
- jgem install glimmer-dsl-swt -v 4.17.10.8
459
+ jgem install glimmer-dsl-swt -v 4.18.1.1
460
+
453
461
 
454
462
  ```
455
463
 
@@ -468,7 +476,8 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
468
476
 
469
477
  Add the following to `Gemfile`:
470
478
  ```
471
- gem 'glimmer-dsl-swt', '~> 4.17'
479
+ gem 'glimmer-dsl-swt', '~> 4.18.1.1
480
+ '
472
481
  ```
473
482
 
474
483
  And, then run:
@@ -526,7 +535,8 @@ bin/glimmer samples
526
535
  Below are the full usage instructions that come up when running `glimmer` without args.
527
536
 
528
537
  ```
529
- Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.17.10.8
538
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.18.1.1
539
+
530
540
 
531
541
 
532
542
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
@@ -583,6 +593,8 @@ glimmer samples/hello/hello_world.rb samples/hello/hello_tab.rb
583
593
 
584
594
  Launches samples/hello/hello_world.rb and samples/hello_tab.rb at the same time, each in a separate JRuby thread.
585
595
 
596
+ Note: under Zsh (Z Shell), glimmer can only be used in its advanced TUI mode (e.g. `glimmer` and then selecting a task) not the primitive rake task mode (e.g. `glimmer scaffold[app]`)
597
+
586
598
  ### Glimmer Samples
587
599
 
588
600
  You can list available Glimmer samples by running:
@@ -1003,8 +1015,9 @@ Output:
1003
1015
  Name Gem Version Author Description
1004
1016
 
1005
1017
  Css glimmer-dsl-css 1.1.0 AndyMaleh Glimmer DSL for CSS
1006
- Opal glimmer-dsl-opal 0.8.0 AndyMaleh Glimmer DSL for Opal
1007
- Swt glimmer-dsl-swt 4.17.10.8
1018
+ Opal glimmer-dsl-opal 0.10.2 AndyMaleh Glimmer DSL for Opal
1019
+ Swt glimmer-dsl-swt 4.18.1.1
1020
+
1008
1021
  AndyMaleh Glimmer DSL for SWT
1009
1022
  Tk glimmer-dsl-tk 0.0.6 AndyMaleh Glimmer DSL for Tk
1010
1023
  Xml glimmer-dsl-xml 1.1.0 AndyMaleh Glimmer DSL for XML
@@ -1085,7 +1098,7 @@ Keep in mind that all samples live under [https://github.com/AndyObtiva/glimmer-
1085
1098
 
1086
1099
  Glimmer's core is a GUI DSL with a lightweight visual syntax that makes it easy to visualize the nesting of widgets in the GUI hierarchy tree.
1087
1100
 
1088
- It is available through mixing in the `Glimmer` module, which makes Glimmer GUI DSL keywords available to both the instance scope and class scope:
1101
+ It is available through mixing in the `Glimmer` module, which makes [Glimmer GUI DSL Keywords](#glimmer-gui-dsl-keywords) available to both the instance scope and class scope:
1089
1102
 
1090
1103
  ```ruby
1091
1104
  include Glimmer
@@ -1271,12 +1284,73 @@ shell {
1271
1284
  }.open
1272
1285
  ```
1273
1286
 
1274
- If you are new to Glimmer, you have learned enough to start running some [samples](#samples). Go ahead and run all Glimmer [samples](#samples), and come back to read the rest in any order you like since this material is more organized like a reference.
1287
+ If you are new to Glimmer, you have learned enough to start running some [samples](#samples) directly or by reading through [Glimmer GUI DSL Keywords](#glimmer-gui-dsl-keywords) (which list each keyword's samples). Go ahead and run all Glimmer [samples](#samples), and come back to read the rest in any order you like since this material is more organized like a reference.
1275
1288
 
1276
1289
  If you are advanced and need more widgets, check out the [Nebula Project](https://www.eclipse.org/nebula/) for an extensive list of high quality custom widgets:
1277
1290
 
1278
1291
  https://www.eclipse.org/nebula/
1279
1292
 
1293
+ #### Glimmer GUI DSL Keywords
1294
+
1295
+ 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.
1296
+
1297
+ **Widgets:**
1298
+ - `button`: featured in [Hello, Checkbox!](#hello-checkbox) / [Hello, Button!](#hello-button) / [Hello, Table!](#hello-table) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, Message Box!](#hello-message-box) / [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Hello, Group!](#hello-group) / [Hello, Combo!](#hello-combo) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Contact Manager](#contact-manager) / [Tic Tac Toe](#tic-tac-toe) / [Login](#login)
1299
+ - `browser`: featured in [Hello, Browser!](#hello-browser)
1300
+ - `calendar`: featured in [Hello, Date Time!](#hello-date-time)
1301
+ - `checkbox`: featured in [Hello, Checkbox Group!](#hello-checkbox-group) / [Hello, Checkbox!](#hello-checkbox)
1302
+ - `checkbox_group`: featured in [Hello, Checkbox Group!](#hello-checkbox-group)
1303
+ - `combo`: featured in [Hello, Table!](#hello-table) / [Hello, Combo!](#hello-combo)
1304
+ - `composite`: featured in [Hello, Radio!](#hello-radio) / [Hello, Computed!](#hello-computed) / [Hello, Checkbox!](#hello-checkbox) / [Tic Tac Toe](#tic-tac-toe) / [Login](#login) / [Contact Manager](#contact-manager)
1305
+ - `date`: featured in [Hello, Table!](#hello-table) / [Hello, Date Time!](#hello-date-time) / [Hello, Custom Shell!](#hello-custom-shell) / [Tic Tac Toe](#tic-tac-toe)
1306
+ - `date_drop_down`: featured in [Hello, Table!](#hello-table) / [Hello, Date Time!](#hello-date-time)
1307
+ - `group`: featured in [Hello, Group!](#hello-group) / [Contact Manager](#contact-manager)
1308
+ - `label`: featured in [Hello, Computed!](#hello-computed) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Hello, Checkbox!](#hello-checkbox) / [Hello, World!](#hello-world) / [Hello, Table!](#hello-table) / [Hello, Tab!](#hello-tab) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Menu Bar!](#hello-menu-bar) / [Hello, Date Time!](#hello-date-time) / [Hello, Custom Widget!](#hello-custom-widget) / [Hello, Custom Shell!](#hello-custom-shell) / [Contact Manager](#contact-manager) / [Login](#login)
1309
+ - `list` (w/ optional `:multi` SWT style): featured in [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Contact Manager](#contact-manager)
1310
+ - `menu`: featured in [Hello, Menu Bar!](#hello-menu-bar) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Table!](#hello-table)
1311
+ - `menu_bar`: featured in [Hello, Menu Bar!](#hello-menu-bar)
1312
+ - `menu_item`: featured in [Hello, Table!](#hello-table) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Menu Bar!](#hello-menu-bar)
1313
+ - `message_box`: featured in [Hello, Table!](#hello-table) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Message Box!](#hello-message-box) / [Hello, Menu Bar!](#hello-menu-bar)
1314
+ - `radio`: featured in [Hello, Radio!](#hello-radio) / [Hello, Group!](#hello-group)
1315
+ - `radio_group`: featured in [Hello, Radio Group!](#hello-radio-group)
1316
+ - `scrolled_composite`
1317
+ - `shell`: featured in [Hello, Checkbox!](#hello-checkbox) / [Hello, Button!](#hello-button) / [Hello, Table!](#hello-table) / [Hello, Tab!](#hello-tab) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Hello, Group!](#hello-group) / [Hello, Date Time!](#hello-date-time) / [Hello, Custom Shell!](#hello-custom-shell) / [Hello, Computed!](#hello-computed) / [Hello, Combo!](#hello-combo) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Contact Manager](#contact-manager) / [Tic Tac Toe](#tic-tac-toe) / [Login](#login)
1318
+ - `tab_folder`: featured in [Hello, Tab!](#hello-tab)
1319
+ - `tab_item`: featured in [Hello, Tab!](#hello-tab)
1320
+ - `table`: featured in [Hello, Custom Shell!](#hello-custom-shell) / [Hello, Table!](#hello-table) / [Contact Manager](#contact-manager)
1321
+ - `table_column`: featured in [Hello, Table!](#hello-table) / [Hello, Custom Shell!](#hello-custom-shell) / [Contact Manager](#contact-manager)
1322
+ - `text`: featured in [Hello, Computed!](#hello-computed) / [Login](#login) / [Contact Manager](#contact-manager)
1323
+ - `time`: featured in [Hello, Table!](#hello-table) / [Hello, Date Time!](#hello-date-time)
1324
+ - Glimmer::UI::CustomWidget: ability to define any keyword as a custom widget - featured in [Hello, Custom Widget!](#hello-custom-widget)
1325
+ - 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!](#hello-custom-shell)
1326
+
1327
+ **Layouts:**
1328
+ - `grid_layout`: featured in [Hello, Custom Shell!](#hello-custom-shell) / [Hello, Computed!](#hello-computed) / [Hello, Table!](#hello-table) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Menu Bar!](#hello-menu-bar) / [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Contact Manager](#contact-manager) / [Login](#login) / [Tic Tac Toe](#tic-tac-toe)
1329
+ - `row_layout`: featured in [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, Group!](#hello-group) / [Hello, Date Time!](#hello-date-time) / [Hello, Combo!](#hello-combo) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Hello, Checkbox!](#hello-checkbox) / [Contact Manager](#contact-manager)
1330
+ - `fill_layout`: featured in [Hello, Custom Widget!](#hello-custom-widget)
1331
+ - `layout_data`: featured in [Hello, Table!](#hello-table) / [Hello, Custom Shell!](#hello-custom-shell) / [Hello, Computed!](#hello-computed) / [Tic Tac Toe](#tic-tac-toe) / [Contact Manager](#contact-manager)
1332
+
1333
+ **Graphics/Style:**
1334
+ - `color`: featured in [Hello, Custom Widget!](#hello-custom-widget) / [Hello, Menu Bar!](#hello-menu-bar)
1335
+ - `font`: featured in [Hello, Checkbox Group!](#hello-checkbox-group) / [Hello, Checkbox!](#hello-checkbox) / [Hello, Table!](#hello-table) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Menu Bar!](#hello-menu-bar) / [Hello, Group!](#hello-group) / [Hello, Date Time!](#hello-date-time) / [Hello, Custom Widget!](#hello-custom-widget) / [Hello, Custom Shell!](#hello-custom-shell) / [Contact Manager](#contact-manager) / [Tic Tac Toe](#tic-tac-toe)
1336
+ - `Point` class used in setting location on widgets
1337
+ - `swt` and `SWT` class to set SWT styles on widgets - featured in [Hello, Custom Shell!](#hello-custom-shell) / [Login](#login) / [Contact Manager](#contact-manager)
1338
+
1339
+ **Data-Binding/Observers:**
1340
+ - `bind`: featured in [Hello, Computed!](#hello-computed) / [Hello, Combo!](#hello-combo) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Hello, Checkbox!](#hello-checkbox) / [Hello, Button!](#hello-button) / [Hello, Table!](#hello-table) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Hello, Group!](#hello-group) / [Hello, Date Time!](#hello-date-time) / [Hello, Custom Widget!](#hello-custom-widget) / [Hello, Custom Shell!](#hello-custom-shell) / [Login](#login) / [Contact Manager](#contact-manager) / [Tic Tac Toe](#tic-tac-toe)
1341
+ - `observe`: featured in [Hello, Table!](#hello-table) / [Tic Tac Toe](#tic-tac-toe)
1342
+ - `on_widget_selected`: featured in [Hello, Combo!](#hello-combo) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Hello, Checkbox!](#hello-checkbox) / [Hello, Button!](#hello-button) / [Hello, Table!](#hello-table) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Message Box!](#hello-message-box) / [Hello, Menu Bar!](#hello-menu-bar) / [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Hello, Group!](#hello-group) / [Contact Manager](#contact-manager) / [Login](#login) / [Tic Tac Toe](#tic-tac-toe)
1343
+ - `on_modify_text`
1344
+ - `on_key_pressed` (and SWT alias `on_swt_keydown`) - featured in [Login](#login) / [Contact Manager](#contact-manager)
1345
+ - `on_key_released` (and SWT alias `on_swt_keyup`)
1346
+ - `on_mouse_down` (and SWT alias `on_swt_mousedown`)
1347
+ - `on_mouse_up` (and SWT alias `on_swt_mouseup`) - featured in [Hello, Custom Shell!](#hello-custom-shell) / [Contact Manager](#contact-manager)
1348
+
1349
+ **Event loop:**
1350
+ - `display`: featured in [Tic Tac Toe](#tic-tac-toe)
1351
+ - `async_exec`: featured in [Hello, Custom Widget!](#hello-custom-widget) / [Hello, Custom Shell!](#hello-custom-shell)
1352
+
1353
+
1280
1354
  #### SWT Proxies
1281
1355
 
1282
1356
  Glimmer follows Proxy Design Pattern by having Ruby proxy wrappers for all SWT objects:
@@ -1361,9 +1435,11 @@ Dialog is a variation on Shell. It is basically a shell that is modal (blocks wh
1361
1435
 
1362
1436
  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.
1363
1437
 
1438
+ Check out [Hello, Dialog!](#hello-dialog) sample to learn more.
1439
+
1364
1440
  ##### message_box
1365
1441
 
1366
- The Glimmer DSL `message_box` keyword is similar to `shell`, but renders a modal dialog with a title `text` property and main body `message` property. It may also be opened via the `#open` method.
1442
+ The Glimmer DSL `message_box` keyword is similar to `shell` and `dialog`, but renders a modal dialog with a title `text` property, main body `message` property, and dismissal button(s) only (OK button by default or [more options](https://www.eclipse.org/swt/javadoc.php)). It may also be opened via the `#open` method.
1367
1443
 
1368
1444
  Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
1369
1445
 
@@ -1477,47 +1553,54 @@ The ampersand symbol indicates the keyboard shortcut key for the menu item (e.g.
1477
1553
  Example of a Menu Bar (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
1478
1554
 
1479
1555
  ```ruby
1480
- shell { |shell_proxy|
1556
+ include Glimmer
1557
+
1558
+ COLORS = [:white, :red, :yellow, :green, :blue, :magenta, :gray, :black]
1559
+
1560
+ shell {
1561
+ grid_layout {
1562
+ margin_width 0
1563
+ margin_height 0
1564
+ }
1565
+
1481
1566
  text 'Hello, Menu Bar!'
1482
- grid_layout
1483
- label(:center) {
1484
- font height: 16
1485
- text 'Check Out The File Menu and History Menu in The Menu Bar Above!'
1567
+
1568
+ @label = label(:center) {
1569
+ font height: 50
1570
+ text 'Check Out The Menu Bar Above!'
1486
1571
  }
1572
+
1487
1573
  menu_bar {
1488
1574
  menu {
1489
1575
  text '&File'
1490
1576
  menu_item {
1491
- text 'E&xit'
1492
- }
1493
- menu_item(0) {
1494
1577
  text '&New'
1578
+ accelerator :command, :N
1579
+
1495
1580
  on_widget_selected {
1496
- message_box(shell_proxy) {
1497
- text 'New File'
1498
- message 'New File Contents'
1581
+ message_box {
1582
+ text 'New'
1583
+ message 'New file created.'
1499
1584
  }.open
1500
1585
  }
1501
1586
  }
1502
- menu(1) {
1503
- text '&Options'
1504
- menu_item(:radio) {
1505
- text 'Option 1'
1506
- }
1507
- menu_item(:separator)
1508
- menu_item(:check) {
1509
- text 'Option 3'
1587
+ menu_item {
1588
+ text '&Open...'
1589
+ accelerator :command, :O
1590
+
1591
+ on_widget_selected {
1592
+ message_box {
1593
+ text 'Open'
1594
+ message 'Opening File...'
1595
+ }.open
1510
1596
  }
1511
1597
  }
1512
- }
1513
- menu {
1514
- text '&History'
1515
1598
  menu {
1516
- text '&Recent'
1599
+ text 'Open &Recent'
1517
1600
  menu_item {
1518
1601
  text 'File 1'
1519
1602
  on_widget_selected {
1520
- message_box(shell_proxy) {
1603
+ message_box {
1521
1604
  text 'File 1'
1522
1605
  message 'File 1 Contents'
1523
1606
  }.open
@@ -1526,13 +1609,167 @@ shell { |shell_proxy|
1526
1609
  menu_item {
1527
1610
  text 'File 2'
1528
1611
  on_widget_selected {
1529
- message_box(shell_proxy) {
1612
+ message_box {
1530
1613
  text 'File 2'
1531
1614
  message 'File 2 Contents'
1532
1615
  }.open
1533
1616
  }
1534
1617
  }
1535
1618
  }
1619
+ menu_item(:separator)
1620
+ menu_item {
1621
+ text 'E&xit'
1622
+
1623
+ on_widget_selected {
1624
+ exit(0)
1625
+ }
1626
+ }
1627
+ }
1628
+ menu {
1629
+ text '&Edit'
1630
+ menu_item {
1631
+ text 'Cut'
1632
+ accelerator :command, :X
1633
+ }
1634
+ menu_item {
1635
+ text 'Copy'
1636
+ accelerator :command, :C
1637
+ }
1638
+ menu_item {
1639
+ text 'Paste'
1640
+ accelerator :command, :V
1641
+ }
1642
+ }
1643
+ menu {
1644
+ text '&Options'
1645
+
1646
+ menu_item(:radio) {
1647
+ text '&Enabled'
1648
+
1649
+ on_widget_selected {
1650
+ @select_one_menu.enabled = true
1651
+ @select_multiple_menu.enabled = true
1652
+ }
1653
+ }
1654
+ @select_one_menu = menu {
1655
+ text '&Select One'
1656
+ enabled false
1657
+
1658
+ menu_item(:radio) {
1659
+ text 'Option 1'
1660
+ }
1661
+ menu_item(:radio) {
1662
+ text 'Option 2'
1663
+ }
1664
+ menu_item(:radio) {
1665
+ text 'Option 3'
1666
+ }
1667
+ }
1668
+ @select_multiple_menu = menu {
1669
+ text '&Select Multiple'
1670
+ enabled false
1671
+
1672
+ menu_item(:check) {
1673
+ text 'Option 4'
1674
+ }
1675
+ menu_item(:check) {
1676
+ text 'Option 5'
1677
+ }
1678
+ menu_item(:check) {
1679
+ text 'Option 6'
1680
+ }
1681
+ }
1682
+ }
1683
+ menu {
1684
+ text '&Format'
1685
+ menu {
1686
+ text '&Background Color'
1687
+ COLORS.each { |color_style|
1688
+ menu_item(:radio) {
1689
+ text color_style.to_s.split('_').map(&:capitalize).join(' ')
1690
+
1691
+ on_widget_selected {
1692
+ @label.background = color_style
1693
+ }
1694
+ }
1695
+ }
1696
+ }
1697
+ menu {
1698
+ text 'Foreground &Color'
1699
+ COLORS.each { |color_style|
1700
+ menu_item(:radio) {
1701
+ text color_style.to_s.split('_').map(&:capitalize).join(' ')
1702
+
1703
+ on_widget_selected {
1704
+ @label.foreground = color_style
1705
+ }
1706
+ }
1707
+ }
1708
+ }
1709
+ }
1710
+ menu {
1711
+ text '&View'
1712
+ menu_item(:radio) {
1713
+ text 'Small'
1714
+
1715
+ on_widget_selected {
1716
+ @label.font = {height: 25}
1717
+ @label.parent.pack
1718
+ }
1719
+ }
1720
+ menu_item(:radio) {
1721
+ text 'Medium'
1722
+ selection true
1723
+
1724
+ on_widget_selected {
1725
+ @label.font = {height: 50}
1726
+ @label.parent.pack
1727
+ }
1728
+ }
1729
+ menu_item(:radio) {
1730
+ text 'Large'
1731
+
1732
+ on_widget_selected {
1733
+ @label.font = {height: 75}
1734
+ @label.parent.pack
1735
+ }
1736
+ }
1737
+ }
1738
+ menu {
1739
+ text '&Help'
1740
+ menu_item {
1741
+ text '&Manual'
1742
+ accelerator :command, :shift, :M
1743
+
1744
+ on_widget_selected {
1745
+ message_box {
1746
+ text 'Manual'
1747
+ message 'Manual Contents'
1748
+ }.open
1749
+ }
1750
+ }
1751
+ menu_item {
1752
+ text '&Tutorial'
1753
+ accelerator :command, :shift, :T
1754
+
1755
+ on_widget_selected {
1756
+ message_box {
1757
+ text 'Tutorial'
1758
+ message 'Tutorial Contents'
1759
+ }.open
1760
+ }
1761
+ }
1762
+ menu_item(:separator)
1763
+ menu_item {
1764
+ text '&Report an Issue...'
1765
+
1766
+ on_widget_selected {
1767
+ message_box {
1768
+ text 'Report an Issue'
1769
+ message 'Reporting an issue...'
1770
+ }.open
1771
+ }
1772
+ }
1536
1773
  }
1537
1774
  }
1538
1775
  }.open
@@ -1541,12 +1778,20 @@ shell { |shell_proxy|
1541
1778
  Example of a Pop Up Context Menu (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
1542
1779
 
1543
1780
  ```ruby
1544
- shell { |shell_proxy|
1781
+ include Glimmer
1782
+
1783
+ shell {
1784
+ grid_layout {
1785
+ margin_width 0
1786
+ margin_height 0
1787
+ }
1788
+
1545
1789
  text 'Hello, Pop Up Context Menu!'
1546
- grid_layout
1790
+
1547
1791
  label {
1548
- font height: 16
1549
- text 'Right-Click To Pop Up a Context Menu'
1792
+ text "Right-Click on the Text to\nPop Up a Context Menu"
1793
+ font height: 50
1794
+
1550
1795
  menu {
1551
1796
  menu {
1552
1797
  text '&History'
@@ -1555,7 +1800,7 @@ shell { |shell_proxy|
1555
1800
  menu_item {
1556
1801
  text 'File 1'
1557
1802
  on_widget_selected {
1558
- message_box(shell_proxy) {
1803
+ message_box {
1559
1804
  text 'File 1'
1560
1805
  message 'File 1 Contents'
1561
1806
  }.open
@@ -1564,13 +1809,34 @@ shell { |shell_proxy|
1564
1809
  menu_item {
1565
1810
  text 'File 2'
1566
1811
  on_widget_selected {
1567
- message_box(shell_proxy) {
1812
+ message_box {
1568
1813
  text 'File 2'
1569
1814
  message 'File 2 Contents'
1570
1815
  }.open
1571
1816
  }
1572
1817
  }
1573
1818
  }
1819
+ menu {
1820
+ text '&Archived'
1821
+ menu_item {
1822
+ text 'File 3'
1823
+ on_widget_selected {
1824
+ message_box {
1825
+ text 'File 3'
1826
+ message 'File 3 Contents'
1827
+ }.open
1828
+ }
1829
+ }
1830
+ menu_item {
1831
+ text 'File 4'
1832
+ on_widget_selected {
1833
+ message_box {
1834
+ text 'File 4'
1835
+ message 'File 4 Contents'
1836
+ }.open
1837
+ }
1838
+ }
1839
+ }
1574
1840
  }
1575
1841
  }
1576
1842
  }
@@ -2025,6 +2291,132 @@ Also, for a reference, check the SWT API:
2025
2291
 
2026
2292
  https://help.eclipse.org/2019-12/nftopic/org.eclipse.platform.doc.isv/reference/api/index.html
2027
2293
 
2294
+
2295
+ ### Canvas Shape DSL
2296
+
2297
+ (note: this is a very new feature of Glimmer. It may change a bit while getting battle tested. As always, you could default to basic SWT usage if needed.)
2298
+
2299
+ Glimmer supports drawing graphics directly on a `canvas` widget via SWT (or any widget for that matter though `canvas` is recommended for drawing).
2300
+
2301
+ This is accomplished via the Shape DSL a sub-DSL of the Glimmer GUI DSL, which makes it possible to draw graphics declaratively with very understandable and maintainable syntax.
2302
+
2303
+ Shape keywords and their args (including defaults) are listed below (they basically match method names and arguments on [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) minus the `draw` or `fill` prefix in downcase):
2304
+ - `arc​(x, y, width, height, startAngle, arcAngle, fill: false)`
2305
+ - `focus​(x, y, width, height)`
2306
+ - `image(image, x, y)`
2307
+ - `line(x1, y1, x2, y2)`
2308
+ - `oval(x, y, width, height, fill: false)`
2309
+ - `point​(x, y)`
2310
+ - `polygon(pointArray, fill: false)`
2311
+ - `polyline(pointArray)`
2312
+ - `rectangle(x, y, width, height, fill: false)`
2313
+ - `round_rectangle(x, y, width, height, arcWidth = 60, arcHeight = 60, fill: false)`
2314
+ - `gradient_rectangle​(x, y, width, height, vertical = true, fill: false)`
2315
+ - `text(String string, x, y)`
2316
+
2317
+ Shape keywords that can be filled with color can take an keyword argument `fill: true` (defaults to false when not specified)
2318
+
2319
+ Optionally, a shape keyword takes a block that can set any attributes from [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) (methods starting with `set`), which enable setting the `background` for filling and `foreground` for drawing.
2320
+
2321
+ Here is a list of supported attributes nestable within a block under shapes:
2322
+ - `alpha` sets transparency (integer between 0 and 255)
2323
+ - `antialias` enables antialiasing (SWT style value of :default, :off, :on whereby :default applies OS default)
2324
+ - `background` sets fill color for fillable shapes (standard color symbol (e.g. :red), `rgb(red_integer, green_integer, blue_integer)` color, or Color/ColorProxy object directly)
2325
+ - `clipping​(x, y, width, height)` clips area of painting
2326
+ - `fill_rule` sets filling rule (SWT style value of :fill_even_odd or :fill_winding)
2327
+ - `font` sets font (Hash of :name, :height, and :style just like standard widget font property, or Font/FontProxy object directly)
2328
+ - `line_cap` sets line cap (SWT style value of :cap_flat, :cap_round, or :cap_square)
2329
+ - `line_dash` line dash float values (automatically sets `line_style` to SWT style value of :line_custom)
2330
+ - `line_join` line join style (SWT style value of :join_miter, :join_round, or :join_bevel)
2331
+ - `line_style` line join style (SWT style value of :line_solid, :line_dash, :line_dot, :line_dashdot, or :line_dashdotdot)
2332
+ - `line_width` line width in integer (used in draw operations)
2333
+ - `text_anti_alias` enables text antialiasing (SWT style value of :default, :off, :on whereby :default applies OS default)
2334
+
2335
+ Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
2336
+
2337
+ ```ruby
2338
+ include Glimmer
2339
+
2340
+ shell {
2341
+ text 'Canvas Example'
2342
+ minimum_size 320, 400
2343
+
2344
+ canvas {
2345
+ background :yellow
2346
+ rectangle(0, 0, 220, 400, fill: true) {
2347
+ background :red
2348
+ }
2349
+ round_rectangle(50, 20, 300, 150, 30, 50, fill: true) {
2350
+ background :magenta
2351
+ }
2352
+ gradient_rectangle(150, 200, 100, 70, true, fill: true) {
2353
+ background :dark_magenta
2354
+ foreground :yellow
2355
+ }
2356
+ rectangle(200, 80, 108, 36) {
2357
+ foreground color(:dark_blue)
2358
+ }
2359
+ }
2360
+ }.open
2361
+ ```
2362
+
2363
+ Screenshot:
2364
+
2365
+ ![Canvas Animation Example](images/glimmer-example-canvas.png)
2366
+
2367
+ Learn more at the [Hello, Canvas! Sample](#hello-canvas).
2368
+
2369
+ ### Canvas Animation DSL
2370
+
2371
+ (note: this is a very new feature of Glimmer. It may change a bit while getting battle tested. As always, you could default to basic SWT usage if needed.)
2372
+
2373
+ Glimmer additionally provides built-in support for animations via a declarative Animation DSL, another sub-DSL of the Glimmer GUI DSL.
2374
+
2375
+ Animations take advantage of multi-threading, each animation runs in its own independent thread of execution while updating the GUI asynchronously.
2376
+
2377
+ This example says it all (it moves a tiny red square across a blue background):
2378
+
2379
+ ```ruby
2380
+ include Glimmer
2381
+
2382
+ shell {
2383
+ text 'Canvas Animation Example'
2384
+ minimum_size 400, 400
2385
+
2386
+ canvas {
2387
+ animation {
2388
+ every 0.1
2389
+
2390
+ frame { |index|
2391
+ background rgb(index%100, index%100 + 100, index%55 + 200)
2392
+ rectangle(index, index, 20, 20, fill: true) {
2393
+ background :red
2394
+ }
2395
+ }
2396
+ }
2397
+ }
2398
+ }.open
2399
+ ```
2400
+
2401
+ Screenshot:
2402
+
2403
+ ![Canvas Animation Example](images/glimmer-example-canvas-animation.png)
2404
+
2405
+ Keywords:
2406
+ - `animation` declares an animation under a canvas, which renders frames using a frame block indefinitely or finitely depending on (cycle_count/frame_count) properties
2407
+ - `every` specifies delay in seconds between every two frame renders
2408
+ - `frame` a block that can contain Shape DSL syntax that is rendered dynamically with variables calculated on the fly
2409
+ - `cycle` a property that takes an array to cycle into a second variable for the `frame` block
2410
+ - `cycle_count` an optional cycle count limit after which the animation stops
2411
+ - `frame_count` an optional frame count limit after which the animation stops
2412
+ - `started` a boolean indicating if the animation is started right away or stopped waiting for manual startup via `#start` method
2413
+
2414
+ API:
2415
+ - `#start` starts animation as a method on the animation object (returned from `animation` keyword)
2416
+ - `#stop` stops animation gracefully as a method on the animation object (returned from `animation` keyword)
2417
+
2418
+ Learn more at the [Hello, Canvas Animation! Sample](#hello-canvas-animation).
2419
+
2028
2420
  ### Data-Binding
2029
2421
 
2030
2422
  Data-binding is done with `bind` command following widget property to bind and taking model and bindable attribute as arguments.
@@ -2374,7 +2766,7 @@ shell {
2374
2766
 
2375
2767
  Check out [Hello, Table!](#hello-table) for an actual example including table editors.
2376
2768
 
2377
- [Are We There Yet?](#are-we-there-yet) is an actual production Glimmer application that takes full advantage of table capabilities.
2769
+ [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.
2378
2770
 
2379
2771
  ##### Table Sorting
2380
2772
 
@@ -3208,12 +3600,12 @@ Example.new
3208
3600
 
3209
3601
  Application name (shows up on the Mac in top menu bar) and version may be specified upon [packaging](#packaging--distribution) by specifying "-Bmac.CFBundleName" and "-Bmac.CFBundleVersion" options.
3210
3602
 
3211
- Still, if you would like proper application name to show up on the Mac top menu bar during development, you may do so by invoking the SWT Display.setAppName method before any Display object has been instantiated (i.e. before any Glimmer widget like shell has been declared).
3603
+ Still, if you would like proper application name to show up on the Mac top menu bar during development, you may do so by invoking the SWT `Display.app_name=` method before any Display object has been instantiated (i.e. before any Glimmer widget like shell has been declared).
3212
3604
 
3213
3605
  Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
3214
3606
 
3215
3607
  ```ruby
3216
- Display.setAppName('Glimmer Demo')
3608
+ Display.app_name = 'Glimmer Demo'
3217
3609
 
3218
3610
  shell(:no_resize) {
3219
3611
  text "Glimmer"
@@ -3223,7 +3615,7 @@ shell(:no_resize) {
3223
3615
  }.open
3224
3616
  ```
3225
3617
 
3226
- Also, you may invoke `Display.setAppVersion('1.0.0')` if needed for OS app version identification reasons during development, replacing `'1.0.0'` with your application version.
3618
+ Also, you may invoke `Display.app_version = '1.0.0'` if needed for OS app version identification reasons during development, replacing `'1.0.0'` with your application version.
3227
3619
 
3228
3620
  #### Checkbox Group Widget
3229
3621
 
@@ -3287,12 +3679,13 @@ Glimmer Meta-Sample Code Example:
3287
3679
  ```ruby
3288
3680
  # ...
3289
3681
  @code_text = code_text {
3290
- text bind(SampleDirectory, 'selected_sample.content', read_only: true)
3682
+ text bind(SampleDirectory, 'selected_sample.code', read_only: true)
3683
+ editable bind(SampleDirectory, 'selected_sample.editable')
3291
3684
  }
3292
3685
  # ...
3293
3686
  ```
3294
3687
 
3295
- To use, simply use `code_text` in place of `text` or `styled_text` widget. If you set its `text` value to Ruby code, it automatically styles it with syntax highlighting.
3688
+ To use, simply use `code_text` in place of the `text` or `styled_text` widget. If you set its `text` value to Ruby code, it automatically styles it with syntax highlighting.
3296
3689
 
3297
3690
  #### Video Widget
3298
3691
 
@@ -3635,7 +4028,7 @@ This brings up the [Glimmer Meta-Sample (The Sample of Samples)](samples/elabora
3635
4028
 
3636
4029
  ![Glimmer Meta-Sample](images/glimmer-meta-sample.png)
3637
4030
 
3638
- You may edit the code of any sample before launching it via the "Launch" button. This helps you learn by experiementing with Glimmer GUI DSL syntax. To go back to original code, simply hit the "Reset" button.
4031
+ You may edit the code of any sample before launching it by clicking on the "Launch" button. This helps you learn by experimenting with Glimmer GUI DSL syntax. To go back to original code, simply hit the "Reset" button.
3639
4032
 
3640
4033
  ### Hello Samples
3641
4034
 
@@ -3732,15 +4125,47 @@ Code:
3732
4125
 
3733
4126
  #### Hello, Menu Bar!
3734
4127
 
3735
- This sample demonstrates menus in Glimmer.
4128
+ This sample demonstrates menus in Glimmer, including accelerators on the Mac.
3736
4129
 
3737
4130
  Code:
3738
4131
 
3739
4132
  [samples/hello/hello_menu_bar.rb](samples/hello/hello_menu_bar.rb)
3740
4133
 
3741
4134
  ![Hello Menu Bar](images/glimmer-hello-menu-bar.png)
4135
+
3742
4136
  ![Hello Menu Bar File Menu](images/glimmer-hello-menu-bar-file-menu.png)
3743
- ![Hello Menu Bar History Menu](images/glimmer-hello-menu-bar-history-menu.png)
4137
+
4138
+ The Mac Menu includes Accelerator Keys (keyboard shortcuts).
4139
+
4140
+ ![Hello Menu Bar File Menu Mac Accelerators](images/glimmer-hello-menu-bar-file-menu-mac-accelerators.png)
4141
+
4142
+ ![Hello Menu Bar Edit Menu](images/glimmer-hello-menu-bar-edit-menu.png)
4143
+
4144
+ The Mac Menu includes Accelerator Keys (keyboard shortcuts).
4145
+
4146
+ ![Hello Menu Bar Edit Menu Mac Accelerators](images/glimmer-hello-menu-bar-edit-menu-mac-accelerators.png)
4147
+
4148
+ ![Hello Menu Bar Options Menu Disabled](images/glimmer-hello-menu-bar-options-menu-disabled.png)
4149
+
4150
+ ![Hello Menu Bar Options Menu Select One](images/glimmer-hello-menu-bar-options-menu-select-one.png)
4151
+
4152
+ ![Hello Menu Bar Options Menu Select Multiple](images/glimmer-hello-menu-bar-options-menu-select-multiple.png)
4153
+
4154
+ ![Hello Menu Bar Format Menu Background Color](images/glimmer-hello-menu-bar-format-menu-background-color.png)
4155
+
4156
+ ![Hello Menu Bar Format Menu Foreground Color](images/glimmer-hello-menu-bar-format-menu-foreground-color.png)
4157
+
4158
+ ![Hello Menu Bar View Menu](images/glimmer-hello-menu-bar-view-menu.png)
4159
+
4160
+ ![Hello Menu Bar View Small](images/glimmer-hello-menu-bar-view-small.png)
4161
+
4162
+ ![Hello Menu Bar View Large](images/glimmer-hello-menu-bar-view-large.png)
4163
+
4164
+ ![Hello Menu Bar Help Menu](images/glimmer-hello-menu-bar-help-menu.png)
4165
+
4166
+ The Mac Menu includes Accelerator Keys (keyboard shortcuts) and Mac built-in Search.
4167
+
4168
+ ![Hello Menu Bar Help Menu Mac Accelerators](images/glimmer-hello-menu-bar-help-menu-mac-accelerators.png)
3744
4169
 
3745
4170
  #### Hello, Pop Up Context Menu!
3746
4171
 
@@ -4048,6 +4473,50 @@ Hello, Link! Clicked
4048
4473
 
4049
4474
  ![Hello Link Clicked](images/glimmer-hello-link-clicked.png)
4050
4475
 
4476
+ #### Hello, Dialog!
4477
+
4478
+ This sample demonstrates the use of the `dialog` widget in Glimmer, which provides a modal `shell` that blocks shells beneath it until closed. And unlike `message_box`, it can contain arbitrary widgets (not just a message).
4479
+
4480
+ Code:
4481
+
4482
+ [samples/hello/hello_dialog.rb](samples/hello/hello_dialog.rb)
4483
+
4484
+ Hello, Dialog!
4485
+
4486
+ ![Hello Dialog](images/glimmer-hello-dialog.png)
4487
+
4488
+ Hello, Dialog! Open Dialog
4489
+
4490
+ ![Hello Dialog Open Dialog](images/glimmer-hello-dialog-open-dialog.png)
4491
+
4492
+ #### Hello, Canvas!
4493
+
4494
+ This sample demonstrates the use of the `canvas` widget and [Shape DSL](#canvas-shape-dsl) in Glimmer.
4495
+
4496
+ Code:
4497
+
4498
+ [samples/hello/hello_canvas.rb](samples/hello/hello_canvas.rb)
4499
+
4500
+ Hello, Canvas!
4501
+
4502
+ ![Hello Canvas](images/glimmer-hello-canvas.png)
4503
+
4504
+ #### Hello, Canvas Animation!
4505
+
4506
+ This sample demonstrates the use of the `canvas` widget and [Animation DSL](#canvas-animation-dsl) in Glimmer.
4507
+
4508
+ Code:
4509
+
4510
+ [samples/hello/hello_canvas_animation.rb](samples/hello/hello_canvas_animation.rb)
4511
+
4512
+ Hello, Canvas Animation!
4513
+
4514
+ ![Hello Canvas Animation](images/glimmer-hello-canvas-animation.png)
4515
+
4516
+ Hello, Canvas Animation Another Frame!
4517
+
4518
+ ![Hello Canvas Animation Frame 2](images/glimmer-hello-canvas-animation-frame2.png)
4519
+
4051
4520
  ### Elaborate Samples
4052
4521
 
4053
4522
  For more elaborate samples, check the following:
@@ -4367,7 +4836,7 @@ Here is a list of notable 3rd party gems used by Glimmer:
4367
4836
 
4368
4837
  ## Glimmer Process
4369
4838
 
4370
- [Glimmer Process](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md) is the lightweight software development process used for building Glimmer libraries and Glimmer apps, which goes beyond Agile, rendering all Agile processes obsolete. [Glimmer Process](PROCESS.md) is simply made up of 7 guidelines to pick and choose as necessary until software development needs are satisfied.
4839
+ [Glimmer Process](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md) is the lightweight software development process used for building Glimmer libraries and Glimmer apps, which goes beyond Agile, rendering all Agile processes obsolete. [Glimmer Process](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md) is simply made up of 7 guidelines to pick and choose as necessary until software development needs are satisfied.
4371
4840
 
4372
4841
  Learn more by reading the [GPG](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md) (Glimmer Process Guidelines)
4373
4842
 
@@ -4437,7 +4906,7 @@ If your company would like to invest fulltime in further development of the Glim
4437
4906
 
4438
4907
  [MIT](LICENSE.txt)
4439
4908
 
4440
- Copyright (c) 2007-2020 - Andy Maleh.
4909
+ Copyright (c) 2007-2021 - Andy Maleh.
4441
4910
 
4442
4911
  --
4443
4912