glimmer-dsl-swt 4.20.15.2 → 4.20.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +8 -7
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +107 -101
- data/docs/reference/GLIMMER_SAMPLES.md +1 -1
- data/docs/reference/GLIMMER_STYLE_GUIDE.md +1 -2
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/glimmer/dsl/swt/custom_widget_expression.rb +1 -0
- data/lib/glimmer/launcher.rb +1 -1
- data/lib/glimmer/swt/custom/shape/oval.rb +0 -4
- data/lib/glimmer/ui/custom_widget.rb +5 -0
- data/samples/elaborate/tetris.rb +2 -2
- data/samples/hello/hello_canvas.rb +26 -25
- data/samples/hello/hello_canvas_path.rb +10 -10
- data/samples/hello/hello_progress_bar.rb +4 -4
- data/samples/hello/hello_sash_form.rb +6 -6
- data/samples/hello/hello_text.rb +32 -2
- data/samples/hello/hello_tray_item.rb +8 -8
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82d9785cf890715947534ab665bf4f821cd79d67149e5bf7eb98d461d6457e46
|
4
|
+
data.tar.gz: 89ca9c71b72d865b69b526f3a9f7c1745e38df226ca32a71d800e34e80c35228
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76f88567594af281b05b30a521ec609c8b6ac305870addcd7e018f3cdbae79f1dc7d415900cc047057e4f3f970f14c2f4b46a5db4fa8ede29957d4b1ce42effc
|
7
|
+
data.tar.gz: fa5ee13574ea2c71de9e0d285ff3b4f3a9eea2e068292e6f7b86908f2b1d69e8412e40db28b68d4df9f93dab9ce749e41e50431fccbdbff141a28062330d1f0a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
### 4.20.16.0
|
4
|
+
|
5
|
+
- Fix API of `Glimmer::Launcher` by renaming `#application_paths` to `#application_path`
|
6
|
+
|
7
|
+
### 4.20.15.5
|
8
|
+
|
9
|
+
- Upgrade to glimmer 2.1.5
|
10
|
+
|
11
|
+
### 4.20.15.4
|
12
|
+
|
13
|
+
- Fix issue with not tying observer registrations to custom widgets correctly automatically
|
14
|
+
|
15
|
+
### 4.20.15.3
|
16
|
+
|
17
|
+
- Updated Hello, Text! sample to have a no-border `text` widget
|
18
|
+
|
3
19
|
### 4.20.15.2
|
4
20
|
|
5
21
|
- Fixed `widget#print` support and Hello, Print Dialog! handling of cancellation of printing
|
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.
|
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.16.0
|
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](https://www.eclipse.org/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.
|
18
|
+
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.16.0 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
|
|
@@ -27,6 +27,7 @@ Glimmer DSL gems:
|
|
27
27
|
- [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
|
28
28
|
- [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS
|
29
29
|
- [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)
|
30
|
+
- [glimmer-dsl-libui](https://github.com/AndyObtiva/glimmer-dsl-libui): Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library)
|
30
31
|
|
31
32
|
## Examples
|
32
33
|
|
@@ -321,7 +322,7 @@ jgem install glimmer-dsl-swt
|
|
321
322
|
|
322
323
|
Or this command if you want a specific version:
|
323
324
|
```
|
324
|
-
jgem install glimmer-dsl-swt -v 4.20.
|
325
|
+
jgem install glimmer-dsl-swt -v 4.20.16.0
|
325
326
|
```
|
326
327
|
|
327
328
|
`jgem` is JRuby's version of `gem` command.
|
@@ -349,7 +350,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
|
|
349
350
|
|
350
351
|
Add the following to `Gemfile`:
|
351
352
|
```
|
352
|
-
gem 'glimmer-dsl-swt', '~> 4.20.
|
353
|
+
gem 'glimmer-dsl-swt', '~> 4.20.16.0'
|
353
354
|
```
|
354
355
|
|
355
356
|
And, then run:
|
@@ -370,7 +371,7 @@ glimmer
|
|
370
371
|
```
|
371
372
|
|
372
373
|
```
|
373
|
-
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.
|
374
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.16.0
|
374
375
|
|
375
376
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
376
377
|
|
@@ -546,7 +547,7 @@ Learn more at: [docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md](docs/refer
|
|
546
547
|
|
547
548
|
## App Updates
|
548
549
|
|
549
|
-
Glimmer should have support for automatic (and manual) app updates via the Mac App Store
|
550
|
+
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
551
|
|
551
552
|
## Glimmer Supporting Libraries
|
552
553
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.20.
|
1
|
+
4.20.16.0
|
@@ -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
|
|
@@ -1248,7 +1248,7 @@ Check out a souped up large-card-size packaged version of the game in the [Glimm
|
|
1248
1248
|
|
1249
1249
|
#### Battleship
|
1250
1250
|
|
1251
|
-
This sample demonstrates how to build an interactive board game with
|
1251
|
+
This sample demonstrates how to build an interactive board game with MVC architecture, hybrid canvas widget/shape approach, custom-widgets, data-binding, observers, and widget drag & drop. Note that the A.I. is very simplistic as it is besides the point of this GUI demo, which focuses on leveraging Glimmer DSL for SWT.
|
1252
1252
|
|
1253
1253
|
Code:
|
1254
1254
|
|
@@ -8,8 +8,7 @@
|
|
8
8
|
- Widget property declarations always have arguments and never take a block
|
9
9
|
- Widget property arguments are never wrapped inside parentheses
|
10
10
|
- Widget listeners are always declared starting with `on_` prefix and affixing listener event method name afterwards in underscored lowercase form. Their multi-line blocks rely on the `do; end` style.
|
11
|
-
-
|
12
|
-
- Data-binding is done via `bind` keyword, which always takes arguments wrapped in parentheses
|
11
|
+
- Data-binding can be done via `bind` keyword, which always takes arguments wrapped in parentheses, or using `<=>` and `<=` operators, which expect an array of model/property/options as arguments.
|
13
12
|
- Custom widget/shell/shape `body` blocks open and close with curly braces.
|
14
13
|
- Custom widget/shell/shape `before_body` and `after_body` blocks are declared as `do; end` blocks.
|
15
14
|
- Custom widgets receive additional keyword arguments called options, which come after the SWT styles.
|
data/glimmer-dsl-swt.gemspec
CHANGED
Binary file
|
data/lib/glimmer/launcher.rb
CHANGED
@@ -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
|
data/samples/elaborate/tetris.rb
CHANGED
@@ -72,9 +72,9 @@ class Tetris
|
|
72
72
|
when swt(:arrow_right), 'd'.bytes.first
|
73
73
|
game.right!
|
74
74
|
when swt(:shift), swt(:alt)
|
75
|
-
if key_event.keyLocation == swt(:right) # right
|
75
|
+
if key_event.keyLocation == swt(:right) # right key
|
76
76
|
game.rotate!(:right)
|
77
|
-
elsif key_event.keyLocation == swt(:left) # left
|
77
|
+
elsif key_event.keyLocation == swt(:left) # left key
|
78
78
|
game.rotate!(:left)
|
79
79
|
end
|
80
80
|
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 {
|
@@ -48,6 +48,7 @@ class HelloCanvas
|
|
48
48
|
|
49
49
|
@canvas = canvas {
|
50
50
|
background :yellow
|
51
|
+
|
51
52
|
rectangle(0, 0, 220, 400) {
|
52
53
|
background rgb(255, 0, 0)
|
53
54
|
}
|
@@ -59,7 +60,7 @@ class HelloCanvas
|
|
59
60
|
rectangle([:default, -70], :default, :default, [:default, 1]) {
|
60
61
|
foreground :cyan
|
61
62
|
text {
|
62
|
-
string
|
63
|
+
string <= [self, :artist]
|
63
64
|
x :default, 1 # add 1 pixel to default x (shape centered within parent horizontally)
|
64
65
|
y :default, 1 # add 1 pixel to default y (shape centered within parent vertically)
|
65
66
|
background :yellow
|
@@ -69,16 +70,16 @@ class HelloCanvas
|
|
69
70
|
}
|
70
71
|
rectangle(155, 30) { # width and height are assumed to be the default (calculated from children)
|
71
72
|
foreground :yellow
|
72
|
-
3.times
|
73
|
+
3.times do |n|
|
73
74
|
line(45, 70 + n*10, 65 + n*10, 30 + n*10) {
|
74
75
|
foreground :yellow
|
75
76
|
}
|
76
|
-
|
77
|
-
10.times
|
77
|
+
end
|
78
|
+
10.times do |n|
|
78
79
|
point(15 + n*5, 50 + n*5) {
|
79
80
|
foreground :yellow
|
80
81
|
}
|
81
|
-
|
82
|
+
end
|
82
83
|
polyline(45, 60, 55, 20, 65, 60, 85, 80, 45, 60)
|
83
84
|
image(@image_object, 0, 5)
|
84
85
|
}
|
@@ -106,71 +107,71 @@ class HelloCanvas
|
|
106
107
|
menu_item {
|
107
108
|
text 'Change Background Color...'
|
108
109
|
enabled <=> [self, :selected_shape, on_read: ->(shape) { shape.respond_to?(:background) && shape.background }]
|
109
|
-
on_widget_selected
|
110
|
+
on_widget_selected do
|
110
111
|
@selected_shape&.background = color_dialog.open
|
111
112
|
self.selected_shape = nil
|
112
|
-
|
113
|
+
end
|
113
114
|
}
|
114
115
|
menu_item {
|
115
116
|
text 'Change Background Pattern Color 1...'
|
116
117
|
enabled <=> [self, :selected_shape, on_read: ->(shape) { shape.respond_to?(:background_pattern) && shape.background_pattern }]
|
117
|
-
on_widget_selected
|
118
|
+
on_widget_selected do
|
118
119
|
if @selected_shape
|
119
120
|
background_pattern_args = @selected_shape.background_pattern_args
|
120
121
|
background_pattern_args[5] = color_dialog.open
|
121
122
|
@selected_shape.background_pattern = background_pattern_args
|
122
123
|
self.selected_shape = nil
|
123
124
|
end
|
124
|
-
|
125
|
+
end
|
125
126
|
}
|
126
127
|
menu_item {
|
127
128
|
text 'Change Background Pattern Color 2...'
|
128
129
|
enabled <=> [self, :selected_shape, on_read: ->(shape) { shape.respond_to?(:background_pattern) && shape.background_pattern }]
|
129
|
-
on_widget_selected
|
130
|
+
on_widget_selected do
|
130
131
|
if @selected_shape
|
131
132
|
background_pattern_args = @selected_shape.background_pattern_args
|
132
133
|
background_pattern_args[6] = color_dialog.open
|
133
134
|
@selected_shape.background_pattern = background_pattern_args
|
134
135
|
self.selected_shape = nil
|
135
136
|
end
|
136
|
-
|
137
|
+
end
|
137
138
|
}
|
138
139
|
menu_item(:separator)
|
139
140
|
menu_item {
|
140
141
|
text 'Change Foreground Color...'
|
141
142
|
enabled <=> [self, :selected_shape, on_read: ->(shape) { shape.respond_to?(:foreground) && shape.foreground }]
|
142
|
-
on_widget_selected
|
143
|
+
on_widget_selected do
|
143
144
|
@selected_shape&.foreground = color_dialog.open
|
144
145
|
self.selected_shape = nil
|
145
|
-
|
146
|
+
end
|
146
147
|
}
|
147
148
|
}
|
148
149
|
|
149
|
-
on_mouse_down
|
150
|
+
on_mouse_down do |mouse_event|
|
150
151
|
@drag_detected = false
|
151
152
|
@canvas.cursor = :hand
|
152
153
|
self.selected_shape = @canvas.shape_at_location(mouse_event.x, mouse_event.y)
|
153
|
-
|
154
|
+
end
|
154
155
|
|
155
|
-
on_drag_detected
|
156
|
+
on_drag_detected do |drag_detect_event|
|
156
157
|
@drag_detected = true
|
157
158
|
@drag_current_x = drag_detect_event.x
|
158
159
|
@drag_current_y = drag_detect_event.y
|
159
|
-
|
160
|
+
end
|
160
161
|
|
161
|
-
on_mouse_move
|
162
|
+
on_mouse_move do |mouse_event|
|
162
163
|
if @drag_detected
|
163
164
|
@selected_shape&.move_by(mouse_event.x - @drag_current_x, mouse_event.y - @drag_current_y)
|
164
165
|
@drag_current_x = mouse_event.x
|
165
166
|
@drag_current_y = mouse_event.y
|
166
167
|
end
|
167
|
-
|
168
|
+
end
|
168
169
|
|
169
|
-
on_menu_detected
|
170
|
+
on_menu_detected do |menu_detect_event|
|
170
171
|
@menu_detected = true
|
171
|
-
|
172
|
+
end
|
172
173
|
|
173
|
-
on_mouse_up
|
174
|
+
on_mouse_up do |mouse_event|
|
174
175
|
@canvas.cursor = :arrow
|
175
176
|
@drag_detected = false
|
176
177
|
if @menu_detected
|
@@ -178,7 +179,7 @@ class HelloCanvas
|
|
178
179
|
else
|
179
180
|
self.selected_shape = nil
|
180
181
|
end
|
181
|
-
|
182
|
+
end
|
182
183
|
}
|
183
184
|
}
|
184
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
|
@@ -107,18 +107,18 @@ class HelloProgressBar
|
|
107
107
|
}
|
108
108
|
text "Start"
|
109
109
|
|
110
|
-
on_widget_selected
|
110
|
+
on_widget_selected do
|
111
111
|
# if a previous thread is running, then kill first
|
112
112
|
# (killing is not dangerous since it is only a thread about updating progress)
|
113
113
|
@current_thread&.kill
|
114
|
-
@current_thread = Thread.new
|
114
|
+
@current_thread = Thread.new do
|
115
115
|
@progress_model.selection = @progress_model.minimum
|
116
116
|
(@progress_model.minimum..@progress_model.maximum).to_a.each do |n|
|
117
117
|
@progress_model.selection = n
|
118
118
|
sleep(@progress_model.delay)
|
119
119
|
end
|
120
|
-
|
121
|
-
|
120
|
+
end
|
121
|
+
end
|
122
122
|
}
|
123
123
|
}
|
124
124
|
}
|
@@ -109,9 +109,9 @@ shell {
|
|
109
109
|
foreground :dark_green
|
110
110
|
font height: 16
|
111
111
|
|
112
|
-
on_widget_selected
|
112
|
+
on_widget_selected do
|
113
113
|
@sash_form.maximized_control = @green_label.swt_widget
|
114
|
-
|
114
|
+
end
|
115
115
|
}
|
116
116
|
button {
|
117
117
|
layout_data(:fill, :center, true, false)
|
@@ -119,9 +119,9 @@ shell {
|
|
119
119
|
foreground :red
|
120
120
|
font height: 16
|
121
121
|
|
122
|
-
on_widget_selected
|
122
|
+
on_widget_selected do
|
123
123
|
@sash_form.maximized_control = @red_label.swt_widget
|
124
|
-
|
124
|
+
end
|
125
125
|
}
|
126
126
|
|
127
127
|
button {
|
@@ -131,9 +131,9 @@ shell {
|
|
131
131
|
text 'Maximize None'
|
132
132
|
font height: 16
|
133
133
|
|
134
|
-
on_widget_selected
|
134
|
+
on_widget_selected do
|
135
135
|
@sash_form.maximized_control = nil
|
136
|
-
|
136
|
+
end
|
137
137
|
}
|
138
138
|
}
|
139
139
|
}.open
|
data/samples/hello/hello_text.rb
CHANGED
@@ -1,12 +1,34 @@
|
|
1
|
+
# Copyright (c) 2007-2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
1
22
|
require 'glimmer-dsl-swt'
|
2
23
|
|
3
24
|
class HelloText
|
4
25
|
include Glimmer::UI::CustomShell
|
5
26
|
|
6
|
-
attr_accessor :default, :center, :left, :right, :password, :telephone, :read_only, :wrap, :multi
|
27
|
+
attr_accessor :default, :no_border, :center, :left, :right, :password, :telephone, :read_only, :wrap, :multi
|
7
28
|
|
8
29
|
before_body do
|
9
30
|
self.default = 'default is :border style'
|
31
|
+
self.no_border = 'no border'
|
10
32
|
self.center = 'centered'
|
11
33
|
self.left = 'left-aligned'
|
12
34
|
self.right = 'right-aligned'
|
@@ -32,6 +54,14 @@ class HelloText
|
|
32
54
|
text <=> [self, :default]
|
33
55
|
}
|
34
56
|
|
57
|
+
label {
|
58
|
+
text 'text(:none)'
|
59
|
+
}
|
60
|
+
text(:none) { # no border
|
61
|
+
layout_data :fill, :center, true, false
|
62
|
+
text <=> [self, :no_border]
|
63
|
+
}
|
64
|
+
|
35
65
|
label {
|
36
66
|
text 'text(:center, :border)'
|
37
67
|
}
|
@@ -69,7 +99,7 @@ class HelloText
|
|
69
99
|
}
|
70
100
|
text(:read_only, :border) {
|
71
101
|
layout_data :fill, :center, true, false
|
72
|
-
text
|
102
|
+
text <= [self, :read_only]
|
73
103
|
}
|
74
104
|
|
75
105
|
label {
|
@@ -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,21 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-swt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.20.
|
4
|
+
version: 4.20.16.0
|
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-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
16
|
- - "~>"
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 2.1.
|
18
|
+
version: 2.1.5
|
19
19
|
name: glimmer
|
20
20
|
prerelease: false
|
21
21
|
type: :runtime
|
@@ -23,7 +23,7 @@ dependencies:
|
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.1.
|
26
|
+
version: 2.1.5
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
@@ -362,10 +362,10 @@ description: Glimmer DSL for SWT (JRuby Desktop Development GUI Framework) is a
|
|
362
362
|
started quickly, Glimmer offers scaffolding options for Apps, Gems, and Custom Widgets.
|
363
363
|
Glimmer also includes native-executable packaging support, sorely lacking in other
|
364
364
|
libraries, thus enabling the delivery of desktop apps written in Ruby as truly native
|
365
|
-
DMG/PKG/APP files on the Mac
|
366
|
-
|
367
|
-
|
368
|
-
|
365
|
+
DMG/PKG/APP files on the Mac, MSI/EXE files on Windows, and Gem Packaged Shell Scripts
|
366
|
+
on Linux. Glimmer was the first Ruby gem to bring SWT (Standard Widget Toolkit)
|
367
|
+
to Ruby, thanks to creator Andy Maleh, EclipseCon/EclipseWorld/RubyConf speaker
|
368
|
+
and expert.
|
369
369
|
email: andy.am@gmail.com
|
370
370
|
executables:
|
371
371
|
- glimmer
|