glimmer-dsl-swt 4.18.6.3 → 4.18.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -0
- data/README.md +4 -4
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_COMMAND.md +46 -3
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +26 -3
- data/docs/reference/GLIMMER_SAMPLES.md +56 -0
- data/glimmer-dsl-swt.gemspec +15 -6
- data/lib/glimmer/dsl/swt/animation_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/custom_shape_expression.rb +61 -0
- data/lib/glimmer/dsl/swt/custom_widget_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/dsl.rb +1 -0
- data/lib/glimmer/dsl/swt/expand_item_expression.rb +4 -4
- data/lib/glimmer/dsl/swt/image_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/multiply_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/shape_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/transform_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/widget_expression.rb +1 -1
- data/lib/glimmer/rake_task.rb +36 -6
- data/lib/glimmer/rake_task/list.rb +8 -0
- data/lib/glimmer/rake_task/scaffold.rb +103 -0
- data/lib/glimmer/swt/custom/shape.rb +464 -181
- data/lib/glimmer/swt/custom/shape/image.rb +7 -9
- data/lib/glimmer/swt/custom/shape/path.rb +1 -5
- data/lib/glimmer/swt/custom/shape/polygon.rb +24 -8
- data/lib/glimmer/swt/custom/shape/polyline.rb +5 -0
- data/lib/glimmer/swt/custom/shape/rectangle.rb +10 -19
- data/lib/glimmer/swt/display_proxy.rb +1 -1
- data/lib/glimmer/swt/message_box_proxy.rb +1 -1
- data/lib/glimmer/swt/shell_proxy.rb +1 -1
- data/lib/glimmer/swt/transform_proxy.rb +1 -1
- data/lib/glimmer/swt/widget_proxy.rb +1 -1
- data/lib/glimmer/ui/custom_shape.rb +281 -0
- data/samples/elaborate/meta_sample.rb +5 -5
- data/samples/elaborate/metronome.rb +177 -0
- data/samples/elaborate/tetris.rb +1 -15
- data/samples/elaborate/tetris/model/game.rb +3 -0
- data/samples/elaborate/tetris/view/bevel.rb +81 -0
- data/samples/elaborate/tetris/view/block.rb +5 -30
- data/samples/hello/hello_canvas.rb +3 -0
- data/samples/hello/hello_canvas_animation_data_binding.rb +66 -0
- data/samples/hello/hello_canvas_data_binding.rb +1 -1
- data/samples/hello/hello_custom_shape.rb +78 -0
- data/samples/hello/hello_shape.rb +71 -0
- data/samples/hello/hello_spinner.rb +7 -2
- data/sounds/metronome-down.wav +0 -0
- data/sounds/metronome-up.wav +0 -0
- metadata +13 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a27a28f23a9ca77db7405be0a2789396423d3634e42523440f92b3a86b33df9f
|
4
|
+
data.tar.gz: c6f3b4a9badd95f13c190772537ff0bfae688253573d3d11230f7935721aa9a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93e62d4d5abe0c8c15f27363bbfc52d1e7ebb89ee090e4f6c494c0fda3b0e033928991f9d6898b585848a442b5411aa1d39f476b3d9124a1fa7d81f43f91f839
|
7
|
+
data.tar.gz: 1436f547b6ce8313a432b88e4758cebcd59c8da9f785487d04f96209b1a2b56aeffd6ed74e7942f676a1085efe7d491dfcac3e13c2499e1d0f7b8f8687117db3
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,40 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
### 4.18.7.4
|
4
|
+
|
5
|
+
- Add `glimmer scaffold:customshape[name,namespace]` command
|
6
|
+
- Add `glimmer scaffold:gem:customshape[name,namespace]` command
|
7
|
+
- Add `glimmer list:gems:customshape[keyword]` command
|
8
|
+
- Support automatic inference of `fill: true` for `path` just like other shapes
|
9
|
+
- Support `filled: true` alternative for `fill: true` Canvas Shape DSL option
|
10
|
+
- Fix issue with having to pass base_color to `bevel` custom shape in Tetris before data-binding instead of data-binding being sufficient
|
11
|
+
|
12
|
+
### 4.18.7.3
|
13
|
+
|
14
|
+
- Support the ability for nested shapes to override their parent `shape` common shared properties
|
15
|
+
- Refactor Tetris to use a custom shape (`bevel`) for its blocks given they are used in both the game and the icon, thus achieving code reuse
|
16
|
+
- Fix issue with moving filled polygon (moving drawn polygon works)
|
17
|
+
|
18
|
+
### 4.18.7.2
|
19
|
+
|
20
|
+
- Enable defining custom shapes with direct args just like basic shapes (alternative to using keyword arg options)
|
21
|
+
- Fix interpretation of `:max`/`:default` `width`/`height` values in Canvas Shape DSL
|
22
|
+
|
23
|
+
### 4.18.7.1
|
24
|
+
|
25
|
+
- Hello, Canvas Animation Data Binding! Sample
|
26
|
+
- Metronome Elaborate Sample
|
27
|
+
- Update Hello, Spinner! Sample to data bind a Thank you message to selected value
|
28
|
+
|
29
|
+
### 4.18.7.0
|
30
|
+
|
31
|
+
- Support direct use of the `shape` keyword as a shape composite that could contain other shapes and shares common attributes (e.g. background color) with all of them
|
32
|
+
- Hello, Shape! Sample (implements a method-based custom shape containing other nested shapes)
|
33
|
+
- Support custom shapes via including the Glimmer::UI::CustomShape module to add new shape keywords to the Glimmer GUI DSL / Canvas Shape DSL, representing shapes composed of a group of nested shapes (e.g. `car` shape representing a group of nested `polygon` shapes)
|
34
|
+
- Hello, Custom Shape! Sample (redoes Hello, Shape! with the use of a class-based custom shape)
|
35
|
+
- Support :max value for Canvas Shape DSL width and height, meaning fill up parent (useful for using rectangles as borders)
|
36
|
+
- Upgrade to glimmer v1.2.0
|
37
|
+
|
3
38
|
### 4.18.6.3
|
4
39
|
|
5
40
|
- Support `Glimmer::SWT::Custom::Shape::PathSegment#dispose` method
|
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.18.
|
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.18.7.3
|
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)
|
@@ -13,7 +13,7 @@
|
|
13
13
|
[<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
|
14
14
|
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)
|
15
15
|
|
16
|
-
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.18.
|
16
|
+
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.18.7.3 includes [SWT 4.18](https://download.eclipse.org/eclipse/downloads/drops4/R-4.18-202012021800/), which was released on December 2, 2020. 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.
|
17
17
|
|
18
18
|
[Glimmer DSL for SWT receives two updates per month](https://rubygems.org/gems/glimmer-dsl-swt/versions). You can trust [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) with your Ruby desktop GUI development needs! [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) brings great ideas to the table, such as declarative programming via domain specific languages, currently under-utilized in the GUI domain. That said, it may not be feature complete enough for everybody's needs, so please help make [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) even better by providing feedback and [contributing](#contributing) when possible. The project is very active, so any feature suggestions that are accepted could be implemented within weeks if not days. Also, you are welcome to [hire me](#hire-me) full-time if you want long-term development of [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) for your project needs.
|
19
19
|
|
@@ -340,7 +340,7 @@ jgem install glimmer-dsl-swt
|
|
340
340
|
|
341
341
|
Or this command if you want a specific version:
|
342
342
|
```
|
343
|
-
jgem install glimmer-dsl-swt -v 4.18.
|
343
|
+
jgem install glimmer-dsl-swt -v 4.18.7.3
|
344
344
|
```
|
345
345
|
|
346
346
|
`jgem` is JRuby's version of `gem` command.
|
@@ -358,7 +358,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
|
|
358
358
|
|
359
359
|
Add the following to `Gemfile`:
|
360
360
|
```
|
361
|
-
gem 'glimmer-dsl-swt', '~> 4.18.
|
361
|
+
gem 'glimmer-dsl-swt', '~> 4.18.7.3'
|
362
362
|
```
|
363
363
|
|
364
364
|
And, then run:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.18.
|
1
|
+
4.18.7.4
|
@@ -67,6 +67,7 @@ Tasks are run via rake. Some tasks take arguments in square brackets.
|
|
67
67
|
Available tasks are below (if you do not see any, please add `require 'glimmer/rake_task'` to Rakefile and rerun or run rake -T):
|
68
68
|
|
69
69
|
Select a Glimmer task to run: (Press ↑/↓ arrow to move, Enter to select and letters to filter)
|
70
|
+
glimmer list:gems:customshape[query] # List Glimmer custom shape gems available at rubygems.org (query is optional) [alt: list:gems:cp]
|
70
71
|
‣ glimmer list:gems:customshell[query] # List Glimmer custom shell gems available at rubygems.org (query is optional) [alt: list:gems:cs]
|
71
72
|
glimmer list:gems:customwidget[query] # List Glimmer custom widget gems available at rubygems.org (query is optional) [alt: list:gems:cw]
|
72
73
|
glimmer list:gems:dsl[query] # List Glimmer DSL gems available at rubygems.org (query is optional)
|
@@ -81,8 +82,11 @@ Select a Glimmer task to run: (Press ↑/↓ arrow to move, Enter to select and
|
|
81
82
|
glimmer run[app_path] # Runs Glimmer app or custom shell gem in the current directory, unless app_path is specified, then runs it instead (app_path is optional)
|
82
83
|
glimmer samples # Brings up the Glimmer Meta-Sample app to allow browsing, running, and viewing code of Glimmer samples
|
83
84
|
glimmer scaffold[app_name] # Scaffold Glimmer application directory structure to build a new app
|
85
|
+
glimmer scaffold:customshape[name,namespace] # Scaffold Glimmer::UI::CustomShape subclass (part of a view) under app/views (namespace is optional) [alt: scaffold:cp]
|
84
86
|
glimmer scaffold:customshell[name,namespace] # Scaffold Glimmer::UI::CustomShell subclass (full window view) under app/views (namespace is optional) [alt: scaffold:cs]
|
85
87
|
glimmer scaffold:customwidget[name,namespace] # Scaffold Glimmer::UI::CustomWidget subclass (part of a view) under app/views (namespace is optional) [alt: scaffold:cw]
|
88
|
+
glimmer scaffold:desktopify[app_name,website] # Desktopify a web app
|
89
|
+
glimmer scaffold:gem:customshape[name,namespace] # Scaffold Glimmer::UI::CustomShape subclass (part of a view) under its own Ruby gem project (namespace is required) [alt: scaffold:gem:cp]
|
86
90
|
glimmer scaffold:gem:customshell[name,namespace] # Scaffold Glimmer::UI::CustomShell subclass (full window view) under its own Ruby gem + app project (namespace is required) [alt: scaffold:ge...
|
87
91
|
glimmer scaffold:gem:customwidget[name,namespace] # Scaffold Glimmer::UI::CustomWidget subclass (part of a view) under its own Ruby gem project (namespace is required) [alt: scaffold:gem:cw]
|
88
92
|
```
|
@@ -333,7 +337,7 @@ glimmer scaffold:cs[name]
|
|
333
337
|
|
334
338
|
#### Custom Widget
|
335
339
|
|
336
|
-
To scaffold a Glimmer [custom widget](#custom-widgets) (part of a view) for an existing Glimmer app, run the following command:
|
340
|
+
To scaffold a Glimmer [custom widget](GLIMMER_GUI_DSL_SYNTAX.md#custom-widgets) (part of a view) for an existing Glimmer app, run the following command:
|
337
341
|
|
338
342
|
```
|
339
343
|
glimmer scaffold:customwidget[name]
|
@@ -345,6 +349,20 @@ Or the following alternative abbreviation:
|
|
345
349
|
glimmer scaffold:cw[name]
|
346
350
|
```
|
347
351
|
|
352
|
+
#### Custom Shape
|
353
|
+
|
354
|
+
To scaffold a Glimmer [custom shape](GLIMMER_GUI_DSL_SYNTAX.md#custom-shapes) (a composite or customized shape) for an existing Glimmer app, run the following command:
|
355
|
+
|
356
|
+
```
|
357
|
+
glimmer scaffold:customshape[name]
|
358
|
+
```
|
359
|
+
|
360
|
+
Or the following alternative abbreviation:
|
361
|
+
|
362
|
+
```
|
363
|
+
glimmer scaffold:cp[name]
|
364
|
+
```
|
365
|
+
|
348
366
|
#### Custom Shell Gem
|
349
367
|
|
350
368
|
Custom shell gems are self-contained Glimmer apps as well as reusable [custom shells](#custom-shells).
|
@@ -382,7 +400,7 @@ Examples:
|
|
382
400
|
|
383
401
|
#### Custom Widget Gem
|
384
402
|
|
385
|
-
To scaffold a Glimmer [custom widget](#custom-widgets) gem (part of a view distributed as a Ruby gem), run the following command:
|
403
|
+
To scaffold a Glimmer [custom widget](GLIMMER_GUI_DSL_SYNTAX.md#custom-widgets) gem (part of a view distributed as a Ruby gem), run the following command:
|
386
404
|
|
387
405
|
```
|
388
406
|
glimmer scaffold:gem:customwidget[name,namespace]
|
@@ -397,7 +415,7 @@ glimmer scaffold:gem:cw[name,namespace]
|
|
397
415
|
|
398
416
|
It is important to specify a namespace to avoid having your gem clash with existing gems.
|
399
417
|
|
400
|
-
The Ruby gem name will follow the convention "glimmer-cw-customwidgetname-namespace" (the 'cw' is for Custom Widget)
|
418
|
+
The Ruby gem name will follow the convention "glimmer-cw-customwidgetname-namespace" (the 'cw' is for Custom Widget; name words are not separated)
|
401
419
|
|
402
420
|
Only official Glimmer gems created by the Glimmer project committers will have no namespace (e.g. [glimmer-cw-video](https://rubygems.org/gems/glimmer-cw-video) Ruby gem)
|
403
421
|
|
@@ -406,6 +424,31 @@ Examples:
|
|
406
424
|
- [glimmer-cw-video](https://github.com/AndyObtiva/glimmer-cw-video): Video Widget
|
407
425
|
- [glimmer-cw-cdatetime-nebula](https://github.com/AndyObtiva/glimmer-cw-cdatetime-nebula): Nebula CDateTime Widget
|
408
426
|
|
427
|
+
#### Custom Shape Gem
|
428
|
+
|
429
|
+
To scaffold a Glimmer [custom shape](GLIMMER_GUI_DSL_SYNTAX.md#custom-shapes) gem (part of a view distributed as a Ruby gem), run the following command:
|
430
|
+
|
431
|
+
```
|
432
|
+
glimmer scaffold:gem:customshape[name,namespace]
|
433
|
+
```
|
434
|
+
|
435
|
+
Or the following alternative abbreviation:
|
436
|
+
|
437
|
+
```
|
438
|
+
glimmer scaffold:gem:cp[name,namespace]
|
439
|
+
```
|
440
|
+
|
441
|
+
|
442
|
+
It is important to specify a namespace to avoid having your gem clash with existing gems.
|
443
|
+
|
444
|
+
The Ruby gem name will follow the convention "glimmer-cp-customshapename-namespace" (the 'cp' is for Custom Shape; name words are not separated)
|
445
|
+
|
446
|
+
Only official Glimmer gems created by the Glimmer project committers will have no namespace (e.g. [glimmer-cp-bevel](https://rubygems.org/gems/glimmer-cp-bevel) Ruby gem)
|
447
|
+
|
448
|
+
Examples:
|
449
|
+
|
450
|
+
- [glimmer-cp-bevel](https://github.com/AndyObtiva/glimmer-cp-bevel): Bevel
|
451
|
+
|
409
452
|
### Gem Listing
|
410
453
|
|
411
454
|
The `glimmer` command comes with tasks for listing Glimmer related gems to make it easy to find Glimmer [Custom Shells](#custom-shells), [Custom Widgets](#custom-widgets), and DSLs published by others in the Glimmer community on [rubygems.org](http://www.rubygems.org).
|
@@ -39,6 +39,7 @@ This guide should help you get started with Glimmer DSL for SWT. For more advanc
|
|
39
39
|
- [Shapes inside a Shape](#shapes-inside-a-shape)
|
40
40
|
- [Shapes inside a Widget](#shapes-inside-a-widget)
|
41
41
|
- [Shapes inside an Image](#shapes-inside-an-image)
|
42
|
+
- [Custom Shapes](#custom-shapes)
|
42
43
|
- [Canvas Shape API](#canvas-shape-api)
|
43
44
|
- [Pixel Graphics](#pixel-graphics)
|
44
45
|
- [Canvas Path DSL](#canvas-path-dsl)
|
@@ -1415,7 +1416,7 @@ Shape keywords and their args (including defaults) are listed below (they basica
|
|
1415
1416
|
- `text(string, x, y, is_transparent = true)` text with optional is_transparent to indicate if background is transparent (default is true)
|
1416
1417
|
- `text(string, x, y, flags)` text with optional flags (flag format is `swt(comma_separated_flags)` where flags can be `:draw_delimiter` (i.e. new lines), `:draw_tab`, `:draw_mnemonic`, and `:draw_transparent` as explained in [GC API](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/GC.html))
|
1417
1418
|
|
1418
|
-
Shape keywords that can be filled with color can take a keyword argument `fill: true
|
1419
|
+
Shape keywords that can be filled with color can take a keyword argument `fill: true` (or `filled: true`). Defaults to false when not specified unless background is set with no foreground (or foreground is set with no background), in which case a smart default is applied.
|
1419
1420
|
Smart defaults can be applied to automatically infer `gradient: true` (rectangle with both foreground and background) and `round: true` (rectangle with more than 4 args, the extra args are numeric) as well.
|
1420
1421
|
|
1421
1422
|
Optionally, a shape keyword takes a block that can set any attributes from [org.eclipse.swt.graphics.GC](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/GC.html) (methods starting with `set`), which enable setting the `background` for filling and `foreground` for drawing.
|
@@ -1484,6 +1485,8 @@ Screenshot:
|
|
1484
1485
|
|
1485
1486
|
If you specify the x and y coordinates as `:default`, `nil`, or leave them out, they get calculated automatically by centering the shape within its parent `canvas`.
|
1486
1487
|
|
1488
|
+
If you specify the `width` and `height` parameters as `:max`, they get calculated from the parent's size, filling the parent maximally.
|
1489
|
+
|
1487
1490
|
Note that you could shift a shape off its centered position within its parent `canvas` by setting `x` to `[:default, x_delta]` and `y` to `[:default, y_delta]`
|
1488
1491
|
|
1489
1492
|
The round and gradient options could be dropped since Glimmer DSL for SWT supports auto-inference of them based on shape parameters.
|
@@ -1643,7 +1646,9 @@ As such, if you move the parent, it moves all its children with it.
|
|
1643
1646
|
|
1644
1647
|
If you specify the `x` and `y` coordinates as `:default`, `nil`, or leave them out, they get calculated automatically by centering the shape within its parent shape relatively.
|
1645
1648
|
|
1646
|
-
If you specify the `width` and `height` parameters as `:default`, `nil`, or leave them out, they get calculated automatically from the shape's nested children shapes (e.g calculating the dimensions of a text from its extent according to its font size).
|
1649
|
+
If you specify the `width` and `height` parameters as `:default`, `nil`, or leave them out, they get calculated automatically from the shape's nested children shapes if any (e.g calculating the dimensions of a text from its extent according to its font size) or from the parent's size otherwise.
|
1650
|
+
|
1651
|
+
If you specify the `width` and `height` parameters as `:max`, they get calculated from the parent's size, filling the parent maximally.
|
1647
1652
|
|
1648
1653
|
Note that you could shift a shape off its centered position within its parent shape by setting `x` to `[:default, x_delta]` and `y` to `[:default, y_delta]`
|
1649
1654
|
|
@@ -1767,6 +1772,21 @@ shell {
|
|
1767
1772
|
|
1768
1773
|
![Image Shape DSL](/images/glimmer-example-image-shape-dsl-app-switcher-icon.png)
|
1769
1774
|
|
1775
|
+
#### Custom Shapes
|
1776
|
+
|
1777
|
+
Glimmer enables defining custom shape keywords, which represent shapes made up of other nested shapes.
|
1778
|
+
|
1779
|
+
Custom shapes expand a software engineer's Glimmer GUI DSL vocabulary in their app development to be able to represent
|
1780
|
+
higher visual concepts like vehicles, scenes, and characters with a single keyword (e.g. `car`, `beach`, `player`),
|
1781
|
+
which embody and abstract all the details relating to the visual concept. This enables orders of magnitudes in increased
|
1782
|
+
productivity and readability/maintainability as a result.
|
1783
|
+
|
1784
|
+
Just like [custom widgets](#custom-widgets), custom shapes can be defined in one of two ways:
|
1785
|
+
- method-based custom shapes: Use the `shape` keyword as a parent to represent a shape composite (similar to widget composite) and include other shapes like rectangles, polygons, and lines within.
|
1786
|
+
- class-based custom shapes: Include the `Glimmer::UI::CustomShape` supermodule and define the `options`, `body {}` block, and `before_body/after_body` hooks (similar to how it is down with [custom widgets](#custom-widgets))
|
1787
|
+
|
1788
|
+
Check out [Hello, Shape!](/docs/reference/GLIMMER_SAMPLES.md#hello-shape) and [Hello, Custom Shape!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shape) for examples of both approaches.
|
1789
|
+
|
1770
1790
|
#### Canvas Shape API
|
1771
1791
|
|
1772
1792
|
These Canvas Shape API methods help with manipulating shapes upon user interaction, such as mouse clicking a specific shape.
|
@@ -1785,6 +1805,8 @@ They are implemented with the help of the highly robust Java built-in shape geom
|
|
1785
1805
|
- `Shape#height` : static (including `:default`) or derived height for shape (including irregular geometric shapes like Polygon)
|
1786
1806
|
- `Shape#default_width?` : whether `:default` or `[:default, delta]` is set for static width
|
1787
1807
|
- `Shape#default_height?` : whether `:default` or `[:default, delta]` is set for static height
|
1808
|
+
- `Shape#max_width?` : whether `:max` or `[:max, delta]` is set for static width
|
1809
|
+
- `Shape#max_height?` : whether `:max` or `[:max, delta]` is set for static height
|
1788
1810
|
- `Shape#calculated_width` : calculated width for shape when set to :default to indicate it is sized by its children (e.g. in the case of containing text with a specific font size not knowing its width/height dimensions in advance)
|
1789
1811
|
- `Shape#calculated_height` : calculated height for shape when set to :default to indicate it is sized by its children (e.g. in the case of containing text with a specific font size not knowing its width/height dimensions in advance)
|
1790
1812
|
- `Shape#x` : top-left corner x position, static or `:default` (could be relative if shape is nested within another shape)
|
@@ -1798,6 +1820,7 @@ They are implemented with the help of the highly robust Java built-in shape geom
|
|
1798
1820
|
|
1799
1821
|
Check [Hello, Canvas!](GLIMMER_SAMPLES.md#hello-canvas) for an example.
|
1800
1822
|
|
1823
|
+
|
1801
1824
|
#### Pixel Graphics
|
1802
1825
|
|
1803
1826
|
**(Early Alpha Feature)**
|
@@ -2174,7 +2197,7 @@ API of Animation Object (returned from `animation` keyword):
|
|
2174
2197
|
- `#cycle_limited?` returns true if `cycle_count` is specified
|
2175
2198
|
- `#duration_limited?` returns true if `duration_limit` is specified
|
2176
2199
|
|
2177
|
-
Learn more at the [Hello, Canvas Animation!
|
2200
|
+
Learn more at the [Hello, Canvas Animation!](GLIMMER_SAMPLES.md#hello-canvas-animation) and [Hello, Canvas Animation Data Binding!](GLIMMER_SAMPLES.md#hello-canvas-animation-data-binding) samples.
|
2178
2201
|
|
2179
2202
|
If there is anything missing you would like added to the Glimmer Animation DSL that you saw available in the SWT APIs, you may [report an issue](https://github.com/AndyObtiva/glimmer-dsl-swt/issues) or implement yourself and [contribute](#contributing) via a Pull Request.
|
2180
2203
|
|
@@ -32,6 +32,7 @@
|
|
32
32
|
- [Hello, Code Text!](#hello-code-text)
|
33
33
|
- [Hello, Canvas!](#hello-canvas)
|
34
34
|
- [Hello, Canvas Animation!](#hello-canvas-animation)
|
35
|
+
- [Hello, Canvas Animation Data Binding!](#hello-canvas-animation-data-binding)
|
35
36
|
- [Hello, Canvas Transform!](#hello-canvas-transform)
|
36
37
|
- [Hello, Canvas Path!](#hello-canvas-path)
|
37
38
|
- [Hello, Canvas Data Binding!](#hello-canvas-data-binding)
|
@@ -40,6 +41,8 @@
|
|
40
41
|
- [Hello, Tree!](#hello-tree)
|
41
42
|
- [Hello, Color Dialog!](#hello-color-dialog)
|
42
43
|
- [Hello, Font Dialog!](#hello-font-dialog)
|
44
|
+
- [Hello, Shape!](#hello-shape)
|
45
|
+
- [Hello, Custom Shape!](#hello-custom-shape)
|
43
46
|
- [Elaborate Samples](#elaborate-samples)
|
44
47
|
- [User Profile](#user-profile)
|
45
48
|
- [Login](#login)
|
@@ -48,6 +51,7 @@
|
|
48
51
|
- [Glimmer Tetris](#glimmer-tetris)
|
49
52
|
- [Mandelbrot Fractal](#mandelbrot-fractal)
|
50
53
|
- [Stock Ticker](#stock-ticker)
|
54
|
+
- [Metronome](#metronome)
|
51
55
|
- [External Samples](#external-samples)
|
52
56
|
- [Glimmer Calculator](#glimmer-calculator)
|
53
57
|
- [Gladiator](#gladiator)
|
@@ -607,6 +611,18 @@ Hello, Canvas Animation Another Frame!
|
|
607
611
|
|
608
612
|
![Hello Canvas Animation Frame 2](/images/glimmer-hello-canvas-animation-frame2.png)
|
609
613
|
|
614
|
+
#### Hello, Canvas Animation Data Binding!
|
615
|
+
|
616
|
+
This sample demonstrates the use of the [Canvas Animation DSL](#canvas-animation-dsl) with data-binding.
|
617
|
+
|
618
|
+
Code:
|
619
|
+
|
620
|
+
[samples/hello/hello_canvas_animation_data_binding.rb](/samples/hello/hello_canvas_animation_data_binding.rb)
|
621
|
+
|
622
|
+
Hello, Canvas Animation Data Binding!
|
623
|
+
|
624
|
+
![Hello Canvas Animation Data Binding](/images/glimmer-hello-canvas-animation-data-binding.gif)
|
625
|
+
|
610
626
|
#### Hello, Canvas Transform!
|
611
627
|
|
612
628
|
This sample demonstrates the use of the `transform` keyword as part of the [Transform DSL](#canvas-transform-dsl) within the [Shape DSL](#canvas-shape-dsl).
|
@@ -717,6 +733,32 @@ Hello, Font Dialog!
|
|
717
733
|
|
718
734
|
![Hello Font Dialog Font Changed](/images/glimmer-hello-font-dialog-font-changed.png)
|
719
735
|
|
736
|
+
#### Hello, Shape!
|
737
|
+
|
738
|
+
This sample demonstrates the use of the `shape` keyword, which represents shape composites that contain other nested shapes.
|
739
|
+
|
740
|
+
Code:
|
741
|
+
|
742
|
+
[samples/hello/hello_shape.rb](/samples/hello/hello_shape.rb)
|
743
|
+
|
744
|
+
Hello, Shape!
|
745
|
+
|
746
|
+
![Hello Shape](/images/glimmer-hello-shape.png)
|
747
|
+
|
748
|
+
#### Hello, Custom Shape!
|
749
|
+
|
750
|
+
This sample demonstrates the use of the `Glimmer::UI::CustomShape` module, which is used to author new custom shape keywords.
|
751
|
+
It reimplements Hello, Shape! with a class-based custom shape instead of a method-based custom shape.
|
752
|
+
Just provides another option that is useful when defining more elaborate shapes to separate them from the main app code.
|
753
|
+
|
754
|
+
Code:
|
755
|
+
|
756
|
+
[samples/hello/hello_custom_shape.rb](/samples/hello/hello_custom_shape.rb)
|
757
|
+
|
758
|
+
Hello, Custom Shape!
|
759
|
+
|
760
|
+
![Hello Custom Shape](/images/glimmer-hello-custom-shape.png)
|
761
|
+
|
720
762
|
### Elaborate Samples
|
721
763
|
|
722
764
|
For more elaborate samples, check the following:
|
@@ -851,6 +893,20 @@ Code:
|
|
851
893
|
|
852
894
|
![Stock Ticker](/images/glimmer-stock-ticker.gif)
|
853
895
|
|
896
|
+
#### Metronome
|
897
|
+
|
898
|
+
This sample demonstrates a Metronome that accepts a beat count and bpm rate, ticking at every beat, with an uptick at the beginning of the rhythm interval.
|
899
|
+
|
900
|
+
It takes advantage of the Canvas Shape DSL, data-binding, and the Java Sound library. It employs a hybrid approach of relying on standard widget layouts (grid layout) and canvas shape x,y placement.
|
901
|
+
|
902
|
+
Code:
|
903
|
+
|
904
|
+
[samples/elaborate/metronome.rb](/samples/elaborate/metronome.rb)
|
905
|
+
|
906
|
+
![Metronome](/images/glimmer-metronome.gif)
|
907
|
+
|
908
|
+
[Download video with sound](/videos/glimmer-metronome.mp4?raw=true).
|
909
|
+
|
854
910
|
### External Samples
|
855
911
|
|
856
912
|
#### Glimmer Calculator
|
data/glimmer-dsl-swt.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: glimmer-dsl-swt 4.18.
|
5
|
+
# stub: glimmer-dsl-swt 4.18.7.4 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "glimmer-dsl-swt".freeze
|
9
|
-
s.version = "4.18.
|
9
|
+
s.version = "4.18.7.4"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["AndyMaleh".freeze]
|
14
|
-
s.date = "2021-03-
|
14
|
+
s.date = "2021-03-10"
|
15
15
|
s.description = "Glimmer DSL for SWT (JRuby Desktop Development GUI Framework) is a native-GUI cross-platform desktop development library written in JRuby, an OS-threaded faster JVM version of Ruby. Glimmer's main innovation is a declarative Ruby DSL that enables productive and efficient authoring of desktop application user-interfaces by relying on the robust Eclipse SWT library. Glimmer additionally innovates by having built-in data-binding support, which greatly facilitates synchronizing the GUI with domain models, thus achieving true decoupling of object oriented components and enabling developers to solve business problems (test-first) without worrying about GUI concerns, or alternatively drive development GUI-first, and then write clean business models (test-first) afterwards. Not only does Glimmer provide a large set of GUI widgets, but it also supports drawing Canvas Graphics like Shapes and Animations. To get started quickly, Glimmer offers scaffolding options for Apps, Gems, and Custom Widgets. Glimmer also includes native-executable packaging support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in Ruby as truly native DMG/PKG/APP files on the Mac + App Store, MSI/EXE files on Windows, and Gem Packaged Shell Scripts on Linux.".freeze
|
16
16
|
s.email = "andy.am@gmail.com".freeze
|
17
17
|
s.executables = ["glimmer".freeze, "girb".freeze]
|
@@ -66,6 +66,7 @@ Gem::Specification.new do |s|
|
|
66
66
|
"lib/glimmer/dsl/swt/column_properties_expression.rb",
|
67
67
|
"lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb",
|
68
68
|
"lib/glimmer/dsl/swt/cursor_expression.rb",
|
69
|
+
"lib/glimmer/dsl/swt/custom_shape_expression.rb",
|
69
70
|
"lib/glimmer/dsl/swt/custom_widget_expression.rb",
|
70
71
|
"lib/glimmer/dsl/swt/data_binding_expression.rb",
|
71
72
|
"lib/glimmer/dsl/swt/dialog_expression.rb",
|
@@ -157,6 +158,7 @@ Gem::Specification.new do |s|
|
|
157
158
|
"lib/glimmer/swt/widget_listener_proxy.rb",
|
158
159
|
"lib/glimmer/swt/widget_proxy.rb",
|
159
160
|
"lib/glimmer/ui.rb",
|
161
|
+
"lib/glimmer/ui/custom_shape.rb",
|
160
162
|
"lib/glimmer/ui/custom_shell.rb",
|
161
163
|
"lib/glimmer/ui/custom_widget.rb",
|
162
164
|
"lib/glimmer/util/proc_tracker.rb",
|
@@ -167,12 +169,14 @@ Gem::Specification.new do |s|
|
|
167
169
|
"samples/elaborate/login.rb",
|
168
170
|
"samples/elaborate/mandelbrot_fractal.rb",
|
169
171
|
"samples/elaborate/meta_sample.rb",
|
172
|
+
"samples/elaborate/metronome.rb",
|
170
173
|
"samples/elaborate/stock_ticker.rb",
|
171
174
|
"samples/elaborate/tetris.rb",
|
172
175
|
"samples/elaborate/tetris/model/block.rb",
|
173
176
|
"samples/elaborate/tetris/model/game.rb",
|
174
177
|
"samples/elaborate/tetris/model/past_game.rb",
|
175
178
|
"samples/elaborate/tetris/model/tetromino.rb",
|
179
|
+
"samples/elaborate/tetris/view/bevel.rb",
|
176
180
|
"samples/elaborate/tetris/view/block.rb",
|
177
181
|
"samples/elaborate/tetris/view/high_score_dialog.rb",
|
178
182
|
"samples/elaborate/tetris/view/playfield.rb",
|
@@ -186,6 +190,7 @@ Gem::Specification.new do |s|
|
|
186
190
|
"samples/hello/hello_button.rb",
|
187
191
|
"samples/hello/hello_canvas.rb",
|
188
192
|
"samples/hello/hello_canvas_animation.rb",
|
193
|
+
"samples/hello/hello_canvas_animation_data_binding.rb",
|
189
194
|
"samples/hello/hello_canvas_data_binding.rb",
|
190
195
|
"samples/hello/hello_canvas_path.rb",
|
191
196
|
"samples/hello/hello_canvas_transform.rb",
|
@@ -197,6 +202,7 @@ Gem::Specification.new do |s|
|
|
197
202
|
"samples/hello/hello_computed.rb",
|
198
203
|
"samples/hello/hello_computed/contact.rb",
|
199
204
|
"samples/hello/hello_cursor.rb",
|
205
|
+
"samples/hello/hello_custom_shape.rb",
|
200
206
|
"samples/hello/hello_custom_shell.rb",
|
201
207
|
"samples/hello/hello_custom_widget.rb",
|
202
208
|
"samples/hello/hello_date_time.rb",
|
@@ -217,6 +223,7 @@ Gem::Specification.new do |s|
|
|
217
223
|
"samples/hello/hello_radio.rb",
|
218
224
|
"samples/hello/hello_radio_group.rb",
|
219
225
|
"samples/hello/hello_sash_form.rb",
|
226
|
+
"samples/hello/hello_shape.rb",
|
220
227
|
"samples/hello/hello_spinner.rb",
|
221
228
|
"samples/hello/hello_styled_text.rb",
|
222
229
|
"samples/hello/hello_tab.rb",
|
@@ -224,6 +231,8 @@ Gem::Specification.new do |s|
|
|
224
231
|
"samples/hello/hello_table/baseball_park.png",
|
225
232
|
"samples/hello/hello_tree.rb",
|
226
233
|
"samples/hello/hello_world.rb",
|
234
|
+
"sounds/metronome-down.wav",
|
235
|
+
"sounds/metronome-up.wav",
|
227
236
|
"vendor/swt/linux/swt.jar",
|
228
237
|
"vendor/swt/mac/swt.jar",
|
229
238
|
"vendor/swt/windows/swt.jar"
|
@@ -238,7 +247,7 @@ Gem::Specification.new do |s|
|
|
238
247
|
s.specification_version = 4
|
239
248
|
|
240
249
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
241
|
-
s.add_runtime_dependency(%q<glimmer>.freeze, ["~> 1.
|
250
|
+
s.add_runtime_dependency(%q<glimmer>.freeze, ["~> 1.2.0"])
|
242
251
|
s.add_runtime_dependency(%q<super_module>.freeze, [">= 1.4.1", "< 2.0.0"])
|
243
252
|
s.add_runtime_dependency(%q<nested_inherited_jruby_include_package>.freeze, [">= 0.3.0", "< 2.0.0"])
|
244
253
|
s.add_runtime_dependency(%q<puts_debuggerer>.freeze, [">= 0.11.0", "< 2.0.0"])
|
@@ -256,7 +265,7 @@ Gem::Specification.new do |s|
|
|
256
265
|
s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
|
257
266
|
s.add_development_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
|
258
267
|
else
|
259
|
-
s.add_dependency(%q<glimmer>.freeze, ["~> 1.
|
268
|
+
s.add_dependency(%q<glimmer>.freeze, ["~> 1.2.0"])
|
260
269
|
s.add_dependency(%q<super_module>.freeze, [">= 1.4.1", "< 2.0.0"])
|
261
270
|
s.add_dependency(%q<nested_inherited_jruby_include_package>.freeze, [">= 0.3.0", "< 2.0.0"])
|
262
271
|
s.add_dependency(%q<puts_debuggerer>.freeze, [">= 0.11.0", "< 2.0.0"])
|
@@ -275,7 +284,7 @@ Gem::Specification.new do |s|
|
|
275
284
|
s.add_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
|
276
285
|
end
|
277
286
|
else
|
278
|
-
s.add_dependency(%q<glimmer>.freeze, ["~> 1.
|
287
|
+
s.add_dependency(%q<glimmer>.freeze, ["~> 1.2.0"])
|
279
288
|
s.add_dependency(%q<super_module>.freeze, [">= 1.4.1", "< 2.0.0"])
|
280
289
|
s.add_dependency(%q<nested_inherited_jruby_include_package>.freeze, [">= 0.3.0", "< 2.0.0"])
|
281
290
|
s.add_dependency(%q<puts_debuggerer>.freeze, [">= 0.11.0", "< 2.0.0"])
|