glimmer-dsl-swt 4.21.0.1 → 4.21.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -0
- data/README.md +17 -11
- data/RUBY_VERSION +1 -1
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_COMMAND.md +1 -1
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +45 -26
- data/docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md +73 -16
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/glimmer/data_binding/widget_binding.rb +3 -3
- data/lib/glimmer/rake_task/package.rb +1 -1
- data/lib/glimmer/rake_task/scaffold.rb +4 -22
- data/lib/glimmer/rake_task.rb +1 -5
- data/lib/glimmer/swt/image_proxy.rb +5 -3
- data/lib/glimmer/swt/shell_proxy.rb +5 -3
- data/lib/glimmer/swt/style_constantizable.rb +2 -0
- data/lib/glimmer/swt/widget_proxy.rb +80 -0
- data/samples/elaborate/battleship/view/grid.rb +3 -3
- data/samples/elaborate/battleship/view/ship.rb +1 -1
- data/samples/elaborate/meta_sample.rb +12 -5
- data/samples/elaborate/tetris/view/tetris_menu_bar.rb +2 -2
- data/samples/elaborate/tetris.rb +12 -14
- data/samples/elaborate/tic_tac_toe.rb +6 -3
- data/samples/elaborate/timer.rb +0 -1
- data/samples/elaborate/weather.rb +3 -0
- data/samples/hello/hello_canvas.rb +1 -1
- data/samples/hello/hello_canvas_transform.rb +1 -1
- data/samples/hello/hello_cool_bar.rb +5 -60
- data/samples/hello/hello_drag_and_drop.rb +172 -11
- data/samples/hello/hello_scale.rb +1 -4
- data/samples/hello/hello_slider.rb +1 -4
- data/samples/hello/hello_tool_bar.rb +7 -53
- data/samples/hello/images/copy.png +0 -0
- data/samples/hello/images/cut.png +0 -0
- data/samples/hello/images/paste.png +0 -0
- metadata +11 -9
@@ -35,18 +35,179 @@ include Glimmer
|
|
35
35
|
|
36
36
|
shell {
|
37
37
|
text 'Hello, Drag and Drop!'
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
|
39
|
+
tab_folder {
|
40
|
+
tab_item {
|
41
|
+
fill_layout
|
42
|
+
text 'List'
|
43
|
+
|
44
|
+
list {
|
45
|
+
selection <=> [@location, :country]
|
46
|
+
|
47
|
+
# Option 1: Automatic Drag Data Setting
|
48
|
+
drag_source true
|
49
|
+
|
50
|
+
# Option 2: Manual Drag Data Setting
|
51
|
+
# on_drag_set_data do |event|
|
52
|
+
# drag_widget = event.widget.control
|
53
|
+
# event.data = drag_widget.selection.first
|
54
|
+
# end
|
55
|
+
|
56
|
+
# Option 3: Full Customization of Drag Source (details at: https://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html)
|
57
|
+
# drag_source(:drop_copy) { # options: :drop_copy, :drop_link, :drop_move, :drop_target_move
|
58
|
+
# transfer :text # options: :text, :file, :rtf
|
59
|
+
#
|
60
|
+
# on_drag_start do |event|
|
61
|
+
# drag_widget = event.widget.control.data('proxy') # obtain Glimmer widget proxy since it permits nicer syntax for setting cursor via symbol
|
62
|
+
# drag_widget.cursor = :wait
|
63
|
+
# end
|
64
|
+
#
|
65
|
+
# on_drag_set_data do |event|
|
66
|
+
# drag_widget = event.widget.control
|
67
|
+
# event.data = drag_widget.selection.first
|
68
|
+
# end
|
69
|
+
#
|
70
|
+
# on_drag_finished do |event|
|
71
|
+
# drag_widget = event.widget.control.data('proxy') # obtain Glimmer widget proxy since it permits nicer syntax for setting cursor via symbol
|
72
|
+
# drag_widget.cursor = :arrow
|
73
|
+
# end
|
74
|
+
# }
|
75
|
+
}
|
76
|
+
|
77
|
+
list {
|
78
|
+
# Option 1: Automatic Drop Data Consumption
|
79
|
+
# drop_target :unique # does not add same data twice
|
80
|
+
drop_target true
|
81
|
+
|
82
|
+
# Option 2: Manual Drop Data Consumption
|
83
|
+
# on_drop do |event|
|
84
|
+
# drop_widget = event.widget.control
|
85
|
+
# drop_widget.add(event.data)
|
86
|
+
# drop_widget.select(drop_widget.items.count - 1)
|
87
|
+
# end
|
88
|
+
|
89
|
+
# Option 3: Full Customization of Drop Target (details at: https://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html)
|
90
|
+
# drop_target(:drop_copy) { # options: :drop_copy, :drop_link, :drop_move, :drop_target_move
|
91
|
+
# transfer :text # options: :text, :file, :rtf
|
92
|
+
#
|
93
|
+
# on_drag_enter do |event|
|
94
|
+
# drop_widget = event.widget.control.data('proxy') # obtain Glimmer widget proxy since it permits nicer syntax for setting background via symbol
|
95
|
+
# drop_widget.background = :red
|
96
|
+
# end
|
97
|
+
#
|
98
|
+
# on_drag_leave do |event|
|
99
|
+
# drop_widget = event.widget.control.data('proxy') # obtain Glimmer widget proxy since it permits nicer syntax for setting background via symbol
|
100
|
+
# drop_widget.background = :white
|
101
|
+
# end
|
102
|
+
#
|
103
|
+
# on_drop do |event|
|
104
|
+
# drop_widget = event.widget.control.data('proxy') # obtain Glimmer widget proxy since it permits nicer syntax for setting background/cursor via symbol
|
105
|
+
# drop_widget.background = :white
|
106
|
+
# drop_widget.add(event.data)
|
107
|
+
# drop_widget.select(drop_widget.items.count - 1)
|
108
|
+
# drop_widget.cursor = :arrow
|
109
|
+
# end
|
110
|
+
# }
|
111
|
+
}
|
43
112
|
}
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
113
|
+
|
114
|
+
tab_item {
|
115
|
+
grid_layout 2, true
|
116
|
+
text 'Label'
|
117
|
+
|
118
|
+
label {
|
119
|
+
layout_data {
|
120
|
+
horizontal_span 2
|
121
|
+
}
|
122
|
+
text 'Drag text from any label and drop it unto another label'
|
123
|
+
}
|
124
|
+
|
125
|
+
{
|
126
|
+
Argentina: :green,
|
127
|
+
Brazil: :red,
|
128
|
+
Finland: :yellow,
|
129
|
+
Sweden: :magenta,
|
130
|
+
Denmark: :gray,
|
131
|
+
Iceland: :cyan
|
132
|
+
}.each do |country, color|
|
133
|
+
label {
|
134
|
+
layout_data :fill, :fill, true, true
|
135
|
+
text country
|
136
|
+
font height: 20
|
137
|
+
background color
|
138
|
+
drag_source true
|
139
|
+
drop_target true
|
140
|
+
}
|
141
|
+
end
|
142
|
+
}
|
143
|
+
|
144
|
+
tab_item {
|
145
|
+
grid_layout 2, true
|
146
|
+
text 'Text'
|
147
|
+
|
148
|
+
label {
|
149
|
+
text 'Drag'
|
150
|
+
}
|
151
|
+
|
152
|
+
label {
|
153
|
+
text 'Drop To Insert'
|
154
|
+
}
|
155
|
+
|
156
|
+
text {
|
157
|
+
layout_data :fill, :center, true, false
|
158
|
+
text 'Text1'
|
159
|
+
drag_source true
|
160
|
+
}
|
161
|
+
|
162
|
+
text {
|
163
|
+
layout_data :fill, :center, true, false
|
164
|
+
text 'Drop To Insert'
|
165
|
+
drop_target true
|
166
|
+
}
|
167
|
+
|
168
|
+
label {
|
169
|
+
text 'Drag'
|
170
|
+
}
|
171
|
+
|
172
|
+
label {
|
173
|
+
text 'Drop To Replace'
|
174
|
+
}
|
175
|
+
|
176
|
+
text {
|
177
|
+
layout_data :fill, :center, true, false
|
178
|
+
text 'Text2'
|
179
|
+
drag_source true
|
180
|
+
}
|
181
|
+
|
182
|
+
text {
|
183
|
+
layout_data :fill, :center, true, false
|
184
|
+
text 'Drop To Replace'
|
185
|
+
drop_target :replace
|
186
|
+
}
|
187
|
+
}
|
188
|
+
|
189
|
+
tab_item {
|
190
|
+
grid_layout 2, true
|
191
|
+
text 'Spinner'
|
192
|
+
|
193
|
+
label {
|
194
|
+
text 'Drag'
|
195
|
+
}
|
196
|
+
|
197
|
+
label {
|
198
|
+
text 'Drop To Insert'
|
199
|
+
}
|
200
|
+
|
201
|
+
spinner {
|
202
|
+
layout_data :fill, :center, true, false
|
203
|
+
selection 30
|
204
|
+
drag_source true
|
205
|
+
}
|
206
|
+
|
207
|
+
spinner {
|
208
|
+
layout_data :fill, :center, true, false
|
209
|
+
drop_target true
|
210
|
+
}
|
50
211
|
}
|
51
212
|
}
|
52
213
|
}.open
|
@@ -42,33 +42,31 @@ class HelloToolBar
|
|
42
42
|
}
|
43
43
|
|
44
44
|
text 'Hello, Tool Bar!'
|
45
|
+
minimum_size 280, 50
|
45
46
|
|
46
47
|
tool_bar { # optionally takes a :flat style, :wrap style if you need wrapping upon shrinking window, and :vertical style if you need vertical layout
|
47
48
|
tool_item {
|
48
|
-
image
|
49
|
+
image File.expand_path('./images/cut.png', __dir__), height: 16
|
49
50
|
|
50
51
|
on_widget_selected do
|
51
52
|
self.operation = 'Cut'
|
52
53
|
end
|
53
54
|
}
|
54
55
|
tool_item {
|
55
|
-
image
|
56
|
+
image File.expand_path('./images/copy.png', __dir__), height: 16
|
56
57
|
|
57
58
|
on_widget_selected do
|
58
59
|
self.operation = 'Copy'
|
59
60
|
end
|
60
61
|
}
|
61
62
|
tool_item {
|
62
|
-
image
|
63
|
+
image File.expand_path('./images/paste.png', __dir__), height: 16
|
63
64
|
|
64
65
|
on_widget_selected do
|
65
66
|
self.operation = 'Paste'
|
66
67
|
end
|
67
68
|
}
|
68
69
|
tool_item(:separator)
|
69
|
-
tool_item {
|
70
|
-
text 'Font Size'
|
71
|
-
}
|
72
70
|
# a combo can be nested in a tool_bar (it auto-generates a tool_item for itself behind the scenes)
|
73
71
|
combo {
|
74
72
|
selection <=> [self, :font_size]
|
@@ -84,59 +82,15 @@ class HelloToolBar
|
|
84
82
|
}
|
85
83
|
|
86
84
|
def cut_image
|
87
|
-
|
88
|
-
image(25, 25) {
|
89
|
-
rectangle(0, 0, 25, 25) {
|
90
|
-
background_pattern 0, 0, 0, 25, :white, :gray
|
91
|
-
line(20, 2, 9, 15) {
|
92
|
-
line_width 2
|
93
|
-
}
|
94
|
-
line(5, 2, 16, 15) {
|
95
|
-
line_width 2
|
96
|
-
}
|
97
|
-
oval(2, 15, 8, 8) {
|
98
|
-
line_width 2
|
99
|
-
}
|
100
|
-
oval(16, 15, 8, 8) {
|
101
|
-
line_width 2
|
102
|
-
}
|
103
|
-
}
|
104
|
-
}
|
85
|
+
File.expand_path('./images/cut.png', __dir__)
|
105
86
|
end
|
106
87
|
|
107
88
|
def copy_image
|
108
|
-
|
109
|
-
image(25, 25) {
|
110
|
-
rectangle(0, 0, 25, 25) {
|
111
|
-
background_pattern 0, 0, 0, 25, :white, :gray
|
112
|
-
rectangle([:default, 2], [:default, -2], 14, 14, 5, 5) {
|
113
|
-
line_width 2
|
114
|
-
}
|
115
|
-
rectangle([:default, -2], [:default, 2], 14, 14, 5, 5) {
|
116
|
-
line_width 2
|
117
|
-
}
|
118
|
-
}
|
119
|
-
}
|
89
|
+
File.expand_path('./images/copy.png', __dir__)
|
120
90
|
end
|
121
91
|
|
122
92
|
def paste_image
|
123
|
-
|
124
|
-
rectangle(0, 0, 25, 25) {
|
125
|
-
background_pattern 0, 0, 0, 25, :white, :gray
|
126
|
-
rectangle(:default, [:default, 1], 15, 20, 5, 5) {
|
127
|
-
line_width 2
|
128
|
-
}
|
129
|
-
line(7, 8, 18, 8) {
|
130
|
-
line_width 2
|
131
|
-
}
|
132
|
-
line(7, 13, 18, 13) {
|
133
|
-
line_width 2
|
134
|
-
}
|
135
|
-
line(7, 18, 18, 18) {
|
136
|
-
line_width 2
|
137
|
-
}
|
138
|
-
}
|
139
|
-
}
|
93
|
+
File.expand_path('./images/paste.png', __dir__)
|
140
94
|
end
|
141
95
|
end
|
142
96
|
|
Binary file
|
Binary file
|
Binary file
|
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.21.
|
4
|
+
version: 4.21.2.1
|
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-11-19 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.
|
18
|
+
version: 2.4.0
|
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.
|
26
|
+
version: 2.4.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
@@ -376,10 +376,9 @@ description: Glimmer DSL for SWT (JRuby Desktop Development GUI Framework) is a
|
|
376
376
|
started quickly, Glimmer offers scaffolding options for Apps, Gems, and Custom Widgets.
|
377
377
|
Glimmer also includes native-executable packaging support, sorely lacking in other
|
378
378
|
libraries, thus enabling the delivery of desktop apps written in Ruby as truly native
|
379
|
-
DMG/PKG/APP files on the Mac, MSI/EXE files on Windows, and
|
380
|
-
|
381
|
-
to
|
382
|
-
and expert.
|
379
|
+
DMG/PKG/APP files on the Mac, MSI/EXE files on Windows, and DEB/RPM files on Linux.
|
380
|
+
Glimmer was the first Ruby gem to bring SWT (Standard Widget Toolkit) to Ruby, thanks
|
381
|
+
to creator Andy Maleh, EclipseCon/EclipseWorld/RubyConf speaker.
|
383
382
|
email: andy.am@gmail.com
|
384
383
|
executables:
|
385
384
|
- glimmer
|
@@ -682,6 +681,8 @@ files:
|
|
682
681
|
- samples/hello/hello_tray_item.rb
|
683
682
|
- samples/hello/hello_tree.rb
|
684
683
|
- samples/hello/hello_world.rb
|
684
|
+
- samples/hello/images/copy.png
|
685
|
+
- samples/hello/images/cut.png
|
685
686
|
- samples/hello/images/denmark.png
|
686
687
|
- samples/hello/images/finland.png
|
687
688
|
- samples/hello/images/france.png
|
@@ -690,6 +691,7 @@ files:
|
|
690
691
|
- samples/hello/images/mexico.png
|
691
692
|
- samples/hello/images/netherlands.png
|
692
693
|
- samples/hello/images/norway.png
|
694
|
+
- samples/hello/images/paste.png
|
693
695
|
- samples/hello/images/usa.png
|
694
696
|
- sounds/metronome-down.wav
|
695
697
|
- sounds/metronome-up.wav
|
@@ -726,7 +728,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
726
728
|
- !ruby/object:Gem::Version
|
727
729
|
version: '0'
|
728
730
|
requirements: []
|
729
|
-
rubygems_version: 3.2.
|
731
|
+
rubygems_version: 3.2.29
|
730
732
|
signing_key:
|
731
733
|
specification_version: 4
|
732
734
|
summary: Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
|