glimmer-dsl-swt 4.18.2.4 → 4.18.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +60 -0
- data/README.md +240 -30
- 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/color_expression.rb +4 -4
- data/lib/glimmer/dsl/swt/data_binding_expression.rb +3 -3
- data/lib/glimmer/dsl/swt/dsl.rb +1 -0
- data/lib/glimmer/dsl/swt/multiply_expression.rb +53 -0
- data/lib/glimmer/dsl/swt/property_expression.rb +4 -2
- data/lib/glimmer/dsl/swt/shape_expression.rb +2 -4
- data/{samples/elaborate/tetris/view/game_over_dialog.rb → lib/glimmer/dsl/swt/transform_expression.rb} +29 -46
- data/lib/glimmer/dsl/swt/widget_expression.rb +2 -1
- data/lib/glimmer/swt/color_proxy.rb +28 -6
- data/lib/glimmer/swt/custom/drawable.rb +8 -0
- data/lib/glimmer/swt/custom/shape.rb +66 -26
- 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/shell_proxy.rb +24 -4
- 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 +35 -20
- data/lib/glimmer/ui/custom_shell.rb +11 -9
- data/lib/glimmer/ui/custom_widget.rb +65 -39
- data/samples/elaborate/meta_sample.rb +81 -24
- data/samples/elaborate/tetris.rb +105 -44
- data/samples/elaborate/tetris/model/block.rb +1 -1
- data/samples/elaborate/tetris/model/game.rb +233 -137
- data/samples/elaborate/tetris/model/past_game.rb +26 -0
- data/samples/elaborate/tetris/model/tetromino.rb +46 -30
- data/samples/elaborate/tetris/view/block.rb +33 -5
- 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 +121 -0
- data/samples/elaborate/tic_tac_toe.rb +4 -4
- data/samples/hello/hello_canvas_transform.rb +40 -0
- data/samples/hello/hello_link.rb +1 -1
- metadata +11 -5
@@ -0,0 +1,121 @@
|
|
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
|
+
} # end of menu
|
98
|
+
|
99
|
+
menu {
|
100
|
+
text '&Help'
|
101
|
+
|
102
|
+
menu_item {
|
103
|
+
text '&About'
|
104
|
+
accelerator :command, :shift, :a
|
105
|
+
|
106
|
+
on_widget_selected {
|
107
|
+
parent_custom_shell&.show_about_dialog
|
108
|
+
}
|
109
|
+
}
|
110
|
+
} # end of menu
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
def parent_custom_shell
|
115
|
+
# grab custom shell widget wrapping parent widget proxy (i.e. Tetris) and invoke method on it
|
116
|
+
the_parent_custom_shell = parent_proxy&.get_data('custom_shell')
|
117
|
+
the_parent_custom_shell if the_parent_custom_shell&.visible?
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
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|
|
@@ -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.3
|
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-29 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
|