glimmer-dsl-swt 4.20.15.3 → 4.21.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/README.md +12 -11
- data/RUBY_VERSION +1 -1
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +107 -101
- data/docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md +80 -90
- 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/rake_task/package.rb +20 -22
- data/lib/glimmer/rake_task/scaffold.rb +45 -28
- data/lib/glimmer/swt/custom/shape/oval.rb +0 -4
- data/lib/glimmer/swt/image_proxy.rb +3 -3
- data/lib/glimmer/swt/shell_proxy.rb +1 -1
- 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
- data/vendor/swt/linux/swt.jar +0 -0
- data/vendor/swt/linux_aarch64/swt.jar +0 -0
- data/vendor/swt/mac/swt.jar +0 -0
- data/vendor/swt/mac_aarch64/swt.jar +0 -0
- data/vendor/swt/windows/swt.jar +0 -0
- metadata +23 -9
@@ -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
|
|