glimmer-dsl-swt 4.21.1.0 → 4.21.1.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 +6 -0
- data/README.md +6 -6
- data/VERSION +1 -1
- data/bin/girb +0 -0
- data/bin/glimmer +0 -0
- data/docs/reference/GLIMMER_COMMAND.md +1 -1
- data/docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md +5 -1
- data/glimmer-dsl-swt.gemspec +0 -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 +11 -4
- 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_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 +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bf8841cfbf5434aa97cc021720d0198f54b2aa8579ca21086d0edd94c36f896
|
4
|
+
data.tar.gz: c2a683b52ec35a36036db500ad8af9b1571387bf89fc2ed5ceeaccd2012a9753
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4af7fca643eace69c2d323bb8ec0c9610af59e554d490fbac62bb79ac53ebc24fb25f1bd87bc25bf3471475d1a033db957825c2770787a3ffd1decae1a1b812
|
7
|
+
data.tar.gz: a16a96f5239163c25742b5728c7e10fdd31a12c5d4153ea4a47a3a8795025554701422b74ae3fdfa3c4e7cc0e75beb4353b2f91902d0c2bab543436b4208d0d3
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.21.1.
|
1
|
+
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.21.1.1
|
2
2
|
## JRuby Desktop Development GUI Framework
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
|
4
4
|
[![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
|
@@ -15,7 +15,7 @@
|
|
15
15
|
[<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
|
16
16
|
Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) and [Chalmers/Gothenburg University Software Engineering Master's Lecture Material](http://www.cse.chalmers.se/~bergert/slides/guest_lecture_DSLs.pdf)
|
17
17
|
|
18
|
-
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.21.1.
|
18
|
+
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.21.1.1 includes [SWT 4.21](https://download.eclipse.org/eclipse/downloads/drops4/R-4.21-202109060500/), which was released on September 6, 2021. Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT. Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested in Glimmer DSL for SWT yet, so deem its support experimental for the time being without guarantees for functionality until declared otherwise (please report any issues you may encounter).
|
19
19
|
|
20
20
|
**Starting in version 4.20.0.0, [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) comes with the new [***Shine***](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#shine) syntax** for highly intuitive and visually expressive View/Model Attribute Mapping, relying on `<=>` for bidirectional (two-way) data-binding and `<=` for unidirectional (one-way) data-binding, providing an alternative to the `bind` keyword (keep in mind that it is still a beta, so default back to `bind` whenever needed).
|
21
21
|
|
@@ -290,7 +290,7 @@ https://www.eclipse.org/swt/faq.php
|
|
290
290
|
|
291
291
|
## Pre-requisites
|
292
292
|
|
293
|
-
- JDK 16 (16.0.2) (find at https://www.oracle.com/java/technologies/downloads
|
293
|
+
- JDK 16 (16.0.2) (find at https://www.oracle.com/java/technologies/javase/jdk16-archive-downloads.html / Ensure PATH includes Java bin directory for `jpackage` command to work when packaging Glimmer applications)
|
294
294
|
- [RVM](http://rvm.io) on Mac & Linux (not available on Windows)
|
295
295
|
- JRuby 9.3.0.0 (supporting Ruby 2.6.x syntax) (get via [RVM](http://rvm.io) on Mac and Linux by running `rvm install jruby-9.3.0.0`; On Windows, find at [https://www.jruby.org/download](https://www.jruby.org/download) [you might have to dual-install JDK8 temporarily as it might be required by jruby installer and then switch JAVA_HOME to JDK16 once done installing and restart command prompt/git bash])
|
296
296
|
- SWT 4.21 (already included in the [glimmer-dsl-swt](https://rubygems.org/gems/glimmer-dsl-swt) gem). Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested with Glimmer DSL for SWT yet, so it is considered experimental until declared otherwise.
|
@@ -322,7 +322,7 @@ jgem install glimmer-dsl-swt
|
|
322
322
|
|
323
323
|
Or this command if you want a specific version:
|
324
324
|
```
|
325
|
-
jgem install glimmer-dsl-swt -v 4.21.1.
|
325
|
+
jgem install glimmer-dsl-swt -v 4.21.1.1
|
326
326
|
```
|
327
327
|
|
328
328
|
`jgem` is JRuby's version of `gem` command.
|
@@ -350,7 +350,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
|
|
350
350
|
|
351
351
|
Add the following to `Gemfile`:
|
352
352
|
```
|
353
|
-
gem 'glimmer-dsl-swt', '~> 4.21.1.
|
353
|
+
gem 'glimmer-dsl-swt', '~> 4.21.1.1'
|
354
354
|
```
|
355
355
|
|
356
356
|
And, then run:
|
@@ -371,7 +371,7 @@ glimmer
|
|
371
371
|
```
|
372
372
|
|
373
373
|
```
|
374
|
-
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.21.1.
|
374
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.21.1.1
|
375
375
|
|
376
376
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
377
377
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.21.1.
|
1
|
+
4.21.1.1
|
data/bin/girb
CHANGED
File without changes
|
data/bin/glimmer
CHANGED
File without changes
|
@@ -213,7 +213,7 @@ In order to run the app after making changes, you must run the `glimmer run`. It
|
|
213
213
|
glimmer run
|
214
214
|
```
|
215
215
|
|
216
|
-
Alternatively, to
|
216
|
+
Alternatively, to manually run the app, you may type:
|
217
217
|
|
218
218
|
```
|
219
219
|
glimmer run[bin/greeter]
|
@@ -4,7 +4,7 @@ Note: this section mostly applies to Mac and Windows. On Linux, you can just run
|
|
4
4
|
|
5
5
|
Note 2: On Windows, ensure system environment PATH includes Java bin directory `"C:\Program Files\Java\jdk-16.0.2\bin"` at the top for `jpackage` command to work during packaging Glimmer applications (the default Oracle setup path for Java after installing the JDK is usually not sufficient).
|
6
6
|
|
7
|
-
Note 3: Glimmer packaging has a strong dependency on JDK16 since it includes the packaging tool `jpackage`.
|
7
|
+
Note 3: Glimmer packaging has a strong dependency on JDK16 since it includes the packaging tool `jpackage`. On the Mac, it seems there is a new gotcha in the latest JDK 16 DMG/PKG installable that is resulting in `jpackage` to be missing from `PATH`. To include, you might need to add `export PATH="/Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home/bin:$PATH"` to `~/.zprofile` or `~/.bashrc`
|
8
8
|
|
9
9
|
Glimmer simplifies the process of native-executable packaging and distribution on Mac and Windows via a single `glimmer package` command:
|
10
10
|
|
@@ -182,6 +182,10 @@ org.apache.maven.InternalErrorException: Internal error: org.jruby.exceptions.Ra
|
|
182
182
|
Caused by: org.jruby.exceptions.RaiseException: (LoadError) library `java' could not be loaded: java.lang.reflect.InaccessibleObjectException: Unable to make protected native java.lang.Object java.lang.Object.clone() throws java.lang.CloneNotSupportedException accessible: module java.base does not "opens java.lang" to unnamed module @138caeca
|
183
183
|
[ERROR]
|
184
184
|
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
|
185
|
+
|
186
|
+
3. jpackage missing from PATH on the Mac
|
187
|
+
|
188
|
+
On the Mac, the latest JDK 16 installable DMG/PKG is resulting in `jpackage` to be missing from `PATH`. To include, you might need to add `export PATH="/Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home/bin:$PATH"` to `~/.zprofile` or `~/.bashrc`
|
185
189
|
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
|
186
190
|
[ERROR]
|
187
191
|
[ERROR] For more information about the errors and possible solutions, please read the following articles:
|
data/glimmer-dsl-swt.gemspec
CHANGED
Binary file
|
@@ -45,21 +45,21 @@ class Battleship
|
|
45
45
|
}
|
46
46
|
|
47
47
|
text player.to_s.capitalize
|
48
|
-
font height: 20, style: :bold
|
48
|
+
font height: OS.windows? ? 18 : 20, style: :bold
|
49
49
|
}
|
50
50
|
|
51
51
|
label # filler
|
52
52
|
Model::Grid::WIDTH.times do |column_index|
|
53
53
|
label {
|
54
54
|
text (column_index + 1).to_s
|
55
|
-
font height: 16
|
55
|
+
font height: OS.windows? ? 14 : 16
|
56
56
|
}
|
57
57
|
end
|
58
58
|
|
59
59
|
Model::Grid::HEIGHT.times do |row_index|
|
60
60
|
label {
|
61
61
|
text Model::Grid::ROW_ALPHABETS[row_index]
|
62
|
-
font height: 16
|
62
|
+
font height: OS.windows? ? 14 : 16
|
63
63
|
}
|
64
64
|
Model::Grid::WIDTH.times do |column_index|
|
65
65
|
cell(game: game, player: player, row_index: row_index, column_index: column_index) {
|
@@ -23,8 +23,6 @@ require 'glimmer-dsl-swt'
|
|
23
23
|
require 'fileutils'
|
24
24
|
|
25
25
|
class Sample
|
26
|
-
include Glimmer::DataBinding::ObservableModel
|
27
|
-
|
28
26
|
class << self
|
29
27
|
def glimmer_directory
|
30
28
|
File.expand_path('../../..', __FILE__)
|
@@ -42,6 +40,10 @@ class Sample
|
|
42
40
|
end
|
43
41
|
end
|
44
42
|
end
|
43
|
+
|
44
|
+
include Glimmer::DataBinding::ObservableModel
|
45
|
+
|
46
|
+
UNEDITABLE = ['meta_sample.rb'] + (OS.windows? ? ['calculator.rb', 'weather.rb'] : []) # Windows StyledText does not support unicode characters found in certain samples
|
45
47
|
|
46
48
|
attr_accessor :sample_directory, :file, :selected
|
47
49
|
|
@@ -74,9 +76,13 @@ class Sample
|
|
74
76
|
end
|
75
77
|
|
76
78
|
def editable
|
79
|
+
!UNEDITABLE.include?(File.basename(file))
|
80
|
+
end
|
81
|
+
alias editable? editable
|
82
|
+
|
83
|
+
def launchable
|
77
84
|
File.basename(file) != 'meta_sample.rb'
|
78
85
|
end
|
79
|
-
alias launchable editable
|
80
86
|
|
81
87
|
def file_relative_path
|
82
88
|
file.sub(self.class.glimmer_directory, '')
|
@@ -97,6 +103,7 @@ class Sample
|
|
97
103
|
def launch(modified_code)
|
98
104
|
launch_file = user_file
|
99
105
|
begin
|
106
|
+
raise 'Unsupported through editor!' unless editable?
|
100
107
|
FileUtils.cp_r(file, user_file_parent_directory)
|
101
108
|
FileUtils.cp_r(directory, user_file_parent_directory) if File.exist?(directory)
|
102
109
|
File.write(user_file, modified_code)
|
@@ -207,7 +214,7 @@ class MetaSampleApplication
|
|
207
214
|
image File.expand_path('../../icons/scaffold_app.png', __dir__)
|
208
215
|
|
209
216
|
sash_form {
|
210
|
-
weights
|
217
|
+
weights 1, 2
|
211
218
|
|
212
219
|
composite {
|
213
220
|
grid_layout(1, false) {
|
@@ -45,8 +45,8 @@ class Tetris
|
|
45
45
|
menu_item(:check) {
|
46
46
|
text '&Pause'
|
47
47
|
accelerator COMMAND_KEY, :p
|
48
|
-
enabled <= [game, :game_over, on_read: ->(value) { value && !game.show_high_scores }]
|
49
|
-
enabled <= [game, :show_high_scores, on_read: ->(value) { value && !game.game_over }]
|
48
|
+
enabled <= [game, :game_over, on_read: ->(value) { !value && !game.show_high_scores }]
|
49
|
+
enabled <= [game, :show_high_scores, on_read: ->(value) { !value && !game.game_over }]
|
50
50
|
selection <=> [game, :paused]
|
51
51
|
}
|
52
52
|
menu_item {
|
data/samples/elaborate/tetris.rb
CHANGED
@@ -57,7 +57,17 @@ class Tetris
|
|
57
57
|
on_swt_keydown { |key_event|
|
58
58
|
case key_event.keyCode
|
59
59
|
when swt(:arrow_down), 's'.bytes.first
|
60
|
-
|
60
|
+
if OS.mac?
|
61
|
+
game.down!
|
62
|
+
else
|
63
|
+
# rate limit downs in Windows/Linux as they go too fast when key is held
|
64
|
+
@queued_downs ||= 0
|
65
|
+
@queued_downs += 1
|
66
|
+
async_exec do
|
67
|
+
game.down! if @queued_downs < 3
|
68
|
+
@queued_downs -= 1
|
69
|
+
end
|
70
|
+
end
|
61
71
|
when swt(:arrow_up)
|
62
72
|
case game.up_arrow_action
|
63
73
|
when :instant_down
|
@@ -80,16 +90,6 @@ class Tetris
|
|
80
90
|
end
|
81
91
|
}
|
82
92
|
|
83
|
-
# invoke game.down! on keyup with Windows/Linux since they seem to group-render similar events, preventing intermediate renders (causing invisiblity while holding keys)
|
84
|
-
if !OS.mac?
|
85
|
-
on_swt_keyup { |key_event|
|
86
|
-
case key_event.keyCode
|
87
|
-
when swt(:arrow_down), 's'.bytes.first
|
88
|
-
game.down!
|
89
|
-
end
|
90
|
-
}
|
91
|
-
end
|
92
|
-
|
93
93
|
# if running in app mode, set the Mac app about dialog (ignored in platforms)
|
94
94
|
on_about {
|
95
95
|
show_about_dialog
|
@@ -170,9 +170,7 @@ class Tetris
|
|
170
170
|
sleep @game.delay
|
171
171
|
break if @game.game_over? || body_root.disposed?
|
172
172
|
# ensure entire game tetromino down movement happens as one GUI update event with sync_exec (to avoid flicker/stutter)
|
173
|
-
sync_exec {
|
174
|
-
@game.down! unless @game.paused?
|
175
|
-
}
|
173
|
+
sync_exec { @game.down! unless @game.paused? }
|
176
174
|
end
|
177
175
|
end
|
178
176
|
end
|
@@ -41,18 +41,21 @@ class TicTacToe
|
|
41
41
|
shell {
|
42
42
|
text "Tic-Tac-Toe"
|
43
43
|
minimum_size 176, 200
|
44
|
+
|
44
45
|
composite {
|
45
46
|
grid_layout 3, true
|
47
|
+
|
46
48
|
(1..3).each { |row|
|
47
49
|
(1..3).each { |column|
|
48
50
|
button {
|
49
51
|
layout_data :fill, :fill, true, true
|
50
52
|
text <= [@tic_tac_toe_board[row, column], :sign]
|
51
53
|
enabled <= [@tic_tac_toe_board[row, column], :empty]
|
52
|
-
font style: :bold, height: 20
|
53
|
-
|
54
|
+
font style: :bold, height: (OS.windows? ? 18 : 20)
|
55
|
+
|
56
|
+
on_widget_selected do
|
54
57
|
@tic_tac_toe_board.mark(row, column)
|
55
|
-
|
58
|
+
end
|
56
59
|
}
|
57
60
|
}
|
58
61
|
}
|
data/samples/elaborate/timer.rb
CHANGED
@@ -102,6 +102,7 @@ class Weather
|
|
102
102
|
layout_data(:fill, :center, true, false)
|
103
103
|
text <= [self, field_name, on_read: ->(t) { "#{kelvin_to_temp_unit(t, temp_unit).to_f.round}°" }]
|
104
104
|
font height: DEFAULT_FONT_HEIGHT
|
105
|
+
background DEFAULT_BACKGROUND
|
105
106
|
foreground DEFAULT_FOREGROUND
|
106
107
|
}
|
107
108
|
end
|
@@ -112,6 +113,7 @@ class Weather
|
|
112
113
|
layout_data(:fill, :center, true, false)
|
113
114
|
text <= [self, 'humidity', on_read: ->(h) { "#{h.to_f.round}%" }]
|
114
115
|
font height: DEFAULT_FONT_HEIGHT
|
116
|
+
background DEFAULT_BACKGROUND
|
115
117
|
foreground DEFAULT_FOREGROUND
|
116
118
|
}
|
117
119
|
end
|
@@ -121,6 +123,7 @@ class Weather
|
|
121
123
|
layout_data :fill, :center, false, false
|
122
124
|
text field_name.titlecase
|
123
125
|
font height: DEFAULT_FONT_HEIGHT
|
126
|
+
background DEFAULT_BACKGROUND
|
124
127
|
foreground DEFAULT_FOREGROUND
|
125
128
|
}
|
126
129
|
end
|
@@ -65,7 +65,7 @@ class HelloCanvas
|
|
65
65
|
y :default, 1 # add 1 pixel to default y (shape centered within parent vertically)
|
66
66
|
background :yellow
|
67
67
|
foreground :dark_magenta
|
68
|
-
font name: 'Courier', height: 30
|
68
|
+
font name: 'Courier', height: (OS.windows? ? 26 : 30)
|
69
69
|
}
|
70
70
|
}
|
71
71
|
rectangle(155, 30) { # width and height are assumed to be the default (calculated from children)
|
@@ -40,27 +40,28 @@ class HelloCoolBar
|
|
40
40
|
margin_width 0
|
41
41
|
margin_height 0
|
42
42
|
}
|
43
|
-
|
43
|
+
|
44
44
|
text 'Hello, Cool Bar!'
|
45
|
+
minimum_size 280, 50
|
45
46
|
|
46
47
|
cool_bar { # optionally takes a :flat style and/or :vertical style if you need vertical layout
|
47
48
|
tool_bar {
|
48
49
|
tool_item {
|
49
|
-
image
|
50
|
+
image File.expand_path('./images/cut.png', __dir__), height: 16
|
50
51
|
|
51
52
|
on_widget_selected do
|
52
53
|
self.operation = 'Cut'
|
53
54
|
end
|
54
55
|
}
|
55
56
|
tool_item {
|
56
|
-
image
|
57
|
+
image File.expand_path('./images/copy.png', __dir__), height: 16
|
57
58
|
|
58
59
|
on_widget_selected do
|
59
60
|
self.operation = 'Copy'
|
60
61
|
end
|
61
62
|
}
|
62
63
|
tool_item {
|
63
|
-
image
|
64
|
+
image File.expand_path('./images/paste.png', __dir__), height: 16
|
64
65
|
|
65
66
|
on_widget_selected do
|
66
67
|
self.operation = 'Paste'
|
@@ -86,62 +87,6 @@ class HelloCoolBar
|
|
86
87
|
}
|
87
88
|
}
|
88
89
|
}
|
89
|
-
|
90
|
-
def cut_image
|
91
|
-
# building image on the fly with Canvas Shape DSL
|
92
|
-
image(25, 25) {
|
93
|
-
rectangle(0, 0, 25, 25) {
|
94
|
-
background_pattern 0, 0, 0, 25, :white, :gray
|
95
|
-
line(20, 2, 9, 15) {
|
96
|
-
line_width 2
|
97
|
-
}
|
98
|
-
line(5, 2, 16, 15) {
|
99
|
-
line_width 2
|
100
|
-
}
|
101
|
-
oval(2, 15, 8, 8) {
|
102
|
-
line_width 2
|
103
|
-
}
|
104
|
-
oval(16, 15, 8, 8) {
|
105
|
-
line_width 2
|
106
|
-
}
|
107
|
-
}
|
108
|
-
}
|
109
|
-
end
|
110
|
-
|
111
|
-
def copy_image
|
112
|
-
# building image on the fly with Canvas Shape DSL
|
113
|
-
image(25, 25) {
|
114
|
-
rectangle(0, 0, 25, 25) {
|
115
|
-
background_pattern 0, 0, 0, 25, :white, :gray
|
116
|
-
rectangle([:default, 2], [:default, -2], 14, 14, 5, 5) {
|
117
|
-
line_width 2
|
118
|
-
}
|
119
|
-
rectangle([:default, -2], [:default, 2], 14, 14, 5, 5) {
|
120
|
-
line_width 2
|
121
|
-
}
|
122
|
-
}
|
123
|
-
}
|
124
|
-
end
|
125
|
-
|
126
|
-
def paste_image
|
127
|
-
image(25, 25) {
|
128
|
-
rectangle(0, 0, 25, 25) {
|
129
|
-
background_pattern 0, 0, 0, 25, :white, :gray
|
130
|
-
rectangle(:default, [:default, 1], 15, 20, 5, 5) {
|
131
|
-
line_width 2
|
132
|
-
}
|
133
|
-
line(7, 8, 18, 8) {
|
134
|
-
line_width 2
|
135
|
-
}
|
136
|
-
line(7, 13, 18, 13) {
|
137
|
-
line_width 2
|
138
|
-
}
|
139
|
-
line(7, 18, 18, 18) {
|
140
|
-
line_width 2
|
141
|
-
}
|
142
|
-
}
|
143
|
-
}
|
144
|
-
end
|
145
90
|
end
|
146
91
|
|
147
92
|
HelloCoolBar.launch
|
@@ -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,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-swt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.21.1.
|
4
|
+
version: 4.21.1.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-10-
|
11
|
+
date: 2021-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -681,6 +681,8 @@ files:
|
|
681
681
|
- samples/hello/hello_tray_item.rb
|
682
682
|
- samples/hello/hello_tree.rb
|
683
683
|
- samples/hello/hello_world.rb
|
684
|
+
- samples/hello/images/copy.png
|
685
|
+
- samples/hello/images/cut.png
|
684
686
|
- samples/hello/images/denmark.png
|
685
687
|
- samples/hello/images/finland.png
|
686
688
|
- samples/hello/images/france.png
|
@@ -689,6 +691,7 @@ files:
|
|
689
691
|
- samples/hello/images/mexico.png
|
690
692
|
- samples/hello/images/netherlands.png
|
691
693
|
- samples/hello/images/norway.png
|
694
|
+
- samples/hello/images/paste.png
|
692
695
|
- samples/hello/images/usa.png
|
693
696
|
- sounds/metronome-down.wav
|
694
697
|
- sounds/metronome-up.wav
|