glimmer-dsl-swt 4.20.15.3 → 4.20.15.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +7 -7
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +107 -101
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/glimmer/dsl/swt/custom_widget_expression.rb +1 -0
- data/lib/glimmer/swt/custom/shape/oval.rb +0 -4
- data/lib/glimmer/ui/custom_widget.rb +5 -0
- data/samples/hello/hello_canvas.rb +25 -25
- data/samples/hello/hello_canvas_path.rb +10 -10
- data/samples/hello/hello_tray_item.rb +8 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8641fc7b39d8a829136d03ed973752cc511a866cc0425b04f55619972e531c0c
|
4
|
+
data.tar.gz: 5f0f736617be7472209692a6a965a28e7a0f429acdf0461b6e382934056acc57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7be9776847bf7206a911bdc0984197f67baf827ae49f5f7e2e7122cbe79ba45aea92c9e50c48291351ccc781d8805eced2114760ad3bba10c9ea3f882a8e19f
|
7
|
+
data.tar.gz: febda452930f7f883c900f410ad71100871d8848a6a1125ac61536772b875314b7bc424524dcb503adc8e7a9732069bfb56a9e54673abb2f481989edfd2c6485
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
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.20.15.
|
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.20.15.4
|
2
2
|
## JRuby Desktop Development GUI Framework
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
|
4
4
|
[![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
|
@@ -10,12 +10,12 @@
|
|
10
10
|
|
11
11
|
**(The Original Glimmer Library Handling the World’s Ruby GUI Needs Since 2007. Beware of Imitators!)**
|
12
12
|
|
13
|
-
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for SWT is a native-GUI cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster JVM version of [Ruby](https://www.ruby-lang.org/en/). [Glimmer](https://github.com/AndyObtiva/glimmer)'s main innovation is a declarative [Ruby DSL](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#glimmer-dsl-syntax) that enables productive and efficient authoring of desktop application user-interfaces by 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](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#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
|
13
|
+
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for SWT is a native-GUI cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster JVM version of [Ruby](https://www.ruby-lang.org/en/). [Glimmer](https://github.com/AndyObtiva/glimmer)'s main innovation is a declarative [Ruby DSL](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#glimmer-dsl-syntax) that enables productive and efficient authoring of desktop application user-interfaces by 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](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#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 afterwards. Not only does Glimmer provide a large set of GUI [widgets](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#widgets), but it also supports drawing Canvas Graphics like [Shapes](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#canvas-shape-dsl) and [Animations](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#canvas-animation-dsl). To get started quickly, [Glimmer](https://rubygems.org/gems/glimmer) offers [scaffolding](docs/reference/GLIMMER_COMMAND.md#scaffolding) options for [Apps](#in-production), [Gems](docs/reference/GLIMMER_COMMAND.md#custom-shell-gem), and [Custom Widgets](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#custom-widgets). [Glimmer](https://rubygems.org/gems/glimmer) also includes native-executable [packaging](docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md) 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), MSI/EXE files on [Windows](https://www.microsoft.com/en-ca/windows), and [Gems](docs/reference/GLIMMER_COMMAND.md#packaging) on [Linux](https://www.linux.org/). [Glimmer](https://github.com/AndyObtiva/glimmer) was the [first Ruby gem](https://rubygems.org/gems/glimmer) to bring [SWT](https://www.eclipse.org/swt/) (Standard Widget Toolkit) to [Ruby](https://www.ruby-lang.org/en/), thanks to creator [Andy Maleh](https://andymaleh.blogspot.com/), EclipseCon/EclipseWorld/RubyConf speaker.
|
14
14
|
|
15
15
|
[<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
|
16
16
|
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)
|
17
17
|
|
18
|
-
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.15.
|
18
|
+
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.15.4 includes [SWT 4.20](https://download.eclipse.org/eclipse/downloads/drops4/R-4.20-202106111600/), which was released on June 11, 2021. 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. Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested in Glimmer DSL for SWT yet, so deem its support experimental for the time being without guarantees for functionality until declared otherwise (please report any issues you may encounter).
|
19
19
|
|
20
20
|
**Starting in version 4.20.0.0, [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) comes with the new [***Shine***](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#shine) syntax** for highly intuitive and visually expressive View/Model Attribute Mapping, relying on `<=>` for bidirectional (two-way) data-binding and `<=` for unidirectional (one-way) data-binding, providing an alternative to the `bind` keyword (keep in mind that it is still a beta, so default back to `bind` whenever needed).
|
21
21
|
|
@@ -321,7 +321,7 @@ jgem install glimmer-dsl-swt
|
|
321
321
|
|
322
322
|
Or this command if you want a specific version:
|
323
323
|
```
|
324
|
-
jgem install glimmer-dsl-swt -v 4.20.15.
|
324
|
+
jgem install glimmer-dsl-swt -v 4.20.15.4
|
325
325
|
```
|
326
326
|
|
327
327
|
`jgem` is JRuby's version of `gem` command.
|
@@ -349,7 +349,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
|
|
349
349
|
|
350
350
|
Add the following to `Gemfile`:
|
351
351
|
```
|
352
|
-
gem 'glimmer-dsl-swt', '~> 4.20.15.
|
352
|
+
gem 'glimmer-dsl-swt', '~> 4.20.15.4'
|
353
353
|
```
|
354
354
|
|
355
355
|
And, then run:
|
@@ -370,7 +370,7 @@ glimmer
|
|
370
370
|
```
|
371
371
|
|
372
372
|
```
|
373
|
-
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.15.
|
373
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.15.4
|
374
374
|
|
375
375
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
376
376
|
|
@@ -546,7 +546,7 @@ Learn more at: [docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md](docs/refer
|
|
546
546
|
|
547
547
|
## App Updates
|
548
548
|
|
549
|
-
Glimmer should have support for automatic (and manual) app updates via the Mac App Store
|
549
|
+
Glimmer should have support for automatic (and manual) app updates via the Mac App Store on the Mac (not tested yet, so contributor help is appreciated). Getting on the App Store requires running the `glimmer package` command with the Mac App Store keys configured as per the [Mac Application Distribution](mac-application-distribution) instructions.
|
550
550
|
|
551
551
|
## Glimmer Supporting Libraries
|
552
552
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.20.15.
|
1
|
+
4.20.15.4
|
@@ -463,12 +463,12 @@ include Glimmer
|
|
463
463
|
text 'Hello, Message Box!'
|
464
464
|
button {
|
465
465
|
text 'Please Click To Win a Surprise'
|
466
|
-
on_widget_selected
|
466
|
+
on_widget_selected do
|
467
467
|
message_box(@shell) {
|
468
468
|
text 'Surprise'
|
469
469
|
message "Congratulations!\n\nYou have won $1,000,000!"
|
470
470
|
}.open
|
471
|
-
|
471
|
+
end
|
472
472
|
}
|
473
473
|
}
|
474
474
|
@shell.open
|
@@ -502,9 +502,9 @@ automatically uses the `display` created earlier without having to explicitly ho
|
|
502
502
|
```ruby
|
503
503
|
@display = display {
|
504
504
|
cursor_location 300, 300
|
505
|
-
on_swt_keydown
|
505
|
+
on_swt_keydown do
|
506
506
|
# ...
|
507
|
-
|
507
|
+
end
|
508
508
|
# ...
|
509
509
|
}
|
510
510
|
@shell = shell { # uses display created above
|
@@ -607,52 +607,52 @@ shell {
|
|
607
607
|
text '&New'
|
608
608
|
accelerator :command, :N
|
609
609
|
|
610
|
-
on_widget_selected
|
610
|
+
on_widget_selected do
|
611
611
|
message_box {
|
612
612
|
text 'New'
|
613
613
|
message 'New file created.'
|
614
614
|
}.open
|
615
|
-
|
615
|
+
end
|
616
616
|
}
|
617
617
|
menu_item {
|
618
618
|
text '&Open...'
|
619
619
|
accelerator :command, :O
|
620
620
|
|
621
|
-
on_widget_selected
|
621
|
+
on_widget_selected do
|
622
622
|
message_box {
|
623
623
|
text 'Open'
|
624
624
|
message 'Opening File...'
|
625
625
|
}.open
|
626
|
-
|
626
|
+
end
|
627
627
|
}
|
628
628
|
menu {
|
629
629
|
text 'Open &Recent'
|
630
630
|
menu_item {
|
631
631
|
text 'File 1'
|
632
|
-
on_widget_selected
|
632
|
+
on_widget_selected do
|
633
633
|
message_box {
|
634
634
|
text 'File 1'
|
635
635
|
message 'File 1 Contents'
|
636
636
|
}.open
|
637
|
-
|
637
|
+
end
|
638
638
|
}
|
639
639
|
menu_item {
|
640
640
|
text 'File 2'
|
641
|
-
on_widget_selected
|
641
|
+
on_widget_selected do
|
642
642
|
message_box {
|
643
643
|
text 'File 2'
|
644
644
|
message 'File 2 Contents'
|
645
645
|
}.open
|
646
|
-
|
646
|
+
end
|
647
647
|
}
|
648
648
|
}
|
649
649
|
menu_item(:separator)
|
650
650
|
menu_item {
|
651
651
|
text 'E&xit'
|
652
652
|
|
653
|
-
on_widget_selected
|
653
|
+
on_widget_selected do
|
654
654
|
exit(0)
|
655
|
-
|
655
|
+
end
|
656
656
|
}
|
657
657
|
}
|
658
658
|
menu {
|
@@ -676,10 +676,10 @@ shell {
|
|
676
676
|
menu_item(:radio) {
|
677
677
|
text '&Enabled'
|
678
678
|
|
679
|
-
on_widget_selected
|
679
|
+
on_widget_selected do
|
680
680
|
@select_one_menu.enabled = true
|
681
681
|
@select_multiple_menu.enabled = true
|
682
|
-
|
682
|
+
end
|
683
683
|
}
|
684
684
|
@select_one_menu = menu {
|
685
685
|
text '&Select One'
|
@@ -718,9 +718,9 @@ shell {
|
|
718
718
|
menu_item(:radio) {
|
719
719
|
text color_style.to_s.split('_').map(&:capitalize).join(' ')
|
720
720
|
|
721
|
-
on_widget_selected
|
721
|
+
on_widget_selected do
|
722
722
|
@label.background = color_style
|
723
|
-
|
723
|
+
end
|
724
724
|
}
|
725
725
|
}
|
726
726
|
}
|
@@ -730,9 +730,9 @@ shell {
|
|
730
730
|
menu_item(:radio) {
|
731
731
|
text color_style.to_s.split('_').map(&:capitalize).join(' ')
|
732
732
|
|
733
|
-
on_widget_selected
|
733
|
+
on_widget_selected do
|
734
734
|
@label.foreground = color_style
|
735
|
-
|
735
|
+
end
|
736
736
|
}
|
737
737
|
}
|
738
738
|
}
|
@@ -742,27 +742,27 @@ shell {
|
|
742
742
|
menu_item(:radio) {
|
743
743
|
text 'Small'
|
744
744
|
|
745
|
-
on_widget_selected
|
745
|
+
on_widget_selected do
|
746
746
|
@label.font = {height: 25}
|
747
747
|
@label.parent.pack
|
748
|
-
|
748
|
+
end
|
749
749
|
}
|
750
750
|
menu_item(:radio) {
|
751
751
|
text 'Medium'
|
752
752
|
selection true
|
753
753
|
|
754
|
-
on_widget_selected
|
754
|
+
on_widget_selected do
|
755
755
|
@label.font = {height: 50}
|
756
756
|
@label.parent.pack
|
757
|
-
|
757
|
+
end
|
758
758
|
}
|
759
759
|
menu_item(:radio) {
|
760
760
|
text 'Large'
|
761
761
|
|
762
|
-
on_widget_selected
|
762
|
+
on_widget_selected do
|
763
763
|
@label.font = {height: 75}
|
764
764
|
@label.parent.pack
|
765
|
-
|
765
|
+
end
|
766
766
|
}
|
767
767
|
}
|
768
768
|
menu {
|
@@ -771,34 +771,34 @@ shell {
|
|
771
771
|
text '&Manual'
|
772
772
|
accelerator :command, :shift, :M
|
773
773
|
|
774
|
-
on_widget_selected
|
774
|
+
on_widget_selected do
|
775
775
|
message_box {
|
776
776
|
text 'Manual'
|
777
777
|
message 'Manual Contents'
|
778
778
|
}.open
|
779
|
-
|
779
|
+
end
|
780
780
|
}
|
781
781
|
menu_item {
|
782
782
|
text '&Tutorial'
|
783
783
|
accelerator :command, :shift, :T
|
784
784
|
|
785
|
-
on_widget_selected
|
785
|
+
on_widget_selected do
|
786
786
|
message_box {
|
787
787
|
text 'Tutorial'
|
788
788
|
message 'Tutorial Contents'
|
789
789
|
}.open
|
790
|
-
|
790
|
+
end
|
791
791
|
}
|
792
792
|
menu_item(:separator)
|
793
793
|
menu_item {
|
794
794
|
text '&Report an Issue...'
|
795
795
|
|
796
|
-
on_widget_selected
|
796
|
+
on_widget_selected do
|
797
797
|
message_box {
|
798
798
|
text 'Report an Issue'
|
799
799
|
message 'Reporting an issue...'
|
800
800
|
}.open
|
801
|
-
|
801
|
+
end
|
802
802
|
}
|
803
803
|
}
|
804
804
|
}
|
@@ -829,42 +829,42 @@ shell {
|
|
829
829
|
text '&Recent'
|
830
830
|
menu_item {
|
831
831
|
text 'File 1'
|
832
|
-
on_widget_selected
|
832
|
+
on_widget_selected do
|
833
833
|
message_box {
|
834
834
|
text 'File 1'
|
835
835
|
message 'File 1 Contents'
|
836
836
|
}.open
|
837
|
-
|
837
|
+
end
|
838
838
|
}
|
839
839
|
menu_item {
|
840
840
|
text 'File 2'
|
841
|
-
on_widget_selected
|
841
|
+
on_widget_selected do
|
842
842
|
message_box {
|
843
843
|
text 'File 2'
|
844
844
|
message 'File 2 Contents'
|
845
845
|
}.open
|
846
|
-
|
846
|
+
end
|
847
847
|
}
|
848
848
|
}
|
849
849
|
menu {
|
850
850
|
text '&Archived'
|
851
851
|
menu_item {
|
852
852
|
text 'File 3'
|
853
|
-
on_widget_selected
|
853
|
+
on_widget_selected do
|
854
854
|
message_box {
|
855
855
|
text 'File 3'
|
856
856
|
message 'File 3 Contents'
|
857
857
|
}.open
|
858
|
-
|
858
|
+
end
|
859
859
|
}
|
860
860
|
menu_item {
|
861
861
|
text 'File 4'
|
862
|
-
on_widget_selected
|
862
|
+
on_widget_selected do
|
863
863
|
message_box {
|
864
864
|
text 'File 4'
|
865
865
|
message 'File 4 Contents'
|
866
866
|
}.open
|
867
|
-
|
867
|
+
end
|
868
868
|
}
|
869
869
|
}
|
870
870
|
}
|
@@ -933,24 +933,24 @@ Example code:
|
|
933
933
|
menu_item {
|
934
934
|
text 'Exit'
|
935
935
|
|
936
|
-
on_widget_selected
|
936
|
+
on_widget_selected do
|
937
937
|
exit(0)
|
938
|
-
|
938
|
+
end
|
939
939
|
}
|
940
940
|
}
|
941
941
|
|
942
942
|
# supported tray item listeners (you can try to add actions to them when needed)
|
943
|
-
# on_swt_Show
|
944
|
-
#
|
943
|
+
# on_swt_Show do
|
944
|
+
# end
|
945
945
|
#
|
946
|
-
# on_swt_Hide
|
947
|
-
#
|
946
|
+
# on_swt_Hide do
|
947
|
+
# end
|
948
948
|
#
|
949
|
-
# on_widget_selected
|
950
|
-
#
|
949
|
+
# on_widget_selected do
|
950
|
+
# end
|
951
951
|
#
|
952
|
-
# on_menu_detected
|
953
|
-
#
|
952
|
+
# on_menu_detected do
|
953
|
+
# end
|
954
954
|
}
|
955
955
|
|
956
956
|
label(:center) {
|
@@ -1042,9 +1042,9 @@ shell {
|
|
1042
1042
|
h1 { "Hello, World!" }
|
1043
1043
|
}
|
1044
1044
|
}
|
1045
|
-
on_completed
|
1045
|
+
on_completed do # on load of the page execute this JavaScript
|
1046
1046
|
@browser.swt_widget.execute("alert('Hello, World!');")
|
1047
|
-
|
1047
|
+
end
|
1048
1048
|
}
|
1049
1049
|
}.open
|
1050
1050
|
```
|
@@ -1715,7 +1715,7 @@ shell {
|
|
1715
1715
|
canvas {
|
1716
1716
|
background :dark_yellow
|
1717
1717
|
|
1718
|
-
on_paint_control
|
1718
|
+
on_paint_control do |paint_event|
|
1719
1719
|
gc = paint_event.gc
|
1720
1720
|
|
1721
1721
|
gc.background = color(:dark_red).swt_color
|
@@ -1737,7 +1737,7 @@ shell {
|
|
1737
1737
|
gc.draw_rectangle(200, 80, 108, 36)
|
1738
1738
|
|
1739
1739
|
gc.draw_image(image_object.swt_image, 70, 50)
|
1740
|
-
|
1740
|
+
end
|
1741
1741
|
}
|
1742
1742
|
}.open
|
1743
1743
|
```
|
@@ -1987,15 +1987,15 @@ shell {
|
|
1987
1987
|
text 'Pixel Graphics Example'
|
1988
1988
|
|
1989
1989
|
canvas {
|
1990
|
-
on_paint_control
|
1990
|
+
on_paint_control do |paint_event|
|
1991
1991
|
gc = paint_event.gc
|
1992
|
-
250.times
|
1993
|
-
250.times
|
1992
|
+
250.times do |y|
|
1993
|
+
250.times do |x|
|
1994
1994
|
gc.foreground = Color.new(y%255, x%255, (x+y)%255)
|
1995
1995
|
gc.draw_point(x, y)
|
1996
|
-
|
1997
|
-
|
1998
|
-
|
1996
|
+
end
|
1997
|
+
end
|
1998
|
+
end
|
1999
1999
|
}
|
2000
2000
|
}.open
|
2001
2001
|
```
|
@@ -2572,9 +2572,9 @@ shell {
|
|
2572
2572
|
}
|
2573
2573
|
items bind(group, :people), column_properties(:name, :age, :adult)
|
2574
2574
|
selection bind(group, :selected_person)
|
2575
|
-
on_mouse_up
|
2575
|
+
on_mouse_up do |event|
|
2576
2576
|
@table.edit_table_item(event.table_item, event.column_index)
|
2577
|
-
|
2577
|
+
end
|
2578
2578
|
}
|
2579
2579
|
}
|
2580
2580
|
```
|
@@ -2886,9 +2886,9 @@ shell {
|
|
2886
2886
|
layout_data :fill, :fill, true, true
|
2887
2887
|
text bind(@tic_tac_toe_board[row, column], :sign)
|
2888
2888
|
enabled bind(@tic_tac_toe_board[row, column], :empty)
|
2889
|
-
on_widget_selected
|
2889
|
+
on_widget_selected do
|
2890
2890
|
@tic_tac_toe_board.mark(row, column)
|
2891
|
-
|
2891
|
+
end
|
2892
2892
|
}
|
2893
2893
|
}
|
2894
2894
|
}
|
@@ -2914,22 +2914,22 @@ shell {
|
|
2914
2914
|
@button1 = button {
|
2915
2915
|
text "Show 2nd Button"
|
2916
2916
|
visible true
|
2917
|
-
on_swt_show
|
2917
|
+
on_swt_show do
|
2918
2918
|
@button2.swt_widget.setVisible(false)
|
2919
|
-
|
2920
|
-
on_widget_selected
|
2919
|
+
end
|
2920
|
+
on_widget_selected do
|
2921
2921
|
@button2.swt_widget.setVisible(true)
|
2922
|
-
|
2922
|
+
end
|
2923
2923
|
}
|
2924
2924
|
@button2 = button {
|
2925
2925
|
text "Show 1st Button"
|
2926
2926
|
visible false
|
2927
|
-
on_swt_show
|
2927
|
+
on_swt_show do
|
2928
2928
|
@button1.swt_widget.setVisible(false)
|
2929
|
-
|
2930
|
-
on_widget_selected
|
2929
|
+
end
|
2930
|
+
on_widget_selected do
|
2931
2931
|
@button1.swt_widget.setVisible(true)
|
2932
|
-
|
2932
|
+
end
|
2933
2933
|
}
|
2934
2934
|
}.open
|
2935
2935
|
```
|
@@ -2948,9 +2948,9 @@ Example (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
|
|
2948
2948
|
text "Hello, World!"
|
2949
2949
|
}
|
2950
2950
|
}
|
2951
|
-
@shell.on_shell_iconified
|
2951
|
+
@shell.on_shell_iconified do
|
2952
2952
|
@shell.close
|
2953
|
-
|
2953
|
+
end
|
2954
2954
|
@shell.open
|
2955
2955
|
```
|
2956
2956
|
|
@@ -2968,10 +2968,10 @@ class TicTacToe
|
|
2968
2968
|
|
2969
2969
|
def initialize
|
2970
2970
|
# ...
|
2971
|
-
observe(@tic_tac_toe_board, :game_status)
|
2971
|
+
observe(@tic_tac_toe_board, :game_status) do |game_status|
|
2972
2972
|
display_win_message if game_status == Board::WIN
|
2973
2973
|
display_draw_message if game_status == Board::DRAW
|
2974
|
-
|
2974
|
+
end
|
2975
2975
|
end
|
2976
2976
|
# ...
|
2977
2977
|
end
|
@@ -2988,10 +2988,10 @@ class TicTacToe
|
|
2988
2988
|
|
2989
2989
|
def initialize
|
2990
2990
|
# ...
|
2991
|
-
observe(@tic_tac_toe_board, :game_status)
|
2991
|
+
observe(@tic_tac_toe_board, :game_status) do |game_status|
|
2992
2992
|
display_win_message if game_status == Board::WIN
|
2993
2993
|
display_draw_message if game_status == Board::DRAW
|
2994
|
-
|
2994
|
+
end
|
2995
2995
|
end
|
2996
2996
|
|
2997
2997
|
def display_win_message
|
@@ -3577,9 +3577,9 @@ class WizardStep
|
|
3577
3577
|
if number < step_count
|
3578
3578
|
button {
|
3579
3579
|
text "Go To Next Step"
|
3580
|
-
on_widget_selected
|
3580
|
+
on_widget_selected do
|
3581
3581
|
body_root.hide
|
3582
|
-
|
3582
|
+
end
|
3583
3583
|
}
|
3584
3584
|
end
|
3585
3585
|
}
|
@@ -3592,22 +3592,22 @@ shell { |app_shell|
|
|
3592
3592
|
@current_step_number = 1
|
3593
3593
|
@wizard_steps = 5.times.map { |n|
|
3594
3594
|
wizard_step(number: n+1, step_count: 5) {
|
3595
|
-
on_swt_hide
|
3595
|
+
on_swt_hide do
|
3596
3596
|
if @current_step_number < 5
|
3597
3597
|
@current_step_number += 1
|
3598
3598
|
app_shell.hide
|
3599
3599
|
@wizard_steps[@current_step_number - 1].open
|
3600
3600
|
end
|
3601
|
-
|
3601
|
+
end
|
3602
3602
|
}
|
3603
3603
|
}
|
3604
3604
|
button {
|
3605
3605
|
text "Start"
|
3606
3606
|
font height: 40
|
3607
|
-
on_widget_selected
|
3607
|
+
on_widget_selected do
|
3608
3608
|
app_shell.hide
|
3609
3609
|
@wizard_steps[@current_step_number - 1].open
|
3610
|
-
|
3610
|
+
end
|
3611
3611
|
}
|
3612
3612
|
}.open
|
3613
3613
|
```
|
@@ -3647,17 +3647,17 @@ shell {
|
|
3647
3647
|
text 'Hello, Drag and Drop!'
|
3648
3648
|
list {
|
3649
3649
|
selection bind(@location, :country)
|
3650
|
-
on_drag_set_data
|
3650
|
+
on_drag_set_data do |event|
|
3651
3651
|
list = event.widget.getControl
|
3652
3652
|
event.data = list.getSelection.first
|
3653
|
-
|
3653
|
+
end
|
3654
3654
|
}
|
3655
3655
|
label(:center) {
|
3656
3656
|
text 'Drag a country here!'
|
3657
3657
|
font height: 20
|
3658
|
-
on_drop
|
3658
|
+
on_drop do |event|
|
3659
3659
|
event.widget.getControl.setText(event.data)
|
3660
|
-
|
3660
|
+
end
|
3661
3661
|
}
|
3662
3662
|
}.open
|
3663
3663
|
```
|
@@ -3824,15 +3824,17 @@ Example (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
|
|
3824
3824
|
|
3825
3825
|
```ruby
|
3826
3826
|
class Example
|
3827
|
-
|
3827
|
+
include Glimmer::UI::CustomShell
|
3828
|
+
|
3829
|
+
before_body do
|
3828
3830
|
display {
|
3829
|
-
on_about
|
3831
|
+
on_about do
|
3830
3832
|
message_box(@shell_proxy) {
|
3831
3833
|
text 'About'
|
3832
3834
|
message 'About Application'
|
3833
3835
|
}.open
|
3834
|
-
|
3835
|
-
on_preferences
|
3836
|
+
end
|
3837
|
+
on_preferences do
|
3836
3838
|
preferences_dialog = dialog {
|
3837
3839
|
text 'Preferences'
|
3838
3840
|
row_layout {
|
@@ -3853,24 +3855,28 @@ class Example
|
|
3853
3855
|
}
|
3854
3856
|
}
|
3855
3857
|
preferences_dialog.open
|
3856
|
-
|
3858
|
+
end
|
3857
3859
|
}
|
3858
|
-
|
3859
|
-
|
3860
|
+
end
|
3861
|
+
|
3862
|
+
body {
|
3863
|
+
shell {
|
3860
3864
|
fill_layout {
|
3861
3865
|
margin_width 15
|
3862
3866
|
margin_height 15
|
3863
3867
|
}
|
3868
|
+
|
3869
|
+
text 'Application Menu Items'
|
3870
|
+
|
3864
3871
|
label {
|
3865
3872
|
text 'Application Menu Items'
|
3866
3873
|
font height: 30
|
3867
3874
|
}
|
3868
|
-
}
|
3869
|
-
|
3870
|
-
end
|
3875
|
+
}
|
3876
|
+
}
|
3871
3877
|
end
|
3872
3878
|
|
3873
|
-
Example.
|
3879
|
+
Example.launch
|
3874
3880
|
```
|
3875
3881
|
|
3876
3882
|
#### App Name and Version
|
@@ -3919,9 +3925,9 @@ Example:
|
|
3919
3925
|
```ruby
|
3920
3926
|
shell {
|
3921
3927
|
# some code
|
3922
|
-
on_swt_show
|
3928
|
+
on_swt_show do
|
3923
3929
|
exit(0)
|
3924
|
-
|
3930
|
+
end
|
3925
3931
|
}
|
3926
3932
|
```
|
3927
3933
|
|
data/glimmer-dsl-swt.gemspec
CHANGED
Binary file
|
@@ -33,10 +33,6 @@ module Glimmer
|
|
33
33
|
# That is because Shape is drawn on a parent as graphics and doesn't have an SWT widget for itself
|
34
34
|
class Shape
|
35
35
|
class Oval < Shape
|
36
|
-
def parameter_names
|
37
|
-
[:x, :y, :width, :height]
|
38
|
-
end
|
39
|
-
|
40
36
|
# checks if shape contains the point denoted by x and y
|
41
37
|
def contain?(x, y)
|
42
38
|
x, y = inverse_transform_point(x, y)
|
@@ -192,6 +192,7 @@ module Glimmer
|
|
192
192
|
observer_registrations.clear
|
193
193
|
end
|
194
194
|
end
|
195
|
+
post_add_content if content.nil?
|
195
196
|
end
|
196
197
|
|
197
198
|
# Subclasses may override to perform post initialization work on an added child
|
@@ -199,6 +200,10 @@ module Glimmer
|
|
199
200
|
# No Op by default
|
200
201
|
end
|
201
202
|
|
203
|
+
def post_add_content
|
204
|
+
Glimmer::UI::CustomWidget.current_custom_widgets.delete(self)
|
205
|
+
end
|
206
|
+
|
202
207
|
def observer_registrations
|
203
208
|
@observer_registrations ||= []
|
204
209
|
end
|
@@ -33,12 +33,12 @@ class HelloCanvas
|
|
33
33
|
end
|
34
34
|
|
35
35
|
after_body do
|
36
|
-
Thread.new
|
36
|
+
Thread.new do
|
37
37
|
'Picasso'.chars.each do |character|
|
38
38
|
sleep(1)
|
39
39
|
self.artist += character
|
40
40
|
end
|
41
|
-
|
41
|
+
end
|
42
42
|
end
|
43
43
|
|
44
44
|
body {
|
@@ -60,7 +60,7 @@ class HelloCanvas
|
|
60
60
|
rectangle([:default, -70], :default, :default, [:default, 1]) {
|
61
61
|
foreground :cyan
|
62
62
|
text {
|
63
|
-
string
|
63
|
+
string <= [self, :artist]
|
64
64
|
x :default, 1 # add 1 pixel to default x (shape centered within parent horizontally)
|
65
65
|
y :default, 1 # add 1 pixel to default y (shape centered within parent vertically)
|
66
66
|
background :yellow
|
@@ -70,16 +70,16 @@ class HelloCanvas
|
|
70
70
|
}
|
71
71
|
rectangle(155, 30) { # width and height are assumed to be the default (calculated from children)
|
72
72
|
foreground :yellow
|
73
|
-
3.times
|
73
|
+
3.times do |n|
|
74
74
|
line(45, 70 + n*10, 65 + n*10, 30 + n*10) {
|
75
75
|
foreground :yellow
|
76
76
|
}
|
77
|
-
|
78
|
-
10.times
|
77
|
+
end
|
78
|
+
10.times do |n|
|
79
79
|
point(15 + n*5, 50 + n*5) {
|
80
80
|
foreground :yellow
|
81
81
|
}
|
82
|
-
|
82
|
+
end
|
83
83
|
polyline(45, 60, 55, 20, 65, 60, 85, 80, 45, 60)
|
84
84
|
image(@image_object, 0, 5)
|
85
85
|
}
|
@@ -107,71 +107,71 @@ class HelloCanvas
|
|
107
107
|
menu_item {
|
108
108
|
text 'Change Background Color...'
|
109
109
|
enabled <=> [self, :selected_shape, on_read: ->(shape) { shape.respond_to?(:background) && shape.background }]
|
110
|
-
on_widget_selected
|
110
|
+
on_widget_selected do
|
111
111
|
@selected_shape&.background = color_dialog.open
|
112
112
|
self.selected_shape = nil
|
113
|
-
|
113
|
+
end
|
114
114
|
}
|
115
115
|
menu_item {
|
116
116
|
text 'Change Background Pattern Color 1...'
|
117
117
|
enabled <=> [self, :selected_shape, on_read: ->(shape) { shape.respond_to?(:background_pattern) && shape.background_pattern }]
|
118
|
-
on_widget_selected
|
118
|
+
on_widget_selected do
|
119
119
|
if @selected_shape
|
120
120
|
background_pattern_args = @selected_shape.background_pattern_args
|
121
121
|
background_pattern_args[5] = color_dialog.open
|
122
122
|
@selected_shape.background_pattern = background_pattern_args
|
123
123
|
self.selected_shape = nil
|
124
124
|
end
|
125
|
-
|
125
|
+
end
|
126
126
|
}
|
127
127
|
menu_item {
|
128
128
|
text 'Change Background Pattern Color 2...'
|
129
129
|
enabled <=> [self, :selected_shape, on_read: ->(shape) { shape.respond_to?(:background_pattern) && shape.background_pattern }]
|
130
|
-
on_widget_selected
|
130
|
+
on_widget_selected do
|
131
131
|
if @selected_shape
|
132
132
|
background_pattern_args = @selected_shape.background_pattern_args
|
133
133
|
background_pattern_args[6] = color_dialog.open
|
134
134
|
@selected_shape.background_pattern = background_pattern_args
|
135
135
|
self.selected_shape = nil
|
136
136
|
end
|
137
|
-
|
137
|
+
end
|
138
138
|
}
|
139
139
|
menu_item(:separator)
|
140
140
|
menu_item {
|
141
141
|
text 'Change Foreground Color...'
|
142
142
|
enabled <=> [self, :selected_shape, on_read: ->(shape) { shape.respond_to?(:foreground) && shape.foreground }]
|
143
|
-
on_widget_selected
|
143
|
+
on_widget_selected do
|
144
144
|
@selected_shape&.foreground = color_dialog.open
|
145
145
|
self.selected_shape = nil
|
146
|
-
|
146
|
+
end
|
147
147
|
}
|
148
148
|
}
|
149
149
|
|
150
|
-
on_mouse_down
|
150
|
+
on_mouse_down do |mouse_event|
|
151
151
|
@drag_detected = false
|
152
152
|
@canvas.cursor = :hand
|
153
153
|
self.selected_shape = @canvas.shape_at_location(mouse_event.x, mouse_event.y)
|
154
|
-
|
154
|
+
end
|
155
155
|
|
156
|
-
on_drag_detected
|
156
|
+
on_drag_detected do |drag_detect_event|
|
157
157
|
@drag_detected = true
|
158
158
|
@drag_current_x = drag_detect_event.x
|
159
159
|
@drag_current_y = drag_detect_event.y
|
160
|
-
|
160
|
+
end
|
161
161
|
|
162
|
-
on_mouse_move
|
162
|
+
on_mouse_move do |mouse_event|
|
163
163
|
if @drag_detected
|
164
164
|
@selected_shape&.move_by(mouse_event.x - @drag_current_x, mouse_event.y - @drag_current_y)
|
165
165
|
@drag_current_x = mouse_event.x
|
166
166
|
@drag_current_y = mouse_event.y
|
167
167
|
end
|
168
|
-
|
168
|
+
end
|
169
169
|
|
170
|
-
on_menu_detected
|
170
|
+
on_menu_detected do |menu_detect_event|
|
171
171
|
@menu_detected = true
|
172
|
-
|
172
|
+
end
|
173
173
|
|
174
|
-
on_mouse_up
|
174
|
+
on_mouse_up do |mouse_event|
|
175
175
|
@canvas.cursor = :arrow
|
176
176
|
@drag_detected = false
|
177
177
|
if @menu_detected
|
@@ -179,7 +179,7 @@ class HelloCanvas
|
|
179
179
|
else
|
180
180
|
self.selected_shape = nil
|
181
181
|
end
|
182
|
-
|
182
|
+
end
|
183
183
|
}
|
184
184
|
}
|
185
185
|
}
|
@@ -37,10 +37,10 @@ shell {
|
|
37
37
|
text 'Regenerate'
|
38
38
|
enabled false
|
39
39
|
|
40
|
-
on_widget_selected
|
40
|
+
on_widget_selected do
|
41
41
|
@regenerate = true
|
42
42
|
@button.enabled = false
|
43
|
-
|
43
|
+
end
|
44
44
|
}
|
45
45
|
canvas {
|
46
46
|
layout_data :fill, :fill, true, true
|
@@ -71,10 +71,10 @@ shell {
|
|
71
71
|
}
|
72
72
|
}
|
73
73
|
|
74
|
-
on_swt_show
|
74
|
+
on_swt_show do
|
75
75
|
@regenerate = true
|
76
|
-
@thread = Thread.new
|
77
|
-
loop
|
76
|
+
@thread = Thread.new do
|
77
|
+
loop do
|
78
78
|
if @regenerate
|
79
79
|
@regenerate = false
|
80
80
|
@path1.clear
|
@@ -107,14 +107,14 @@ shell {
|
|
107
107
|
@button.enabled = true
|
108
108
|
end
|
109
109
|
sleep(0.1)
|
110
|
-
|
110
|
+
end
|
111
111
|
|
112
|
-
|
112
|
+
end
|
113
113
|
|
114
|
-
|
114
|
+
end
|
115
115
|
|
116
|
-
on_widget_disposed
|
116
|
+
on_widget_disposed do
|
117
117
|
@thread.kill # safe to kill since data is in memory only
|
118
|
-
|
118
|
+
end
|
119
119
|
|
120
120
|
}.open
|
@@ -105,17 +105,17 @@ class HelloTrayItem
|
|
105
105
|
}
|
106
106
|
|
107
107
|
# supported tray item listeners (you can try to add actions to them when needed)
|
108
|
-
# on_swt_Show
|
109
|
-
#
|
108
|
+
# on_swt_Show do
|
109
|
+
# end
|
110
110
|
#
|
111
|
-
# on_swt_Hide
|
112
|
-
#
|
111
|
+
# on_swt_Hide do
|
112
|
+
# end
|
113
113
|
#
|
114
|
-
# on_widget_selected
|
115
|
-
#
|
114
|
+
# on_widget_selected do
|
115
|
+
# end
|
116
116
|
#
|
117
|
-
# on_menu_detected
|
118
|
-
#
|
117
|
+
# on_menu_detected do
|
118
|
+
# end
|
119
119
|
}
|
120
120
|
|
121
121
|
label(:center) {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-swt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.20.15.
|
4
|
+
version: 4.20.15.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|