glimmer-dsl-swt 4.20.0.1 → 4.20.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -0
- data/README.md +16 -12
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +10 -7
- data/docs/reference/GLIMMER_SAMPLES.md +40 -0
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/glimmer/dsl/swt/widget_expression.rb +2 -0
- data/lib/glimmer/rake_task/scaffold.rb +0 -2
- data/lib/glimmer/swt/combo_proxy.rb +48 -0
- data/lib/glimmer/swt/tool_bar_proxy.rb +51 -0
- data/lib/glimmer/swt/widget_proxy.rb +6 -0
- data/samples/elaborate/tetris/model/game.rb +0 -3
- data/samples/hello/hello_cool_bar.rb +147 -0
- data/samples/hello/hello_tool_bar.rb +143 -0
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc02ae10c108569a6bc2eb9d0bbc541fde4e4cb7a45d96239a3d7dbe1e60d372
|
4
|
+
data.tar.gz: 5d8fcdf0a1da65600360459d309f423950726bf81a538c9de5f68c66223c724a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9250b2d9c29327262c833908681ae0826389489c2a60cb11cef17300ca94675b79a2ae2b9834a7caef1d68ed6583f54c8c4135b0b398937fac625422bab79913
|
7
|
+
data.tar.gz: 34044f13edbc7e0d6c2132d5b894164698373e5823619f1c9ec859a6459d593d14564e72ce3c1510508be07a270bb243342a7f0b29976beb14772acd06f782b6
|
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.20.0.
|
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.20.0.2
|
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.20.0.
|
18
|
+
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.0.2 includes [SWT 4.20](https://download.eclipse.org/eclipse/downloads/drops4/R-4.20-202106111600/), which was released on June 11, 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 (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 an early alpha, so default back to `bind` whenever needed).
|
21
21
|
|
@@ -341,7 +341,7 @@ jgem install glimmer-dsl-swt
|
|
341
341
|
|
342
342
|
Or this command if you want a specific version:
|
343
343
|
```
|
344
|
-
jgem install glimmer-dsl-swt -v 4.20.0.
|
344
|
+
jgem install glimmer-dsl-swt -v 4.20.0.2
|
345
345
|
```
|
346
346
|
|
347
347
|
`jgem` is JRuby's version of `gem` command.
|
@@ -358,7 +358,7 @@ glimmer-setup
|
|
358
358
|
|
359
359
|
This ensures configuring extra required Mac options before using `glimmer` and `girb` commands.
|
360
360
|
|
361
|
-
If you are new to Glimmer and would like to continue learning the basics, you may continue to the [Glimmer Command](
|
361
|
+
If you are new to Glimmer and would like to continue learning the basics, you may continue to the [Glimmer Command](#glimmer-command) section.
|
362
362
|
|
363
363
|
Otherwise, if you are ready to build a Glimmer app, you can jump to the [Glimmer Scaffolding](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_COMMAND.md#scaffolding) section next.
|
364
364
|
|
@@ -369,7 +369,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
|
|
369
369
|
|
370
370
|
Add the following to `Gemfile`:
|
371
371
|
```
|
372
|
-
gem 'glimmer-dsl-swt', '~> 4.20.0.
|
372
|
+
gem 'glimmer-dsl-swt', '~> 4.20.0.2'
|
373
373
|
```
|
374
374
|
|
375
375
|
And, then run:
|
@@ -390,7 +390,7 @@ glimmer
|
|
390
390
|
```
|
391
391
|
|
392
392
|
```
|
393
|
-
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.0.
|
393
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.0.2
|
394
394
|
|
395
395
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
396
396
|
|
@@ -592,9 +592,9 @@ Learn more by reading the [GPG](https://github.com/AndyObtiva/glimmer/blob/maste
|
|
592
592
|
|
593
593
|
https://www.eclipse.org/swt/docs.php
|
594
594
|
|
595
|
-
Here is the SWT API:
|
595
|
+
Here is the SWT Javadoc API:
|
596
596
|
|
597
|
-
https://
|
597
|
+
https://www.eclipse.org/swt/javadoc.php
|
598
598
|
|
599
599
|
Here is a visual list of SWT widgets:
|
600
600
|
|
@@ -612,22 +612,26 @@ Here is a SWT style bit constant reference:
|
|
612
612
|
|
613
613
|
https://help.eclipse.org/2019-12/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/SWT.html
|
614
614
|
|
615
|
-
Here is an SWT
|
615
|
+
Here is an SWT Layout guide:
|
616
616
|
|
617
|
-
https://www.eclipse.org/articles/Article-
|
617
|
+
https://www.eclipse.org/articles/Article-Understanding-Layouts/Understanding-Layouts.htm
|
618
618
|
|
619
619
|
Here is an SWT Custom Widget guide:
|
620
620
|
|
621
621
|
https://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm
|
622
622
|
|
623
|
-
Here is an SWT
|
623
|
+
Here is an SWT Drag and Drop guide:
|
624
624
|
|
625
|
-
https://www.eclipse.org/articles/Article-SWT-
|
625
|
+
https://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html
|
626
626
|
|
627
627
|
Here is an SWT Graphics / Canvas-Drawing guide:
|
628
628
|
|
629
629
|
https://www.eclipse.org/articles/Article-SWT-graphics/SWT_graphics.html
|
630
630
|
|
631
|
+
Here is an SWT Image guide:
|
632
|
+
|
633
|
+
https://www.eclipse.org/articles/Article-SWT-images/graphics-resources.html
|
634
|
+
|
631
635
|
Here is the Nebula Project (custom widget library) homepage:
|
632
636
|
|
633
637
|
https://www.eclipse.org/nebula/
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.20.0.
|
1
|
+
4.20.0.2
|
@@ -184,8 +184,9 @@ This screenshot taken from the link above should give a glimpse of how SWT widge
|
|
184
184
|
|
185
185
|
[![SWT Widgets](/images/glimmer-swt-widgets.png)](https://www.eclipse.org/swt/widgets/)
|
186
186
|
|
187
|
-
In Glimmer DSL, widgets are declared with lowercase underscored names mirroring their SWT names minus the package name.
|
187
|
+
In Glimmer DSL, widgets are declared with lowercase underscored names mirroring their SWT names minus the package name.
|
188
188
|
|
189
|
+
For example, here are some Glimmer widgets and their SWT counterparts:
|
189
190
|
- `shell` instantiates `org.eclipse.swt.widgets.Shell`
|
190
191
|
- `text` instantiates `org.eclipse.swt.widgets.Text`
|
191
192
|
- `button` instantiates `org.eclipse.swt.widgets.Button`
|
@@ -298,7 +299,8 @@ This is not an exaustive list, but should give you a good start in learning Glim
|
|
298
299
|
- `checkbox`: featured in [Hello, Checkbox Group!](GLIMMER_SAMPLES.md#hello-checkbox-group) / [Hello, Checkbox!](GLIMMER_SAMPLES.md#hello-checkbox)
|
299
300
|
- `checkbox_group`: featured in [Hello, Checkbox Group!](GLIMMER_SAMPLES.md#hello-checkbox-group)
|
300
301
|
- `combo`: featured in [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Combo!](GLIMMER_SAMPLES.md#hello-combo)
|
301
|
-
- `composite`: featured in [Hello, Radio!](GLIMMER_SAMPLES.md#hello-radio) / [Hello, Computed!](GLIMMER_SAMPLES.md#hello-computed) / [Hello, Checkbox!](GLIMMER_SAMPLES.md#hello-checkbox) / [Tic Tac Toe](GLIMMER_SAMPLES.md#tic-tac-toe) / [Login](GLIMMER_SAMPLES.md#login) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager)
|
302
|
+
- `composite`: featured in [Hello, Composite!](GLIMMER_SAMPLES.md#hello-composite) / [Hello, Radio!](GLIMMER_SAMPLES.md#hello-radio) / [Hello, Computed!](GLIMMER_SAMPLES.md#hello-computed) / [Hello, Checkbox!](GLIMMER_SAMPLES.md#hello-checkbox) / [Tic Tac Toe](GLIMMER_SAMPLES.md#tic-tac-toe) / [Login](GLIMMER_SAMPLES.md#login) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager)
|
303
|
+
- `cool_bar`: featured in [Hello, Cool Bar!](GLIMMER_SAMPLES.md#hello-cool-bar)
|
302
304
|
- `date`: featured in [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Date Time!](GLIMMER_SAMPLES.md#hello-date-time) / [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell) / [Tic Tac Toe](GLIMMER_SAMPLES.md#tic-tac-toe)
|
303
305
|
- `date_drop_down`: featured in [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Date Time!](GLIMMER_SAMPLES.md#hello-date-time)
|
304
306
|
- `group`: featured in [Hello, Group!](GLIMMER_SAMPLES.md#hello-group) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager)
|
@@ -318,14 +320,16 @@ This is not an exaustive list, but should give you a good start in learning Glim
|
|
318
320
|
- `table_column`: featured in [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager)
|
319
321
|
- `text`: featured in [Hello, Computed!](GLIMMER_SAMPLES.md#hello-computed) / [Login](GLIMMER_SAMPLES.md#login) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager)
|
320
322
|
- `time`: featured in [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Date Time!](GLIMMER_SAMPLES.md#hello-date-time)
|
323
|
+
- `tool_bar`: featured in [Hello, Tool Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-tool-bar)
|
324
|
+
- `tool_item`: featured in [Hello, Tool Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-tool-bar)
|
321
325
|
- Glimmer::UI::CustomWidget: ability to define any keyword as a custom widget - featured in [Hello, Custom Widget!](GLIMMER_SAMPLES.md#hello-custom-widget)
|
322
326
|
- Glimmer::UI::CustomShell: ability to define any keyword as a custom shell (aka custom window) that opens in a new browser window (tab) automatically unless there is no shell open in the current browser window (tab) - featured in [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell)
|
323
327
|
|
324
328
|
**Layouts:**
|
325
|
-
- `grid_layout`: featured in [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell) / [Hello, Computed!](GLIMMER_SAMPLES.md#hello-computed) / [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Pop Up Context Menu!](GLIMMER_SAMPLES.md#hello-pop-up-context-menu) / [Hello, Menu Bar!](GLIMMER_SAMPLES.md#hello-menu-bar) / [Hello, List Single Selection!](GLIMMER_SAMPLES.md#hello-list-single-selection) / [Hello, List Multi Selection!](GLIMMER_SAMPLES.md#hello-list-multi-selection) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager) / [Login](GLIMMER_SAMPLES.md#login) / [Tic Tac Toe](GLIMMER_SAMPLES.md#tic-tac-toe)
|
326
|
-
- `row_layout`: featured in [Hello, Radio Group!](GLIMMER_SAMPLES.md#hello-radio-group) / [Hello, Radio!](GLIMMER_SAMPLES.md#hello-radio) / [Hello, Group!](GLIMMER_SAMPLES.md#hello-group) / [Hello, Date Time!](GLIMMER_SAMPLES.md#hello-date-time) / [Hello, Combo!](GLIMMER_SAMPLES.md#hello-combo) / [Hello, Checkbox Group!](GLIMMER_SAMPLES.md#hello-checkbox-group) / [Hello, Checkbox!](GLIMMER_SAMPLES.md#hello-checkbox) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager)
|
327
|
-
- `fill_layout`: featured in [Hello, Custom Widget!](GLIMMER_SAMPLES.md#hello-custom-widget)
|
328
|
-
- `layout_data`: featured in [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell) / [Hello, Computed!](GLIMMER_SAMPLES.md#hello-computed) / [Tic Tac Toe](GLIMMER_SAMPLES.md#tic-tac-toe) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager)
|
329
|
+
- `grid_layout`: featured in [Hello, Layout!](GLIMMER_SAMPLES.md#hello-layout) / [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell) / [Hello, Computed!](GLIMMER_SAMPLES.md#hello-computed) / [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Pop Up Context Menu!](GLIMMER_SAMPLES.md#hello-pop-up-context-menu) / [Hello, Menu Bar!](GLIMMER_SAMPLES.md#hello-menu-bar) / [Hello, List Single Selection!](GLIMMER_SAMPLES.md#hello-list-single-selection) / [Hello, List Multi Selection!](GLIMMER_SAMPLES.md#hello-list-multi-selection) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager) / [Login](GLIMMER_SAMPLES.md#login) / [Tic Tac Toe](GLIMMER_SAMPLES.md#tic-tac-toe)
|
330
|
+
- `row_layout`: featured in [Hello, Layout!](GLIMMER_SAMPLES.md#hello-layout) / [Hello, Radio Group!](GLIMMER_SAMPLES.md#hello-radio-group) / [Hello, Radio!](GLIMMER_SAMPLES.md#hello-radio) / [Hello, Group!](GLIMMER_SAMPLES.md#hello-group) / [Hello, Date Time!](GLIMMER_SAMPLES.md#hello-date-time) / [Hello, Combo!](GLIMMER_SAMPLES.md#hello-combo) / [Hello, Checkbox Group!](GLIMMER_SAMPLES.md#hello-checkbox-group) / [Hello, Checkbox!](GLIMMER_SAMPLES.md#hello-checkbox) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager)
|
331
|
+
- `fill_layout`: featured in [Hello, Layout!](GLIMMER_SAMPLES.md#hello-layout) / [Hello, Custom Widget!](GLIMMER_SAMPLES.md#hello-custom-widget)
|
332
|
+
- `layout_data`: featured in [Hello, Layout!](GLIMMER_SAMPLES.md#hello-layout) / [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) / [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell) / [Hello, Computed!](GLIMMER_SAMPLES.md#hello-computed) / [Tic Tac Toe](GLIMMER_SAMPLES.md#tic-tac-toe) / [Contact Manager](GLIMMER_SAMPLES.md#contact-manager)
|
329
333
|
|
330
334
|
**Graphics/Style:**
|
331
335
|
- `color`: featured in [Hello, Custom Widget!](GLIMMER_SAMPLES.md#hello-custom-widget) / [Hello, Menu Bar!](GLIMMER_SAMPLES.md#hello-menu-bar)
|
@@ -1396,7 +1400,6 @@ Also, for a reference, check the SWT API:
|
|
1396
1400
|
|
1397
1401
|
https://help.eclipse.org/2019-12/nftopic/org.eclipse.platform.doc.isv/reference/api/index.html
|
1398
1402
|
|
1399
|
-
|
1400
1403
|
### Canvas Shape DSL
|
1401
1404
|
|
1402
1405
|
**(ALPHA FEATURE)**
|
@@ -47,6 +47,8 @@
|
|
47
47
|
- [Hello, Font Dialog!](#hello-font-dialog)
|
48
48
|
- [Hello, Shape!](#hello-shape)
|
49
49
|
- [Hello, Custom Shape!](#hello-custom-shape)
|
50
|
+
- [Hello, Tool Bar!](#hello-tool-bar)
|
51
|
+
- [Hello, Cool Bar!](#hello-cool-bar)
|
50
52
|
- [Elaborate Samples](#elaborate-samples)
|
51
53
|
- [User Profile](#user-profile)
|
52
54
|
- [Login](#login)
|
@@ -820,6 +822,44 @@ Hello, Custom Shape!
|
|
820
822
|
|
821
823
|
![Hello Custom Shape](/images/glimmer-hello-custom-shape.png)
|
822
824
|
|
825
|
+
#### Hello, Tool Bar!
|
826
|
+
|
827
|
+
This sample demonstrates the use of `tool_bar` & `tool_item` as well as being able to nest `combo` in a `tool_bar`.
|
828
|
+
|
829
|
+
Code:
|
830
|
+
|
831
|
+
[samples/hello/hello_tool_bar.rb](/samples/hello/hello_tool_bar.rb)
|
832
|
+
|
833
|
+
Hello, Tool Bar!
|
834
|
+
|
835
|
+
![Hello Tool Bar](/images/glimmer-hello-tool-bar.png)
|
836
|
+
|
837
|
+
![Hello Tool Bar Cut](/images/glimmer-hello-tool-bar-cut.png)
|
838
|
+
|
839
|
+
![Hello Tool Bar Copy](/images/glimmer-hello-tool-bar-copy.png)
|
840
|
+
|
841
|
+
![Hello Tool Bar Paste](/images/glimmer-hello-tool-bar-paste.png)
|
842
|
+
|
843
|
+
![Hello Tool Bar Font Size](/images/glimmer-hello-tool-bar-font-size.png)
|
844
|
+
|
845
|
+
#### Hello, Cool Bar!
|
846
|
+
|
847
|
+
This sample demonstrates the use of `cool_bar` that can contain multiple reorganizable `tool_bar` widgets
|
848
|
+
|
849
|
+
Code:
|
850
|
+
|
851
|
+
[samples/hello/hello_cool_bar.rb](/samples/hello/hello_cool_bar.rb)
|
852
|
+
|
853
|
+
Hello, Cool Bar!
|
854
|
+
|
855
|
+
![Hello Cool Bar](/images/glimmer-hello-cool-bar.png)
|
856
|
+
|
857
|
+
![Hello Cool Bar Reorg1](/images/glimmer-hello-cool-bar-reorg1.png)
|
858
|
+
|
859
|
+
![Hello Cool Bar Reorg2](/images/glimmer-hello-cool-bar-reorg2.png)
|
860
|
+
|
861
|
+
![Hello Cool Bar Reorg3](/images/glimmer-hello-cool-bar-reorg3.png)
|
862
|
+
|
823
863
|
### Elaborate Samples
|
824
864
|
|
825
865
|
For more elaborate samples, check the following:
|
data/glimmer-dsl-swt.gemspec
CHANGED
Binary file
|
@@ -441,8 +441,6 @@ module Glimmer
|
|
441
441
|
require '#{file_name(app_name)}/view/app_view'
|
442
442
|
|
443
443
|
class #{class_name(app_name)}
|
444
|
-
include Glimmer
|
445
|
-
|
446
444
|
APP_ROOT = File.expand_path('../..', __FILE__)
|
447
445
|
VERSION = File.read(File.join(APP_ROOT, 'VERSION'))
|
448
446
|
LICENSE = File.read(File.join(APP_ROOT, 'LICENSE.txt'))
|
@@ -0,0 +1,48 @@
|
|
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
|
+
require 'glimmer/swt/widget_proxy'
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module SWT
|
26
|
+
# Proxy for org.eclipse.swt.widgets.Combo
|
27
|
+
#
|
28
|
+
# Follows the Proxy Design Pattern
|
29
|
+
class ComboProxy < WidgetProxy
|
30
|
+
attr_accessor :tool_item_proxy, :swt_tool_item
|
31
|
+
|
32
|
+
def initialize(*init_args, &block)
|
33
|
+
super
|
34
|
+
self.tool_item_proxy = WidgetProxy.new("tool_item", parent_proxy, [:separator]) if parent_proxy.swt_widget.is_a?(ToolBar)
|
35
|
+
self.swt_tool_item = tool_item_proxy&.swt_widget
|
36
|
+
end
|
37
|
+
|
38
|
+
def post_add_content
|
39
|
+
if self.tool_item_proxy
|
40
|
+
self.swt_widget.pack
|
41
|
+
self.tool_item_proxy.text = 'filler' # text seems needed (any text works)
|
42
|
+
self.tool_item_proxy.width = swt_widget.size.x
|
43
|
+
self.tool_item_proxy.control = swt_widget
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,51 @@
|
|
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
|
+
require 'glimmer/swt/widget_proxy'
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module SWT
|
26
|
+
# Proxy for org.eclipse.swt.widgets.ToolBarProxy
|
27
|
+
#
|
28
|
+
# Follows the Proxy Design Pattern
|
29
|
+
class ToolBarProxy < WidgetProxy
|
30
|
+
attr_accessor :cool_item_proxy, :swt_cool_item
|
31
|
+
|
32
|
+
def initialize(*init_args, &block)
|
33
|
+
super
|
34
|
+
self.cool_item_proxy = WidgetProxy.new("cool_item", parent_proxy, []) if parent_proxy.swt_widget.is_a?(CoolBar)
|
35
|
+
self.swt_cool_item = cool_item_proxy&.swt_widget
|
36
|
+
end
|
37
|
+
|
38
|
+
def post_add_content
|
39
|
+
apply_preferred_size if cool_item_proxy
|
40
|
+
end
|
41
|
+
|
42
|
+
def apply_preferred_size
|
43
|
+
swt_widget.pack
|
44
|
+
size = swt_widget.size
|
45
|
+
cool_item_proxy.control = swt_widget
|
46
|
+
preferred = swt_cool_item.computeSize(size.x, size.y)
|
47
|
+
swt_cool_item.setPreferredSize(preferred)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -1006,6 +1006,12 @@ module Glimmer
|
|
1006
1006
|
image: lambda do |*value|
|
1007
1007
|
ImageProxy.create(*value).swt_image
|
1008
1008
|
end,
|
1009
|
+
disabled_image: lambda do |*value|
|
1010
|
+
ImageProxy.create(*value).swt_image
|
1011
|
+
end,
|
1012
|
+
hot_image: lambda do |*value|
|
1013
|
+
ImageProxy.create(*value).swt_image
|
1014
|
+
end,
|
1009
1015
|
images: lambda do |array|
|
1010
1016
|
array.to_a.map do |value|
|
1011
1017
|
ImageProxy.create(value).swt_image
|
@@ -33,8 +33,6 @@ class Tetris
|
|
33
33
|
class Game
|
34
34
|
PLAYFIELD_WIDTH = 10
|
35
35
|
PLAYFIELD_HEIGHT = 20
|
36
|
-
# PLAYFIELD_WIDTH = 5
|
37
|
-
# PLAYFIELD_HEIGHT = 5
|
38
36
|
PREVIEW_PLAYFIELD_WIDTH = 4
|
39
37
|
PREVIEW_PLAYFIELD_HEIGHT = 2
|
40
38
|
SCORE_MULTIPLIER = {1 => 40, 2 => 100, 3 => 300, 4 => 1200}
|
@@ -201,7 +199,6 @@ class Tetris
|
|
201
199
|
|
202
200
|
def delay
|
203
201
|
[1.1 - (level.to_i * 0.1), 0.001].max
|
204
|
-
# 99999
|
205
202
|
end
|
206
203
|
|
207
204
|
def beep
|
@@ -0,0 +1,147 @@
|
|
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
|
+
require 'glimmer-dsl-swt'
|
23
|
+
|
24
|
+
class HelloCoolBar
|
25
|
+
include Glimmer::UI::CustomShell
|
26
|
+
|
27
|
+
attr_accessor :operation, :font_size
|
28
|
+
|
29
|
+
def font_size_options
|
30
|
+
(10..30).to_a.map(&:to_s)
|
31
|
+
end
|
32
|
+
|
33
|
+
before_body {
|
34
|
+
self.font_size = '10'
|
35
|
+
}
|
36
|
+
|
37
|
+
body {
|
38
|
+
shell {
|
39
|
+
fill_layout(:vertical) {
|
40
|
+
margin_width 0
|
41
|
+
margin_height 0
|
42
|
+
}
|
43
|
+
|
44
|
+
text 'Hello, Cool Bar!'
|
45
|
+
|
46
|
+
cool_bar { # optionally takes a :flat style and/or :vertical style if you need vertical layout
|
47
|
+
tool_bar {
|
48
|
+
tool_item {
|
49
|
+
image cut_image # alternatively you can pass an image file path
|
50
|
+
|
51
|
+
on_widget_selected do
|
52
|
+
self.operation = 'Cut'
|
53
|
+
end
|
54
|
+
}
|
55
|
+
tool_item {
|
56
|
+
image copy_image # alternatively you can pass an image file path
|
57
|
+
|
58
|
+
on_widget_selected do
|
59
|
+
self.operation = 'Copy'
|
60
|
+
end
|
61
|
+
}
|
62
|
+
tool_item {
|
63
|
+
image paste_image # alternatively you can pass an image file path
|
64
|
+
|
65
|
+
on_widget_selected do
|
66
|
+
self.operation = 'Paste'
|
67
|
+
end
|
68
|
+
}
|
69
|
+
}
|
70
|
+
tool_bar {
|
71
|
+
tool_item {
|
72
|
+
text 'Font Size'
|
73
|
+
}
|
74
|
+
# a combo can be nested in a tool_bar (it auto-generates a tool_item for itself behind the scenes)
|
75
|
+
combo {
|
76
|
+
selection bind(self, :font_size)
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
|
82
|
+
label {
|
83
|
+
font height: 30
|
84
|
+
text bind(self, :operation)
|
85
|
+
text bind(self, :font_size)
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
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
|
+
end
|
146
|
+
|
147
|
+
HelloCoolBar.launch
|
@@ -0,0 +1,143 @@
|
|
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
|
+
require 'glimmer-dsl-swt'
|
23
|
+
|
24
|
+
class HelloToolBar
|
25
|
+
include Glimmer::UI::CustomShell
|
26
|
+
|
27
|
+
attr_accessor :operation, :font_size
|
28
|
+
|
29
|
+
def font_size_options
|
30
|
+
(10..30).to_a.map(&:to_s)
|
31
|
+
end
|
32
|
+
|
33
|
+
before_body {
|
34
|
+
self.font_size = '10'
|
35
|
+
}
|
36
|
+
|
37
|
+
body {
|
38
|
+
shell {
|
39
|
+
fill_layout(:vertical) {
|
40
|
+
margin_width 0
|
41
|
+
margin_height 0
|
42
|
+
}
|
43
|
+
|
44
|
+
text 'Hello, Tool Bar!'
|
45
|
+
|
46
|
+
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
|
+
tool_item {
|
48
|
+
image cut_image # alternatively you can pass an image file path
|
49
|
+
|
50
|
+
on_widget_selected do
|
51
|
+
self.operation = 'Cut'
|
52
|
+
end
|
53
|
+
}
|
54
|
+
tool_item {
|
55
|
+
image copy_image # alternatively you can pass an image file path
|
56
|
+
|
57
|
+
on_widget_selected do
|
58
|
+
self.operation = 'Copy'
|
59
|
+
end
|
60
|
+
}
|
61
|
+
tool_item {
|
62
|
+
image paste_image # alternatively you can pass an image file path
|
63
|
+
|
64
|
+
on_widget_selected do
|
65
|
+
self.operation = 'Paste'
|
66
|
+
end
|
67
|
+
}
|
68
|
+
tool_item(:separator)
|
69
|
+
tool_item {
|
70
|
+
text 'Font Size'
|
71
|
+
}
|
72
|
+
# a combo can be nested in a tool_bar (it auto-generates a tool_item for itself behind the scenes)
|
73
|
+
combo {
|
74
|
+
selection bind(self, :font_size)
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
label {
|
79
|
+
font height: 30
|
80
|
+
text bind(self, :operation)
|
81
|
+
text bind(self, :font_size)
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
def cut_image
|
87
|
+
# building image on the fly with Canvas Shape DSL
|
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
|
+
}
|
105
|
+
end
|
106
|
+
|
107
|
+
def copy_image
|
108
|
+
# building image on the fly with Canvas Shape DSL
|
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
|
+
}
|
120
|
+
end
|
121
|
+
|
122
|
+
def paste_image
|
123
|
+
image(25, 25) {
|
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
|
+
}
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
HelloToolBar.launch
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-swt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.20.0.
|
4
|
+
version: 4.20.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
@@ -449,6 +449,7 @@ files:
|
|
449
449
|
- lib/glimmer/rake_task/scaffold.rb
|
450
450
|
- lib/glimmer/swt/c_tab_item_proxy.rb
|
451
451
|
- lib/glimmer/swt/color_proxy.rb
|
452
|
+
- lib/glimmer/swt/combo_proxy.rb
|
452
453
|
- lib/glimmer/swt/cursor_proxy.rb
|
453
454
|
- lib/glimmer/swt/custom/animation.rb
|
454
455
|
- lib/glimmer/swt/custom/checkbox_group.rb
|
@@ -494,6 +495,7 @@ files:
|
|
494
495
|
- lib/glimmer/swt/tab_item_proxy.rb
|
495
496
|
- lib/glimmer/swt/table_column_proxy.rb
|
496
497
|
- lib/glimmer/swt/table_proxy.rb
|
498
|
+
- lib/glimmer/swt/tool_bar_proxy.rb
|
497
499
|
- lib/glimmer/swt/transform_proxy.rb
|
498
500
|
- lib/glimmer/swt/tree_proxy.rb
|
499
501
|
- lib/glimmer/swt/widget_listener_proxy.rb
|
@@ -554,6 +556,7 @@ files:
|
|
554
556
|
- samples/hello/hello_composite.rb
|
555
557
|
- samples/hello/hello_computed.rb
|
556
558
|
- samples/hello/hello_computed/contact.rb
|
559
|
+
- samples/hello/hello_cool_bar.rb
|
557
560
|
- samples/hello/hello_cursor.rb
|
558
561
|
- samples/hello/hello_custom_shape.rb
|
559
562
|
- samples/hello/hello_custom_shell.rb
|
@@ -583,6 +586,7 @@ files:
|
|
583
586
|
- samples/hello/hello_tab.rb
|
584
587
|
- samples/hello/hello_table.rb
|
585
588
|
- samples/hello/hello_table/baseball_park.png
|
589
|
+
- samples/hello/hello_tool_bar.rb
|
586
590
|
- samples/hello/hello_tree.rb
|
587
591
|
- samples/hello/hello_world.rb
|
588
592
|
- sounds/metronome-down.wav
|