glimmer-dsl-swt 4.18.2.5 → 4.18.3.4
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 +56 -0
- data/README.md +344 -35
- data/VERSION +1 -1
- data/glimmer-dsl-swt.gemspec +13 -7
- data/lib/ext/glimmer/config.rb +24 -7
- data/lib/glimmer/data_binding/table_items_binding.rb +8 -5
- data/lib/glimmer/data_binding/widget_binding.rb +22 -4
- data/lib/glimmer/dsl/swt/dsl.rb +1 -0
- data/lib/glimmer/dsl/swt/image_expression.rb +14 -6
- data/lib/glimmer/dsl/swt/layout_data_expression.rb +4 -4
- data/lib/glimmer/dsl/swt/layout_expression.rb +5 -3
- data/lib/glimmer/dsl/swt/multiply_expression.rb +53 -0
- data/lib/glimmer/dsl/swt/property_expression.rb +4 -2
- data/{samples/elaborate/tetris/view/game_over_dialog.rb → lib/glimmer/dsl/swt/transform_expression.rb} +29 -46
- data/lib/glimmer/swt/custom/drawable.rb +4 -3
- data/lib/glimmer/swt/custom/shape.rb +37 -14
- data/lib/glimmer/swt/directory_dialog_proxy.rb +3 -3
- data/lib/glimmer/swt/display_proxy.rb +26 -5
- data/lib/glimmer/swt/file_dialog_proxy.rb +3 -3
- data/lib/glimmer/swt/image_proxy.rb +68 -1
- data/lib/glimmer/swt/shell_proxy.rb +23 -3
- data/lib/glimmer/swt/table_proxy.rb +31 -7
- data/lib/glimmer/swt/transform_proxy.rb +109 -0
- data/lib/glimmer/swt/widget_listener_proxy.rb +14 -5
- data/lib/glimmer/swt/widget_proxy.rb +7 -3
- data/lib/glimmer/ui/custom_shell.rb +11 -9
- data/lib/glimmer/ui/custom_widget.rb +32 -17
- data/samples/elaborate/meta_sample.rb +81 -24
- data/samples/elaborate/tetris.rb +146 -42
- data/samples/elaborate/tetris/model/game.rb +258 -137
- data/samples/elaborate/tetris/model/past_game.rb +26 -0
- data/samples/elaborate/tetris/model/tetromino.rb +45 -29
- data/samples/elaborate/tetris/view/block.rb +8 -13
- data/samples/elaborate/tetris/view/high_score_dialog.rb +133 -0
- data/samples/elaborate/tetris/view/playfield.rb +1 -1
- data/samples/elaborate/tetris/view/score_lane.rb +11 -11
- data/samples/elaborate/tetris/view/tetris_menu_bar.rb +139 -0
- data/samples/elaborate/tic_tac_toe.rb +4 -4
- data/samples/hello/hello_canvas.rb +4 -4
- data/samples/hello/hello_canvas_animation.rb +3 -3
- data/samples/hello/hello_canvas_transform.rb +40 -0
- data/samples/hello/hello_link.rb +1 -1
- metadata +11 -5
@@ -0,0 +1,139 @@
|
|
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
|
+
|
22
|
+
class Tetris
|
23
|
+
module View
|
24
|
+
class TetrisMenuBar
|
25
|
+
include Glimmer::UI::CustomWidget
|
26
|
+
|
27
|
+
options :game
|
28
|
+
|
29
|
+
body {
|
30
|
+
menu_bar {
|
31
|
+
menu {
|
32
|
+
text '&Game'
|
33
|
+
|
34
|
+
menu_item {
|
35
|
+
text '&Start'
|
36
|
+
enabled bind(game, :game_over)
|
37
|
+
accelerator :command, :s
|
38
|
+
|
39
|
+
on_widget_selected {
|
40
|
+
game.start!
|
41
|
+
}
|
42
|
+
}
|
43
|
+
menu_item(:check) {
|
44
|
+
text '&Pause'
|
45
|
+
accelerator :command, :p
|
46
|
+
enabled bind(game, :game_over, on_read: :!) {|value| value && !game.show_high_scores}
|
47
|
+
enabled bind(game, :show_high_scores, on_read: :!) {|value| value && !game.game_over}
|
48
|
+
selection bind(game, :paused)
|
49
|
+
}
|
50
|
+
menu_item {
|
51
|
+
text '&Restart'
|
52
|
+
accelerator :command, :r
|
53
|
+
|
54
|
+
on_widget_selected {
|
55
|
+
game.restart!
|
56
|
+
}
|
57
|
+
}
|
58
|
+
menu_item(:separator)
|
59
|
+
menu_item {
|
60
|
+
text '&Exit'
|
61
|
+
accelerator :command, :x
|
62
|
+
|
63
|
+
on_widget_selected {
|
64
|
+
parent_proxy.close
|
65
|
+
}
|
66
|
+
}
|
67
|
+
} # end of menu
|
68
|
+
|
69
|
+
menu {
|
70
|
+
text '&View'
|
71
|
+
|
72
|
+
menu {
|
73
|
+
text '&High Scores'
|
74
|
+
menu_item(:check) {
|
75
|
+
text '&Show'
|
76
|
+
accelerator :command, :shift, :h
|
77
|
+
selection bind(game, :show_high_scores)
|
78
|
+
}
|
79
|
+
menu_item {
|
80
|
+
text '&Clear'
|
81
|
+
accelerator :command, :shift, :c
|
82
|
+
|
83
|
+
on_widget_selected {
|
84
|
+
game.clear_high_scores!
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
} # end of menu
|
89
|
+
|
90
|
+
menu {
|
91
|
+
text '&Options'
|
92
|
+
menu_item(:check) {
|
93
|
+
text '&Beeping'
|
94
|
+
accelerator :command, :b
|
95
|
+
selection bind(game, :beeping)
|
96
|
+
}
|
97
|
+
menu {
|
98
|
+
text 'Up Arrow'
|
99
|
+
menu_item(:radio) {
|
100
|
+
text '&Instant Down'
|
101
|
+
accelerator :command, :shift, :i
|
102
|
+
selection bind(game, :instant_down_on_up, computed_by: :up_arrow_action)
|
103
|
+
}
|
104
|
+
menu_item(:radio) {
|
105
|
+
text 'Rotate &Right'
|
106
|
+
accelerator :command, :shift, :r
|
107
|
+
selection bind(game, :rotate_right_on_up, computed_by: :up_arrow_action)
|
108
|
+
}
|
109
|
+
menu_item(:radio) {
|
110
|
+
text 'Rotate &Left'
|
111
|
+
accelerator :command, :shift, :l
|
112
|
+
selection bind(game, :rotate_left_on_up, computed_by: :up_arrow_action)
|
113
|
+
}
|
114
|
+
}
|
115
|
+
} # end of menu
|
116
|
+
|
117
|
+
menu {
|
118
|
+
text '&Help'
|
119
|
+
|
120
|
+
menu_item {
|
121
|
+
text '&About'
|
122
|
+
accelerator :command, :shift, :a
|
123
|
+
|
124
|
+
on_widget_selected {
|
125
|
+
parent_custom_shell&.show_about_dialog
|
126
|
+
}
|
127
|
+
}
|
128
|
+
} # end of menu
|
129
|
+
}
|
130
|
+
}
|
131
|
+
|
132
|
+
def parent_custom_shell
|
133
|
+
# grab custom shell widget wrapping parent widget proxy (i.e. Tetris) and invoke method on it
|
134
|
+
the_parent_custom_shell = parent_proxy&.get_data('custom_shell')
|
135
|
+
the_parent_custom_shell if the_parent_custom_shell&.visible?
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -28,7 +28,7 @@ class TicTacToe
|
|
28
28
|
@tic_tac_toe_board = Board.new
|
29
29
|
@shell = shell {
|
30
30
|
text "Tic-Tac-Toe"
|
31
|
-
minimum_size
|
31
|
+
minimum_size 176, 200
|
32
32
|
composite {
|
33
33
|
grid_layout 3, true
|
34
34
|
(1..3).each { |row|
|
@@ -30,7 +30,7 @@ shell {
|
|
30
30
|
rectangle(0, 0, 220, 400, fill: true) {
|
31
31
|
background :red
|
32
32
|
}
|
33
|
-
rectangle(50, 20, 300, 150, 30, 50, round: true
|
33
|
+
rectangle(50, 20, 300, 150, 30, 50, round: true) {
|
34
34
|
background :magenta
|
35
35
|
}
|
36
36
|
rectangle(150, 200, 100, 70, true, gradient: true) {
|
@@ -49,13 +49,13 @@ shell {
|
|
49
49
|
foreground :dark_magenta
|
50
50
|
font name: 'Courier', height: 30
|
51
51
|
}
|
52
|
-
oval(110, 310, 100, 100
|
52
|
+
oval(110, 310, 100, 100) {
|
53
53
|
background rgb(128, 138, 248)
|
54
54
|
}
|
55
|
-
arc(210, 210, 100, 100, 30, -77
|
55
|
+
arc(210, 210, 100, 100, 30, -77) {
|
56
56
|
background :red
|
57
57
|
}
|
58
|
-
polygon(250, 210, 260, 170, 270, 210, 290, 230
|
58
|
+
polygon(250, 210, 260, 170, 270, 210, 290, 230) {
|
59
59
|
background :dark_yellow
|
60
60
|
}
|
61
61
|
polyline(250, 110, 260, 70, 270, 110, 290, 130, 250, 110)
|
@@ -35,7 +35,7 @@ shell {
|
|
35
35
|
oval(0, 0, 400, 400) { # x, y, width, height
|
36
36
|
foreground :black # sets oval background color
|
37
37
|
}
|
38
|
-
arc(0, 0, 400, 400, -1.4*index%360, 10
|
38
|
+
arc(0, 0, 400, 400, -1.4*index%360, 10) { # x, y, width, height, start angle, arc angle
|
39
39
|
background rgb(200, 200, 50) # sets arc background color
|
40
40
|
}
|
41
41
|
}
|
@@ -54,10 +54,10 @@ shell {
|
|
54
54
|
|
55
55
|
background outside_color # sets canvas background color
|
56
56
|
|
57
|
-
rectangle(0, 0, 200, 200
|
57
|
+
rectangle(0, 0, 200, 200) {
|
58
58
|
background inside_color # sets rectangle background color
|
59
59
|
}
|
60
|
-
rectangle(200, 200, 200, 200
|
60
|
+
rectangle(200, 200, 200, 200) {
|
61
61
|
background inside_color # sets rectangle background color
|
62
62
|
}
|
63
63
|
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
include Glimmer
|
2
|
+
|
3
|
+
glimmer_logo = File.expand_path('../../images/glimmer-logo-hi-res.png', __dir__)
|
4
|
+
|
5
|
+
shell {
|
6
|
+
text 'Hello, Canvas Transform!'
|
7
|
+
minimum_size 330, 352
|
8
|
+
|
9
|
+
canvas {
|
10
|
+
background :white
|
11
|
+
|
12
|
+
image(glimmer_logo, 0, 0) {
|
13
|
+
transform {
|
14
|
+
translate 110, 110
|
15
|
+
rotate 90
|
16
|
+
scale 0.21, 0.21
|
17
|
+
}
|
18
|
+
}
|
19
|
+
image(glimmer_logo, 0, 0) {
|
20
|
+
transform {
|
21
|
+
translate 110, 220
|
22
|
+
scale 0.21, 0.21
|
23
|
+
}
|
24
|
+
}
|
25
|
+
image(glimmer_logo, 0, 0) {
|
26
|
+
transform {
|
27
|
+
translate 220, 220
|
28
|
+
rotate 270
|
29
|
+
scale 0.21, 0.21
|
30
|
+
}
|
31
|
+
}
|
32
|
+
image(glimmer_logo, 0, 0) {
|
33
|
+
transform {
|
34
|
+
translate 220, 110
|
35
|
+
rotate 180
|
36
|
+
scale 0.21, 0.21
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}.open
|
data/samples/hello/hello_link.rb
CHANGED
@@ -49,7 +49,7 @@ shell { |main_shell|
|
|
49
49
|
}
|
50
50
|
on_mouse_up { |mouse_event|
|
51
51
|
unless @selected_link.nil?
|
52
|
-
@help_shell.close unless @help_shell.nil? || @help_shell.
|
52
|
+
@help_shell.close unless @help_shell.nil? || @help_shell.disposed?
|
53
53
|
@help_shell = shell(:no_trim) {
|
54
54
|
grid_layout {
|
55
55
|
margin_width 10
|
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.18.
|
4
|
+
version: 4.18.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-30 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: 1.0.
|
18
|
+
version: 1.0.11
|
19
19
|
name: glimmer
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
@@ -23,7 +23,7 @@ dependencies:
|
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.0.
|
26
|
+
version: 1.0.11
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
@@ -402,6 +402,7 @@ files:
|
|
402
402
|
- lib/glimmer/dsl/swt/menu_bar_expression.rb
|
403
403
|
- lib/glimmer/dsl/swt/menu_expression.rb
|
404
404
|
- lib/glimmer/dsl/swt/message_box_expression.rb
|
405
|
+
- lib/glimmer/dsl/swt/multiply_expression.rb
|
405
406
|
- lib/glimmer/dsl/swt/observe_expression.rb
|
406
407
|
- lib/glimmer/dsl/swt/property_expression.rb
|
407
408
|
- lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb
|
@@ -413,6 +414,7 @@ files:
|
|
413
414
|
- lib/glimmer/dsl/swt/sync_exec_expression.rb
|
414
415
|
- lib/glimmer/dsl/swt/tab_item_expression.rb
|
415
416
|
- lib/glimmer/dsl/swt/table_items_data_binding_expression.rb
|
417
|
+
- lib/glimmer/dsl/swt/transform_expression.rb
|
416
418
|
- lib/glimmer/dsl/swt/tree_items_data_binding_expression.rb
|
417
419
|
- lib/glimmer/dsl/swt/tree_properties_expression.rb
|
418
420
|
- lib/glimmer/dsl/swt/widget_expression.rb
|
@@ -453,6 +455,7 @@ files:
|
|
453
455
|
- lib/glimmer/swt/tab_item_proxy.rb
|
454
456
|
- lib/glimmer/swt/table_column_proxy.rb
|
455
457
|
- lib/glimmer/swt/table_proxy.rb
|
458
|
+
- lib/glimmer/swt/transform_proxy.rb
|
456
459
|
- lib/glimmer/swt/tree_proxy.rb
|
457
460
|
- lib/glimmer/swt/widget_listener_proxy.rb
|
458
461
|
- lib/glimmer/swt/widget_proxy.rb
|
@@ -468,11 +471,13 @@ files:
|
|
468
471
|
- samples/elaborate/tetris.rb
|
469
472
|
- samples/elaborate/tetris/model/block.rb
|
470
473
|
- samples/elaborate/tetris/model/game.rb
|
474
|
+
- samples/elaborate/tetris/model/past_game.rb
|
471
475
|
- samples/elaborate/tetris/model/tetromino.rb
|
472
476
|
- samples/elaborate/tetris/view/block.rb
|
473
|
-
- samples/elaborate/tetris/view/
|
477
|
+
- samples/elaborate/tetris/view/high_score_dialog.rb
|
474
478
|
- samples/elaborate/tetris/view/playfield.rb
|
475
479
|
- samples/elaborate/tetris/view/score_lane.rb
|
480
|
+
- samples/elaborate/tetris/view/tetris_menu_bar.rb
|
476
481
|
- samples/elaborate/tic_tac_toe.rb
|
477
482
|
- samples/elaborate/tic_tac_toe/board.rb
|
478
483
|
- samples/elaborate/tic_tac_toe/cell.rb
|
@@ -481,6 +486,7 @@ files:
|
|
481
486
|
- samples/hello/hello_button.rb
|
482
487
|
- samples/hello/hello_canvas.rb
|
483
488
|
- samples/hello/hello_canvas_animation.rb
|
489
|
+
- samples/hello/hello_canvas_transform.rb
|
484
490
|
- samples/hello/hello_checkbox.rb
|
485
491
|
- samples/hello/hello_checkbox_group.rb
|
486
492
|
- samples/hello/hello_combo.rb
|