glimmer-dsl-swt 4.17.10.7 → 4.18.1.0

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 +42 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.md +508 -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 +1 -1
  66. data/lib/glimmer/rake_task/package.rb +1 -1
  67. data/lib/glimmer/rake_task/scaffold.rb +1 -1
  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 +116 -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 +135 -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 +16 -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 +80 -20
  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 +3 -1
  115. data/samples/hello/hello_button.rb +1 -1
  116. data/samples/hello/hello_canvas.rb +62 -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 +10 -4
  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 +10 -9
  137. data/samples/hello/hello_pop_up_context_menu.rb +34 -7
  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: 00b44b39eadc5263ddccde3ac95a754a9b4ad32c9412c268e9cf481ce89b7b05
4
- data.tar.gz: 7a72f47c3a36921160c3217652cc98a1b377f8c5202c2c24ade6288106d87b7a
3
+ metadata.gz: 174d5b75d96fe6595809e3f212aa30b4fd17caec61fe98018ce8fcf72880c036
4
+ data.tar.gz: 42f16bb6b36d68dea3ed1886d1993f65b539cc47e22799a4c7bd02fad2208389
5
5
  SHA512:
6
- metadata.gz: c630340b8dad5f0fe4f12481aec9dd039e21cd5be5fec8350c8624b23d3a76aa4cd84ce3e5b85fd1506c1037ab5094e2872548061029cf02c906a13b56df5f5b
7
- data.tar.gz: 1bd3f35d763bb34095e3b600abaf013d38ad7c4545bbcff6e1f1739a9702d760e79b533bc29b863587307bac567e34604fe212980cac3552eb96b05595bbd5c9
6
+ metadata.gz: 220d7fbbba99b5b9f65c334cd0aec9a3ddb4120227d3ea2876e7ab9327027d70e651b849a4891dd58e5e61f85dce01382919a212c2c39d9d79af83106596bfa3
7
+ data.tar.gz: ca8a7864a504618abd517aaf97832a185b84e86b7fb21ef4a27ffd70edc068822d1d5aae0ebdd192c9cd5ab106411fd78512354f676e49e1ac2b0dd8a1072154
@@ -1,5 +1,47 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.18.1.0
4
+
5
+ - Canvas Shape DSL
6
+ - Hello, Canvas! Sample
7
+ - Animation DSL
8
+ - Hello, Canvas Animation! Sample
9
+ - Fixed issue with async_exec not working in ShellProxy when delegate widget is nil
10
+
11
+ ### 4.18.0.2
12
+
13
+ - Minor update on Hello, Dialog! Sample
14
+ - Upgrade to glimmer v1.0.7
15
+
16
+ ### 4.18.0.1
17
+
18
+ - Hello, Dialog! Sample
19
+ - Added Glimmer icon to Glimmer Meta-Sample (Sample of Samples)
20
+ - Upgrade Scaffolded projects to JRuby v9.2.14.0
21
+ - Switch back to official git gem v1.8.1 now that glimmer-git gem branch is merged into it
22
+ - Fix issue with not reporting exception encountered in editing a tree item if consumer code had a bug
23
+
24
+ ### 4.18.0.0
25
+
26
+ - Upgrade to SWT v4.18
27
+ - Upgrade to JRuby v9.2.14.0
28
+ - Apply all WidgetProxy property converters upon normal setting of properties too (not just in DSL) (like `some_widget.background = color_symbol`)
29
+ - Update Hello, Menu Bar! sample to show accelerators on menu items
30
+ - Have the `swt` keyword (SWTProxy) support accepting a string character (to build an accelerator style)
31
+ - Make accelerator property accept symbols and character directly (without swt)
32
+ - Write meta-sample changes to user directory to avoid permission issues
33
+ - Zero margin_left, margin_right, margin_top, margin_bottom in layouts given that margin_width and margin_height are set by default
34
+ - Prevent editing/launching meta-sample from Glimmer Meta-Sample
35
+ - Fix enablement on `menu` (as opposed to menu_item, where it works)
36
+ - Fix issue relating to background image scaling on resize of widget
37
+
38
+ ### 4.17.10.8
39
+
40
+ - Support editing sample code in the Glimmer Meta-Sample to enable experimentation and learning
41
+ - Add a "Reset" button to the Glimmer Meta-Sample to allow resetting sample code changes
42
+ - Refactor/revise hello_message_box.rb and hello_pop_up_context_menu.rb samples
43
+ - Upgrade to glimmer 1.0.6
44
+
3
45
  ### 4.17.10.7
