glimmer-dsl-swt 4.20.15.2 → 4.21.0.0
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 +21 -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_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/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/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
- 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
@@ -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) {
|
data/vendor/swt/linux/swt.jar
CHANGED
Binary file
|
Binary file
|
data/vendor/swt/mac/swt.jar
CHANGED
Binary file
|
Binary file
|
data/vendor/swt/windows/swt.jar
CHANGED
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.
|
4
|
+
version: 4.21.0.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-09-27 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:
|
@@ -238,6 +238,20 @@ dependencies:
|
|
238
238
|
- - "<"
|
239
239
|
- !ruby/object:Gem::Version
|
240
240
|
version: 4.0.0
|
241
|
+
- !ruby/object:Gem::Dependency
|
242
|
+
requirement: !ruby/object:Gem::Requirement
|
243
|
+
requirements:
|
244
|
+
- - '='
|
245
|
+
- !ruby/object:Gem::Version
|
246
|
+
version: 3.3.2
|
247
|
+
name: psych
|
248
|
+
prerelease: false
|
249
|
+
type: :runtime
|
250
|
+
version_requirements: !ruby/object:Gem::Requirement
|
251
|
+
requirements:
|
252
|
+
- - '='
|
253
|
+
- !ruby/object:Gem::Version
|
254
|
+
version: 3.3.2
|
241
255
|
- !ruby/object:Gem::Dependency
|
242
256
|
requirement: !ruby/object:Gem::Requirement
|
243
257
|
requirements:
|
@@ -362,10 +376,10 @@ description: Glimmer DSL for SWT (JRuby Desktop Development GUI Framework) is a
|
|
362
376
|
started quickly, Glimmer offers scaffolding options for Apps, Gems, and Custom Widgets.
|
363
377
|
Glimmer also includes native-executable packaging support, sorely lacking in other
|
364
378
|
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
|
-
|
379
|
+
DMG/PKG/APP files on the Mac, MSI/EXE files on Windows, and Gem Packaged Shell Scripts
|
380
|
+
on Linux. Glimmer was the first Ruby gem to bring SWT (Standard Widget Toolkit)
|
381
|
+
to Ruby, thanks to creator Andy Maleh, EclipseCon/EclipseWorld/RubyConf speaker
|
382
|
+
and expert.
|
369
383
|
email: andy.am@gmail.com
|
370
384
|
executables:
|
371
385
|
- glimmer
|
@@ -712,7 +726,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
712
726
|
- !ruby/object:Gem::Version
|
713
727
|
version: '0'
|
714
728
|
requirements: []
|
715
|
-
rubygems_version: 3.
|
729
|
+
rubygems_version: 3.2.14
|
716
730
|
signing_key:
|
717
731
|
specification_version: 4
|
718
732
|
summary: Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
|