glimmer-dsl-swt 4.17.2.4 → 4.17.5.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 +44 -0
- data/README.md +294 -467
- data/VERSION +1 -1
- data/glimmer-dsl-swt.gemspec +14 -6
- data/lib/glimmer-dsl-swt.rb +1 -0
- data/lib/glimmer/dsl/swt/custom_widget_expression.rb +1 -0
- data/lib/glimmer/dsl/swt/expand_item_expression.rb +60 -0
- data/lib/glimmer/dsl/swt/widget_expression.rb +2 -0
- data/lib/glimmer/rake_task.rb +19 -21
- data/lib/glimmer/rake_task/package.rb +9 -2
- data/lib/glimmer/rake_task/scaffold.rb +138 -42
- data/lib/glimmer/swt/custom/code_text.rb +95 -0
- data/lib/glimmer/swt/expand_item_proxy.rb +98 -0
- data/lib/glimmer/swt/image_proxy.rb +5 -0
- 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/samples/elaborate/meta_sample.rb +166 -0
- data/samples/hello/hello_expand_bar.rb +108 -0
- data/samples/hello/hello_sash_form.rb +137 -0
- data/samples/hello/hello_styled_text.rb +138 -0
- metadata +16 -8
- 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: a2111fbe2df8040f64a319e5e62b15982cdc4749a6cd0c548b97f2b37f01b276
|
4
|
+
data.tar.gz: 283eb8a7a8faedde6ab6224ebe06fda3fca7cdff44ec99b32baca35da9df7d04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cb656a29e5d9da0759b295bc5dba9f1a174e8a83a1ffa2921c4b5efb6fd10542f0a46e475807cbd884c7f14270afa0983b5e49b392f97e9ddd41a6a4ecbbf30
|
7
|
+
data.tar.gz: 9283a302b3aaa99f5ec50f0d0996b951bb72ce0309ae9ca978429621d81f14c4005251286229d3555f31754c0e9a727db2f15f9245fab28f902ef1456e1fa07e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,49 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
### 4.17.5.0
|
4
|
+
|
5
|
+
- Support auto-scaling by aspect ratio of width and height (write specs)
|
6
|
+
- Support SWT ExpandBar via expand_bar keyword
|
7
|
+
- Hello, Expand Bar! Sample
|
8
|
+
- Hello, Styled Text! Sample
|
9
|
+
- Use expand_bar in Glimmer Meta-Sample
|
10
|
+
|
11
|
+
### 4.17.4.2
|
12
|
+
|
13
|
+
- Support StyledText data-binding of caret_offset, selection_count, selection, top_index, and top_pixel, useful for code_text
|
14
|
+
- Support `width, height` hash options for ImageProxy and image properties on widgets
|
15
|
+
- Default SWT styles for tool_bar (:border) and tool_item (:push)
|
16
|
+
|
17
|
+
### 4.17.4.1
|
18
|
+
|
19
|
+
- Optimize code_text line style listener algorithm or avoid setting code_text style via listener for performance reasons
|
20
|
+
- Optimize code_text syntax highlighting by not lexing except when content changes (e.g. during scrolling, do not lex)
|
21
|
+
|
22
|
+
### 4.17.4.0
|
23
|
+
|
24
|
+
- Glimmer sample app to launch samples (sample of samples meta-sample)
|
25
|
+
- Syntax Color Highlighting in meta-sample
|
26
|
+
- Make sash_form weights accept splat array elements (not wrapped in [])
|
27
|
+
- 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)
|
28
|
+
- Replace dependency on tty-markdown gem with dependency on rouge gem instead
|
29
|
+
- Remove rake tasks `sample:list`, `sample:code` and `sample:run`
|
30
|
+
- Add rake task `samples` to point to the new Glimmer Meta-Sample
|
31
|
+
- Have meta-sample load samples from gems
|
32
|
+
|
33
|
+
### 4.17.3.0
|
34
|
+
|
35
|
+
- `glimmer scaffold:desktopify[appname,website]` Mac
|
36
|
+
- `glimmer scaffold:desktopify[appname,website]` Windows
|
37
|
+
- `glimmer scaffold:desktopify[appname,website]` Linux (have scaffolding include the glimmer-cw-browser-chromium gem in scaffolded app on Linux)
|
38
|
+
- Remove the native packaging from Linux scaffolding since it is not officially supported
|
39
|
+
- Add gem packaging as part of scaffolding on Linux
|
40
|
+
- Launch the app at the end of scaffolding in Linux
|
41
|
+
- Provide a `glimmer package:gem` task
|
42
|
+
- Add support for scaffolding "app/scaffolded_app/launch" and "lib/namespace/custom_shell/launch" to enable launching SWT apps in Glimmer DSL for Opal without changing a line of code
|
43
|
+
- Add a binary executable shell in "app" mode (just like "custom shell gem" mode)
|
44
|
+
- Have glimmer packaging check the Java version and give a warning if an unsupported version is used.
|
45
|
+
|
46
|
+
|
3
47
|
### 4.17.2.4
|
4
48
|
|
5
49
|
- New `glimmer run` glimmer command task.
|
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.5.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,7 +10,7 @@
|
|
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
|
|
@@ -40,9 +40,10 @@ shell {
|
|
40
40
|
}.open
|
41
41
|
```
|
42
42
|
|
43
|
-
Run:
|
43
|
+
Run via `glimmer samples` or directly:
|
44
|
+
|
44
45
|
```
|
45
|
-
glimmer
|
46
|
+
glimmer samples/hello/hello_world.rb
|
46
47
|
```
|
47
48
|
|
48
49
|
Glimmer app:
|
@@ -85,10 +86,10 @@ Glimmer code (from [samples/elaborate/tic_tac_toe.rb](https://github.com/AndyObt
|
|
85
86
|
# ...
|
86
87
|
```
|
87
88
|
|
88
|
-
Run:
|
89
|
+
Run via `glimmer samples` or directly:
|
89
90
|
|
90
91
|
```
|
91
|
-
glimmer
|
92
|
+
glimmer samples/elaborate/tic_tac_toe.rb
|
92
93
|
```
|
93
94
|
|
94
95
|
Glimmer app:
|
@@ -210,10 +211,10 @@ Glimmer code (from [samples/elaborate/contact_manager.rb](https://github.com/And
|
|
210
211
|
# ...
|
211
212
|
```
|
212
213
|
|
213
|
-
Run:
|
214
|
+
Run via `glimmer samples` or directly:
|
214
215
|
|
215
216
|
```
|
216
|
-
glimmer
|
217
|
+
glimmer samples/elaborate/contact_manager.rb
|
217
218
|
```
|
218
219
|
|
219
220
|
Glimmer App:
|
@@ -248,12 +249,10 @@ Glimmer App:
|
|
248
249
|
- [Glimmer Command](#glimmer-command)
|
249
250
|
- [Basic Usage](#basic-usage)
|
250
251
|
- [Advanced Usage](#advanced-usage)
|
251
|
-
- [
|
252
|
-
- [Sample List](#sample-list)
|
253
|
-
- [Sample Run](#sample-run)
|
254
|
-
- [Sample Code](#sample-code)
|
252
|
+
- [Glimmer Samples](#glimmer-samples)
|
255
253
|
- [Scaffolding](#scaffolding)
|
256
254
|
- [App](#app)
|
255
|
+
- [Desktopify](#desktopify)
|
257
256
|
- [Custom Shell](#custom-shell)
|
258
257
|
- [Custom Widget](#custom-widget)
|
259
258
|
- [Custom Shell Gem](#custom-shell-gem)
|
@@ -283,6 +282,7 @@ Glimmer App:
|
|
283
282
|
- [Color](#color)
|
284
283
|
- [Font](#font)
|
285
284
|
- [Image](#image)
|
285
|
+
- [Image Options](#image-options)
|
286
286
|
- [Cursor](#cursor)
|
287
287
|
- [Layouts](#layouts)
|
288
288
|
- [Layout Data](#layout-data)
|
@@ -309,7 +309,9 @@ Glimmer App:
|
|
309
309
|
- [Multi-DSL Support](#multi-dsl-support)
|
310
310
|
- [Application Menu Items (About/Preferences)](#application-menu-items-aboutpreferences)
|
311
311
|
- [App Name and Version](#app-name-and-version)
|
312
|
+
- [Code Text Widget](#code-text-widget)
|
312
313
|
- [Video Widget](#video-widget)
|
314
|
+
- [Sash Form Widget](#sash-form-widget)
|
313
315
|
- [Browser Widget](#browser-widget)
|
314
316
|
- [Glimmer Configuration](#glimmer-configuration)
|
315
317
|
- [logger](#logger)
|
@@ -338,6 +340,9 @@ Glimmer App:
|
|
338
340
|
- [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu)
|
339
341
|
- [Hello, Custom Widget!](#hello-custom-widget)
|
340
342
|
- [Hello, Custom Shell!](#hello-custom-shell)
|
343
|
+
- [Hello, Sash Form!](#hello-sash-form)
|
344
|
+
- [Hello, Styled Text!](#hello-styled-text)
|
345
|
+
- [Hello, Expand Bar!](#hello-expand-bar)
|
341
346
|
- [Elaborate Samples](#elaborate-samples)
|
342
347
|
- [User Profile](#user-profile)
|
343
348
|
- [Login](#login)
|
@@ -373,7 +378,7 @@ Glimmer App:
|
|
373
378
|
- [Contributors](#contributors)
|
374
379
|
- [Hire Me](#hire-me)
|
375
380
|
- [License](#license)
|
376
|
-
|
381
|
+
|
377
382
|
## Background
|
378
383
|
|
379
384
|
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,7 +436,7 @@ jgem install glimmer-dsl-swt
|
|
431
436
|
|
432
437
|
Or this command if you want a specific version:
|
433
438
|
```
|
434
|
-
jgem install glimmer-dsl-swt -v 4.17.
|
439
|
+
jgem install glimmer-dsl-swt -v 4.17.5.0
|
435
440
|
```
|
436
441
|
|
437
442
|
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.
|
@@ -490,17 +495,18 @@ glimmer application.rb
|
|
490
495
|
Runs a Glimmer application using JRuby, automatically preloading
|
491
496
|
the glimmer ruby gem and SWT jar dependency.
|
492
497
|
|
493
|
-
|
498
|
+
Run Glimmer samples with:
|
499
|
+
|
494
500
|
```
|
495
|
-
glimmer
|
501
|
+
glimmer samples
|
496
502
|
```
|
497
|
-
This
|
503
|
+
This brings up the [Glimmer Meta-Sample (The Sample of Samples)](#samples)
|
498
504
|
|
499
|
-
If you cloned this project locally
|
505
|
+
If you cloned this project locally instead of installing the gem, run `bin/glimmer` instead.
|
500
506
|
|
501
507
|
Example:
|
502
508
|
```
|
503
|
-
bin/glimmer
|
509
|
+
bin/glimmer samples
|
504
510
|
```
|
505
511
|
|
506
512
|
### Advanced Usage
|
@@ -508,7 +514,7 @@ bin/glimmer sample:run[hello_world]
|
|
508
514
|
Below are the full usage instructions that come up when running `glimmer` without args.
|
509
515
|
|
510
516
|
```
|
511
|
-
Glimmer (Ruby Desktop Development GUI Library) - JRuby Gem: glimmer-dsl-swt v4.17.
|
517
|
+
Glimmer (Ruby Desktop Development GUI Library) - JRuby Gem: glimmer-dsl-swt v4.17.5.0
|
512
518
|
|
513
519
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
514
520
|
|
@@ -542,9 +548,7 @@ Select a Glimmer task to run: (Press ↑/↓ arrow to move, Enter to select and
|
|
542
548
|
glimmer package:lock_jars # Lock JARs
|
543
549
|
glimmer package:native[type] # Generate Native files
|
544
550
|
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
|
551
|
+
glimmer samples # Brings up the Glimmer Meta-Sample app to allow browsing, running, and viewing code of Glimmer samples
|
548
552
|
glimmer scaffold[app_name] # Scaffold Glimmer application directory structure to build a new app
|
549
553
|
glimmer scaffold:customshell[name,namespace] # Scaffold Glimmer::UI::CustomShell subclass (full window view) under app/views (namespace is optional) [alt: scaffold:cs]
|
550
554
|
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 +570,17 @@ glimmer samples/hello/hello_world.rb samples/hello/hello_tab.rb
|
|
566
570
|
|
567
571
|
Launches samples/hello/hello_world.rb and samples/hello_tab.rb at the same time, each in a separate JRuby thread.
|
568
572
|
|
569
|
-
###
|
570
|
-
|
571
|
-
#### Sample List
|
573
|
+
### Glimmer Samples
|
572
574
|
|
573
575
|
You can list available Glimmer samples by running:
|
574
576
|
|
575
577
|
```
|
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
|
-
|
625
|
-
```
|
626
|
-
$ glimmer sample:run[hello_tab]
|
627
|
-
|
628
|
-
# /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.2.4/samples/hello/hello_tab.rb
|
629
|
-
|
630
|
-
class HelloTab
|
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
|
-
|
578
|
+
glimmer samples
|
670
579
|
```
|
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.2.4/samples/elaborate/tic_tac_toe.rb
|
674
580
|
|
675
|
-
|
676
|
-
|
677
|
-
class TicTacToe
|
678
|
-
include Glimmer
|
581
|
+
This brings up the [Glimmer Meta-Sample (The Sample of Samples)](#samples):
|
679
582
|
|
680
|
-
|
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.2.4/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.2.4/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
|
-
```
|
583
|
+
![Glimmer Meta-Sample](images/glimmer-meta-sample.png)
|
896
584
|
|
897
585
|
### Scaffolding
|
898
586
|
|
@@ -913,7 +601,7 @@ letting Glimmer scaffolding take care of initial app file structure concerns, su
|
|
913
601
|
- Icon (under `package/{platform}/{App Name}.{icon_extension}` for `macosx` .icns, `windows` .ico, and `linux` .png)
|
914
602
|
- Bin file for starting application (`bin/{app_name}.rb`)
|
915
603
|
|
916
|
-
|
604
|
+
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
605
|
|
918
606
|
#### App
|
919
607
|
|
@@ -925,7 +613,7 @@ To scaffold a Glimmer app from scratch, run the following command:
|
|
925
613
|
glimmer scaffold[AppName]
|
926
614
|
```
|
927
615
|
|
928
|
-
This will generate an advanced "Hello, World!" app, package it as a Mac
|
616
|
+
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.
|
929
617
|
|
930
618
|
Suppose you run:
|
931
619
|
|
@@ -937,18 +625,18 @@ You should see output like the following:
|
|
937
625
|
|
938
626
|
```
|
939
627
|
$ glimmer scaffold[greeter]
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
628
|
+
create .gitignore
|
629
|
+
create Rakefile
|
630
|
+
create Gemfile
|
631
|
+
create LICENSE.txt
|
632
|
+
create README.rdoc
|
633
|
+
create .document
|
634
|
+
create lib
|
635
|
+
create lib/greeter.rb
|
636
|
+
create spec
|
637
|
+
create spec/spec_helper.rb
|
638
|
+
create spec/greeter_spec.rb
|
639
|
+
create .rspec
|
952
640
|
Juwelier has prepared your gem in ./greeter
|
953
641
|
Created greeter/.gitignore
|
954
642
|
Created greeter/.ruby-version
|
@@ -1001,6 +689,101 @@ or:
|
|
1001
689
|
glimmer bin/greeter
|
1002
690
|
```
|
1003
691
|
|
692
|
+
#### Desktopify
|
693
|
+
|
694
|
+
This scaffolding mode enables you to desktopify a web app. Glimmer Scaffolding basically wraps the website with a [Browser Widget](#browser-widget).
|
695
|
+
|
696
|
+
The desktopify app is similar to the standard scaffolded app. It can be extended and the [browser may even be instrumented](https://help.eclipse.org/2020-09/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/browser/Browser.html).
|
697
|
+
|
698
|
+
The app even remembers your cookies if you log into the website, close the app, and reopen again.
|
699
|
+
|
700
|
+
Note that on Linux, the default SWT browser, which runs on webkit, does not support HTML5 Video out of the box. If you need video support, open `Gemfile` after scaffolding and enable the line that has the `glimmer-cw-browser-chromium` gem then replace the `browser` in "app/views/snowboard_utah/app_view.rb" with `browser(:chromium)`
|
701
|
+
|
702
|
+
Before you start, make sure you are in a JRuby environment with Glimmer gem installed as per "Direct Install" pre-requisites.
|
703
|
+
|
704
|
+
To scaffold a Glimmer desktopify app from scratch, run the following command:
|
705
|
+
|
706
|
+
```
|
707
|
+
glimmer scaffold:desktopify[app_name,website]
|
708
|
+
```
|
709
|
+
|
710
|
+
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.
|
711
|
+
|
712
|
+
Suppose you run:
|
713
|
+
|
714
|
+
```
|
715
|
+
glimmer scaffold:desktopify[snowboard_utah,https://www.brightonresort.com]
|
716
|
+
```
|
717
|
+
|
718
|
+
You should see output like the following:
|
719
|
+
|
720
|
+
```
|
721
|
+
$ glimmer scaffold:desktopify[snowboard_utah,https://www.brightonresort.com]
|
722
|
+
Fetching kamelcase-0.0.2.gem
|
723
|
+
Fetching github_api-0.19.0.gem
|
724
|
+
Fetching highline-2.0.3.gem
|
725
|
+
Fetching juwelier-2.4.9.gem
|
726
|
+
Fetching hashie-3.6.0.gem
|
727
|
+
Fetching nokogiri-1.10.10-java.gem
|
728
|
+
Fetching semver2-3.4.2.gem
|
729
|
+
Successfully installed semver2-3.4.2
|
730
|
+
Successfully installed kamelcase-0.0.2
|
731
|
+
Successfully installed highline-2.0.3
|
732
|
+
Successfully installed hashie-3.6.0
|
733
|
+
Successfully installed github_api-0.19.0
|
734
|
+
Successfully installed nokogiri-1.10.10-java
|
735
|
+
Successfully installed juwelier-2.4.9
|
736
|
+
7 gems installed
|
737
|
+
create .gitignore
|
738
|
+
create Rakefile
|
739
|
+
create Gemfile
|
740
|
+
create LICENSE.txt
|
741
|
+
create README.markdown
|
742
|
+
create .document
|
743
|
+
create lib
|
744
|
+
create lib/snowboard_utah.rb
|
745
|
+
create .rspec
|
746
|
+
Juwelier has prepared your gem in ./snowboard_utah
|
747
|
+
Created snowboard_utah/.gitignore
|
748
|
+
Created snowboard_utah/.ruby-version
|
749
|
+
Created snowboard_utah/.ruby-gemset
|
750
|
+
Created snowboard_utah/VERSION
|
751
|
+
Created snowboard_utah/LICENSE.txt
|
752
|
+
Created snowboard_utah/Gemfile
|
753
|
+
Created snowboard_utah/Rakefile
|
754
|
+
Created snowboard_utah/app/snowboard_utah.rb
|
755
|
+
Created snowboard_utah/app/views/snowboard_utah/app_view.rb
|
756
|
+
Created snowboard_utah/package/windows/Snowboard Utah.ico
|
757
|
+
Created snowboard_utah/package/macosx/Snowboard Utah.icns
|
758
|
+
Created snowboard_utah/package/linux/Snowboard Utah.png
|
759
|
+
Created snowboard_utah/bin/snowboard_utah
|
760
|
+
...
|
761
|
+
```
|
762
|
+
|
763
|
+
Eventually, it will launch a desktopified version of "https://www.brightonresort.com" having the title of ("Snowboard Utah").
|
764
|
+
|
765
|
+
Desktopified App on Mac
|
766
|
+
|
767
|
+
![Glimmer Scaffold App](images/glimmer-scaffolding-desktopify.png)
|
768
|
+
|
769
|
+
It also comes with a boilerplate About dialog.
|
770
|
+
|
771
|
+
![Glimmer Scaffold App About](images/glimmer-scaffolding-desktopify-about.png)
|
772
|
+
|
773
|
+
Desktopified App on Windows
|
774
|
+
|
775
|
+
![Glimmer Scaffold App](images/glimmer-scaffolding-desktopify-windows.png)
|
776
|
+
|
777
|
+
Desktopified App on Linux
|
778
|
+
|
779
|
+
![Glimmer Scaffold App](images/glimmer-scaffolding-desktopify-linux.png)
|
780
|
+
|
781
|
+
In order to run the app after making changes, you must run the `glimmer run`. It automatically detects the generated run script under the `bin` directory and uses it as an argument.
|
782
|
+
|
783
|
+
```
|
784
|
+
glimmer run
|
785
|
+
```
|
786
|
+
|
1004
787
|
#### Custom Shell
|
1005
788
|
|
1006
789
|
To scaffold a Glimmer custom shell (full window view) for an existing Glimmer app, run the following command:
|
@@ -1207,9 +990,9 @@ Output:
|
|
1207
990
|
Name Gem Version Author Description
|
1208
991
|
|
1209
992
|
Css glimmer-dsl-css 1.1.0 AndyMaleh Glimmer DSL for CSS
|
1210
|
-
Opal glimmer-dsl-opal 0.
|
1211
|
-
Swt glimmer-dsl-swt 4.17.
|
1212
|
-
Tk glimmer-dsl-tk 0.0.
|
993
|
+
Opal glimmer-dsl-opal 0.4.0 AndyMaleh Glimmer DSL for Opal
|
994
|
+
Swt glimmer-dsl-swt 4.17.5.0 AndyMaleh Glimmer DSL for SWT
|
995
|
+
Tk glimmer-dsl-tk 0.0.6 AndyMaleh Glimmer DSL for Tk
|
1213
996
|
Xml glimmer-dsl-xml 1.1.0 AndyMaleh Glimmer DSL for XML
|
1214
997
|
```
|
1215
998
|
|
@@ -2000,10 +1783,27 @@ The `image` keyword creates an instance of [org.eclipse.swt.graphics.Image](http
|
|
2000
1783
|
|
2001
1784
|
It is a graphics `Image` object (not a widget), but is used used in setting the `image` property on `label` and `background_image` on `composite` (and subclasses)
|
2002
1785
|
|
2003
|
-
Glimmer recently included **EXPERIMENTAL** gif animation support for the `background_image` property on `composite' since SWT does not support animation by default.
|
1786
|
+
Glimmer recently included **EXPERIMENTAL** gif animation support for the `background_image` property on `composite' since SWT does not support animation by default. On Windows, it only works inside composites nested under standard shells, not ones that have the SWT styles :on_top or :no_trim
|
2004
1787
|
|
2005
1788
|
Learn more about images in general at this SWT Image guide: https://www.eclipse.org/articles/Article-SWT-images/graphics-resources.html
|
2006
1789
|
|
1790
|
+
#### Image Options
|
1791
|
+
|
1792
|
+
Options may be passed in a hash at the end of `image` arguments:
|
1793
|
+
|
1794
|
+
- `width`: width of image
|
1795
|
+
- `height`: height of image
|
1796
|
+
|
1797
|
+
If only the width or height alone are specified, the other is calculated while maintaining the image aspect ratio.
|
1798
|
+
|
1799
|
+
Example:
|
1800
|
+
|
1801
|
+
```
|
1802
|
+
label {
|
1803
|
+
image 'someimage.png', width: 400, height: 300
|
1804
|
+
}
|
1805
|
+
```
|
1806
|
+
|
2007
1807
|
### Cursor
|
2008
1808
|
|
2009
1809
|
SWT widget `cursor` property represents the mouse cursor you see on the screen when you hover over that widget.
|
@@ -2727,7 +2527,7 @@ Custom widgets are brand new Glimmer DSL keywords that represent aggregates of e
|
|
2727
2527
|
|
2728
2528
|
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
|
2729
2529
|
|
2730
|
-
Glimmer supports
|
2530
|
+
Glimmer supports three ways of creating custom widgets with minimal code:
|
2731
2531
|
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.
|
2732
2532
|
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.
|
2733
2533
|
|
@@ -3273,6 +3073,28 @@ shell(:no_resize) {
|
|
3273
3073
|
|
3274
3074
|
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.
|
3275
3075
|
|
3076
|
+
#### Code Text Widget
|
3077
|
+
|
3078
|
+
`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.
|
3079
|
+
|
3080
|
+
It is used in the [Glimmer Meta-Sample (The Sample of Samples)](#samples):
|
3081
|
+
|
3082
|
+
![Glimmer Meta-Sample](images/glimmer-meta-sample.png)
|
3083
|
+
|
3084
|
+
Glimmer Meta-Sample Code Example:
|
3085
|
+
|
3086
|
+
```ruby
|
3087
|
+
# ...
|
3088
|
+
code_text {
|
3089
|
+
text bind(SampleDirectory, 'selected_sample.content')
|
3090
|
+
editable false
|
3091
|
+
caret nil
|
3092
|
+
}
|
3093
|
+
# ...
|
3094
|
+
```
|
3095
|
+
|
3096
|
+
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.
|
3097
|
+
|
3276
3098
|
#### Video Widget
|
3277
3099
|
|
3278
3100
|
[![Video Widget](images/glimmer-video-widget.png)](https://github.com/AndyObtiva/glimmer-cw-video)
|
@@ -3281,6 +3103,41 @@ Glimmer supports a [video custom widget](https://github.com/AndyObtiva/glimmer-c
|
|
3281
3103
|
|
3282
3104
|
You may obtain via `glimmer-cw-video` gem.
|
3283
3105
|
|
3106
|
+
#### Sash Form Widget
|
3107
|
+
|
3108
|
+
`sash_form` is an SWT built-in custom widget that provides a resizable sash that splits a window area into two or more panes.
|
3109
|
+
|
3110
|
+
It can be customized with the `weights` attribute by setting initial weights to size the panes at first display.
|
3111
|
+
|
3112
|
+
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)
|
3113
|
+
|
3114
|
+
Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
|
3115
|
+
|
3116
|
+
```ruby
|
3117
|
+
shell {
|
3118
|
+
text 'Sash Form Example'
|
3119
|
+
sash_form {
|
3120
|
+
label {
|
3121
|
+
text '(resize >>)'
|
3122
|
+
background :dark_green
|
3123
|
+
foreground :white
|
3124
|
+
font height: 20
|
3125
|
+
}
|
3126
|
+
label {
|
3127
|
+
text '(<< resize)'
|
3128
|
+
background :red
|
3129
|
+
foreground :white
|
3130
|
+
font height: 20
|
3131
|
+
}
|
3132
|
+
weights 1, 2
|
3133
|
+
}
|
3134
|
+
}.open
|
3135
|
+
```
|
3136
|
+
|
3137
|
+
You may check out a more full-fledged example in [Hello, Sash Form!](#hello-sash-form)
|
3138
|
+
|
3139
|
+
![Hello Sash Form](images/glimmer-hello-sash-form.png)
|
3140
|
+
|
3284
3141
|
#### Browser Widget
|
3285
3142
|
|
3286
3143
|
![Hello Browser](images/glimmer-hello-browser.png)
|
@@ -3569,12 +3426,16 @@ https://www.eclipse.org/nebula/
|
|
3569
3426
|
|
3570
3427
|
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`).
|
3571
3428
|
|
3572
|
-
|
3429
|
+
You may run any sample via this command:
|
3573
3430
|
|
3574
3431
|
```
|
3575
|
-
samples
|
3432
|
+
glimmer samples
|
3576
3433
|
```
|
3577
3434
|
|
3435
|
+
This brings up the [Glimmer Meta-Sample (The Sample of Samples)](samples/elaborate/meta_sample.rb)
|
3436
|
+
|
3437
|
+
![Glimmer Meta-Sample](images/glimmer-meta-sample.png)
|
3438
|
+
|
3578
3439
|
### Hello Samples
|
3579
3440
|
|
3580
3441
|
For hello-type simple samples, check the following.
|
@@ -3585,12 +3446,6 @@ Code:
|
|
3585
3446
|
|
3586
3447
|
[samples/hello/hello_world.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_world.rb)
|
3587
3448
|
|
3588
|
-
Run:
|
3589
|
-
|
3590
|
-
```
|
3591
|
-
glimmer sample:run[hello_world]
|
3592
|
-
```
|
3593
|
-
|
3594
3449
|
![Hello World](images/glimmer-hello-world.png)
|
3595
3450
|
|
3596
3451
|
#### Hello, Tab!
|
@@ -3599,12 +3454,6 @@ Code:
|
|
3599
3454
|
|
3600
3455
|
[samples/hello/hello_tab.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_tab.rb)
|
3601
3456
|
|
3602
|
-
Run:
|
3603
|
-
|
3604
|
-
```
|
3605
|
-
glimmer sample:run[hello_tab]
|
3606
|
-
```
|
3607
|
-
|
3608
3457
|
![Hello Tab English](images/glimmer-hello-tab-english.png)
|
3609
3458
|
![Hello Tab French](images/glimmer-hello-tab-french.png)
|
3610
3459
|
|
@@ -3616,12 +3465,6 @@ Code:
|
|
3616
3465
|
|
3617
3466
|
[samples/hello/hello_combo.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_combo.rb)
|
3618
3467
|
|
3619
|
-
Run:
|
3620
|
-
|
3621
|
-
```
|
3622
|
-
glimmer sample:run[hello_combo]
|
3623
|
-
```
|
3624
|
-
|
3625
3468
|
![Hello Combo](images/glimmer-hello-combo.png)
|
3626
3469
|
![Hello Combo Expanded](images/glimmer-hello-combo-expanded.png)
|
3627
3470
|
|
@@ -3633,12 +3476,6 @@ Code:
|
|
3633
3476
|
|
3634
3477
|
[samples/hello/hello_list_single_selection.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_list_single_selection.rb)
|
3635
3478
|
|
3636
|
-
Run:
|
3637
|
-
|
3638
|
-
```
|
3639
|
-
glimmer sample:run[hello_list_single_selection]
|
3640
|
-
```
|
3641
|
-
|
3642
3479
|
![Hello List Single Selection](images/glimmer-hello-list-single-selection.png)
|
3643
3480
|
|
3644
3481
|
#### Hello, List Multi Selection!
|
@@ -3649,12 +3486,6 @@ Code:
|
|
3649
3486
|
|
3650
3487
|
[samples/hello/hello_list_multi_selection.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_list_multi_selection.rb)
|
3651
3488
|
|
3652
|
-
Run:
|
3653
|
-
|
3654
|
-
```
|
3655
|
-
glimmer sample:run[hello_list_multi_selection]
|
3656
|
-
```
|
3657
|
-
|
3658
3489
|
![Hello List Multi Selection](images/glimmer-hello-list-multi-selection.png)
|
3659
3490
|
|
3660
3491
|
#### Hello, Computed!
|
@@ -3665,12 +3496,6 @@ Code:
|
|
3665
3496
|
|
3666
3497
|
[samples/hello/hello_computed.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_computed.rb)
|
3667
3498
|
|
3668
|
-
Run:
|
3669
|
-
|
3670
|
-
```
|
3671
|
-
glimmer sample:run[hello_computed]
|
3672
|
-
```
|
3673
|
-
|
3674
3499
|
![Hello Browser](images/glimmer-hello-computed.png)
|
3675
3500
|
|
3676
3501
|
#### Hello, Message Box!
|
@@ -3681,12 +3506,6 @@ Code:
|
|
3681
3506
|
|
3682
3507
|
[samples/hello/hello_message_box.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_message_box.rb)
|
3683
3508
|
|
3684
|
-
Run:
|
3685
|
-
|
3686
|
-
```
|
3687
|
-
glimmer sample:run[hello_message_box]
|
3688
|
-
```
|
3689
|
-
|
3690
3509
|
![Hello Message Box](images/glimmer-hello-message-box.png)
|
3691
3510
|
![Hello Message Box Dialog](images/glimmer-hello-message-box-dialog.png)
|
3692
3511
|
|
@@ -3698,12 +3517,6 @@ Code:
|
|
3698
3517
|
|
3699
3518
|
[samples/hello/hello_browser.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_browser.rb)
|
3700
3519
|
|
3701
|
-
Run:
|
3702
|
-
|
3703
|
-
```
|
3704
|
-
glimmer sample:run[hello_browser]
|
3705
|
-
```
|
3706
|
-
|
3707
3520
|
![Hello Browser](images/glimmer-hello-browser.png)
|
3708
3521
|
|
3709
3522
|
#### Hello, Drag and Drop!
|
@@ -3714,12 +3527,6 @@ Code:
|
|
3714
3527
|
|
3715
3528
|
[samples/hello/hello_drag_and_drop.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_drag_and_drop.rb)
|
3716
3529
|
|
3717
|
-
Run:
|
3718
|
-
|
3719
|
-
```
|
3720
|
-
glimmer sample:run[hello_drag_and_drop]
|
3721
|
-
```
|
3722
|
-
|
3723
3530
|
![Hello Drag and Drop](images/glimmer-hello-drag-and-drop.gif)
|
3724
3531
|
|
3725
3532
|
#### Hello, Menu Bar!
|
@@ -3730,12 +3537,6 @@ Code:
|
|
3730
3537
|
|
3731
3538
|
[samples/hello/hello_menu_bar.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_menu_bar.rb)
|
3732
3539
|
|
3733
|
-
Run:
|
3734
|
-
|
3735
|
-
```
|
3736
|
-
glimmer sample:run[hello_menu_bar]
|
3737
|
-
```
|
3738
|
-
|
3739
3540
|
![Hello Menu Bar](images/glimmer-hello-menu-bar.png)
|
3740
3541
|
![Hello Menu Bar File Menu](images/glimmer-hello-menu-bar-file-menu.png)
|
3741
3542
|
![Hello Menu Bar History Menu](images/glimmer-hello-menu-bar-history-menu.png)
|
@@ -3748,12 +3549,6 @@ Code:
|
|
3748
3549
|
|
3749
3550
|
[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)
|
3750
3551
|
|
3751
|
-
Run:
|
3752
|
-
|
3753
|
-
```
|
3754
|
-
glimmer sample:run[hello_pop_up_context_menu]
|
3755
|
-
```
|
3756
|
-
|
3757
3552
|
![Hello Pop Up Context Menu](images/glimmer-hello-pop-up-context-menu.png)
|
3758
3553
|
![Hello Pop Up Context Menu Popped Up](images/glimmer-hello-pop-up-context-menu-popped-up.png)
|
3759
3554
|
|
@@ -3765,12 +3560,6 @@ Code:
|
|
3765
3560
|
|
3766
3561
|
[samples/hello/hello_custom_widget.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_custom_widget.rb)
|
3767
3562
|
|
3768
|
-
Run:
|
3769
|
-
|
3770
|
-
```
|
3771
|
-
glimmer sample:run[hello_custom_widget]
|
3772
|
-
```
|
3773
|
-
|
3774
3563
|
![Hello Custom Widget](images/glimmer-hello-custom-widget.gif)
|
3775
3564
|
|
3776
3565
|
#### Hello, Custom Shell!
|
@@ -3781,17 +3570,79 @@ Code:
|
|
3781
3570
|
|
3782
3571
|
[samples/hello/hello_custom_shell.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_custom_shell.rb)
|
3783
3572
|
|
3784
|
-
Run:
|
3785
|
-
|
3786
|
-
```
|
3787
|
-
glimmer sample:run[hello_custom_shell]
|
3788
|
-
```
|
3789
|
-
|
3790
3573
|
![Hello Custom Shell](images/glimmer-hello-custom-shell.png)
|
3791
3574
|
![Hello Custom Shell Email1](images/glimmer-hello-custom-shell-email1.png)
|
3792
3575
|
![Hello Custom Shell Email2](images/glimmer-hello-custom-shell-email2.png)
|
3793
3576
|
![Hello Custom Shell Email3](images/glimmer-hello-custom-shell-email3.png)
|
3794
3577
|
|
3578
|
+
#### Hello, Sash Form!
|
3579
|
+
|
3580
|
+
This sample demonstrates the use of a `sash_form` in Glimmer.
|
3581
|
+
|
3582
|
+
Code:
|
3583
|
+
|
3584
|
+
[samples/hello/hello_sash_form.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_sash_form.rb)
|
3585
|
+
|
3586
|
+
Hello, Sash Form! Horizontal Orientation
|
3587
|
+
|
3588
|
+
![Hello Sash Form](images/glimmer-hello-sash-form.png)
|
3589
|
+
|
3590
|
+
Hello, Sash Form! Resized
|
3591
|
+
|
3592
|
+
![Hello Sash Form Resized](images/glimmer-hello-sash-form-resized.png)
|
3593
|
+
|
3594
|
+
Hello, Sash Form! Sash Width Changed
|
3595
|
+
|
3596
|
+
![Hello Sash Form Sash Width Changed](images/glimmer-hello-sash-form-sash-width-changed.png)
|
3597
|
+
|
3598
|
+
Hello, Sash Form! Vertical Orientation
|
3599
|
+
|
3600
|
+
![Hello Sash Form Vertical](images/glimmer-hello-sash-form-vertical.png)
|
3601
|
+
|
3602
|
+
Hello, Sash Form! Green Label Maximized
|
3603
|
+
|
3604
|
+
![Hello Sash Form Green Maximized](images/glimmer-hello-sash-form-green-maximized.png)
|
3605
|
+
|
3606
|
+
Hello, Sash Form! Red Label Maximized
|
3607
|
+
|
3608
|
+
![Hello Sash Form Red Maximized](images/glimmer-hello-sash-form-red-maximized.png)
|
3609
|
+
|
3610
|
+
#### Hello, Styled Text!
|
3611
|
+
|
3612
|
+
This sample demonstrates the use of a `styled_text` in Glimmer.
|
3613
|
+
|
3614
|
+
Code:
|
3615
|
+
|
3616
|
+
[samples/hello/hello_styled_text.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_styled_text.rb)
|
3617
|
+
|
3618
|
+
Hello, Styled Text!
|
3619
|
+
|
3620
|
+
![Hello Styled Text](images/glimmer-hello-styled-text.png)
|
3621
|
+
|
3622
|
+
#### Hello, Expand Bar!
|
3623
|
+
|
3624
|
+
This sample demonstrates the use of a `expand_bar` and `expand_item` in Glimmer.
|
3625
|
+
|
3626
|
+
Code:
|
3627
|
+
|
3628
|
+
[samples/hello/hello_expand_bar.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_expand_bar.rb)
|
3629
|
+
|
3630
|
+
Hello, Expand Bar! All Expanded
|
3631
|
+
|
3632
|
+
![Hello Expand Bar All Expanded](images/glimmer-hello-expand-bar-all-expanded.png)
|
3633
|
+
|
3634
|
+
Hello, Expand Bar! Productivity Expanded
|
3635
|
+
|
3636
|
+
![Hello Expand Bar Productivity Expanded](images/glimmer-hello-expand-bar-productivity-expanded.png)
|
3637
|
+
|
3638
|
+
Hello, Expand Bar! Tools Expanded
|
3639
|
+
|
3640
|
+
![Hello Expand Bar Tools Expanded](images/glimmer-hello-expand-bar-tools-expanded.png)
|
3641
|
+
|
3642
|
+
Hello, Expand Bar! Reading Expanded
|
3643
|
+
|
3644
|
+
![Hello Expand Bar Reading Expanded](images/glimmer-hello-expand-bar-reading-expanded.png)
|
3645
|
+
|
3795
3646
|
### Elaborate Samples
|
3796
3647
|
|
3797
3648
|
For more elaborate samples, check the following:
|
@@ -3806,12 +3657,6 @@ Code:
|
|
3806
3657
|
|
3807
3658
|
[samples/elaborate/user_profile.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/user_profile.rb)
|
3808
3659
|
|
3809
|
-
Run:
|
3810
|
-
|
3811
|
-
```
|
3812
|
-
glimmer sample:run[user_profile]
|
3813
|
-
```
|
3814
|
-
|
3815
3660
|
![User Profile](images/glimmer-user-profile.png)
|
3816
3661
|
|
3817
3662
|
#### Login
|
@@ -3822,12 +3667,6 @@ Code:
|
|
3822
3667
|
|
3823
3668
|
[samples/elaborate/login.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/login.rb)
|
3824
3669
|
|
3825
|
-
Run:
|
3826
|
-
|
3827
|
-
```
|
3828
|
-
glimmer sample:run[login]
|
3829
|
-
```
|
3830
|
-
|
3831
3670
|
![Login](images/glimmer-login.png)
|
3832
3671
|
![Login Filled In](images/glimmer-login-filled-in.png)
|
3833
3672
|
![Login Logged In](images/glimmer-login-logged-in.png)
|
@@ -3842,12 +3681,6 @@ Code:
|
|
3842
3681
|
|
3843
3682
|
[samples/elaborate/tic_tac_toe.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/tic_tac_toe.rb)
|
3844
3683
|
|
3845
|
-
Run:
|
3846
|
-
|
3847
|
-
```
|
3848
|
-
glimmer sample:run[tic_tac_toe]
|
3849
|
-
```
|
3850
|
-
|
3851
3684
|
![Tic Tac Toe](images/glimmer-tic-tac-toe.png)
|
3852
3685
|
![Tic Tac Toe In Progress](images/glimmer-tic-tac-toe-in-progress.png)
|
3853
3686
|
![Tic Tac Toe Game Over](images/glimmer-tic-tac-toe-game-over.png)
|
@@ -3860,12 +3693,6 @@ Code:
|
|
3860
3693
|
|
3861
3694
|
[samples/elaborate/contact_manager.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/contact_manager.rb)
|
3862
3695
|
|
3863
|
-
Run:
|
3864
|
-
|
3865
|
-
```
|
3866
|
-
glimmer sample:run[contact_manager]
|
3867
|
-
```
|
3868
|
-
|
3869
3696
|
Contact Manager
|
3870
3697
|
|
3871
3698
|
![Contact Manager](images/glimmer-contact-manager.png)
|
@@ -3937,7 +3764,7 @@ If you have a Glimmer app you would like referenced here, please mention in a Pu
|
|
3937
3764
|
|
3938
3765
|
## Packaging & Distribution
|
3939
3766
|
|
3940
|
-
Note: this section mostly applies to Mac and Windows. On Linux,
|
3767
|
+
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)
|
3941
3768
|
|
3942
3769
|
Glimmer simplifies the process of native-executable packaging and distribution on Mac and Windows via a single `glimmer package` command:
|
3943
3770
|
|