4
46
 
5
47
  - Loosened dependencies on most Glimmer author-owned gems
@@ -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.7
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.0
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. 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.7
459
+ jgem install glimmer-dsl-swt -v 4.18.1.0
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.0
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.7
538
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.18.1.0
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]...]
@@ -1003,8 +1013,9 @@ Output:
1003
1013
  Name Gem Version Author Description
1004
1014
 
1005
1015
  Css glimmer-dsl-css 1.1.0 AndyMaleh Glimmer DSL for CSS
1006
- Opal glimmer-dsl-opal 0.4.0 AndyMaleh Glimmer DSL for Opal
1007
- Swt glimmer-dsl-swt 4.17.10.7
1016
+ Opal glimmer-dsl-opal 0.8.0 AndyMaleh Glimmer DSL for Opal
1017
+ Swt glimmer-dsl-swt 4.18.1.0
1018
+
1008
1019
  AndyMaleh Glimmer DSL for SWT
1009
1020
  Tk glimmer-dsl-tk 0.0.6 AndyMaleh Glimmer DSL for Tk
1010
1021
  Xml glimmer-dsl-xml 1.1.0 AndyMaleh Glimmer DSL for XML
@@ -1085,7 +1096,7 @@ Keep in mind that all samples live under [https://github.com/AndyObtiva/glimmer-
1085
1096
 
1086
1097
  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
1098
 
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:
1099
+ 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
1100
 
1090
1101
  ```ruby
1091
1102
  include Glimmer
@@ -1271,12 +1282,73 @@ shell {
1271
1282
  }.open
1272
1283
  ```
1273
1284
 
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.
1285
+ 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
1286
 
1276
1287
  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
1288
 
1278
1289
  https://www.eclipse.org/nebula/
1279
1290
 
1291
+ #### Glimmer GUI DSL Keywords
1292
+
1293
+ 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.
1294
+
1295
+ **Widgets:**
1296
+ - `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)
1297
+ - `browser`: featured in [Hello, Browser!](#hello-browser)
1298
+ - `calendar`: featured in [Hello, Date Time!](#hello-date-time)
1299
+ - `checkbox`: featured in [Hello, Checkbox Group!](#hello-checkbox-group) / [Hello, Checkbox!](#hello-checkbox)
1300
+ - `checkbox_group`: featured in [Hello, Checkbox Group!](#hello-checkbox-group)
1301
+ - `combo`: featured in [Hello, Table!](#hello-table) / [Hello, Combo!](#hello-combo)
1302
+ - `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)
1303
+ - `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)
1304
+ - `date_drop_down`: featured in [Hello, Table!](#hello-table) / [Hello, Date Time!](#hello-date-time)
1305
+ - `group`: featured in [Hello, Group!](#hello-group) / [Contact Manager](#contact-manager)
1306
+ - `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)
1307
+ - `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)
1308
+ - `menu`: featured in [Hello, Menu Bar!](#hello-menu-bar) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Table!](#hello-table)
1309
+ - `menu_bar`: featured in [Hello, Menu Bar!](#hello-menu-bar)
1310
+ - `menu_item`: featured in [Hello, Table!](#hello-table) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Menu Bar!](#hello-menu-bar)
1311
+ - `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)
1312
+ - `radio`: featured in [Hello, Radio!](#hello-radio) / [Hello, Group!](#hello-group)
1313
+ - `radio_group`: featured in [Hello, Radio Group!](#hello-radio-group)
1314
+ - `scrolled_composite`
1315
+ - `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)
1316
+ - `tab_folder`: featured in [Hello, Tab!](#hello-tab)
1317
+ - `tab_item`: featured in [Hello, Tab!](#hello-tab)
1318
+ - `table`: featured in [Hello, Custom Shell!](#hello-custom-shell) / [Hello, Table!](#hello-table) / [Contact Manager](#contact-manager)
1319
+ - `table_column`: featured in [Hello, Table!](#hello-table) / [Hello, Custom Shell!](#hello-custom-shell) / [Contact Manager](#contact-manager)
1320
+ - `text`: featured in [Hello, Computed!](#hello-computed) / [Login](#login) / [Contact Manager](#contact-manager)
1321
+ - `time`: featured in [Hello, Table!](#hello-table) / [Hello, Date Time!](#hello-date-time)
1322
+ - Glimmer::UI::CustomWidget: ability to define any keyword as a custom widget - featured in [Hello, Custom Widget!](#hello-custom-widget)
1323
+ - 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)
1324
+
1325
+ **Layouts:**
1326
+ - `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)
1327
+ - `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)
1328
+ - `fill_layout`: featured in [Hello, Custom Widget!](#hello-custom-widget)
1329
+ - `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)
1330
+
1331
+ **Graphics/Style:**
1332
+ - `color`: featured in [Hello, Custom Widget!](#hello-custom-widget) / [Hello, Menu Bar!](#hello-menu-bar)
1333
+ - `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)
1334
+ - `Point` class used in setting location on widgets
1335
+ - `swt` and `SWT` class to set SWT styles on widgets - featured in [Hello, Custom Shell!](#hello-custom-shell) / [Login](#login) / [Contact Manager](#contact-manager)
1336
+
1337
+ **Data-Binding/Observers:**
1338
+ - `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)
1339
+ - `observe`: featured in [Hello, Table!](#hello-table) / [Tic Tac Toe](#tic-tac-toe)
1340
+ - `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)
1341
+ - `on_modify_text`
1342
+ - `on_key_pressed` (and SWT alias `on_swt_keydown`) - featured in [Login](#login) / [Contact Manager](#contact-manager)
1343
+ - `on_key_released` (and SWT alias `on_swt_keyup`)
1344
+ - `on_mouse_down` (and SWT alias `on_swt_mousedown`)
1345
+ - `on_mouse_up` (and SWT alias `on_swt_mouseup`) - featured in [Hello, Custom Shell!](#hello-custom-shell) / [Contact Manager](#contact-manager)
1346
+
1347
+ **Event loop:**
1348
+ - `display`: featured in [Tic Tac Toe](#tic-tac-toe)
1349
+ - `async_exec`: featured in [Hello, Custom Widget!](#hello-custom-widget) / [Hello, Custom Shell!](#hello-custom-shell)
1350
+
1351
+
1280
1352
  #### SWT Proxies
1281
1353
 
1282
1354
  Glimmer follows Proxy Design Pattern by having Ruby proxy wrappers for all SWT objects:
@@ -1361,9 +1433,11 @@ Dialog is a variation on Shell. It is basically a shell that is modal (blocks wh
1361
1433
 
1362
1434
  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
1435
 
1436
+ Check out [Hello, Dialog!](#hello-dialog) sample to learn more.
1437
+
1364
1438
  ##### message_box
1365
1439
 
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.
1440
+ 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
1441
 
1368
1442
  Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
1369
1443
 
@@ -1477,47 +1551,54 @@ The ampersand symbol indicates the keyboard shortcut key for the menu item (e.g.
1477
1551
  Example of a Menu Bar (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
1478
1552
 
1479
1553
  ```ruby
1480
- shell { |shell_proxy|
1554
+ include Glimmer
1555
+
1556
+ COLORS = [:white, :red, :yellow, :green, :blue, :magenta, :gray, :black]
1557
+
1558
+ shell {
1559
+ grid_layout {
1560
+ margin_width 0
1561
+ margin_height 0
1562
+ }
1563
+
1481
1564
  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!'
1565
+
1566
+ @label = label(:center) {
1567
+ font height: 50
1568
+ text 'Check Out The Menu Bar Above!'
1486
1569
  }
1570
+
1487
1571
  menu_bar {
1488
1572
  menu {
1489
1573
  text '&File'
1490
1574
  menu_item {
1491
- text 'E&xit'
1492
- }
1493
- menu_item(0) {
1494
1575
  text '&New'
1576
+ accelerator :command, :N
1577
+
1495
1578
  on_widget_selected {
1496
- message_box(shell_proxy) {
1497
- text 'New File'
1498
- message 'New File Contents'
1579
+ message_box {
1580
+ text 'New'
1581
+ message 'New file created.'
1499
1582
  }.open
1500
1583
  }
1501
1584
  }
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'
1585
+ menu_item {
1586
+ text '&Open...'
1587
+ accelerator :command, :O
1588
+
1589
+ on_widget_selected {
1590
+ message_box {
1591
+ text 'Open'
1592
+ message 'Opening File...'
1593
+ }.open
1510
1594
  }
1511
1595
  }
1512
- }
1513
- menu {
1514
- text '&History'
1515
1596
  menu {
1516
- text '&Recent'
1597
+ text 'Open &Recent'
1517
1598
  menu_item {
1518
1599
  text 'File 1'
1519
1600
  on_widget_selected {
1520
- message_box(shell_proxy) {
1601
+ message_box {
1521
1602
  text 'File 1'
1522
1603
  message 'File 1 Contents'
1523
1604
  }.open
@@ -1526,13 +1607,167 @@ shell { |shell_proxy|
1526
1607
  menu_item {
1527
1608
  text 'File 2'
1528
1609
  on_widget_selected {
1529
- message_box(shell_proxy) {
1610
+ message_box {
1530
1611
  text 'File 2'
1531
1612
  message 'File 2 Contents'
1532
1613
  }.open
1533
1614
  }
1534
1615
  }
1535
1616
  }
1617
+ menu_item(:separator)
1618
+ menu_item {
1619
+ text 'E&xit'
1620
+
1621
+ on_widget_selected {
1622
+ exit(0)
1623
+ }
1624
+ }
1625
+ }
1626
+ menu {
1627
+ text '&Edit'
1628
+ menu_item {
1629
+ text 'Cut'
1630
+ accelerator :command, :X
1631
+ }
1632
+ menu_item {
1633
+ text 'Copy'
1634
+ accelerator :command, :C
1635
+ }
1636
+ menu_item {
1637
+ text 'Paste'
1638
+ accelerator :command, :V
1639
+ }
1640
+ }
1641
+ menu {
1642
+ text '&Options'
1643
+
1644
+ menu_item(:radio) {
1645
+ text '&Enabled'
1646
+
1647
+ on_widget_selected {
1648
+ @select_one_menu.enabled = true
1649
+ @select_multiple_menu.enabled = true
1650
+ }
1651
+ }
1652
+ @select_one_menu = menu {
1653
+ text '&Select One'
1654
+ enabled false
1655
+
1656
+ menu_item(:radio) {
1657
+ text 'Option 1'
1658
+ }
1659
+ menu_item(:radio) {
1660
+ text 'Option 2'
1661
+ }
1662
+ menu_item(:radio) {
1663
+ text 'Option 3'
1664
+ }
1665
+ }
1666
+ @select_multiple_menu = menu {
1667
+ text '&Select Multiple'
1668
+ enabled false
1669
+
1670
+ menu_item(:check) {
1671
+ text 'Option 4'
1672
+ }
1673
+ menu_item(:check) {
1674
+ text 'Option 5'
1675
+ }
1676
+ menu_item(:check) {
1677
+ text 'Option 6'
1678
+ }
1679
+ }
1680
+ }
1681
+ menu {
1682
+ text '&Format'
1683
+ menu {
1684
+ text '&Background Color'
1685
+ COLORS.each { |color_style|
1686
+ menu_item(:radio) {
1687
+ text color_style.to_s.split('_').map(&:capitalize).join(' ')
1688
+
1689
+ on_widget_selected {
1690
+ @label.background = color_style
1691
+ }
1692
+ }
1693
+ }
1694
+ }
1695
+ menu {
1696
+ text 'Foreground &Color'
1697
+ COLORS.each { |color_style|
1698
+ menu_item(:radio) {
1699
+ text color_style.to_s.split('_').map(&:capitalize).join(' ')
1700
+
1701
+ on_widget_selected {
1702
+ @label.foreground = color_style
1703
+ }
1704
+ }
1705
+ }
1706
+ }
1707
+ }
1708
+ menu {
1709
+ text '&View'
1710
+ menu_item(:radio) {
1711
+ text 'Small'
1712
+
1713
+ on_widget_selected {
1714
+ @label.font = {height: 25}
1715
+ @label.parent.pack
1716
+ }
1717
+ }
1718
+ menu_item(:radio) {
1719
+ text 'Medium'
1720
+ selection true
1721
+
1722
+ on_widget_selected {
1723
+ @label.font = {height: 50}
1724
+ @label.parent.pack
1725
+ }
1726
+ }
1727
+ menu_item(:radio) {
1728
+ text 'Large'
1729
+
1730
+ on_widget_selected {
1731
+ @label.font = {height: 75}
1732
+ @label.parent.pack
1733
+ }
1734
+ }
1735
+ }
1736
+ menu {
1737
+ text '&Help'
1738
+ menu_item {
1739
+ text '&Manual'
1740
+ accelerator :command, :shift, :M
1741
+
1742
+ on_widget_selected {
1743
+ message_box {
1744
+ text 'Manual'
1745
+ message 'Manual Contents'
1746
+ }.open
1747
+ }
1748
+ }
1749
+ menu_item {
1750
+ text '&Tutorial'
1751
+ accelerator :command, :shift, :T
1752
+
1753
+ on_widget_selected {
1754
+ message_box {
1755
+ text 'Tutorial'
1756
+ message 'Tutorial Contents'
1757
+ }.open
1758
+ }
1759
+ }
1760
+ menu_item(:separator)
1761
+ menu_item {
1762
+ text '&Report an Issue...'
1763
+
1764
+ on_widget_selected {
1765
+ message_box {
1766
+ text 'Report an Issue'
1767
+ message 'Reporting an issue...'
1768
+ }.open
1769
+ }
1770
+ }
1536
1771
  }
1537
1772
  }
1538
1773
  }.open
@@ -1541,12 +1776,20 @@ shell { |shell_proxy|
1541
1776
  Example of a Pop Up Context Menu (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
1542
1777
 
1543
1778
  ```ruby
1544
- shell { |shell_proxy|
1779
+ include Glimmer
1780
+
1781
+ shell {
1782
+ grid_layout {
1783
+ margin_width 0
1784
+ margin_height 0
1785
+ }
1786
+
1545
1787
  text 'Hello, Pop Up Context Menu!'
1546
- grid_layout
1788
+
1547
1789
  label {
1548
- font height: 16
1549
- text 'Right-Click To Pop Up a Context Menu'
1790
+ text "Right-Click on the Text to\nPop Up a Context Menu"
1791
+ font height: 50
1792
+
1550
1793
  menu {
1551
1794
  menu {
1552
1795
  text '&History'
@@ -1555,7 +1798,7 @@ shell { |shell_proxy|
1555
1798
  menu_item {
1556
1799
  text 'File 1'
1557
1800
  on_widget_selected {
1558
- message_box(shell_proxy) {
1801
+ message_box {
1559
1802
  text 'File 1'
1560
1803
  message 'File 1 Contents'
1561
1804
  }.open
@@ -1564,13 +1807,34 @@ shell { |shell_proxy|
1564
1807
  menu_item {
1565
1808
  text 'File 2'
1566
1809
  on_widget_selected {
1567
- message_box(shell_proxy) {
1810
+ message_box {
1568
1811
  text 'File 2'
1569
1812
  message 'File 2 Contents'
1570
1813
  }.open
1571
1814
  }
1572
1815
  }
1573
1816
  }
1817
+ menu {
1818
+ text '&Archived'
1819
+ menu_item {
1820
+ text 'File 3'
1821
+ on_widget_selected {
1822
+ message_box {
1823
+ text 'File 3'
1824
+ message 'File 3 Contents'
1825
+ }.open
1826
+ }
1827
+ }
1828
+ menu_item {
1829
+ text 'File 4'
1830
+ on_widget_selected {
1831
+ message_box {
1832
+ text 'File 4'
1833
+ message 'File 4 Contents'
1834
+ }.open
1835
+ }
1836
+ }
1837
+ }
1574
1838
  }
1575
1839
  }
1576
1840
  }
@@ -2025,6 +2289,113 @@ Also, for a reference, check the SWT API:
2025
2289
 
2026
2290
  https://help.eclipse.org/2019-12/nftopic/org.eclipse.platform.doc.isv/reference/api/index.html
2027
2291
 
2292
+
2293
+ ### Canvas Shape DSL
2294
+
2295
+ (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.)
2296
+
2297
+ Glimmer supports drawing graphics directly on a `canvas` widget via SWT (or any widget for that matter though `canvas` is recommended for drawing).
2298
+
2299
+ 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.
2300
+
2301
+ Shape keywords 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):
2302
+ - `arc​(int x, int y, int width, int height, int startAngle, int arcAngle)`
2303
+ - `focus​(int x, int y, int width, int height)`
2304
+ - `image(Image image, int x, int y)`
2305
+ - `line(int x1, int y1, int x2, int y2)`
2306
+ - `oval(int x, int y, int width, int height)`
2307
+ - `point​(int x, int y)`
2308
+ - `polygon(int[] pointArray)`
2309
+ - `polyline(int[] pointArray)`
2310
+ - `rectangle(int x, int y, int width, int height)`
2311
+ - `round_rectangle(int x, int y, int width, int height, int arcWidth, int arcHeight)`
2312
+ - `gradiant_rectangle​(int x, int y, int width, int height, boolean vertical)`
2313
+ - `text(String string, int x, int y)`
2314
+
2315
+ Shape keywords that can be filled with color can take an additional keyword argument `fill: true`
2316
+
2317
+ 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.
2318
+
2319
+ Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
2320
+
2321
+ ```ruby
2322
+ include Glimmer
2323
+
2324
+ shell {
2325
+ text 'Canvas Example!'
2326
+ minimum_size 320, 400
2327
+
2328
+ canvas {
2329
+ background :yellow
2330
+ rectangle(0, 0, 220, 400, fill: true) {
2331
+ background :red
2332
+ }
2333
+ round_rectangle(50, 20, 300, 150, 30, 50, fill: true) {
2334
+ background :magenta
2335
+ }
2336
+ gradient_rectangle(150, 200, 100, 70, true, fill: true) {
2337
+ background :dark_magenta
2338
+ foreground :yellow
2339
+ }
2340
+ rectangle(200, 80, 108, 36) {
2341
+ foreground color(:dark_blue)
2342
+ }
2343
+ }
2344
+ }.open
2345
+ ```
2346
+
2347
+ Learn more at the [Hello, Canvas! Sample](#hello-canvas).
2348
+
2349
+ ### Canvas Animation DSL
2350
+
2351
+ (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.)
2352
+
2353
+ Glimmer additionally provides built-in support for animations via a declarative Animation DSL, another sub-DSL of the Glimmer GUI DSL.
2354
+
2355
+ Animations take advantage of multi-threading, each animation runs in its own independent thread of execution while updating the GUI asynchronously.
2356
+
2357
+ This example says it all (it moves a tiny red square across a blue background):
2358
+
2359
+ ```ruby
2360
+ include Glimmer
2361
+
2362
+ shell {
2363
+ text 'Canvas Animation Example!'
2364
+ minimum_size 400, 400
2365
+
2366
+ canvas {
2367
+ animation {
2368
+ every 0.1
2369
+
2370
+ frame { |index|
2371
+ background rgb(index%100, index%100 + 100, index%55 + 200)
2372
+ rectangle(index, index, 20, 20, fill: true) {
2373
+ background :red
2374
+ }
2375
+ }
2376
+ }
2377
+ }
2378
+ }.open
2379
+ ```
2380
+
2381
+ Keywords involved:
2382
+ - `animation` declares an animation under a canvas, which renders frames indefinitely or finitely depending on properties
2383
+ - `every` specifies delay in seconds between every two frame renders
2384
+ - `frame` a block that can contain Shape DSL syntax that is rendered dynamically with variables calculated on the fly
2385
+ - `cycle` a property that takes an array to cycle into a second variable for the `frame` block
2386
+ - `cycle_count` an optional cycle count limit after which the animation stops
2387
+ - `frame_count` an optional frame count limit after which the animation stops
2388
+ - `started` a boolean indicating if the animation is started right away or stopped waiting for manual startup via `#start` method
2389
+
2390
+ API:
2391
+ - `#start` starts animation as a method on the animation object (returned from `animation` keyword)
2392
+ - `#stop` stops animation gracefully as a method on the animation object (returned from `animation` keyword)
2393
+
2394
+ Caveat:
2395
+ In order for animation to occur, the frame block must include changes that happen directly on the canvas (like setting initial background updating every frame) not just changes to shapes. This should be fixed in the future.
2396
+
2397
+ Learn more at the [Hello, Canvas Animation! Sample](#hello-canvas-animation).
2398
+
2028
2399
  ### Data-Binding
2029
2400
 
2030
2401
  Data-binding is done with `bind` command following widget property to bind and taking model and bindable attribute as arguments.
@@ -2374,7 +2745,7 @@ shell {
2374
2745
 
2375
2746
  Check out [Hello, Table!](#hello-table) for an actual example including table editors.
2376
2747
 
2377
- [Are We There Yet?](#are-we-there-yet) is an actual production Glimmer application that takes full advantage of table capabilities.
2748
+ [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
2749
 
2379
2750
  ##### Table Sorting
2380
2751
 
@@ -3286,15 +3657,14 @@ Glimmer Meta-Sample Code Example:
3286
3657
 
3287
3658
  ```ruby
3288
3659
  # ...
3289
- code_text {
3290
- text bind(SampleDirectory, 'selected_sample.content')
3291
- editable false
3292
- caret nil
3660
+ @code_text = code_text {
3661
+ text bind(SampleDirectory, 'selected_sample.code', read_only: true)
3662
+ editable bind(SampleDirectory, 'selected_sample.editable')
3293
3663
  }
3294
3664
  # ...
3295
3665
  ```
3296
3666
 
3297
- 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.
3667
+ 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.
3298
3668
 
3299
3669
  #### Video Widget
3300
3670
 
@@ -3625,7 +3995,7 @@ https://www.eclipse.org/nebula/
3625
3995
 
3626
3996
  ## Samples
3627
3997
 
3628
- Check the [samples](samples) directory in [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) for examples on how to write Glimmer applications. To run a sample, make sure to install the `glimmer` gem first and then use the `glimmer` command to run it (alternatively, you may clone the repo, follow [CONTRIBUTING.md](CONTRIBUTING.md) instructions, and run samples locally with development glimmer command: `bin/glimmer`).
3998
+ Check the [samples](samples) directory in [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) for examples on how to write Glimmer applications. To run a sample, make sure to install the `glimmer` gem first and then use the `glimmer samples` command to run it (alternatively, you may clone the repo, follow [CONTRIBUTING.md](CONTRIBUTING.md) instructions, and run samples locally with development glimmer command: `bin/glimmer`).
3629
3999
 
3630
4000
  You may run any sample via this command:
3631
4001
 
@@ -3637,6 +4007,8 @@ This brings up the [Glimmer Meta-Sample (The Sample of Samples)](samples/elabora
3637
4007
 
3638
4008
  ![Glimmer Meta-Sample](images/glimmer-meta-sample.png)
3639
4009
 
4010
+ 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.
4011
+
3640
4012
  ### Hello Samples
3641
4013
 
3642
4014
  For hello-type simple samples, check the following.
@@ -3732,15 +4104,47 @@ Code:
3732
4104
 
3733
4105
  #### Hello, Menu Bar!
3734
4106
 
3735
- This sample demonstrates menus in Glimmer.
4107
+ This sample demonstrates menus in Glimmer, including accelerators on the Mac.
3736
4108
 
3737
4109
  Code:
3738
4110
 
3739
4111
  [samples/hello/hello_menu_bar.rb](samples/hello/hello_menu_bar.rb)
3740
4112
 
3741
4113
  ![Hello Menu Bar](images/glimmer-hello-menu-bar.png)
4114
+
3742
4115
  ![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)
4116
+
4117
+ The Mac Menu includes Accelerator Keys (keyboard shortcuts).
4118
+
4119
+ ![Hello Menu Bar File Menu Mac Accelerators](images/glimmer-hello-menu-bar-file-menu-mac-accelerators.png)
4120
+
4121
+ ![Hello Menu Bar Edit Menu](images/glimmer-hello-menu-bar-edit-menu.png)
4122
+
4123
+ The Mac Menu includes Accelerator Keys (keyboard shortcuts).
4124
+
4125
+ ![Hello Menu Bar Edit Menu Mac Accelerators](images/glimmer-hello-menu-bar-edit-menu-mac-accelerators.png)
4126
+
4127
+ ![Hello Menu Bar Options Menu Disabled](images/glimmer-hello-menu-bar-options-menu-disabled.png)
4128
+
4129
+ ![Hello Menu Bar Options Menu Select One](images/glimmer-hello-menu-bar-options-menu-select-one.png)
4130
+
4131
+ ![Hello Menu Bar Options Menu Select Multiple](images/glimmer-hello-menu-bar-options-menu-select-multiple.png)
4132
+
4133
+ ![Hello Menu Bar Format Menu Background Color](images/glimmer-hello-menu-bar-format-menu-background-color.png)
4134
+
4135
+ ![Hello Menu Bar Format Menu Foreground Color](images/glimmer-hello-menu-bar-format-menu-foreground-color.png)
4136
+
4137
+ ![Hello Menu Bar View Menu](images/glimmer-hello-menu-bar-view-menu.png)
4138
+
4139
+ ![Hello Menu Bar View Small](images/glimmer-hello-menu-bar-view-small.png)
4140
+
4141
+ ![Hello Menu Bar View Large](images/glimmer-hello-menu-bar-view-large.png)
4142
+
4143
+ ![Hello Menu Bar Help Menu](images/glimmer-hello-menu-bar-help-menu.png)
4144
+
4145
+ The Mac Menu includes Accelerator Keys (keyboard shortcuts) and Mac built-in Search.
4146
+
4147
+ ![Hello Menu Bar Help Menu Mac Accelerators](images/glimmer-hello-menu-bar-help-menu-mac-accelerators.png)
3744
4148
 
3745
4149
  #### Hello, Pop Up Context Menu!
3746
4150
 
@@ -4048,6 +4452,50 @@ Hello, Link! Clicked
4048
4452
 
4049
4453
  ![Hello Link Clicked](images/glimmer-hello-link-clicked.png)
4050
4454
 
4455
+ #### Hello, Dialog!
4456
+
4457
+ 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).
4458
+
4459
+ Code:
4460
+
4461
+ [samples/hello/hello_dialog.rb](samples/hello/hello_dialog.rb)
4462
+
4463
+ Hello, Dialog!
4464
+
4465
+ ![Hello Dialog](images/glimmer-hello-dialog.png)
4466
+
4467
+ Hello, Dialog! Open Dialog
4468
+
4469
+ ![Hello Dialog Open Dialog](images/glimmer-hello-dialog-open-dialog.png)
4470
+
4471
+ #### Hello, Canvas!
4472
+
4473
+ This sample demonstrates the use of the `canvas` widget and [Shape DSL](#canvas-shape-dsl) in Glimmer.
4474
+
4475
+ Code:
4476
+
4477
+ [samples/hello/hello_canvas.rb](samples/hello/hello_canvas.rb)
4478
+
4479
+ Hello, Canvas!
4480
+
4481
+ ![Hello Canvas](images/glimmer-hello-canvas.png)
4482
+
4483
+ #### Hello, Canvas Animation!
4484
+
4485
+ This sample demonstrates the use of the `canvas` widget and [Animation DSL](#canvas-animation-dsl) in Glimmer.
4486
+
4487
+ Code:
4488
+
4489
+ [samples/hello/hello_canvas_animation.rb](samples/hello/hello_canvas_animation.rb)
4490
+
4491
+ Hello, Canvas Animation!
4492
+
4493
+ ![Hello Canvas Animation](images/glimmer-hello-canvas-animation.png)
4494
+
4495
+ Hello, Canvas Animation Another Frame!
4496
+
4497
+ ![Hello Canvas Animation Frame 2](images/glimmer-hello-canvas-animation-frame2.png)
4498
+
4051
4499
  ### Elaborate Samples
4052
4500
 
4053
4501
  For more elaborate samples, check the following:
@@ -4367,7 +4815,7 @@ Here is a list of notable 3rd party gems used by Glimmer:
4367
4815
 
4368
4816
  ## Glimmer Process
4369
4817
 
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.
4818
+ [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
4819
 
4372
4820
  Learn more by reading the [GPG](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md) (Glimmer Process Guidelines)
4373
4821
 
@@ -4437,7 +4885,7 @@ If your company would like to invest fulltime in further development of the Glim
4437
4885
 
4438
4886
  [MIT](LICENSE.txt)
4439
4887
 
4440
- Copyright (c) 2007-2020 - Andy Maleh.
4888
+ Copyright (c) 2007-2021 - Andy Maleh.
4441
4889
 
4442
4890
  --
4443
4891