glimmer-dsl-swt 4.17.3.0 → 4.17.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +38 -0
- data/README.md +250 -478
- data/VERSION +1 -1
- data/glimmer-dsl-swt.gemspec +21 -8
- data/lib/glimmer-dsl-swt.rb +1 -0
- data/lib/glimmer/dsl/swt/custom_widget_expression.rb +2 -0
- data/lib/glimmer/dsl/swt/dsl.rb +1 -0
- data/lib/glimmer/dsl/swt/expand_item_expression.rb +60 -0
- data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +61 -0
- data/lib/glimmer/dsl/swt/widget_expression.rb +2 -0
- data/lib/glimmer/rake_task.rb +4 -21
- data/lib/glimmer/swt/custom/code_text.rb +95 -0
- data/lib/glimmer/swt/custom/radio_group.rb +101 -0
- data/lib/glimmer/swt/expand_item_proxy.rb +98 -0
- data/lib/glimmer/swt/image_proxy.rb +5 -0
- data/lib/glimmer/swt/menu_proxy.rb +1 -1
- data/lib/glimmer/swt/message_box_proxy.rb +1 -1
- data/lib/glimmer/swt/sash_form_proxy.rb +53 -0
- data/lib/glimmer/swt/styled_text_proxy.rb +43 -0
- data/lib/glimmer/swt/tab_item_proxy.rb +1 -1
- data/lib/glimmer/swt/widget_proxy.rb +92 -33
- data/lib/glimmer/ui/custom_widget.rb +3 -0
- data/samples/elaborate/meta_sample.rb +166 -0
- data/samples/hello/hello_checkbox.rb +85 -0
- data/samples/hello/hello_expand_bar.rb +108 -0
- data/samples/hello/hello_radio.rb +108 -0
- data/samples/hello/hello_radio_group.rb +84 -0
- data/samples/hello/hello_sash_form.rb +137 -0
- data/samples/hello/hello_styled_text.rb +138 -0
- metadata +23 -10
- data/lib/glimmer/rake_task/sample.rb +0 -115
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50dd550729725e788ad32393c82aa34c1e39cbc536b0bfce60734603c052b1cf
|
4
|
+
data.tar.gz: 19cf9cb269726720dac30ebf82d458afc1c535861153be8e3fad8ba0864f4a5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2dffb27676fc7884bd58927e1648677ec972b56b56fdd9a6162c99e252fe6018b3f135766abf739a215d46398136422bdf656a52832821b326b6c02dbed9a8a
|
7
|
+
data.tar.gz: 93c4fb967105b1271e3425155ccb3e5e71acb796d63eac3990a984fc0094708ec7be11faf0f9f0760c5c16e3168a6e477d6737bca444801c4425556458978a81
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,42 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
### 4.17.6.0
|
4
|
+
|
5
|
+
- New `radio_group` built-in Glimmer custom widget
|
6
|
+
- Hello, Radio! Sample
|
7
|
+
- Hello, Radio Group! Sample
|
8
|
+
- Hello, Checkbox! Sample
|
9
|
+
|
10
|
+
### 4.17.5.0
|
11
|
+
|
12
|
+
- Support auto-scaling by aspect ratio of width and height (write specs)
|
13
|
+
- Support SWT ExpandBar via expand_bar keyword
|
14
|
+
- Hello, Expand Bar! Sample
|
15
|
+
- Hello, Styled Text! Sample
|
16
|
+
- Use expand_bar in Glimmer Meta-Sample
|
17
|
+
|
18
|
+
### 4.17.4.2
|
19
|
+
|
20
|
+
- Support StyledText data-binding of caret_offset, selection_count, selection, top_index, and top_pixel, useful for code_text
|
21
|
+
- Support `width, height` hash options for ImageProxy and image properties on widgets
|
22
|
+
- Default SWT styles for tool_bar (:border) and tool_item (:push)
|
23
|
+
|
24
|
+
### 4.17.4.1
|
25
|
+
|
26
|
+
- Optimize code_text line style listener algorithm or avoid setting code_text style via listener for performance reasons
|
27
|
+
- Optimize code_text syntax highlighting by not lexing except when content changes (e.g. during scrolling, do not lex)
|
28
|
+
|
29
|
+
### 4.17.4.0
|
30
|
+
|
31
|
+
- Glimmer sample app to launch samples (sample of samples meta-sample)
|
32
|
+
- Syntax Color Highlighting in meta-sample
|
33
|
+
- Make sash_form weights accept splat array elements (not wrapped in [])
|
34
|
+
- Make sash_form weights not get set till the closing of the sash_form (to allow putting it above content instead of below as originally required by SWT)
|
35
|
+
- Replace dependency on tty-markdown gem with dependency on rouge gem instead
|
36
|
+
- Remove rake tasks `sample:list`, `sample:code` and `sample:run`
|
37
|
+
- Add rake task `samples` to point to the new Glimmer Meta-Sample
|
38
|
+
- Have meta-sample load samples from gems
|
39
|
+
|
3
40
|
### 4.17.3.0
|
4
41
|
|
5
42
|
- `glimmer scaffold:desktopify[appname,website]` Mac
|
@@ -18,6 +55,7 @@
|
|
18
55
|
|
19
56
|
- New `glimmer run` glimmer command task.
|
20
57
|
- Add built in support for handling jar file paths like that in ImageProxy code processing "uri:classloader" path
|
58
|
+
- Document that gif background_image only works without on_top and no_trim styles in Windows
|
21
59
|
- Give a good error message when Git is not properly setup for Glimmer Scaffolding
|
22
60
|
- Give an error message when attempting to scaffold over an already scaffolded directory
|
23
61
|
- Fix issue on Windows regarding use of the new EXPERIMENTAL Animated gif support in the `composite#background_image` property
|
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.17.
|
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.17.6.0
|
2
2
|
## JRuby Desktop Development GUI Library
|
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)
|
@@ -10,10 +10,14 @@
|
|
10
10
|
|
11
11
|
(The Original Glimmer Library Since 2007. Beware of Imitators!)
|
12
12
|
|
13
|
-
[
|
13
|
+
[Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer) is a native-GUI cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster version of [Ruby](https://www.ruby-lang.org/en/). [Glimmer](https://github.com/AndyObtiva/glimmer)'s main innovation is a declarative [Ruby DSL](#glimmer-dsl-syntax) that enables productive and efficient authoring of desktop application user-interfaces while relying on the robust [Eclipse SWT library](https://www.eclipse.org/swt/). [Glimmer](https://rubygems.org/gems/glimmer) additionally innovates by having built-in [data-binding](#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. To get started quickly, [Glimmer](https://rubygems.org/gems/glimmer) offers [scaffolding](#scaffolding) options for [Apps](#in-production), [Gems](#custom-shell-gem), and [Custom Widgets](#custom-widgets). [Glimmer](https://rubygems.org/gems/glimmer) also includes native-executable [packaging](#packaging--distribution) support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in [Ruby](https://www.ruby-lang.org/en/) as truly native DMG/PKG/APP files on the [Mac](https://www.apple.com/ca/macos) + [App Store](https://developer.apple.com/macos/distribution/), MSI/EXE files on [Windows](https://www.microsoft.com/en-ca/windows), and [Gem Packaged Shell Scripts](#custom-shell-gem) on [Linux](https://www.linux.org/).
|
14
14
|
|
15
15
|
[Glimmer receives two updates per month](https://rubygems.org/gems/glimmer-dsl-swt/versions). You can trust [Glimmer](https://rubygems.org/gems/glimmer) with your Ruby desktop GUI development needs. Please make [Glimmer](https://rubygems.org/gems/glimmer) even better by providing feedback and [contributing](#contributing) when possible.
|
16
16
|
|
17
|
+
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.
|
18
|
+
|
19
|
+
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) versions 4.17.x.y come with [SWT 4.17](https://download.eclipse.org/eclipse/downloads/drops4/R-4.17-202009021800/), which was released on September 2, 2020.
|
20
|
+
|
17
21
|
[<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
|
18
22
|
Featured in<br />JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do)
|
19
23
|
|
@@ -40,9 +44,10 @@ shell {
|
|
40
44
|
}.open
|
41
45
|
```
|
42
46
|
|
43
|
-
Run:
|
47
|
+
Run via `glimmer samples` or directly:
|
48
|
+
|
44
49
|
```
|
45
|
-
glimmer
|
50
|
+
glimmer samples/hello/hello_world.rb
|
46
51
|
```
|
47
52
|
|
48
53
|
Glimmer app:
|
@@ -85,10 +90,10 @@ Glimmer code (from [samples/elaborate/tic_tac_toe.rb](https://github.com/AndyObt
|
|
85
90
|
# ...
|
86
91
|
```
|
87
92
|
|
88
|
-
Run:
|
93
|
+
Run via `glimmer samples` or directly:
|
89
94
|
|
90
95
|
```
|
91
|
-
glimmer
|
96
|
+
glimmer samples/elaborate/tic_tac_toe.rb
|
92
97
|
```
|
93
98
|
|
94
99
|
Glimmer app:
|
@@ -210,10 +215,10 @@ Glimmer code (from [samples/elaborate/contact_manager.rb](https://github.com/And
|
|
210
215
|
# ...
|
211
216
|
```
|
212
217
|
|
213
|
-
Run:
|
218
|
+
Run via `glimmer samples` or directly:
|
214
219
|
|
215
220
|
```
|
216
|
-
glimmer
|
221
|
+
glimmer samples/elaborate/contact_manager.rb
|
217
222
|
```
|
218
223
|
|
219
224
|
Glimmer App:
|
@@ -248,12 +253,10 @@ Glimmer App:
|
|
248
253
|
- [Glimmer Command](#glimmer-command)
|
249
254
|
- [Basic Usage](#basic-usage)
|
250
255
|
- [Advanced Usage](#advanced-usage)
|
251
|
-
- [
|
252
|
-
- [Sample List](#sample-list)
|
253
|
-
- [Sample Run](#sample-run)
|
254
|
-
- [Sample Code](#sample-code)
|
256
|
+
- [Glimmer Samples](#glimmer-samples)
|
255
257
|
- [Scaffolding](#scaffolding)
|
256
258
|
- [App](#app)
|
259
|
+
- [Desktopify](#desktopify)
|
257
260
|
- [Custom Shell](#custom-shell)
|
258
261
|
- [Custom Widget](#custom-widget)
|
259
262
|
- [Custom Shell Gem](#custom-shell-gem)
|
@@ -283,6 +286,7 @@ Glimmer App:
|
|
283
286
|
- [Color](#color)
|
284
287
|
- [Font](#font)
|
285
288
|
- [Image](#image)
|
289
|
+
- [Image Options](#image-options)
|
286
290
|
- [Cursor](#cursor)
|
287
291
|
- [Layouts](#layouts)
|
288
292
|
- [Layout Data](#layout-data)
|
@@ -309,7 +313,9 @@ Glimmer App:
|
|
309
313
|
- [Multi-DSL Support](#multi-dsl-support)
|
310
314
|
- [Application Menu Items (About/Preferences)](#application-menu-items-aboutpreferences)
|
311
315
|
- [App Name and Version](#app-name-and-version)
|
316
|
+
- [Code Text Widget](#code-text-widget)
|
312
317
|
- [Video Widget](#video-widget)
|
318
|
+
- [Sash Form Widget](#sash-form-widget)
|
313
319
|
- [Browser Widget](#browser-widget)
|
314
320
|
- [Glimmer Configuration](#glimmer-configuration)
|
315
321
|
- [logger](#logger)
|
@@ -338,6 +344,12 @@ Glimmer App:
|
|
338
344
|
- [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu)
|
339
345
|
- [Hello, Custom Widget!](#hello-custom-widget)
|
340
346
|
- [Hello, Custom Shell!](#hello-custom-shell)
|
347
|
+
- [Hello, Sash Form!](#hello-sash-form)
|
348
|
+
- [Hello, Styled Text!](#hello-styled-text)
|
349
|
+
- [Hello, Expand Bar!](#hello-expand-bar)
|
350
|
+
- [Hello, Radio!](#hello-radio)
|
351
|
+
- [Hello, Radio Group!](#hello-radio-group)
|
352
|
+
- [Hello, Checkbox!](#hello-checkbox)
|
341
353
|
- [Elaborate Samples](#elaborate-samples)
|
342
354
|
- [User Profile](#user-profile)
|
343
355
|
- [Login](#login)
|
@@ -373,7 +385,7 @@ Glimmer App:
|
|
373
385
|
- [Contributors](#contributors)
|
374
386
|
- [Hire Me](#hire-me)
|
375
387
|
- [License](#license)
|
376
|
-
|
388
|
+
|
377
389
|
## Background
|
378
390
|
|
379
391
|
Ruby is a dynamically-typed object-oriented language, which provides great productivity gains due to its powerful expressive syntax and dynamic nature. While it is proven by the Ruby on Rails framework for web development, it currently lacks a robust platform-independent framework for building desktop applications. Given that Java libraries can now be utilized in Ruby code through JRuby, Eclipse technologies, such as SWT, JFace, and RCP can help fill the gap of desktop application development with Ruby.
|
@@ -431,11 +443,9 @@ jgem install glimmer-dsl-swt
|
|
431
443
|
|
432
444
|
Or this command if you want a specific version:
|
433
445
|
```
|
434
|
-
jgem install glimmer-dsl-swt -v 4.17.
|
446
|
+
jgem install glimmer-dsl-swt -v 4.17.6.0
|
435
447
|
```
|
436
448
|
|
437
|
-
Note: 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.
|
438
|
-
|
439
449
|
`jgem` is JRuby's version of `gem` command.
|
440
450
|
RVM allows running `gem install` directly as an alias.
|
441
451
|
Otherwise, you may also run `jruby -S gem install ...`
|
@@ -490,17 +500,18 @@ glimmer application.rb
|
|
490
500
|
Runs a Glimmer application using JRuby, automatically preloading
|
491
501
|
the glimmer ruby gem and SWT jar dependency.
|
492
502
|
|
493
|
-
|
503
|
+
Run Glimmer samples with:
|
504
|
+
|
494
505
|
```
|
495
|
-
glimmer
|
506
|
+
glimmer samples
|
496
507
|
```
|
497
|
-
This
|
508
|
+
This brings up the [Glimmer Meta-Sample (The Sample of Samples)](#samples)
|
498
509
|
|
499
|
-
If you cloned this project locally
|
510
|
+
If you cloned this project locally instead of installing the gem, run `bin/glimmer` instead.
|
500
511
|
|
501
512
|
Example:
|
502
513
|
```
|
503
|
-
bin/glimmer
|
514
|
+
bin/glimmer samples
|
504
515
|
```
|
505
516
|
|
506
517
|
### Advanced Usage
|
@@ -508,7 +519,7 @@ bin/glimmer sample:run[hello_world]
|
|
508
519
|
Below are the full usage instructions that come up when running `glimmer` without args.
|
509
520
|
|
510
521
|
```
|
511
|
-
Glimmer (Ruby Desktop Development GUI Library) - JRuby Gem: glimmer-dsl-swt v4.17.
|
522
|
+
Glimmer (Ruby Desktop Development GUI Library) - JRuby Gem: glimmer-dsl-swt v4.17.6.0
|
512
523
|
|
513
524
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
514
525
|
|
@@ -542,9 +553,7 @@ Select a Glimmer task to run: (Press ↑/↓ arrow to move, Enter to select and
|
|
542
553
|
glimmer package:lock_jars # Lock JARs
|
543
554
|
glimmer package:native[type] # Generate Native files
|
544
555
|
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)
|
545
|
-
glimmer
|
546
|
-
glimmer sample:list[query] # Lists Glimmer internal samples [included in gem]. Filters by query if specified (query is optional)
|
547
|
-
glimmer sample:run[name] # Runs a Glimmer internal sample [included in gem]. If no name is supplied, it runs all samples
|
556
|
+
glimmer samples # Brings up the Glimmer Meta-Sample app to allow browsing, running, and viewing code of Glimmer samples
|
548
557
|
glimmer scaffold[app_name] # Scaffold Glimmer application directory structure to build a new app
|
549
558
|
glimmer scaffold:customshell[name,namespace] # Scaffold Glimmer::UI::CustomShell subclass (full window view) under app/views (namespace is optional) [alt: scaffold:cs]
|
550
559
|
glimmer scaffold:customwidget[name,namespace] # Scaffold Glimmer::UI::CustomWidget subclass (part of a view) under app/views (namespace is optional) [alt: scaffold:cw]
|
@@ -566,333 +575,17 @@ glimmer samples/hello/hello_world.rb samples/hello/hello_tab.rb
|
|
566
575
|
|
567
576
|
Launches samples/hello/hello_world.rb and samples/hello_tab.rb at the same time, each in a separate JRuby thread.
|
568
577
|
|
569
|
-
###
|
570
|
-
|
571
|
-
#### Sample List
|
578
|
+
### Glimmer Samples
|
572
579
|
|
573
580
|
You can list available Glimmer samples by running:
|
574
581
|
|
575
582
|
```
|
576
|
-
glimmer
|
577
|
-
```
|
578
|
-
|
579
|
-
This should output the following (providing the name of each sample, description, and command to run the sample and view its code):
|
580
|
-
|
581
|
-
```
|
582
|
-
$ glimmer sample:list
|
583
|
-
|
584
|
-
Glimmer Hello Samples:
|
585
|
-
|
586
|
-
Name Description Run
|
587
|
-
|
588
|
-
hello_browser Hello Browser glimmer sample:run[hello_browser]
|
589
|
-
hello_combo Hello Combo glimmer sample:run[hello_combo]
|
590
|
-
hello_computed Hello Computed glimmer sample:run[hello_computed]
|
591
|
-
hello_drag_and_drop Hello Drag And Drop glimmer sample:run[hello_drag_and_drop]
|
592
|
-
hello_list_multi_selection Hello List Multi Selection glimmer sample:run[hello_list_multi_selection]
|
593
|
-
hello_list_single_selection Hello List Single Selection glimmer sample:run[hello_list_single_selection]
|
594
|
-
hello_menu_bar Hello Menu Bar glimmer sample:run[hello_menu_bar]
|
595
|
-
hello_message_box Hello Message Box glimmer sample:run[hello_message_box]
|
596
|
-
hello_pop_up_context_menu Hello Pop Up Context Menu glimmer sample:run[hello_pop_up_context_menu]
|
597
|
-
hello_tab Hello Tab glimmer sample:run[hello_tab]
|
598
|
-
hello_world Hello World glimmer sample:run[hello_world]
|
599
|
-
|
600
|
-
|
601
|
-
Glimmer Elaborate Samples:
|
602
|
-
|
603
|
-
Name Description Run
|
604
|
-
|
605
|
-
contact_manager Contact Manager glimmer sample:run[contact_manager]
|
606
|
-
login Login glimmer sample:run[login]
|
607
|
-
tic_tac_toe Tic Tac Toe glimmer sample:run[tic_tac_toe]
|
608
|
-
user_profile User Profile glimmer sample:run[user_profile]
|
609
|
-
```
|
610
|
-
|
611
|
-
#### Sample Run
|
612
|
-
|
613
|
-
A sample may be run via `glimmer sample:run[name]`. This also outputs the sample code so that you could take a look at it and compare to the GUI that launches.
|
614
|
-
|
615
|
-
If the sample name is left empty (e.g. `glimmer sample:run`), then all samples are run.
|
616
|
-
|
617
|
-
Example:
|
618
|
-
|
619
|
-
```
|
620
|
-
glimmer sample:run[hello_tab]
|
621
|
-
```
|
622
|
-
|
623
|
-
This will run the hello_tab sample and output its code:
|
624
|
-
|
583
|
+
glimmer samples
|
625
584
|
```
|
626
|
-
$ glimmer sample:run[hello_tab]
|
627
585
|
|
628
|
-
|
586
|
+
This brings up the [Glimmer Meta-Sample (The Sample of Samples)](#samples):
|
629
587
|
|
630
|
-
|
631
|
-
include Glimmer
|
632
|
-
def launch
|
633
|
-
shell {
|
634
|
-
text "Hello, Tab!"
|
635
|
-
tab_folder {
|
636
|
-
tab_item {
|
637
|
-
text "English"
|
638
|
-
label {
|
639
|
-
text "Hello, World!"
|
640
|
-
}
|
641
|
-
}
|
642
|
-
tab_item {
|
643
|
-
text "French"
|
644
|
-
label {
|
645
|
-
text "Bonjour, Univers!"
|
646
|
-
}
|
647
|
-
}
|
648
|
-
}
|
649
|
-
}.open
|
650
|
-
end
|
651
|
-
end
|
652
|
-
|
653
|
-
HelloTab.new.launch
|
654
|
-
|
655
|
-
# # #
|
656
|
-
```
|
657
|
-
|
658
|
-
![Hello Tab English](images/glimmer-hello-tab-english.png)
|
659
|
-
|
660
|
-
#### Sample Code
|
661
|
-
|
662
|
-
You may output any sample code via this command: `glimmer sample:code[name]`
|
663
|
-
|
664
|
-
This is very similar to the sample run command, except the name is required.
|
665
|
-
|
666
|
-
It will not only output the main sample file, but any required supporting files as well.
|
667
|
-
|
668
|
-
Example:
|
669
|
-
|
670
|
-
```
|
671
|
-
$ glimmer sample:code[tic_tac_toe]
|
672
|
-
|
673
|
-
# /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.3.0/samples/elaborate/tic_tac_toe.rb
|
674
|
-
|
675
|
-
require_relative "tic_tac_toe/board"
|
676
|
-
|
677
|
-
class TicTacToe
|
678
|
-
include Glimmer
|
679
|
-
|
680
|
-
def initialize
|
681
|
-
@tic_tac_toe_board = Board.new
|
682
|
-
@shell = shell {
|
683
|
-
text "Tic-Tac-Toe"
|
684
|
-
minimum_size 150, 178
|
685
|
-
composite {
|
686
|
-
grid_layout 3, true
|
687
|
-
(1..3).each { |row|
|
688
|
-
(1..3).each { |column|
|
689
|
-
button {
|
690
|
-
layout_data :fill, :fill, true, true
|
691
|
-
text bind(@tic_tac_toe_board[row, column], :sign)
|
692
|
-
enabled bind(@tic_tac_toe_board[row, column], :empty)
|
693
|
-
font style: :bold, height: 20
|
694
|
-
on_widget_selected {
|
695
|
-
@tic_tac_toe_board.mark(row, column)
|
696
|
-
}
|
697
|
-
}
|
698
|
-
}
|
699
|
-
}
|
700
|
-
}
|
701
|
-
}
|
702
|
-
observe(@tic_tac_toe_board, :game_status) { |game_status|
|
703
|
-
display_win_message if game_status == Board::WIN
|
704
|
-
display_draw_message if game_status == Board::DRAW
|
705
|
-
}
|
706
|
-
end
|
707
|
-
|
708
|
-
def display_win_message
|
709
|
-
display_game_over_message("Player #{@tic_tac_toe_board.winning_sign} has won!")
|
710
|
-
end
|
711
|
-
|
712
|
-
def display_draw_message
|
713
|
-
display_game_over_message("Draw!")
|
714
|
-
end
|
715
|
-
|
716
|
-
def display_game_over_message(message_text)
|
717
|
-
message_box(@shell) {
|
718
|
-
text 'Game Over'
|
719
|
-
message message_text
|
720
|
-
}.open
|
721
|
-
@tic_tac_toe_board.reset
|
722
|
-
end
|
723
|
-
|
724
|
-
def open
|
725
|
-
@shell.open
|
726
|
-
end
|
727
|
-
end
|
728
|
-
|
729
|
-
TicTacToe.new.open
|
730
|
-
|
731
|
-
# # #
|
732
|
-
|
733
|
-
|
734
|
-
# /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.3.0/samples/elaborate/tic_tac_toe/cell.rb
|
735
|
-
|
736
|
-
class TicTacToe
|
737
|
-
class Cell
|
738
|
-
EMPTY = ""
|
739
|
-
attr_accessor :sign, :empty
|
740
|
-
|
741
|
-
def initialize
|
742
|
-
reset
|
743
|
-
end
|
744
|
-
|
745
|
-
def mark(sign)
|
746
|
-
self.sign = sign
|
747
|
-
end
|
748
|
-
|
749
|
-
def reset
|
750
|
-
self.sign = EMPTY
|
751
|
-
end
|
752
|
-
|
753
|
-
def sign=(sign_symbol)
|
754
|
-
@sign = sign_symbol
|
755
|
-
self.empty = sign == EMPTY
|
756
|
-
end
|
757
|
-
|
758
|
-
def marked
|
759
|
-
!empty
|
760
|
-
end
|
761
|
-
end
|
762
|
-
end
|
763
|
-
|
764
|
-
# # #
|
765
|
-
|
766
|
-
|
767
|
-
# /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.3.0/samples/elaborate/tic_tac_toe/board.rb
|
768
|
-
|
769
|
-
require_relative 'cell'
|
770
|
-
|
771
|
-
class TicTacToe
|
772
|
-
class Board
|
773
|
-
DRAW = :draw
|
774
|
-
IN_PROGRESS = :in_progress
|
775
|
-
WIN = :win
|
776
|
-
attr :winning_sign
|
777
|
-
attr_accessor :game_status
|
778
|
-
|
779
|
-
def initialize
|
780
|
-
@sign_state_machine = {nil => "X", "X" => "O", "O" => "X"}
|
781
|
-
build_grid
|
782
|
-
@winning_sign = Cell::EMPTY
|
783
|
-
@game_status = IN_PROGRESS
|
784
|
-
end
|
785
|
-
|
786
|
-
#row and column numbers are 1-based
|
787
|
-
def mark(row, column)
|
788
|
-
self[row, column].mark(current_sign)
|
789
|
-
game_over? #updates winning sign
|
790
|
-
end
|
791
|
-
|
792
|
-
def current_sign
|
793
|
-
@current_sign = @sign_state_machine[@current_sign]
|
794
|
-
end
|
795
|
-
|
796
|
-
def [](row, column)
|
797
|
-
@grid[row-1][column-1]
|
798
|
-
end
|
799
|
-
|
800
|
-
def game_over?
|
801
|
-
win? or draw?
|
802
|
-
end
|
803
|
-
|
804
|
-
def win?
|
805
|
-
win = (row_win? or column_win? or diagonal_win?)
|
806
|
-
self.game_status=WIN if win
|
807
|
-
win
|
808
|
-
end
|
809
|
-
|
810
|
-
def reset
|
811
|
-
(1..3).each do |row|
|
812
|
-
(1..3).each do |column|
|
813
|
-
self[row, column].reset
|
814
|
-
end
|
815
|
-
end
|
816
|
-
@winning_sign = Cell::EMPTY
|
817
|
-
@current_sign = nil
|
818
|
-
self.game_status=IN_PROGRESS
|
819
|
-
end
|
820
|
-
|
821
|
-
private
|
822
|
-
|
823
|
-
def build_grid
|
824
|
-
@grid = []
|
825
|
-
3.times do |row_index| #0-based
|
826
|
-
@grid << []
|
827
|
-
3.times { @grid[row_index] << Cell.new }
|
828
|
-
end
|
829
|
-
end
|
830
|
-
|
831
|
-
def row_win?
|
832
|
-
(1..3).each do |row|
|
833
|
-
if row_has_same_sign(row)
|
834
|
-
@winning_sign = self[row, 1].sign
|
835
|
-
return true
|
836
|
-
end
|
837
|
-
end
|
838
|
-
false
|
839
|
-
end
|
840
|
-
|
841
|
-
def column_win?
|
842
|
-
(1..3).each do |column|
|
843
|
-
if column_has_same_sign(column)
|
844
|
-
@winning_sign = self[1, column].sign
|
845
|
-
return true
|
846
|
-
end
|
847
|
-
end
|
848
|
-
false
|
849
|
-
end
|
850
|
-
|
851
|
-
#needs refactoring if we ever decide to make the board size dynamic
|
852
|
-
def diagonal_win?
|
853
|
-
if (self[1, 1].sign == self[2, 2].sign) and (self[2, 2].sign == self[3, 3].sign) and self[1, 1].marked
|
854
|
-
@winning_sign = self[1, 1].sign
|
855
|
-
return true
|
856
|
-
end
|
857
|
-
if (self[3, 1].sign == self[2, 2].sign) and (self[2, 2].sign == self[1, 3].sign) and self[3, 1].marked
|
858
|
-
@winning_sign = self[3, 1].sign
|
859
|
-
return true
|
860
|
-
end
|
861
|
-
false
|
862
|
-
end
|
863
|
-
|
864
|
-
def draw?
|
865
|
-
@board_full = true
|
866
|
-
3.times do |x|
|
867
|
-
3.times do |y|
|
868
|
-
@board_full = false if self[x, y].empty
|
869
|
-
end
|
870
|
-
end
|
871
|
-
self.game_status = DRAW if @board_full
|
872
|
-
@board_full
|
873
|
-
end
|
874
|
-
|
875
|
-
def row_has_same_sign(number)
|
876
|
-
row_sign = self[number, 1].sign
|
877
|
-
[2, 3].each do |column|
|
878
|
-
return false unless row_sign == (self[number, column].sign)
|
879
|
-
end
|
880
|
-
true if self[number, 1].marked
|
881
|
-
end
|
882
|
-
|
883
|
-
def column_has_same_sign(number)
|
884
|
-
column_sign = self[1, number].sign
|
885
|
-
[2, 3].each do |row|
|
886
|
-
return false unless column_sign == (self[row, number].sign)
|
887
|
-
end
|
888
|
-
true if self[1, number].marked
|
889
|
-
end
|
890
|
-
|
891
|
-
end
|
892
|
-
end
|
893
|
-
|
894
|
-
# # #
|
895
|
-
```
|
588
|
+
![Glimmer Meta-Sample](images/glimmer-meta-sample.png)
|
896
589
|
|
897
590
|
### Scaffolding
|
898
591
|
|
@@ -915,8 +608,6 @@ letting Glimmer scaffolding take care of initial app file structure concerns, su
|
|
915
608
|
|
916
609
|
You need to have your Git `user.name` and `github.user` configured before scaffolding since Glimmer uses Juwelier, which relies on them in creating a Git repo for your Glimmer app.
|
917
610
|
|
918
|
-
NOTE: Linux is not fully supported yet with scaffolding. Please report any issues you may encounter.
|
919
|
-
|
920
611
|
#### App
|
921
612
|
|
922
613
|
Before you start, make sure you are in a JRuby environment with Glimmer gem installed as per "Direct Install" pre-requisites.
|
@@ -927,7 +618,7 @@ To scaffold a Glimmer app from scratch, run the following command:
|
|
927
618
|
glimmer scaffold[AppName]
|
928
619
|
```
|
929
620
|
|
930
|
-
This will generate an advanced "Hello, World!" app, package it as a Mac
|
621
|
+
This will generate an advanced "Hello, World!" app, package it as a Mac DMG/PKG/APP, Windows APP, or Linux GEM, and launch it all in one fell swoop.
|
931
622
|
|
932
623
|
Suppose you run:
|
933
624
|
|
@@ -939,18 +630,18 @@ You should see output like the following:
|
|
939
630
|
|
940
631
|
```
|
941
632
|
$ glimmer scaffold[greeter]
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
633
|
+
create .gitignore
|
634
|
+
create Rakefile
|
635
|
+
create Gemfile
|
636
|
+
create LICENSE.txt
|
637
|
+
create README.rdoc
|
638
|
+
create .document
|
639
|
+
create lib
|
640
|
+
create lib/greeter.rb
|
641
|
+
create spec
|
642
|
+
create spec/spec_helper.rb
|
643
|
+
create spec/greeter_spec.rb
|
644
|
+
create .rspec
|
954
645
|
Juwelier has prepared your gem in ./greeter
|
955
646
|
Created greeter/.gitignore
|
956
647
|
Created greeter/.ruby-version
|
@@ -1021,7 +712,7 @@ To scaffold a Glimmer desktopify app from scratch, run the following command:
|
|
1021
712
|
glimmer scaffold:desktopify[app_name,website]
|
1022
713
|
```
|
1023
714
|
|
1024
|
-
This will generate a Glimmer app, package it as a Mac
|
715
|
+
This will generate a Glimmer app, package it as a Mac DMG/PKG/APP, Windows APP, or Linux GEM, and launch it all in one fell swoop.
|
1025
716
|
|
1026
717
|
Suppose you run:
|
1027
718
|
|
@@ -1048,15 +739,15 @@ Successfully installed github_api-0.19.0
|
|
1048
739
|
Successfully installed nokogiri-1.10.10-java
|
1049
740
|
Successfully installed juwelier-2.4.9
|
1050
741
|
7 gems installed
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
742
|
+
create .gitignore
|
743
|
+
create Rakefile
|
744
|
+
create Gemfile
|
745
|
+
create LICENSE.txt
|
746
|
+
create README.markdown
|
747
|
+
create .document
|
748
|
+
create lib
|
749
|
+
create lib/snowboard_utah.rb
|
750
|
+
create .rspec
|
1060
751
|
Juwelier has prepared your gem in ./snowboard_utah
|
1061
752
|
Created snowboard_utah/.gitignore
|
1062
753
|
Created snowboard_utah/.ruby-version
|
@@ -1304,8 +995,8 @@ Output:
|
|
1304
995
|
Name Gem Version Author Description
|
1305
996
|
|
1306
997
|
Css glimmer-dsl-css 1.1.0 AndyMaleh Glimmer DSL for CSS
|
1307
|
-
Opal glimmer-dsl-opal 0.
|
1308
|
-
Swt glimmer-dsl-swt 4.17.
|
998
|
+
Opal glimmer-dsl-opal 0.4.0 AndyMaleh Glimmer DSL for Opal
|
999
|
+
Swt glimmer-dsl-swt 4.17.6.0 AndyMaleh Glimmer DSL for SWT
|
1309
1000
|
Tk glimmer-dsl-tk 0.0.6 AndyMaleh Glimmer DSL for Tk
|
1310
1001
|
Xml glimmer-dsl-xml 1.1.0 AndyMaleh Glimmer DSL for XML
|
1311
1002
|
```
|
@@ -2101,6 +1792,23 @@ Glimmer recently included **EXPERIMENTAL** gif animation support for the `backgr
|
|
2101
1792
|
|
2102
1793
|
Learn more about images in general at this SWT Image guide: https://www.eclipse.org/articles/Article-SWT-images/graphics-resources.html
|
2103
1794
|
|
1795
|
+
#### Image Options
|
1796
|
+
|
1797
|
+
Options may be passed in a hash at the end of `image` arguments:
|
1798
|
+
|
1799
|
+
- `width`: width of image
|
1800
|
+
- `height`: height of image
|
1801
|
+
|
1802
|
+
If only the width or height alone are specified, the other is calculated while maintaining the image aspect ratio.
|
1803
|
+
|
1804
|
+
Example:
|
1805
|
+
|
1806
|
+
```
|
1807
|
+
label {
|
1808
|
+
image 'someimage.png', width: 400, height: 300
|
1809
|
+
}
|
1810
|
+
```
|
1811
|
+
|
2104
1812
|
### Cursor
|
2105
1813
|
|
2106
1814
|
SWT widget `cursor` property represents the mouse cursor you see on the screen when you hover over that widget.
|
@@ -2824,7 +2532,7 @@ Custom widgets are brand new Glimmer DSL keywords that represent aggregates of e
|
|
2824
2532
|
|
2825
2533
|
You can find out about [published Glimmer Custom Widgets](https://github.com/AndyObtiva/glimmer-dsl-swt#gem-listing) by running the `glimmer list:gems:customwidget` command
|
2826
2534
|
|
2827
|
-
Glimmer supports
|
2535
|
+
Glimmer supports three ways of creating custom widgets with minimal code:
|
2828
2536
|
1. Method-based Custom Widgets (for single-view-internal reuse): Extract a method containing Glimmer DSL widget syntax. Useful for quickly eliminating redundant code within a single view.
|
2829
2537
|
2. Class-based Custom Widgets (for multiple-view-external reuse): Create a class that includes the `Glimmer::UI::CustomWidget` module and Glimmer DSL widget syntax in a `body {}` block. This will automatically extend Glimmer's DSL syntax with an underscored lowercase keyword matching the class name by convention. Useful in making a custom widget available in many views.
|
2830
2538
|
|
@@ -3370,6 +3078,28 @@ shell(:no_resize) {
|
|
3370
3078
|
|
3371
3079
|
Also, you may invoke `Display.setAppVersion('1.0.0')` if needed for OS app version identification reasons during development, replacing `'1.0.0'` with your application version.
|
3372
3080
|
|
3081
|
+
#### Code Text Widget
|
3082
|
+
|
3083
|
+
`code_text` is a Glimmer built-in custom widget that displays syntax highlighted Ruby code in a customized SWT [StyledText](https://help.eclipse.org/2020-09/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/custom/StyledText.html) widget.
|
3084
|
+
|
3085
|
+
It is used in the [Glimmer Meta-Sample (The Sample of Samples)](#samples):
|
3086
|
+
|
3087
|
+
![Glimmer Meta-Sample](images/glimmer-meta-sample.png)
|
3088
|
+
|
3089
|
+
Glimmer Meta-Sample Code Example:
|
3090
|
+
|
3091
|
+
```ruby
|
3092
|
+
# ...
|
3093
|
+
code_text {
|
3094
|
+
text bind(SampleDirectory, 'selected_sample.content')
|
3095
|
+
editable false
|
3096
|
+
caret nil
|
3097
|
+
}
|
3098
|
+
# ...
|
3099
|
+
```
|
3100
|
+
|
3101
|
+
To use, simply use `code_text` in place of `text` or `styled_text` widget. If you set its `text` value to Ruby code, it automatically styles it with syntax highlighting.
|
3102
|
+
|
3373
3103
|
#### Video Widget
|
3374
3104
|
|
3375
3105
|
[![Video Widget](images/glimmer-video-widget.png)](https://github.com/AndyObtiva/glimmer-cw-video)
|
@@ -3378,6 +3108,41 @@ Glimmer supports a [video custom widget](https://github.com/AndyObtiva/glimmer-c
|
|
3378
3108
|
|
3379
3109
|
You may obtain via `glimmer-cw-video` gem.
|
3380
3110
|
|
3111
|
+
#### Sash Form Widget
|
3112
|
+
|
3113
|
+
`sash_form` is an SWT built-in custom widget that provides a resizable sash that splits a window area into two or more panes.
|
3114
|
+
|
3115
|
+
It can be customized with the `weights` attribute by setting initial weights to size the panes at first display.
|
3116
|
+
|
3117
|
+
One noteworthy thing about the Glimmer implementation is that, unlike behavior in SWT, it allows declaring `weights` before the content of the `sash_form`, thus providing more natural and convenient syntax (Glimmer automatically takes care of sending that declaration to SWT at the end of declaring `sash_form` content as per the SWT requirements)
|
3118
|
+
|
3119
|
+
Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
|
3120
|
+
|
3121
|
+
```ruby
|
3122
|
+
shell {
|
3123
|
+
text 'Sash Form Example'
|
3124
|
+
sash_form {
|
3125
|
+
label {
|
3126
|
+
text '(resize >>)'
|
3127
|
+
background :dark_green
|
3128
|
+
foreground :white
|
3129
|
+
font height: 20
|
3130
|
+
}
|
3131
|
+
label {
|
3132
|
+
text '(<< resize)'
|
3133
|
+
background :red
|
3134
|
+
foreground :white
|
3135
|
+
font height: 20
|
3136
|
+
}
|
3137
|
+
weights 1, 2
|
3138
|
+
}
|
3139
|
+
}.open
|
3140
|
+
```
|
3141
|
+
|
3142
|
+
You may check out a more full-fledged example in [Hello, Sash Form!](#hello-sash-form)
|
3143
|
+
|
3144
|
+
![Hello Sash Form](images/glimmer-hello-sash-form.png)
|
3145
|
+
|
3381
3146
|
#### Browser Widget
|
3382
3147
|
|
3383
3148
|
![Hello Browser](images/glimmer-hello-browser.png)
|
@@ -3666,12 +3431,16 @@ https://www.eclipse.org/nebula/
|
|
3666
3431
|
|
3667
3432
|
Check the [samples](samples) directory in [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) for examples on how to write Glimmer applications. To run a sample, make sure to install the `glimmer` gem first and then use the `glimmer` command to run it (alternatively, you may clone the repo, follow [CONTRIBUTING.md](CONTRIBUTING.md) instructions, and run samples locally with development glimmer command: `bin/glimmer`).
|
3668
3433
|
|
3669
|
-
|
3434
|
+
You may run any sample via this command:
|
3670
3435
|
|
3671
3436
|
```
|
3672
|
-
samples
|
3437
|
+
glimmer samples
|
3673
3438
|
```
|
3674
3439
|
|
3440
|
+
This brings up the [Glimmer Meta-Sample (The Sample of Samples)](samples/elaborate/meta_sample.rb)
|
3441
|
+
|
3442
|
+
![Glimmer Meta-Sample](images/glimmer-meta-sample.png)
|
3443
|
+
|
3675
3444
|
### Hello Samples
|
3676
3445
|
|
3677
3446
|
For hello-type simple samples, check the following.
|
@@ -3682,12 +3451,6 @@ Code:
|
|
3682
3451
|
|
3683
3452
|
[samples/hello/hello_world.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_world.rb)
|
3684
3453
|
|
3685
|
-
Run:
|
3686
|
-
|
3687
|
-
```
|
3688
|
-
glimmer sample:run[hello_world]
|
3689
|
-
```
|
3690
|
-
|
3691
3454
|
![Hello World](images/glimmer-hello-world.png)
|
3692
3455
|
|
3693
3456
|
#### Hello, Tab!
|
@@ -3696,12 +3459,6 @@ Code:
|
|
3696
3459
|
|
3697
3460
|
[samples/hello/hello_tab.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_tab.rb)
|
3698
3461
|
|
3699
|
-
Run:
|
3700
|
-
|
3701
|
-
```
|
3702
|
-
glimmer sample:run[hello_tab]
|
3703
|
-
```
|
3704
|
-
|
3705
3462
|
![Hello Tab English](images/glimmer-hello-tab-english.png)
|
3706
3463
|
![Hello Tab French](images/glimmer-hello-tab-french.png)
|
3707
3464
|
|
@@ -3713,12 +3470,6 @@ Code:
|
|
3713
3470
|
|
3714
3471
|
[samples/hello/hello_combo.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_combo.rb)
|
3715
3472
|
|
3716
|
-
Run:
|
3717
|
-
|
3718
|
-
```
|
3719
|
-
glimmer sample:run[hello_combo]
|
3720
|
-
```
|
3721
|
-
|
3722
3473
|
![Hello Combo](images/glimmer-hello-combo.png)
|
3723
3474
|
![Hello Combo Expanded](images/glimmer-hello-combo-expanded.png)
|
3724
3475
|
|
@@ -3730,12 +3481,6 @@ Code:
|
|
3730
3481
|
|
3731
3482
|
[samples/hello/hello_list_single_selection.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_list_single_selection.rb)
|
3732
3483
|
|
3733
|
-
Run:
|
3734
|
-
|
3735
|
-
```
|
3736
|
-
glimmer sample:run[hello_list_single_selection]
|
3737
|
-
```
|
3738
|
-
|
3739
3484
|
![Hello List Single Selection](images/glimmer-hello-list-single-selection.png)
|
3740
3485
|
|
3741
3486
|
#### Hello, List Multi Selection!
|
@@ -3746,12 +3491,6 @@ Code:
|
|
3746
3491
|
|
3747
3492
|
[samples/hello/hello_list_multi_selection.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_list_multi_selection.rb)
|
3748
3493
|
|
3749
|
-
Run:
|
3750
|
-
|
3751
|
-
```
|
3752
|
-
glimmer sample:run[hello_list_multi_selection]
|
3753
|
-
```
|
3754
|
-
|
3755
3494
|
![Hello List Multi Selection](images/glimmer-hello-list-multi-selection.png)
|
3756
3495
|
|
3757
3496
|
#### Hello, Computed!
|
@@ -3762,12 +3501,6 @@ Code:
|
|
3762
3501
|
|
3763
3502
|
[samples/hello/hello_computed.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_computed.rb)
|
3764
3503
|
|
3765
|
-
Run:
|
3766
|
-
|
3767
|
-
```
|
3768
|
-
glimmer sample:run[hello_computed]
|
3769
|
-
```
|
3770
|
-
|
3771
3504
|
![Hello Browser](images/glimmer-hello-computed.png)
|
3772
3505
|
|
3773
3506
|
#### Hello, Message Box!
|
@@ -3778,12 +3511,6 @@ Code:
|
|
3778
3511
|
|
3779
3512
|
[samples/hello/hello_message_box.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_message_box.rb)
|
3780
3513
|
|
3781
|
-
Run:
|
3782
|
-
|
3783
|
-
```
|
3784
|
-
glimmer sample:run[hello_message_box]
|
3785
|
-
```
|
3786
|
-
|
3787
3514
|
![Hello Message Box](images/glimmer-hello-message-box.png)
|
3788
3515
|
![Hello Message Box Dialog](images/glimmer-hello-message-box-dialog.png)
|
3789
3516
|
|
@@ -3795,12 +3522,6 @@ Code:
|
|
3795
3522
|
|
3796
3523
|
[samples/hello/hello_browser.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_browser.rb)
|
3797
3524
|
|
3798
|
-
Run:
|
3799
|
-
|
3800
|
-
```
|
3801
|
-
glimmer sample:run[hello_browser]
|
3802
|
-
```
|
3803
|
-
|
3804
3525
|
![Hello Browser](images/glimmer-hello-browser.png)
|
3805
3526
|
|
3806
3527
|
#### Hello, Drag and Drop!
|
@@ -3811,12 +3532,6 @@ Code:
|
|
3811
3532
|
|
3812
3533
|
[samples/hello/hello_drag_and_drop.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_drag_and_drop.rb)
|
3813
3534
|
|
3814
|
-
Run:
|
3815
|
-
|
3816
|
-
```
|
3817
|
-
glimmer sample:run[hello_drag_and_drop]
|
3818
|
-
```
|
3819
|
-
|
3820
3535
|
![Hello Drag and Drop](images/glimmer-hello-drag-and-drop.gif)
|
3821
3536
|
|
3822
3537
|
#### Hello, Menu Bar!
|
@@ -3827,12 +3542,6 @@ Code:
|
|
3827
3542
|
|
3828
3543
|
[samples/hello/hello_menu_bar.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_menu_bar.rb)
|
3829
3544
|
|
3830
|
-
Run:
|
3831
|
-
|
3832
|
-
```
|
3833
|
-
glimmer sample:run[hello_menu_bar]
|
3834
|
-
```
|
3835
|
-
|
3836
3545
|
![Hello Menu Bar](images/glimmer-hello-menu-bar.png)
|
3837
3546
|
![Hello Menu Bar File Menu](images/glimmer-hello-menu-bar-file-menu.png)
|
3838
3547
|
![Hello Menu Bar History Menu](images/glimmer-hello-menu-bar-history-menu.png)
|
@@ -3845,12 +3554,6 @@ Code:
|
|
3845
3554
|
|
3846
3555
|
[samples/hello/hello_pop_up_context_menu.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_pop_up_context_menu.rb)
|
3847
3556
|
|
3848
|
-
Run:
|
3849
|
-
|
3850
|
-
```
|
3851
|
-
glimmer sample:run[hello_pop_up_context_menu]
|
3852
|
-
```
|
3853
|
-
|
3854
3557
|
![Hello Pop Up Context Menu](images/glimmer-hello-pop-up-context-menu.png)
|
3855
3558
|
![Hello Pop Up Context Menu Popped Up](images/glimmer-hello-pop-up-context-menu-popped-up.png)
|
3856
3559
|
|
@@ -3862,12 +3565,6 @@ Code:
|
|
3862
3565
|
|
3863
3566
|
[samples/hello/hello_custom_widget.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_custom_widget.rb)
|
3864
3567
|
|
3865
|
-
Run:
|
3866
|
-
|
3867
|
-
```
|
3868
|
-
glimmer sample:run[hello_custom_widget]
|
3869
|
-
```
|
3870
|
-
|
3871
3568
|
![Hello Custom Widget](images/glimmer-hello-custom-widget.gif)
|
3872
3569
|
|
3873
3570
|
#### Hello, Custom Shell!
|
@@ -3878,17 +3575,115 @@ Code:
|
|
3878
3575
|
|
3879
3576
|
[samples/hello/hello_custom_shell.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_custom_shell.rb)
|
3880
3577
|
|
3881
|
-
Run:
|
3882
|
-
|
3883
|
-
```
|
3884
|
-
glimmer sample:run[hello_custom_shell]
|
3885
|
-
```
|
3886
|
-
|
3887
3578
|
![Hello Custom Shell](images/glimmer-hello-custom-shell.png)
|
3888
3579
|
![Hello Custom Shell Email1](images/glimmer-hello-custom-shell-email1.png)
|
3889
3580
|
![Hello Custom Shell Email2](images/glimmer-hello-custom-shell-email2.png)
|
3890
3581
|
![Hello Custom Shell Email3](images/glimmer-hello-custom-shell-email3.png)
|
3891
3582
|
|
3583
|
+
#### Hello, Sash Form!
|
3584
|
+
|
3585
|
+
This sample demonstrates the use of a `sash_form` in Glimmer.
|
3586
|
+
|
3587
|
+
Code:
|
3588
|
+
|
3589
|
+
[samples/hello/hello_sash_form.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_sash_form.rb)
|
3590
|
+
|
3591
|
+
Hello, Sash Form! Horizontal Orientation
|
3592
|
+
|
3593
|
+
![Hello Sash Form](images/glimmer-hello-sash-form.png)
|
3594
|
+
|
3595
|
+
Hello, Sash Form! Resized
|
3596
|
+
|
3597
|
+
![Hello Sash Form Resized](images/glimmer-hello-sash-form-resized.png)
|
3598
|
+
|
3599
|
+
Hello, Sash Form! Sash Width Changed
|
3600
|
+
|
3601
|
+
![Hello Sash Form Sash Width Changed](images/glimmer-hello-sash-form-sash-width-changed.png)
|
3602
|
+
|
3603
|
+
Hello, Sash Form! Vertical Orientation
|
3604
|
+
|
3605
|
+
![Hello Sash Form Vertical](images/glimmer-hello-sash-form-vertical.png)
|
3606
|
+
|
3607
|
+
Hello, Sash Form! Green Label Maximized
|
3608
|
+
|
3609
|
+
![Hello Sash Form Green Maximized](images/glimmer-hello-sash-form-green-maximized.png)
|
3610
|
+
|
3611
|
+
Hello, Sash Form! Red Label Maximized
|
3612
|
+
|
3613
|
+
![Hello Sash Form Red Maximized](images/glimmer-hello-sash-form-red-maximized.png)
|
3614
|
+
|
3615
|
+
#### Hello, Styled Text!
|
3616
|
+
|
3617
|
+
This sample demonstrates the use of a `styled_text` in Glimmer.
|
3618
|
+
|
3619
|
+
Code:
|
3620
|
+
|
3621
|
+
[samples/hello/hello_styled_text.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_styled_text.rb)
|
3622
|
+
|
3623
|
+
Hello, Styled Text!
|
3624
|
+
|
3625
|
+
![Hello Styled Text](images/glimmer-hello-styled-text.png)
|
3626
|
+
|
3627
|
+
#### Hello, Expand Bar!
|
3628
|
+
|
3629
|
+
This sample demonstrates the use of a `expand_bar` and `expand_item` in Glimmer.
|
3630
|
+
|
3631
|
+
Code:
|
3632
|
+
|
3633
|
+
[samples/hello/hello_expand_bar.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_expand_bar.rb)
|
3634
|
+
|
3635
|
+
Hello, Expand Bar! All Expanded
|
3636
|
+
|
3637
|
+
![Hello Expand Bar All Expanded](images/glimmer-hello-expand-bar-all-expanded.png)
|
3638
|
+
|
3639
|
+
Hello, Expand Bar! Productivity Expanded
|
3640
|
+
|
3641
|
+
![Hello Expand Bar Productivity Expanded](images/glimmer-hello-expand-bar-productivity-expanded.png)
|
3642
|
+
|
3643
|
+
Hello, Expand Bar! Tools Expanded
|
3644
|
+
|
3645
|
+
![Hello Expand Bar Tools Expanded](images/glimmer-hello-expand-bar-tools-expanded.png)
|
3646
|
+
|
3647
|
+
Hello, Expand Bar! Reading Expanded
|
3648
|
+
|
3649
|
+
![Hello Expand Bar Reading Expanded](images/glimmer-hello-expand-bar-reading-expanded.png)
|
3650
|
+
|
3651
|
+
#### Hello, Radio!
|
3652
|
+
|
3653
|
+
This sample demonstrates the use of a `radio` (aka `button(:radio)`) in Glimmer.
|
3654
|
+
|
3655
|
+
Code:
|
3656
|
+
|
3657
|
+
[samples/hello/hello_radio.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_radio.rb)
|
3658
|
+
|
3659
|
+
Hello, Radio!
|
3660
|
+
|
3661
|
+
![Hello Radio](images/glimmer-hello-radio.png)
|
3662
|
+
|
3663
|
+
#### Hello, Radio Group!
|
3664
|
+
|
3665
|
+
This sample demonstrates the use of a `radio_group` in Glimmer, which is a terser way of representing multiple radio buttons by relying on data-binding to automatically spawn the `radio` widgets based on available options on the model.
|
3666
|
+
|
3667
|
+
Code:
|
3668
|
+
|
3669
|
+
[samples/hello/hello_radio_group.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_radio_group.rb)
|
3670
|
+
|
3671
|
+
Hello, Radio Group!
|
3672
|
+
|
3673
|
+
![Hello Radio Group](images/glimmer-hello-radio-group.png)
|
3674
|
+
|
3675
|
+
#### Hello, Checkbox!
|
3676
|
+
|
3677
|
+
This sample demonstrates the use of a `checkbox` (aka `check` or `button(:check)`) in Glimmer.
|
3678
|
+
|
3679
|
+
Code:
|
3680
|
+
|
3681
|
+
[samples/hello/hello_checkbox.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_checkbox.rb)
|
3682
|
+
|
3683
|
+
Hello, Checkbox!
|
3684
|
+
|
3685
|
+
![Hello Checkbox](images/glimmer-hello-checkbox.png)
|
3686
|
+
|
3892
3687
|
### Elaborate Samples
|
3893
3688
|
|
3894
3689
|
For more elaborate samples, check the following:
|
@@ -3903,12 +3698,6 @@ Code:
|
|
3903
3698
|
|
3904
3699
|
[samples/elaborate/user_profile.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/user_profile.rb)
|
3905
3700
|
|
3906
|
-
Run:
|
3907
|
-
|
3908
|
-
```
|
3909
|
-
glimmer sample:run[user_profile]
|
3910
|
-
```
|
3911
|
-
|
3912
3701
|
![User Profile](images/glimmer-user-profile.png)
|
3913
3702
|
|
3914
3703
|
#### Login
|
@@ -3919,12 +3708,6 @@ Code:
|
|
3919
3708
|
|
3920
3709
|
[samples/elaborate/login.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/login.rb)
|
3921
3710
|
|
3922
|
-
Run:
|
3923
|
-
|
3924
|
-
```
|
3925
|
-
glimmer sample:run[login]
|
3926
|
-
```
|
3927
|
-
|
3928
3711
|
![Login](images/glimmer-login.png)
|
3929
3712
|
![Login Filled In](images/glimmer-login-filled-in.png)
|
3930
3713
|
![Login Logged In](images/glimmer-login-logged-in.png)
|
@@ -3939,12 +3722,6 @@ Code:
|
|
3939
3722
|
|
3940
3723
|
[samples/elaborate/tic_tac_toe.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/tic_tac_toe.rb)
|
3941
3724
|
|
3942
|
-
Run:
|
3943
|
-
|
3944
|
-
```
|
3945
|
-
glimmer sample:run[tic_tac_toe]
|
3946
|
-
```
|
3947
|
-
|
3948
3725
|
![Tic Tac Toe](images/glimmer-tic-tac-toe.png)
|
3949
3726
|
![Tic Tac Toe In Progress](images/glimmer-tic-tac-toe-in-progress.png)
|
3950
3727
|
![Tic Tac Toe Game Over](images/glimmer-tic-tac-toe-game-over.png)
|
@@ -3957,12 +3734,6 @@ Code:
|
|
3957
3734
|
|
3958
3735
|
[samples/elaborate/contact_manager.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/contact_manager.rb)
|
3959
3736
|
|
3960
|
-
Run:
|
3961
|
-
|
3962
|
-
```
|
3963
|
-
glimmer sample:run[contact_manager]
|
3964
|
-
```
|
3965
|
-
|
3966
3737
|
Contact Manager
|
3967
3738
|
|
3968
3739
|
![Contact Manager](images/glimmer-contact-manager.png)
|
@@ -4034,7 +3805,7 @@ If you have a Glimmer app you would like referenced here, please mention in a Pu
|
|
4034
3805
|
|
4035
3806
|
## Packaging & Distribution
|
4036
3807
|
|
4037
|
-
Note: this section mostly applies to Mac and Windows. On Linux,
|
3808
|
+
Note: this section mostly applies to Mac and Windows. On Linux, you can just run `glimmer package:gem` and after installing the gem, you get an executable matching the name of the app/custom-shell-gem you are building (e.g. `calculator` command becomes available after installing the [glimmer-cs-calculator](https://github.com/AndyObtiva/glimmer-cs-calculator) gem)
|
4038
3809
|
|
4039
3810
|
Glimmer simplifies the process of native-executable packaging and distribution on Mac and Windows via a single `glimmer package` command:
|
4040
3811
|
|
@@ -4225,6 +3996,7 @@ Here is a list of notable 3rd party gems used by Glimmer:
|
|
4225
3996
|
- [puts_debuggerer](https://github.com/AndyObtiva/puts_debuggerer): helps in troubleshooting when adding `require 'pd'` and using the `pd` command instead of `puts` or `p` (also `#pd_inspect` or `#pdi` instead of `#inspect`)
|
4226
3997
|
- [rake](https://github.com/ruby/rake): used to implement and execute `glimmer` commands
|
4227
3998
|
- [rake-tui](https://github.com/AndyObtiva/rake-tui): Rake Text-based User Interface. Allows navigating rake tasks with arrow keys and filtering task list by typing to quickly find an run a rake task.
|
3999
|
+
- [rouge](https://github.com/rouge-ruby/rouge): Ruby syntax highlighter used in the `code_text` [Glimmer DSL for SWT custom widget](#custom-widgets) leveraged by the [Glimmer Meta-Sample](#samples)
|
4228
4000
|
- [super_module](https://github.com/AndyObtiva/super_module): used to cleanly write the Glimmer::UI:CustomWidget and Glimmer::UI::CustomShell modules
|
4229
4001
|
- [text-table](https://github.com/aptinio/text-table): renders textual data in a textual table for the command-line interface of Glimmer
|
4230
4002
|
- [warbler](https://github.com/jruby/warbler): converts a Glimmer app into a Java JAR file during packaging
|