glimmer-dsl-swt 4.18.3.2 → 4.18.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +52 -0
- data/README.md +674 -323
- data/VERSION +1 -1
- data/glimmer-dsl-swt.gemspec +7 -3
- data/lib/ext/rouge/themes/glimmer.rb +29 -0
- data/lib/glimmer-dsl-swt.rb +0 -1
- data/lib/glimmer/data_binding/table_items_binding.rb +8 -5
- data/lib/glimmer/data_binding/widget_binding.rb +9 -1
- data/lib/glimmer/dsl/swt/image_expression.rb +14 -6
- data/lib/glimmer/dsl/swt/layout_data_expression.rb +4 -4
- data/lib/glimmer/dsl/swt/layout_expression.rb +5 -3
- data/lib/glimmer/swt/custom/code_text.rb +196 -51
- data/lib/glimmer/swt/custom/drawable.rb +4 -6
- data/lib/glimmer/swt/custom/shape.rb +69 -12
- data/lib/glimmer/swt/date_time_proxy.rb +1 -3
- data/lib/glimmer/swt/display_proxy.rb +12 -1
- data/lib/glimmer/swt/font_proxy.rb +1 -0
- data/lib/glimmer/swt/image_proxy.rb +79 -1
- data/lib/glimmer/swt/layout_proxy.rb +4 -1
- data/lib/glimmer/swt/shell_proxy.rb +10 -1
- data/lib/glimmer/swt/table_proxy.rb +27 -14
- data/lib/glimmer/swt/widget_proxy.rb +12 -2
- data/lib/glimmer/ui/custom_widget.rb +6 -2
- data/samples/elaborate/meta_sample.rb +5 -2
- data/samples/elaborate/meta_sample/meta_sample_logo.png +0 -0
- data/samples/elaborate/tetris.rb +60 -7
- data/samples/elaborate/tetris/model/game.rb +36 -7
- data/samples/elaborate/tetris/model/past_game.rb +14 -1
- data/samples/elaborate/tetris/model/tetromino.rb +18 -5
- data/samples/elaborate/tetris/view/block.rb +8 -13
- data/samples/elaborate/tetris/view/high_score_dialog.rb +23 -6
- data/samples/elaborate/tetris/view/playfield.rb +1 -1
- data/samples/elaborate/tetris/view/tetris_menu_bar.rb +22 -6
- data/samples/hello/hello_canvas.rb +10 -9
- data/samples/hello/hello_canvas_animation.rb +5 -5
- data/samples/hello/hello_code_text.rb +104 -0
- data/samples/hello/hello_table.rb +6 -4
- data/samples/hello/hello_table/baseball_park.png +0 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed016ed2527818f682cb4247d294bf16ddcc8ccddb81f5bd26fa518b0592d4a1
|
4
|
+
data.tar.gz: 2c2d0e7fdc9921ab9861d1151686907d809cd072e0e5651889b4f08851c19791
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 646cec122f5b18ffdd57be914bdd84f7a5af7729cf66aa98ecfe35477d7bb9c445bb6c0b00436c7aa06a40052cd5d96613a4d3b4470d97990ebb60cf6813323d
|
7
|
+
data.tar.gz: c6af13d3fe035da72d5e60b88cbe1c6ab498e07cd061113c46a248c110f2044349b99050fd576ebc4f2923efa49965a0539da512325e9a76d0512c4c6816c88c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,57 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
### 4.18.4.1
|
4
|
+
|
5
|
+
- Support data-binding of `code_text` with lines enabled.
|
6
|
+
- Upgrade the Glimmer Meta-Sample with code_text lines: {width: 2}
|
7
|
+
- With code_text lines enabled, support setting/data-binding properties on root composite via nesting `root { }` underneath
|
8
|
+
- With code_text lines enabled, support setting/data-binding properties on line numbers styled text widget via nesting `line_numbers { }` underneath
|
9
|
+
- Update the Hello, Code Text! sample to remove borders and line numbers background in the JavaScript example
|
10
|
+
- Fix issue with updating layout upon later reopening layout/layout data via `proxy.content {}` method
|
11
|
+
|
12
|
+
### 4.18.4.0
|
13
|
+
|
14
|
+
- Extract line numbers part of text_editor widget from Gladiator into Glimmer code_text and make it an option (e.g. lines: true or lines: {width: 4})
|
15
|
+
- code_text support select all via CMD+A
|
16
|
+
- code_text support end of line via CTRL+E and beginning of line via CTRL+A
|
17
|
+
- Support automatic inferrence of Canvas Shape DSL gradient option (just like fill option)
|
18
|
+
- Support automatic inferrence of Canvas Shape DSL round option (just like fill option)
|
19
|
+
- Add a background image to Hello, Table! Sample + font/color changes
|
20
|
+
- Make Canvas patterns auto-reused and auto-disposed when canvas is disposed
|
21
|
+
- Make Canvas images auto-dispose themselves when canvas is disposed
|
22
|
+
- Update Hello, Code Text!
|
23
|
+
- Change Glimmer Tetris Sample up arrow default to rotate left
|
24
|
+
- Fix issue with "undefined method lex for nil:NilClass" in `code_text`
|
25
|
+
|
26
|
+
### 4.18.3.5
|
27
|
+
|
28
|
+
- Add `write_on_cancel: true` option for TableProxy#edit_table_item to make cancel behave just like save for special cases where you cannot cancel except the edit mode itself
|
29
|
+
- Make code_text custom widget support multiple code languages via `language: 'java'` option
|
30
|
+
- Make code_text custom widget support multiple themes via `theme: 'github'` option
|
31
|
+
- Hello, Code Text! Sample
|
32
|
+
- Fix issue with High Score Dialog in Tetris Sample not sorting by scores correctly (string compare instead of numeric compare) until first game is completed
|
33
|
+
- Fix issue with setting date geting rejected in `date_time` for month or day being incompatible with the year/month/day combo
|
34
|
+
|
35
|
+
### 4.18.3.4
|
36
|
+
|
37
|
+
- Support building Image objects with the Glimmer Canvas Shape DSL
|
38
|
+
- Tetris build icon image in-game by nesting Glimmer Shape DSL syntax
|
39
|
+
- Canvas Make shapes auto-fill if you specify a background only (no need to say fill: true) or not fill if you specify a foreground only
|
40
|
+
- Tetris option to switch Up Arrow between Instant Down, Rotate Right, and Rotate Left
|
41
|
+
|
42
|
+
### 4.18.3.3
|
43
|
+
|
44
|
+
- Support Table data binding read_only_sort: true option to allow visual sorting without affecting model data
|
45
|
+
- on_quit to
|
46
|
+
- Tetris Add lines and level to High Score Dialog
|
47
|
+
- Tetris Immediate Drop on Arrow Up
|
48
|
+
- Tetris Pause on showing High Score Dialog
|
49
|
+
- Tetris Make High Scores -> Show a check menu item
|
50
|
+
- Tetris Disable pause button upon showing High Score Dialog
|
51
|
+
- Fix Quit Tetris CMD+Q shortcut by adding on_quit event to display
|
52
|
+
- Tetris Fix escape button upon entering high score name
|
53
|
+
- If WidgetBinding encounters a disposed widget, it deregisters all observables that it is observing
|
54
|
+
|
3
55
|
### 4.18.3.2
|
4
56
|
|
5
57
|
- Tetris High Scores
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.18.
|
1
|
+
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.18.4.1
|
2
2
|
## JRuby Desktop Development GUI Framework
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
|
4
4
|
[![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
|
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
**[Contributors Wanted! (Submit a Glimmer App Sample to Get Started)](#contributing)**
|
10
10
|
|
11
|
-
[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 JVM 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 by 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, or alternatively drive development GUI-first, and then write clean business models (test-first) afterwards. Not only does Glimmer provide a large set of GUI [widgets](#widgets), but it also supports drawing Canvas Graphics like [Shapes](#canvas-shape-dsl) and [Animations](#canvas-animation-dsl). To get started quickly, [Glimmer](https://rubygems.org/gems/glimmer)
|
11
|
+
[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 JVM 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 by 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, or alternatively drive development GUI-first, and then write clean business models (test-first) afterwards. Not only does Glimmer provide a large set of GUI [widgets](#widgets), but it also supports drawing Canvas Graphics like [Shapes](#canvas-shape-dsl) and [Animations](#canvas-animation-dsl). 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/).
|
12
12
|
|
13
13
|
[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.
|
14
14
|
|
@@ -28,9 +28,10 @@ Glimmer DSL gems:
|
|
28
28
|
|
29
29
|
## Examples
|
30
30
|
|
31
|
-
### Hello, World!
|
31
|
+
### Hello, World! Sample
|
32
|
+
|
33
|
+
Glimmer GUI DSL code (from [samples/hello/hello_world.rb](samples/hello/hello_world.rb)):
|
32
34
|
|
33
|
-
Glimmer code (from [samples/hello/hello_world.rb](samples/hello/hello_world.rb)):
|
34
35
|
```ruby
|
35
36
|
include Glimmer
|
36
37
|
|
@@ -52,169 +53,163 @@ Glimmer app:
|
|
52
53
|
|
53
54
|
![Hello World](images/glimmer-hello-world.png)
|
54
55
|
|
55
|
-
|
56
|
+
Learn more about [Hello, World!](#hello-world).
|
57
|
+
|
58
|
+
### Hello, Table! Sample
|
56
59
|
|
57
|
-
Glimmer code (from [samples/
|
60
|
+
Glimmer GUI DSL code (from [samples/hello/hello_table.rb](samples/hello/hello_table.rb)):
|
58
61
|
|
59
62
|
```ruby
|
60
|
-
# ...
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
63
|
+
# ... model code precedes
|
64
|
+
shell {
|
65
|
+
grid_layout
|
66
|
+
|
67
|
+
text 'Hello, Table!'
|
68
|
+
background_image File.expand_path('hello_table/baseball_park.png', __dir__)
|
69
|
+
|
70
|
+
label {
|
71
|
+
layout_data :center, :center, true, false
|
72
|
+
|
73
|
+
text 'BASEBALL PLAYOFF SCHEDULE'
|
74
|
+
foreground rgb(94, 107, 103)
|
75
|
+
font name: 'Optima', height: 38, style: :bold
|
76
|
+
}
|
77
|
+
|
78
|
+
combo(:read_only) {
|
79
|
+
layout_data :center, :center, true, false
|
80
|
+
selection bind(BaseballGame, :playoff_type)
|
81
|
+
font height: 14
|
82
|
+
}
|
83
|
+
|
84
|
+
table(:editable) { |table_proxy|
|
85
|
+
layout_data :fill, :fill, true, true
|
86
|
+
|
87
|
+
table_column {
|
88
|
+
text 'Game Date'
|
89
|
+
width 150
|
90
|
+
sort_property :date # ensure sorting by real date value (not `game_date` string specified in items below)
|
91
|
+
editor :date_drop_down, property: :date_time
|
92
|
+
}
|
93
|
+
table_column {
|
94
|
+
text 'Game Time'
|
95
|
+
width 150
|
96
|
+
sort_property :time # ensure sorting by real time value (not `game_time` string specified in items below)
|
97
|
+
editor :time, property: :date_time
|
98
|
+
}
|
99
|
+
table_column {
|
100
|
+
text 'Ballpark'
|
101
|
+
width 180
|
102
|
+
editor :none
|
103
|
+
}
|
104
|
+
table_column {
|
105
|
+
text 'Home Team'
|
106
|
+
width 150
|
107
|
+
editor :combo, :read_only # read_only is simply an SWT style passed to combo widget
|
108
|
+
}
|
109
|
+
table_column {
|
110
|
+
text 'Away Team'
|
111
|
+
width 150
|
112
|
+
editor :combo, :read_only # read_only is simply an SWT style passed to combo widget
|
113
|
+
}
|
114
|
+
table_column {
|
115
|
+
text 'Promotion'
|
116
|
+
width 150
|
117
|
+
# default text editor is used here
|
118
|
+
}
|
119
|
+
|
120
|
+
# Data-bind table items (rows) to a model collection property, specifying column properties ordering per nested model
|
121
|
+
items bind(BaseballGame, :schedule), column_properties(:game_date, :game_time, :ballpark, :home_team, :away_team, :promotion)
|
122
|
+
|
123
|
+
# Data-bind table selection
|
124
|
+
selection bind(BaseballGame, :selected_game)
|
125
|
+
|
126
|
+
# Default initial sort property
|
127
|
+
sort_property :date
|
128
|
+
|
129
|
+
# Sort by these additional properties after handling sort by the column the user clicked
|
130
|
+
additional_sort_properties :date, :time, :home_team, :away_team, :ballpark, :promotion
|
131
|
+
|
132
|
+
menu {
|
133
|
+
menu_item {
|
134
|
+
text 'Book'
|
135
|
+
|
136
|
+
on_widget_selected {
|
137
|
+
book_selected_game
|
78
138
|
}
|
79
139
|
}
|
80
140
|
}
|
141
|
+
}
|
142
|
+
|
143
|
+
button {
|
144
|
+
text 'Book Selected Game'
|
145
|
+
layout_data :center, :center, true, false
|
146
|
+
font height: 14
|
147
|
+
enabled bind(BaseballGame, :selected_game)
|
148
|
+
|
149
|
+
on_widget_selected {
|
150
|
+
book_selected_game
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}.open
|
81
154
|
# ...
|
82
155
|
```
|
83
156
|
|
84
157
|
Run via `glimmer samples` or directly:
|
85
158
|
|
86
159
|
```
|
87
|
-
glimmer samples/
|
160
|
+
glimmer samples/hello/hello_table.rb
|
88
161
|
```
|
89
162
|
|
90
|
-
Glimmer
|
163
|
+
Glimmer App:
|
91
164
|
|
92
|
-
![
|
165
|
+
![Hello Table](images/glimmer-hello-table.png)
|
166
|
+
|
167
|
+
Learn more about [Hello, Table!](#hello-table).
|
93
168
|
|
94
|
-
###
|
169
|
+
### Tetris
|
95
170
|
|
96
|
-
Glimmer code (from [samples/elaborate/
|
171
|
+
Glimmer GUI DSL code (from [samples/elaborate/tetris.rb](samples/elaborate/tetris.rb)):
|
97
172
|
|
98
173
|
```ruby
|
99
|
-
# ...
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
label {
|
113
|
-
layout_data :right, :center, false, false
|
114
|
-
text "First &Name: "
|
115
|
-
font height: 16
|
116
|
-
}
|
117
|
-
text {
|
118
|
-
layout_data :fill, :center, true, false
|
119
|
-
text bind(@contact_manager_presenter, :first_name)
|
120
|
-
on_key_pressed {|key_event|
|
121
|
-
@contact_manager_presenter.find if key_event.keyCode == swt(:cr)
|
122
|
-
}
|
123
|
-
}
|
124
|
-
|
125
|
-
label {
|
126
|
-
layout_data :right, :center, false, false
|
127
|
-
text "&Last Name: "
|
128
|
-
font height: 16
|
129
|
-
}
|
130
|
-
text {
|
131
|
-
layout_data :fill, :center, true, false
|
132
|
-
text bind(@contact_manager_presenter, :last_name)
|
133
|
-
on_key_pressed {|key_event|
|
134
|
-
@contact_manager_presenter.find if key_event.keyCode == swt(:cr)
|
135
|
-
}
|
136
|
-
}
|
137
|
-
|
138
|
-
label {
|
139
|
-
layout_data :right, :center, false, false
|
140
|
-
text "&Email: "
|
141
|
-
font height: 16
|
142
|
-
}
|
143
|
-
text {
|
144
|
-
layout_data :fill, :center, true, false
|
145
|
-
text bind(@contact_manager_presenter, :email)
|
146
|
-
on_key_pressed {|key_event|
|
147
|
-
@contact_manager_presenter.find if key_event.keyCode == swt(:cr)
|
148
|
-
}
|
149
|
-
}
|
150
|
-
|
151
|
-
composite {
|
152
|
-
row_layout {
|
153
|
-
margin_width 0
|
154
|
-
margin_height 0
|
155
|
-
}
|
156
|
-
layout_data(:right, :center, false, false) {
|
157
|
-
horizontal_span 2
|
158
|
-
}
|
159
|
-
|
160
|
-
button {
|
161
|
-
text "&Find"
|
162
|
-
on_widget_selected { @contact_manager_presenter.find }
|
163
|
-
on_key_pressed {|key_event|
|
164
|
-
@contact_manager_presenter.find if key_event.keyCode == swt(:cr)
|
165
|
-
}
|
166
|
-
}
|
167
|
-
|
168
|
-
button {
|
169
|
-
text "&List All"
|
170
|
-
on_widget_selected { @contact_manager_presenter.list }
|
171
|
-
on_key_pressed {|key_event|
|
172
|
-
@contact_manager_presenter.list if key_event.keyCode == swt(:cr)
|
173
|
-
}
|
174
|
-
}
|
175
|
-
}
|
176
|
-
}
|
174
|
+
# ... more code resides in other files (navigate sample files to learn more)
|
175
|
+
shell(:no_resize) {
|
176
|
+
grid_layout {
|
177
|
+
num_columns 2
|
178
|
+
make_columns_equal_width false
|
179
|
+
margin_width 0
|
180
|
+
margin_height 0
|
181
|
+
horizontal_spacing 0
|
182
|
+
}
|
183
|
+
|
184
|
+
text 'Glimmer Tetris'
|
185
|
+
minimum_size 475, 500
|
186
|
+
image tetris_icon
|
177
187
|
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
table_column {
|
191
|
-
text "Last Name"
|
192
|
-
width 80
|
193
|
-
}
|
194
|
-
table_column {
|
195
|
-
text "Email"
|
196
|
-
width 200
|
197
|
-
}
|
198
|
-
items bind(@contact_manager_presenter, :results),
|
199
|
-
column_properties(:first_name, :last_name, :email)
|
200
|
-
on_mouse_up { |event|
|
201
|
-
table_proxy.edit_table_item(event.table_item, event.column_index)
|
202
|
-
}
|
203
|
-
}
|
204
|
-
}
|
205
|
-
}.open
|
188
|
+
tetris_menu_bar(game: game)
|
189
|
+
|
190
|
+
playfield(game_playfield: game.playfield, playfield_width: playfield_width, playfield_height: playfield_height, block_size: BLOCK_SIZE)
|
191
|
+
|
192
|
+
score_lane(game: game, block_size: BLOCK_SIZE) {
|
193
|
+
layout_data(:fill, :fill, true, true)
|
194
|
+
}
|
195
|
+
|
196
|
+
on_widget_disposed {
|
197
|
+
deregister_observers
|
198
|
+
}
|
199
|
+
}
|
206
200
|
# ...
|
207
201
|
```
|
208
202
|
|
209
203
|
Run via `glimmer samples` or directly:
|
210
204
|
|
211
205
|
```
|
212
|
-
glimmer samples/elaborate/
|
206
|
+
glimmer samples/elaborate/tetris.rb
|
213
207
|
```
|
214
208
|
|
215
|
-
Glimmer
|
209
|
+
Glimmer app:
|
210
|
+
|
211
|
+
![Tetris](images/glimmer-tetris.png)
|
216
212
|
|
217
|
-
![Contact Manager](images/glimmer-contact-manager.png)
|
218
213
|
|
219
214
|
### Desktop Apps Built with Glimmer DSL for SWT
|
220
215
|
|
@@ -235,9 +230,9 @@ If you see anything that needs to be improved, please do not hesitate to contact
|
|
235
230
|
|
236
231
|
- [Glimmer (JRuby Desktop Development GUI Framework)](#jruby-desktop-development-gui-framework)
|
237
232
|
- [Examples](#examples)
|
238
|
-
- [Hello, World!](#hello-world)
|
239
|
-
- [
|
240
|
-
- [
|
233
|
+
- [Hello, World! Sample](#hello-world-sample)
|
234
|
+
- [Hello, Table! Sample](#hello-table-sample)
|
235
|
+
- [Tetris](#tetris)
|
241
236
|
- [Desktop Apps Built with Glimmer DSL for SWT](#desktop-apps-built-with-glimmer-dsl-for-swt)
|
242
237
|
- [Table of contents](#table-of-contents)
|
243
238
|
- [Background](#background)
|
@@ -276,6 +271,8 @@ If you see anything that needs to be improved, please do not hesitate to contact
|
|
276
271
|
- [Multi-Threading](#multi-threading)
|
277
272
|
- [Menus](#menus)
|
278
273
|
- [ScrolledComposite](#scrolledcomposite)
|
274
|
+
- [Sash Form Widget](#sash-form-widget)
|
275
|
+
- [Browser Widget](#browser-widget)
|
279
276
|
- [Widget Styles](#widget-styles)
|
280
277
|
- [Explicit SWT Style Bit](#explicit-swt-style-bit)
|
281
278
|
- [Negative SWT Style Bits](#negative-swt-style-bits)
|
@@ -307,7 +304,12 @@ If you see anything that needs to be improved, please do not hesitate to contact
|
|
307
304
|
- [Lifecycle Hooks Example](#lifecycle-hooks-example)
|
308
305
|
- [Custom Widget API](#custom-widget-api)
|
309
306
|
- [Content/Options Example](#contentoptions-example)
|
310
|
-
- [
|
307
|
+
- [Custom Widget Gotchas](#custom-widget-gotchas)
|
308
|
+
- [Built-In Custom Widgets](#built-in-custom-widgets)
|
309
|
+
- [Checkbox Group Custom Widget](#checkbox-group-custom-widget)
|
310
|
+
- [Radio Group Custom Widget](#radio-group-custom-widget)
|
311
|
+
- [Code Text Custom Widget](#code-text-custom-widget)
|
312
|
+
- [Video Custom Widget](#video-custom-widget)
|
311
313
|
- [Custom Widget Final Notes](#custom-widget-final-notes)
|
312
314
|
- [Custom Shells](#custom-shells)
|
313
315
|
- [Drag and Drop](#drag-and-drop)
|
@@ -315,12 +317,6 @@ If you see anything that needs to be improved, please do not hesitate to contact
|
|
315
317
|
- [Multi-DSL Support](#multi-dsl-support)
|
316
318
|
- [Application Menu Items (About/Preferences)](#application-menu-items-aboutpreferences)
|
317
319
|
- [App Name and Version](#app-name-and-version)
|
318
|
-
- [Checkbox Group Widget](#checkbox-group-widget)
|
319
|
-
- [Radio Group Widget](#radio-group-widget)
|
320
|
-
- [Code Text Widget](#code-text-widget)
|
321
|
-
- [Video Widget](#video-widget)
|
322
|
-
- [Sash Form Widget](#sash-form-widget)
|
323
|
-
- [Browser Widget](#browser-widget)
|
324
320
|
- [Glimmer Configuration](#glimmer-configuration)
|
325
321
|
- [logger](#logger)
|
326
322
|
- [logging_devices](#loggingdevices)
|
@@ -364,15 +360,16 @@ If you see anything that needs to be improved, please do not hesitate to contact
|
|
364
360
|
- [Hello, Button!](#hello-button)
|
365
361
|
- [Hello, Link!](#hello-link)
|
366
362
|
- [Hello, Dialog!](#hello-dialog)
|
363
|
+
- [Hello, Code Text!](#hello-code-text)
|
367
364
|
- [Hello, Canvas!](#hello-canvas)
|
368
365
|
- [Hello, Canvas Animation!](#hello-canvas-animation)
|
369
366
|
- [Hello, Canvas Transform!](#hello-canvas-transform)
|
370
367
|
- [Elaborate Samples](#elaborate-samples)
|
371
368
|
- [User Profile](#user-profile)
|
372
369
|
- [Login](#login)
|
373
|
-
- [Tic Tac Toe Sample](#tic-tac-toe
|
374
|
-
- [Contact Manager Sample](#contact-manager
|
375
|
-
- [Tetris](#tetris)
|
370
|
+
- [Tic Tac Toe Sample](#tic-tac-toe)
|
371
|
+
- [Contact Manager Sample](#contact-manager)
|
372
|
+
- [Glimmer Tetris](#glimmer-tetris)
|
376
373
|
- [External Samples](#external-samples)
|
377
374
|
- [Glimmer Calculator](#glimmer-calculator)
|
378
375
|
- [Gladiator](#gladiator)
|
@@ -493,9 +490,7 @@ jgem install glimmer-dsl-swt
|
|
493
490
|
|
494
491
|
Or this command if you want a specific version:
|
495
492
|
```
|
496
|
-
jgem install glimmer-dsl-swt -v 4.18.
|
497
|
-
|
498
|
-
|
493
|
+
jgem install glimmer-dsl-swt -v 4.18.4.1
|
499
494
|
```
|
500
495
|
|
501
496
|
`jgem` is JRuby's version of `gem` command.
|
@@ -513,8 +508,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
|
|
513
508
|
|
514
509
|
Add the following to `Gemfile`:
|
515
510
|
```
|
516
|
-
gem 'glimmer-dsl-swt', '~> 4.18.
|
517
|
-
'
|
511
|
+
gem 'glimmer-dsl-swt', '~> 4.18.4.1'
|
518
512
|
```
|
519
513
|
|
520
514
|
And, then run:
|
@@ -572,9 +566,7 @@ bin/glimmer samples
|
|
572
566
|
Below are the full usage instructions that come up when running `glimmer` without args.
|
573
567
|
|
574
568
|
```
|
575
|
-
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.18.
|
576
|
-
|
577
|
-
|
569
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.18.4.1
|
578
570
|
|
579
571
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
580
572
|
|
@@ -1053,9 +1045,7 @@ Output:
|
|
1053
1045
|
|
1054
1046
|
Css glimmer-dsl-css 1.1.0 AndyMaleh Glimmer DSL for CSS
|
1055
1047
|
Opal glimmer-dsl-opal 0.10.2 AndyMaleh Glimmer DSL for Opal
|
1056
|
-
Swt glimmer-dsl-swt 4.18.
|
1057
|
-
|
1058
|
-
AndyMaleh Glimmer DSL for SWT
|
1048
|
+
Swt glimmer-dsl-swt 4.18.4.1 AndyMaleh Glimmer DSL for SWT
|
1059
1049
|
Tk glimmer-dsl-tk 0.0.6 AndyMaleh Glimmer DSL for Tk
|
1060
1050
|
Xml glimmer-dsl-xml 1.1.0 AndyMaleh Glimmer DSL for XML
|
1061
1051
|
```
|
@@ -1895,6 +1885,79 @@ Glimmer provides smart defaults for the `scrolled_composite` widget by:
|
|
1895
1885
|
- Automatically setting the :h_scroll and :v_scroll SWT styles (can be set manually if only one of either :h_scroll or :v_scroll is desired )
|
1896
1886
|
- Automatically setting the expand horizontal and expand vertical SWT properties to `true`
|
1897
1887
|
|
1888
|
+
#### Sash Form Widget
|
1889
|
+
|
1890
|
+
`sash_form` is an SWT built-in custom widget that provides a resizable sash that splits a window area into two or more panes.
|
1891
|
+
|
1892
|
+
It can be customized with the `weights` attribute by setting initial weights to size the panes at first display.
|
1893
|
+
|
1894
|
+
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)
|
1895
|
+
|
1896
|
+
Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
|
1897
|
+
|
1898
|
+
```ruby
|
1899
|
+
shell {
|
1900
|
+
text 'Sash Form Example'
|
1901
|
+
sash_form {
|
1902
|
+
label {
|
1903
|
+
text '(resize >>)'
|
1904
|
+
background :dark_green
|
1905
|
+
foreground :white
|
1906
|
+
font height: 20
|
1907
|
+
}
|
1908
|
+
label {
|
1909
|
+
text '(<< resize)'
|
1910
|
+
background :red
|
1911
|
+
foreground :white
|
1912
|
+
font height: 20
|
1913
|
+
}
|
1914
|
+
weights 1, 2
|
1915
|
+
}
|
1916
|
+
}.open
|
1917
|
+
```
|
1918
|
+
|
1919
|
+
You may check out a more full-fledged example in [Hello, Sash Form!](#hello-sash-form)
|
1920
|
+
|
1921
|
+
![Hello Sash Form](images/glimmer-hello-sash-form.png)
|
1922
|
+
|
1923
|
+
#### Browser Widget
|
1924
|
+
|
1925
|
+
![Hello Browser](images/glimmer-hello-browser.png)
|
1926
|
+
|
1927
|
+
Glimmer supports the SWT Browser widget, which can load URLs or render HTML. It can even be instrumented with JavaScript when needed (though highly discouraged since it defeats the purpose of using Ruby except in very rare cases like leveraging a pre-existing web codebase in a desktop app).
|
1928
|
+
|
1929
|
+
Example loading a URL (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
|
1930
|
+
|
1931
|
+
```ruby
|
1932
|
+
shell {
|
1933
|
+
minimum_size 1024, 860
|
1934
|
+
browser {
|
1935
|
+
url 'http://brightonresort.com/about'
|
1936
|
+
}
|
1937
|
+
}.open
|
1938
|
+
```
|
1939
|
+
|
1940
|
+
Example rendering HTML with JavaScript on document ready (you may copy/paste in [`girb`](#girb-glimmer-irb-command) provided you install and require [glimmer-dsl-xml gem](https://github.com/AndyObtiva/glimmer-dsl-xml)):
|
1941
|
+
|
1942
|
+
```ruby
|
1943
|
+
shell {
|
1944
|
+
minimum_size 130, 130
|
1945
|
+
@browser = browser {
|
1946
|
+
text html {
|
1947
|
+
head {
|
1948
|
+
meta(name: "viewport", content: "width=device-width, initial-scale=2.0")
|
1949
|
+
}
|
1950
|
+
body {
|
1951
|
+
h1 { "Hello, World!" }
|
1952
|
+
}
|
1953
|
+
}
|
1954
|
+
on_completed { # on load of the page execute this JavaScript
|
1955
|
+
@browser.swt_widget.execute("alert('Hello, World!');")
|
1956
|
+
}
|
1957
|
+
}
|
1958
|
+
}.open
|
1959
|
+
```
|
1960
|
+
|
1898
1961
|
### Widget Styles
|
1899
1962
|
|
1900
1963
|
SWT widgets receive `SWT` styles in their constructor as per this guide:
|
@@ -2357,7 +2420,8 @@ Shape keywords and their args (including defaults) are listed below (they basica
|
|
2357
2420
|
- `rectangle(x, y, width, height, vertical = true, fill: true, gradient: true)` gradient rectangle, which is always filled, and takes an optional extra argument to specify true for vertical gradient (default) and false for horizontal gradient
|
2358
2421
|
- `text(string, x, y, flags = nil)` text with optional flags (flag format is `swt(comma_separated_flags)` where flags can be :draw_delimiter (i.e. new lines), :draw_tab, :draw_mnemonic, and :draw_transparent as explained in [GC API](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/GC.html))
|
2359
2422
|
|
2360
|
-
Shape keywords that can be filled with color can take an keyword argument `fill: true
|
2423
|
+
Shape keywords that can be filled with color can take an keyword argument `fill: true`. Defaults to false when not specified unless background is set with no foreground (or foreground is set with no background), in which case a smart default is applied.
|
2424
|
+
Smart defaults can be applied to automatically infer `gradient: true` (rectangle with both foreground and background) and `round: true` (rectangle with more than 4 args, the extra args are numeric) as well.
|
2361
2425
|
|
2362
2426
|
Optionally, a shape keyword takes a block that can set any attributes from [org.eclipse.swt.graphics.GC](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/GC.html) (methods starting with `set`), which enable setting the `background` for filling and `foreground` for drawing.
|
2363
2427
|
|
@@ -2381,6 +2445,8 @@ Here is a list of supported attributes nestable within a block under shapes:
|
|
2381
2445
|
- `text_anti_alias` enables text antialiasing (SWT style value of `:default`, `:off`, `:on` whereby `:default` applies OS default, which varies per OS)
|
2382
2446
|
- `transform` sets transform object using [Canvas Transform DSL](#canvas-transform-dsl) syntax
|
2383
2447
|
|
2448
|
+
Keep in mind that ordering of shapes matters as it is followed in painting. For example, it is recommended you paint filled shapes first and then drawn ones.
|
2449
|
+
|
2384
2450
|
Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
|
2385
2451
|
|
2386
2452
|
```ruby
|
@@ -2395,10 +2461,10 @@ shell {
|
|
2395
2461
|
|
2396
2462
|
canvas {
|
2397
2463
|
background :dark_yellow
|
2398
|
-
rectangle(0, 0, 220, 400
|
2464
|
+
rectangle(0, 0, 220, 400) {
|
2399
2465
|
background :dark_red
|
2400
2466
|
}
|
2401
|
-
rectangle(50, 20, 300, 150, 30, 50, round: true
|
2467
|
+
rectangle(50, 20, 300, 150, 30, 50, round: true) {
|
2402
2468
|
background :yellow
|
2403
2469
|
}
|
2404
2470
|
rectangle(150, 200, 100, 70, true, gradient: true) {
|
@@ -2468,6 +2534,103 @@ In any case, if there is anything missing you would like added to the Glimmer Sh
|
|
2468
2534
|
|
2469
2535
|
Keep in mind that the Shape DSL can be used inside any widget, not just `canvas`. Unlike shapes on a `canvas`, which are standalone graphics, when included in a widget, which already has its own look and feel, shapes are used as a decorative add-on that complements its look by getting painted on top of it. For example, shapes were used to decorate `composite` blocks in the [Tetris](#tetris) sample to have a more bevel look. In summary, Shapes can be used in a hybrid approach (shapes inside a widget), not just standalone in a `canvas`.
|
2470
2536
|
|
2537
|
+
#### Shapes inside an Image
|
2538
|
+
|
2539
|
+
You can build an image using the Canvas Shape DSL (including setting the icon of the application).
|
2540
|
+
|
2541
|
+
Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
|
2542
|
+
|
2543
|
+
```
|
2544
|
+
include Glimmer
|
2545
|
+
|
2546
|
+
shell {
|
2547
|
+
text 'Image Shape DSL Example'
|
2548
|
+
label {
|
2549
|
+
bevel_constant = 20
|
2550
|
+
icon_block_size = 64
|
2551
|
+
icon_bevel_size = icon_block_size.to_f / 25.to_f
|
2552
|
+
icon_bevel_pixel_size = 0.16*icon_block_size.to_f
|
2553
|
+
icon_size = 8
|
2554
|
+
icon_pixel_size = icon_block_size * icon_size
|
2555
|
+
image(icon_pixel_size, icon_pixel_size) {
|
2556
|
+
icon_size.times { |row|
|
2557
|
+
icon_size.times { |column|
|
2558
|
+
colored = row >= 1 && column.between?(1, 6)
|
2559
|
+
color = colored ? color([:white, :red, :blue, :green, :yellow, :magenta, :cyan, :dark_blue].sample) : color(:white)
|
2560
|
+
x = column * icon_block_size
|
2561
|
+
y = row * icon_block_size
|
2562
|
+
rectangle(x, y, icon_block_size, icon_block_size) {
|
2563
|
+
background color
|
2564
|
+
}
|
2565
|
+
polygon(x, y, x + icon_block_size, y, x + icon_block_size - icon_bevel_pixel_size, y + icon_bevel_pixel_size, x + icon_bevel_pixel_size, y + icon_bevel_pixel_size) {
|
2566
|
+
background rgb(color.red + 4*bevel_constant, color.green + 4*bevel_constant, color.blue + 4*bevel_constant)
|
2567
|
+
}
|
2568
|
+
polygon(x + icon_block_size, y, x + icon_block_size - icon_bevel_pixel_size, y + icon_bevel_pixel_size, x + icon_block_size - icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_block_size, y + icon_block_size) {
|
2569
|
+
background rgb(color.red - bevel_constant, color.green - bevel_constant, color.blue - bevel_constant)
|
2570
|
+
}
|
2571
|
+
polygon(x + icon_block_size, y + icon_block_size, x, y + icon_block_size, x + icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_block_size - icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size) {
|
2572
|
+
background rgb(color.red - 2*bevel_constant, color.green - 2*bevel_constant, color.blue - 2*bevel_constant)
|
2573
|
+
}
|
2574
|
+
polygon(x, y, x, y + icon_block_size, x + icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_bevel_pixel_size, y + icon_bevel_pixel_size) {
|
2575
|
+
background rgb(color.red - bevel_constant, color.green - bevel_constant, color.blue - bevel_constant)
|
2576
|
+
}
|
2577
|
+
}
|
2578
|
+
}
|
2579
|
+
}
|
2580
|
+
}
|
2581
|
+
}.open
|
2582
|
+
```
|
2583
|
+
|
2584
|
+
![Image Shape DSL](images/glimmer-example-image-shape-dsl.png)
|
2585
|
+
|
2586
|
+
Example setting the icon of the application (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
|
2587
|
+
|
2588
|
+
```
|
2589
|
+
include Glimmer
|
2590
|
+
|
2591
|
+
shell {
|
2592
|
+
text 'Image Shape DSL Example'
|
2593
|
+
label {
|
2594
|
+
text 'Image Shape DSL Example'
|
2595
|
+
font height: 30
|
2596
|
+
}
|
2597
|
+
bevel_constant = 20
|
2598
|
+
icon_block_size = 64
|
2599
|
+
icon_bevel_size = icon_block_size.to_f / 25.to_f
|
2600
|
+
icon_bevel_pixel_size = 0.16*icon_block_size.to_f
|
2601
|
+
icon_size = 8
|
2602
|
+
icon_pixel_size = icon_block_size * icon_size
|
2603
|
+
image(icon_pixel_size, icon_pixel_size) {
|
2604
|
+
icon_size.times { |row|
|
2605
|
+
icon_size.times { |column|
|
2606
|
+
colored = row >= 1 && column.between?(1, 6)
|
2607
|
+
color = colored ? color([:white, :red, :blue, :green, :yellow, :magenta, :cyan, :dark_blue].sample) : color(:white)
|
2608
|
+
x = column * icon_block_size
|
2609
|
+
y = row * icon_block_size
|
2610
|
+
rectangle(x, y, icon_block_size, icon_block_size) {
|
2611
|
+
background color
|
2612
|
+
}
|
2613
|
+
polygon(x, y, x + icon_block_size, y, x + icon_block_size - icon_bevel_pixel_size, y + icon_bevel_pixel_size, x + icon_bevel_pixel_size, y + icon_bevel_pixel_size) {
|
2614
|
+
background rgb(color.red + 4*bevel_constant, color.green + 4*bevel_constant, color.blue + 4*bevel_constant)
|
2615
|
+
}
|
2616
|
+
polygon(x + icon_block_size, y, x + icon_block_size - icon_bevel_pixel_size, y + icon_bevel_pixel_size, x + icon_block_size - icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_block_size, y + icon_block_size) {
|
2617
|
+
background rgb(color.red - bevel_constant, color.green - bevel_constant, color.blue - bevel_constant)
|
2618
|
+
}
|
2619
|
+
polygon(x + icon_block_size, y + icon_block_size, x, y + icon_block_size, x + icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_block_size - icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size) {
|
2620
|
+
background rgb(color.red - 2*bevel_constant, color.green - 2*bevel_constant, color.blue - 2*bevel_constant)
|
2621
|
+
}
|
2622
|
+
polygon(x, y, x, y + icon_block_size, x + icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_bevel_pixel_size, y + icon_bevel_pixel_size) {
|
2623
|
+
background rgb(color.red - bevel_constant, color.green - bevel_constant, color.blue - bevel_constant)
|
2624
|
+
}
|
2625
|
+
}
|
2626
|
+
}
|
2627
|
+
}
|
2628
|
+
}.open
|
2629
|
+
```
|
2630
|
+
|
2631
|
+
![Image Shape DSL](images/glimmer-example-image-shape-dsl-app-switcher-icon.png)
|
2632
|
+
|
2633
|
+
|
2471
2634
|
### Canvas Transform DSL
|
2472
2635
|
|
2473
2636
|
The transform DSL builds [org.eclipse.swt.graphics.Transform](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/Transform.html) objects with a nice declarative syntax.
|
@@ -2573,7 +2736,7 @@ shell {
|
|
2573
2736
|
|
2574
2737
|
frame { |index|
|
2575
2738
|
background rgb(index%100, index%100 + 100, index%55 + 200)
|
2576
|
-
rectangle(index, index, 20, 20
|
2739
|
+
rectangle(index, index, 20, 20) {
|
2577
2740
|
background :red
|
2578
2741
|
}
|
2579
2742
|
}
|
@@ -2612,6 +2775,12 @@ Learn more at the [Hello, Canvas Animation! Sample](#hello-canvas-animation).
|
|
2612
2775
|
|
2613
2776
|
If there is anything missing you would like added to the Glimmer Animation DSL that you saw available in the SWT APIs, you may [report an issue](https://github.com/AndyObtiva/glimmer-dsl-swt/issues) or implement yourself and [contribute](#contributing) via a Pull Request.
|
2614
2777
|
|
2778
|
+
#### Animation via Data-Binding
|
2779
|
+
|
2780
|
+
Animation could be alternatively implemented without the `animation` keyword through a loop that invokes model methods inside `sync_exec {}` (or `async_exec {}`), which indirectly cause updates to the GUI via data-binding.
|
2781
|
+
|
2782
|
+
The [Glimmer Tetris](#glimmer-tetris) sample provides a good example of that.
|
2783
|
+
|
2615
2784
|
### Data-Binding
|
2616
2785
|
|
2617
2786
|
Data-binding is done with `bind` command following widget property to bind and taking model and bindable attribute as arguments.
|
@@ -3025,6 +3194,7 @@ Here is an explanation of the example above:
|
|
3025
3194
|
- Task Start Date table column has a custom sort comparator block
|
3026
3195
|
- Additional (secondary) sort properties are applied when sorting by Task, Project, or Duration in the order specified
|
3027
3196
|
|
3197
|
+
`bind(model, :property, read_only_sort: true)` could be used with items to make sorting not propagate sorting changes to model.
|
3028
3198
|
|
3029
3199
|
#### Tree
|
3030
3200
|
|
@@ -3428,7 +3598,7 @@ shell {
|
|
3428
3598
|
|
3429
3599
|
Notice how `:no_focus` was the `swt_style` value, followed by the `options` hash `{orientation: :horizontal, bg_color: :white}`, and finally the `content` block containing the label with `'SANDWICH CONTENT'`
|
3430
3600
|
|
3431
|
-
####
|
3601
|
+
#### Custom Widget Gotchas
|
3432
3602
|
|
3433
3603
|
Beware of defining a custom attribute that is a common SWT widget property name.
|
3434
3604
|
For example, if you define `text=` and `text` methods to accept a custom text and then later you write this body:
|
@@ -3458,6 +3628,314 @@ body {
|
|
3458
3628
|
|
3459
3629
|
The `text` method invoked in the custom widget body will call the one you defined above it. To avoid this gotcha, simply name the text property above something else, like `custom_text`.
|
3460
3630
|
|
3631
|
+
#### Built-In Custom Widgets
|
3632
|
+
|
3633
|
+
##### Checkbox Group Custom Widget
|
3634
|
+
|
3635
|
+
`checkbox_group` (or alias `check_group`) is a Glimmer built-in custom widget that displays a list of `checkbox` buttons (`button(:check)`) based on its `items` property.
|
3636
|
+
|
3637
|
+
`checkbox_group` consists of a root `composite` (with `grid_layout 1, false` by default) that holds nested `checkbox` (`button(:check)`) widgets.
|
3638
|
+
|
3639
|
+
The `selection` property determines which `checkbox` buttons are checked. It expects an `Array` of `String` objects
|
3640
|
+
The `selection_indices` property determines which `checkbox` button indices are checked. It expects an `Array` of index `Integer` objects that are zero-based.
|
3641
|
+
The `checkboxes` property returns the list of nested `checkbox` widgets.
|
3642
|
+
|
3643
|
+
When data-binding `selection`, the model property should have a matching property with `_options` suffix (e.g. `activities_options` for `activities`) to provide an `Array` of `String` objects for `checkbox` buttons.
|
3644
|
+
|
3645
|
+
You may see an example at the [Hello, Checkbox Group!](#hello-checkbox-group) sample.
|
3646
|
+
|
3647
|
+
![Hello Checkbox Group](images/glimmer-hello-checkbox-group.png)
|
3648
|
+
|
3649
|
+
##### Radio Group Custom Widget
|
3650
|
+
|
3651
|
+
`radio_group` is a Glimmer built-in custom widget that displays a list of `radio` buttons (`button(:radio)`) based on its `items` property, which expects an `Array` of `String` objects.
|
3652
|
+
|
3653
|
+
`radio_group` consists of a root `composite` (with `grid_layout 1, false` by default) that holds nested `radio` widgets.
|
3654
|
+
|
3655
|
+
The `selection` property determines which `radio` button is selected. It expects a `String`
|
3656
|
+
The `selection_index` property determines which `radio` button index is selected. It expects an index integer that is zero-based.
|
3657
|
+
The `radios` property returns the list of nested `radio` widgets.
|
3658
|
+
|
3659
|
+
When data-binding `selection`, the model property should have a matching property with `_options` suffix (e.g. `country_options` for `country`) to provide text for `radio` buttons.
|
3660
|
+
|
3661
|
+
This custom widget is used in the [Glimmer Meta-Sample (The Sample of Samples)](#samples):
|
3662
|
+
|
3663
|
+
![Glimmer Meta-Sample](images/glimmer-meta-sample.png)
|
3664
|
+
|
3665
|
+
Glimmer Meta-Sample Code Example:
|
3666
|
+
|
3667
|
+
```ruby
|
3668
|
+
# ...
|
3669
|
+
radio_group { |radio_group_proxy|
|
3670
|
+
row_layout(:vertical) {
|
3671
|
+
fill true
|
3672
|
+
}
|
3673
|
+
selection bind(sample_directory, :selected_sample_name)
|
3674
|
+
font height: 24
|
3675
|
+
}
|
3676
|
+
|
3677
|
+
# ...
|
3678
|
+
```
|
3679
|
+
|
3680
|
+
You may see another example at the [Hello, Radio Group!](#hello-radio-group) sample.
|
3681
|
+
|
3682
|
+
##### Code Text Custom Widget
|
3683
|
+
|
3684
|
+
`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.
|
3685
|
+
|
3686
|
+
It is used in the [Glimmer Meta-Sample (The Sample of Samples)](#samples):
|
3687
|
+
|
3688
|
+
![Glimmer Meta-Sample](images/glimmer-meta-sample.png)
|
3689
|
+
|
3690
|
+
Glimmer Meta-Sample Code Example:
|
3691
|
+
|
3692
|
+
```ruby
|
3693
|
+
# ...
|
3694
|
+
@code_text = code_text {
|
3695
|
+
text bind(SampleDirectory, 'selected_sample.code', read_only: true)
|
3696
|
+
editable bind(SampleDirectory, 'selected_sample.editable')
|
3697
|
+
}
|
3698
|
+
# ...
|
3699
|
+
```
|
3700
|
+
|
3701
|
+
To use, simply use `code_text` in place of the `text` or `styled_text` widget. If you set its `text` value to Ruby code, it automatically styles it with syntax highlighting.
|
3702
|
+
|
3703
|
+
###### Options
|
3704
|
+
|
3705
|
+
**lines**
|
3706
|
+
(default: false)
|
3707
|
+
|
3708
|
+
Shows line numbers when set to true.
|
3709
|
+
|
3710
|
+
If set to a hash like `{width: 4}`, it sets the width of the line numbers lane in character count (default: 4)
|
3711
|
+
|
3712
|
+
**theme**
|
3713
|
+
(default: 'glimmer')
|
3714
|
+
|
3715
|
+
Changes syntax color highlighting theme. Can be one of the following:
|
3716
|
+
- glimmer
|
3717
|
+
- github
|
3718
|
+
- pastie
|
3719
|
+
|
3720
|
+
**language**
|
3721
|
+
(default: `'ruby'`)
|
3722
|
+
|
3723
|
+
Sets the code language, which can be one of the following [rouge gem](#https://rubygems.org/gems/rouge) supported languages:
|
3724
|
+
- abap
|
3725
|
+
- actionscript
|
3726
|
+
- ada
|
3727
|
+
- apache
|
3728
|
+
- apex
|
3729
|
+
- apiblueprint
|
3730
|
+
- apple_script
|
3731
|
+
- armasm
|
3732
|
+
- augeas
|
3733
|
+
- awk
|
3734
|
+
- batchfile
|
3735
|
+
- bbcbasic
|
3736
|
+
- bibtex
|
3737
|
+
- biml
|
3738
|
+
- bpf
|
3739
|
+
- brainfuck
|
3740
|
+
- brightscript
|
3741
|
+
- bsl
|
3742
|
+
- c
|
3743
|
+
- ceylon
|
3744
|
+
- cfscript
|
3745
|
+
- clean
|
3746
|
+
- clojure
|
3747
|
+
- cmake
|
3748
|
+
- cmhg
|
3749
|
+
- coffeescript
|
3750
|
+
- common_lisp
|
3751
|
+
- conf
|
3752
|
+
- console
|
3753
|
+
- coq
|
3754
|
+
- cpp
|
3755
|
+
- crystal
|
3756
|
+
- csharp
|
3757
|
+
- css
|
3758
|
+
- csvs
|
3759
|
+
- cuda
|
3760
|
+
- cypher
|
3761
|
+
- cython
|
3762
|
+
- d
|
3763
|
+
- dart
|
3764
|
+
- datastudio
|
3765
|
+
- diff
|
3766
|
+
- digdag
|
3767
|
+
- docker
|
3768
|
+
- dot
|
3769
|
+
- ecl
|
3770
|
+
- eex
|
3771
|
+
- eiffel
|
3772
|
+
- elixir
|
3773
|
+
- elm
|
3774
|
+
- email
|
3775
|
+
- epp
|
3776
|
+
- erb
|
3777
|
+
- erlang
|
3778
|
+
- escape
|
3779
|
+
- factor
|
3780
|
+
- fortran
|
3781
|
+
- freefem
|
3782
|
+
- fsharp
|
3783
|
+
- gdscript
|
3784
|
+
- ghc_cmm
|
3785
|
+
- ghc_core
|
3786
|
+
- gherkin
|
3787
|
+
- glsl
|
3788
|
+
- go
|
3789
|
+
- gradle
|
3790
|
+
- graphql
|
3791
|
+
- groovy
|
3792
|
+
- hack
|
3793
|
+
- haml
|
3794
|
+
- handlebars
|
3795
|
+
- haskell
|
3796
|
+
- haxe
|
3797
|
+
- hcl
|
3798
|
+
- hlsl
|
3799
|
+
- hocon
|
3800
|
+
- hql
|
3801
|
+
- html
|
3802
|
+
- http
|
3803
|
+
- hylang
|
3804
|
+
- idlang
|
3805
|
+
- igorpro
|
3806
|
+
- ini
|
3807
|
+
- io
|
3808
|
+
- irb
|
3809
|
+
- isbl
|
3810
|
+
- j
|
3811
|
+
- janet
|
3812
|
+
- java
|
3813
|
+
- javascript
|
3814
|
+
- jinja
|
3815
|
+
- jsl
|
3816
|
+
- json
|
3817
|
+
- json_doc
|
3818
|
+
- jsonnet
|
3819
|
+
- jsp
|
3820
|
+
- jsx
|
3821
|
+
- julia
|
3822
|
+
- kotlin
|
3823
|
+
- lasso
|
3824
|
+
- liquid
|
3825
|
+
- literate_coffeescript
|
3826
|
+
- literate_haskell
|
3827
|
+
- livescript
|
3828
|
+
- llvm
|
3829
|
+
- lua
|
3830
|
+
- lustre
|
3831
|
+
- lutin
|
3832
|
+
- m68k
|
3833
|
+
- magik
|
3834
|
+
- make
|
3835
|
+
- markdown
|
3836
|
+
- mason
|
3837
|
+
- mathematica
|
3838
|
+
- matlab
|
3839
|
+
- minizinc
|
3840
|
+
- moonscript
|
3841
|
+
- mosel
|
3842
|
+
- msgtrans
|
3843
|
+
- mxml
|
3844
|
+
- nasm
|
3845
|
+
- nesasm
|
3846
|
+
- nginx
|
3847
|
+
- nim
|
3848
|
+
- nix
|
3849
|
+
- objective_c
|
3850
|
+
- objective_cpp
|
3851
|
+
- ocaml
|
3852
|
+
- ocl
|
3853
|
+
- openedge
|
3854
|
+
- opentype_feature_file
|
3855
|
+
- pascal
|
3856
|
+
- perl
|
3857
|
+
- php
|
3858
|
+
- plain_text
|
3859
|
+
- plist
|
3860
|
+
- pony
|
3861
|
+
- postscript
|
3862
|
+
- powershell
|
3863
|
+
- praat
|
3864
|
+
- prolog
|
3865
|
+
- prometheus
|
3866
|
+
- properties
|
3867
|
+
- protobuf
|
3868
|
+
- puppet
|
3869
|
+
- python
|
3870
|
+
- q
|
3871
|
+
- qml
|
3872
|
+
- r
|
3873
|
+
- racket
|
3874
|
+
- reasonml
|
3875
|
+
- rego
|
3876
|
+
- rescript
|
3877
|
+
- robot_framework
|
3878
|
+
- ruby
|
3879
|
+
- rust
|
3880
|
+
- sas
|
3881
|
+
- sass
|
3882
|
+
- scala
|
3883
|
+
- scheme
|
3884
|
+
- scss
|
3885
|
+
- sed
|
3886
|
+
- shell
|
3887
|
+
- sieve
|
3888
|
+
- slice
|
3889
|
+
- slim
|
3890
|
+
- smalltalk
|
3891
|
+
- smarty
|
3892
|
+
- sml
|
3893
|
+
- solidity
|
3894
|
+
- sparql
|
3895
|
+
- sqf
|
3896
|
+
- sql
|
3897
|
+
- ssh
|
3898
|
+
- supercollider
|
3899
|
+
- swift
|
3900
|
+
- systemd
|
3901
|
+
- tap
|
3902
|
+
- tcl
|
3903
|
+
- terraform
|
3904
|
+
- tex
|
3905
|
+
- toml
|
3906
|
+
- tsx
|
3907
|
+
- ttcn3
|
3908
|
+
- tulip
|
3909
|
+
- turtle
|
3910
|
+
- twig
|
3911
|
+
- typescript
|
3912
|
+
- vala
|
3913
|
+
- varnish
|
3914
|
+
- vb
|
3915
|
+
- velocity
|
3916
|
+
- verilog
|
3917
|
+
- vhdl
|
3918
|
+
- viml
|
3919
|
+
- vue
|
3920
|
+
- wollok
|
3921
|
+
- xml
|
3922
|
+
- xojo
|
3923
|
+
- xpath
|
3924
|
+
- xquery
|
3925
|
+
- yaml
|
3926
|
+
- yang
|
3927
|
+
- zig
|
3928
|
+
|
3929
|
+
Learn more at [Hello, Code Text!](#hello-code-text)
|
3930
|
+
|
3931
|
+
##### Video Custom Custom Widget
|
3932
|
+
|
3933
|
+
[![Video Widget](images/glimmer-video-widget.png)](https://github.com/AndyObtiva/glimmer-cw-video)
|
3934
|
+
|
3935
|
+
Glimmer supports a [video custom widget](https://github.com/AndyObtiva/glimmer-cw-video) not in SWT, which was originally a Glimmer built-in custom widget, but has been later extracted into its own [Ruby gem](https://rubygems.org/gems/glimmer-cw-video).
|
3936
|
+
|
3937
|
+
Simply install the [glimmer-cw-video](https://rubygems.org/gems/glimmer-cw-video) gem.
|
3938
|
+
|
3461
3939
|
#### Custom Widget Final Notes
|
3462
3940
|
|
3463
3941
|
This [Eclipse guide](https://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm) for how to write custom SWT widgets is also applicable to Glimmer Custom Widgets written in Ruby. I recommend reading it:
|
@@ -3849,157 +4327,6 @@ You may run `glimmer` with the `--profile.graph` instead for a more detailed out
|
|
3849
4327
|
|
3850
4328
|
Learn more at the [JRuby Performance Profile WIKI page](https://github.com/jruby/jruby/wiki/Profiling-JRuby).
|
3851
4329
|
|
3852
|
-
#### Checkbox Group Widget
|
3853
|
-
|
3854
|
-
`checkbox_group` (or alias `check_group`) is a Glimmer built-in custom widget that displays a list of `checkbox` buttons (`button(:check)`) based on its `items` property.
|
3855
|
-
|
3856
|
-
`checkbox_group` consists of a root `composite` (with `grid_layout 1, false` by default) that holds nested `checkbox` (`button(:check)`) widgets.
|
3857
|
-
|
3858
|
-
The `selection` property determines which `checkbox` buttons are checked. It expects an `Array` of `String` objects
|
3859
|
-
The `selection_indices` property determines which `checkbox` button indices are checked. It expects an `Array` of index `Integer` objects that are zero-based.
|
3860
|
-
The `checkboxes` property returns the list of nested `checkbox` widgets.
|
3861
|
-
|
3862
|
-
When data-binding `selection`, the model property should have a matching property with `_options` suffix (e.g. `activities_options` for `activities`) to provide an `Array` of `String` objects for `checkbox` buttons.
|
3863
|
-
|
3864
|
-
You may see an example at the [Hello, Checkbox Group!](#hello-checkbox-group) sample.
|
3865
|
-
|
3866
|
-
![Hello Checkbox Group](images/glimmer-hello-checkbox-group.png)
|
3867
|
-
|
3868
|
-
#### Radio Group Widget
|
3869
|
-
|
3870
|
-
`radio_group` is a Glimmer built-in custom widget that displays a list of `radio` buttons (`button(:radio)`) based on its `items` property, which expects an `Array` of `String` objects.
|
3871
|
-
|
3872
|
-
`radio_group` consists of a root `composite` (with `grid_layout 1, false` by default) that holds nested `radio` widgets.
|
3873
|
-
|
3874
|
-
The `selection` property determines which `radio` button is selected. It expects a `String`
|
3875
|
-
The `selection_index` property determines which `radio` button index is selected. It expects an index integer that is zero-based.
|
3876
|
-
The `radios` property returns the list of nested `radio` widgets.
|
3877
|
-
|
3878
|
-
When data-binding `selection`, the model property should have a matching property with `_options` suffix (e.g. `country_options` for `country`) to provide text for `radio` buttons.
|
3879
|
-
|
3880
|
-
This custom widget is used in the [Glimmer Meta-Sample (The Sample of Samples)](#samples):
|
3881
|
-
|
3882
|
-
![Glimmer Meta-Sample](images/glimmer-meta-sample.png)
|
3883
|
-
|
3884
|
-
Glimmer Meta-Sample Code Example:
|
3885
|
-
|
3886
|
-
```ruby
|
3887
|
-
# ...
|
3888
|
-
radio_group { |radio_group_proxy|
|
3889
|
-
row_layout(:vertical) {
|
3890
|
-
fill true
|
3891
|
-
}
|
3892
|
-
selection bind(sample_directory, :selected_sample_name)
|
3893
|
-
font height: 24
|
3894
|
-
}
|
3895
|
-
|
3896
|
-
# ...
|
3897
|
-
```
|
3898
|
-
|
3899
|
-
You may see another example at the [Hello, Radio Group!](#hello-radio-group) sample.
|
3900
|
-
|
3901
|
-
#### Code Text Widget
|
3902
|
-
|
3903
|
-
`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.
|
3904
|
-
|
3905
|
-
It is used in the [Glimmer Meta-Sample (The Sample of Samples)](#samples):
|
3906
|
-
|
3907
|
-
![Glimmer Meta-Sample](images/glimmer-meta-sample.png)
|
3908
|
-
|
3909
|
-
Glimmer Meta-Sample Code Example:
|
3910
|
-
|
3911
|
-
```ruby
|
3912
|
-
# ...
|
3913
|
-
@code_text = code_text {
|
3914
|
-
text bind(SampleDirectory, 'selected_sample.code', read_only: true)
|
3915
|
-
editable bind(SampleDirectory, 'selected_sample.editable')
|
3916
|
-
}
|
3917
|
-
# ...
|
3918
|
-
```
|
3919
|
-
|
3920
|
-
To use, simply use `code_text` in place of the `text` or `styled_text` widget. If you set its `text` value to Ruby code, it automatically styles it with syntax highlighting.
|
3921
|
-
|
3922
|
-
#### Video Widget
|
3923
|
-
|
3924
|
-
[![Video Widget](images/glimmer-video-widget.png)](https://github.com/AndyObtiva/glimmer-cw-video)
|
3925
|
-
|
3926
|
-
Glimmer supports a [video custom widget](https://github.com/AndyObtiva/glimmer-cw-video) not in SWT.
|
3927
|
-
|
3928
|
-
You may obtain via `glimmer-cw-video` gem.
|
3929
|
-
|
3930
|
-
#### Sash Form Widget
|
3931
|
-
|
3932
|
-
`sash_form` is an SWT built-in custom widget that provides a resizable sash that splits a window area into two or more panes.
|
3933
|
-
|
3934
|
-
It can be customized with the `weights` attribute by setting initial weights to size the panes at first display.
|
3935
|
-
|
3936
|
-
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)
|
3937
|
-
|
3938
|
-
Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
|
3939
|
-
|
3940
|
-
```ruby
|
3941
|
-
shell {
|
3942
|
-
text 'Sash Form Example'
|
3943
|
-
sash_form {
|
3944
|
-
label {
|
3945
|
-
text '(resize >>)'
|
3946
|
-
background :dark_green
|
3947
|
-
foreground :white
|
3948
|
-
font height: 20
|
3949
|
-
}
|
3950
|
-
label {
|
3951
|
-
text '(<< resize)'
|
3952
|
-
background :red
|
3953
|
-
foreground :white
|
3954
|
-
font height: 20
|
3955
|
-
}
|
3956
|
-
weights 1, 2
|
3957
|
-
}
|
3958
|
-
}.open
|
3959
|
-
```
|
3960
|
-
|
3961
|
-
You may check out a more full-fledged example in [Hello, Sash Form!](#hello-sash-form)
|
3962
|
-
|
3963
|
-
![Hello Sash Form](images/glimmer-hello-sash-form.png)
|
3964
|
-
|
3965
|
-
#### Browser Widget
|
3966
|
-
|
3967
|
-
![Hello Browser](images/glimmer-hello-browser.png)
|
3968
|
-
|
3969
|
-
Glimmer supports the SWT Browser widget, which can load URLs or render HTML. It can even be instrumented with JavaScript when needed (though highly discouraged since it defeats the purpose of using Ruby except in very rare cases like leveraging a pre-existing web codebase in a desktop app).
|
3970
|
-
|
3971
|
-
Example loading a URL (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
|
3972
|
-
|
3973
|
-
```ruby
|
3974
|
-
shell {
|
3975
|
-
minimum_size 1024, 860
|
3976
|
-
browser {
|
3977
|
-
url 'http://brightonresort.com/about'
|
3978
|
-
}
|
3979
|
-
}.open
|
3980
|
-
```
|
3981
|
-
|
3982
|
-
Example rendering HTML with JavaScript on document ready (you may copy/paste in [`girb`](#girb-glimmer-irb-command) provided you install and require [glimmer-dsl-xml gem](https://github.com/AndyObtiva/glimmer-dsl-xml)):
|
3983
|
-
|
3984
|
-
```ruby
|
3985
|
-
shell {
|
3986
|
-
minimum_size 130, 130
|
3987
|
-
@browser = browser {
|
3988
|
-
text html {
|
3989
|
-
head {
|
3990
|
-
meta(name: "viewport", content: "width=device-width, initial-scale=2.0")
|
3991
|
-
}
|
3992
|
-
body {
|
3993
|
-
h1 { "Hello, World!" }
|
3994
|
-
}
|
3995
|
-
}
|
3996
|
-
on_completed { # on load of the page execute this JavaScript
|
3997
|
-
@browser.swt_widget.execute("alert('Hello, World!');")
|
3998
|
-
}
|
3999
|
-
}
|
4000
|
-
}.open
|
4001
|
-
```
|
4002
|
-
|
4003
4330
|
##### SWT Browser Style Options
|
4004
4331
|
|
4005
4332
|
The `browser` widget can use a particular desktop browser by setting the SWT Style to:
|
@@ -4282,7 +4609,7 @@ bin/glimmer samples/hello/hello_canvas_transform.rb
|
|
4282
4609
|
|
4283
4610
|
For hello-type simple samples, check the following.
|
4284
4611
|
|
4285
|
-
#### Hello, World!
|
4612
|
+
#### Hello, World!
|
4286
4613
|
|
4287
4614
|
Code:
|
4288
4615
|
|
@@ -4737,6 +5064,26 @@ Hello, Dialog! Open Dialog
|
|
4737
5064
|
|
4738
5065
|
![Hello Dialog Open Dialog](images/glimmer-hello-dialog-open-dialog.png)
|
4739
5066
|
|
5067
|
+
#### Hello, Code Text!
|
5068
|
+
|
5069
|
+
This sample demonstrates the Glimmer Built-In [Code Text Custom Widget](#code-text-custom-widget).
|
5070
|
+
|
5071
|
+
Code:
|
5072
|
+
|
5073
|
+
[samples/hello/hello_code_text.rb](samples/hello/hello_code_text.rb)
|
5074
|
+
|
5075
|
+
Hello, Code Text! Ruby Language / Glimmer Theme / Show Line Numbers (default width of 4)
|
5076
|
+
|
5077
|
+
![Hello Code Text Ruby](images/glimmer-hello-code-text-ruby.png)
|
5078
|
+
|
5079
|
+
Hello, Code Text! JavaScript Language / Pastie Theme / Show Line Numbers (custom width of 2)
|
5080
|
+
|
5081
|
+
![Hello Code Text JavaScript](images/glimmer-hello-code-text-javascript.png)
|
5082
|
+
|
5083
|
+
Hello, Code Text! HTML Language / GitHub Theme / No Line Numbers
|
5084
|
+
|
5085
|
+
![Hello Code Text HTML](images/glimmer-hello-code-text-html.png)
|
5086
|
+
|
4740
5087
|
#### Hello, Canvas!
|
4741
5088
|
|
4742
5089
|
This sample demonstrates the use of the `canvas` widget and [Shape DSL](#canvas-shape-dsl) in Glimmer.
|
@@ -4806,7 +5153,7 @@ Code:
|
|
4806
5153
|
![Login Filled In](images/glimmer-login-filled-in.png)
|
4807
5154
|
![Login Logged In](images/glimmer-login-logged-in.png)
|
4808
5155
|
|
4809
|
-
#### Tic Tac Toe
|
5156
|
+
#### Tic Tac Toe
|
4810
5157
|
|
4811
5158
|
This sample demonstrates a full MVC application, including GUI layout, text and enablement data-binding, and test-driven development (has [specs](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/spec/samples/elaborate/tic_tac_toe/board_spec.rb)).
|
4812
5159
|
|
@@ -4820,7 +5167,7 @@ Code:
|
|
4820
5167
|
![Tic Tac Toe In Progress](images/glimmer-tic-tac-toe-in-progress.png)
|
4821
5168
|
![Tic Tac Toe Game Over](images/glimmer-tic-tac-toe-game-over.png)
|
4822
5169
|
|
4823
|
-
#### Contact Manager
|
5170
|
+
#### Contact Manager
|
4824
5171
|
|
4825
5172
|
This sample demonstrates table data-binding, sorting, filtering, GUI layout, MVP pattern, and test-driven development (has [specs](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/spec/samples/elaborate/contact_manager/contact_manager_presenter_spec.rb)).
|
4826
5173
|
|
@@ -4848,18 +5195,22 @@ Contact Manager - Edit Done
|
|
4848
5195
|
|
4849
5196
|
![Contact Manager](images/glimmer-contact-manager-edit-done.png)
|
4850
5197
|
|
4851
|
-
#### Tetris
|
5198
|
+
#### Glimmer Tetris
|
4852
5199
|
|
4853
|
-
This sample demonstrates how to build an interactive animated game with MVC architecture, custom-shell/custom-widgets, multi-threading, asynchronous programming, data-binding, canvas shape graphic decorations, and keyboard events.
|
5200
|
+
This sample demonstrates how to build an interactive animated game with MVC architecture, custom-shell/custom-widgets, multi-threading, asynchronous programming, data-binding, canvas shape graphic decorations, canvas shape icon image generation, and keyboard events/shortcuts.
|
4854
5201
|
|
4855
5202
|
Code:
|
4856
5203
|
|
4857
5204
|
[samples/elaborate/tetris.rb](samples/elaborate/tetris.rb)
|
4858
5205
|
|
5206
|
+
![Tetris Icon](images/glimmer-tetris-icon.png)
|
5207
|
+
|
4859
5208
|
![Tetris](images/glimmer-tetris.png)
|
4860
5209
|
|
4861
5210
|
![Tetris Game Over](images/glimmer-tetris-game-over.png)
|
4862
5211
|
|
5212
|
+
![Tetris Game Over](images/glimmer-tetris-game-over-sorted-by-score.png)
|
5213
|
+
|
4863
5214
|
![Tetris High Scores](images/glimmer-tetris-high-score-dialog.png)
|
4864
5215
|
|
4865
5216
|
![Tetris Game Menu](images/glimmer-tetris-game-menu.png)
|