glimmer-dsl-opal 0.16.2 → 0.19.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 +24 -1
- data/README.md +106 -4
- data/VERSION +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_arrow.rb +65 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_c_combo.rb +67 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_c_tab.rb +172 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_tab.rb +10 -8
- data/lib/glimmer-dsl-opal/samples/hello/images/denmark.png +0 -0
- data/lib/glimmer-dsl-opal/samples/hello/images/finland.png +0 -0
- data/lib/glimmer-dsl-opal/samples/hello/images/france.png +0 -0
- data/lib/glimmer-dsl-opal/samples/hello/images/germany.png +0 -0
- data/lib/glimmer-dsl-opal/samples/hello/images/italy.png +0 -0
- data/lib/glimmer-dsl-opal/samples/hello/images/mexico.png +0 -0
- data/lib/glimmer-dsl-opal/samples/hello/images/netherlands.png +0 -0
- data/lib/glimmer-dsl-opal/samples/hello/images/norway.png +0 -0
- data/lib/glimmer-dsl-opal/samples/hello/images/usa.png +0 -0
- data/lib/glimmer/dsl/opal/menu_expression.rb +3 -0
- data/lib/glimmer/swt/arrow_proxy.rb +42 -0
- data/lib/glimmer/swt/button_proxy.rb +36 -1
- data/lib/glimmer/swt/c_combo_proxy.rb +51 -0
- data/lib/glimmer/swt/c_tab_folder_proxy.rb +43 -0
- data/lib/glimmer/swt/c_tab_item_proxy.rb +96 -0
- data/lib/glimmer/swt/combo_proxy.rb +3 -0
- data/lib/glimmer/swt/menu_proxy.rb +17 -1
- data/lib/glimmer/swt/shell_proxy.rb +4 -0
- data/lib/glimmer/swt/tab_folder_proxy.rb +12 -10
- data/lib/glimmer/swt/tab_item_proxy.rb +52 -4
- data/lib/glimmer/swt/widget_proxy.rb +55 -14
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 505a28c0305b2de67ee6c7329e17695df9739d5e922881d5a47b32080c1afebd
|
4
|
+
data.tar.gz: df6ede1e94dc15f1723dba789eac315b42cc9ef33160a4ae9031bdb9cd46077b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffdde267cad7d55b92f887b71eb511c404bccf7aafa6a9196a0886baf07905535c855016387e394a7ed32a3e322ca31e0bf33fe3e9660de4df0e142a4ed20703
|
7
|
+
data.tar.gz: d319b58fa27fab0a6921a8f86748c71589ba898912de24bc72bad5a8ae9e1f4c7fc9fb2721d77269c3f7e235f2a47faf188c17017ded20d804fc144568292199
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.19.1
|
4
|
+
|
5
|
+
- Fix widget `font` property support for both `:bold` and `:italic` styles at the same time
|
6
|
+
|
7
|
+
## 0.19.0
|
8
|
+
|
9
|
+
- Change `tab_item` default background/foreground color to better match Glimmer DSL for SWT
|
10
|
+
- Support `tab_item` `tool_tip_text` attribute
|
11
|
+
- Support `tab_item` `image` attribute
|
12
|
+
- Implement `c_tab_folder` & `c_tab_item` (without the dropdown for hidden tabs that is in Glimmer DSL for SWT)
|
13
|
+
- Hello, C Tab! sample
|
14
|
+
|
15
|
+
## 0.18.0
|
16
|
+
|
17
|
+
- Implement `c_combo`
|
18
|
+
- Hello, C Combo! sample
|
19
|
+
|
20
|
+
## 0.17.0
|
21
|
+
|
22
|
+
- Support `menu` `visible` attribute to enable programmatic display of menu
|
23
|
+
- Support `arrow` widget
|
24
|
+
- Hello, Arrow! sample
|
25
|
+
|
3
26
|
## 0.16.2
|
4
27
|
|
5
28
|
- Support `grid_layout` `margin_top`, `margin_right`, `margin_bottom`, and `margin_left` attributes
|
@@ -16,7 +39,7 @@
|
|
16
39
|
|
17
40
|
## 0.16.0
|
18
41
|
|
19
|
-
- Support label widget background_image attribute
|
42
|
+
- Support `label` widget `background_image` attribute
|
20
43
|
- Have File.expand_path support expanding paths even if they did not base off of __dir__ or __FILE__
|
21
44
|
- Custom specification of gems having image paths via server-side configuration in Glimmer::Config.gems_having_image_paths
|
22
45
|
|
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 Opal
|
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 Opal [Alpha] (Pure Ruby Web GUI)
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-opal.svg)](http://badge.fury.io/rb/glimmer-dsl-opal)
|
3
3
|
[![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
4
4
|
|
@@ -143,7 +143,7 @@ Hello, Table! Game Booked
|
|
143
143
|
|
144
144
|
NOTE: Glimmer DSL for Opal is an alpha project. Please help make better by contributing, adopting for small or low risk projects, and providing feedback. It is still an early alpha, so the more feedback and issues you report the better.
|
145
145
|
|
146
|
-
**Alpha Version** 0.
|
146
|
+
**Alpha Version** 0.19.1 only supports bare-minimum capabilities for the included [samples](https://github.com/AndyObtiva/glimmer-dsl-opal#samples) (originally written for [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt))
|
147
147
|
|
148
148
|
Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
149
149
|
- [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
|
@@ -153,7 +153,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
|
153
153
|
|
154
154
|
## Table of Contents
|
155
155
|
|
156
|
-
- [Glimmer DSL for Opal
|
156
|
+
- [Glimmer DSL for Opal [Alpha] (Pure Ruby Web GUI)](#-glimmer-dsl-for-opal-alpha-pure-ruby-web-gui)
|
157
157
|
- [Principles](#principles)
|
158
158
|
- [Background](#background)
|
159
159
|
- [Pre-requisites](#pre-requisites)
|
@@ -165,6 +165,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
|
165
165
|
- [Hello, Combo!](#hello-combo)
|
166
166
|
- [Hello, Composite!](#hello-composite)
|
167
167
|
- [Hello, Computed!](#hello-computed)
|
168
|
+
- [Hello, Layout!](#hello-layout)
|
168
169
|
- [Hello, List Single Selection!](#hello-list-single-selection)
|
169
170
|
- [Hello, List Multi Selection!](#hello-list-multi-selection)
|
170
171
|
- [Hello, Browser!](#hello-browser)
|
@@ -174,11 +175,14 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
|
174
175
|
- [Hello, Radio!](#hello-radio)
|
175
176
|
- [Hello, Radio Group!](#hello-radio-group)
|
176
177
|
- [Hello, Group!](#hello-group)
|
178
|
+
- [Hello, C Combo!](#hello-c-combo)
|
179
|
+
- [Hello, C Tab!](#hello-c-tab)
|
177
180
|
- [Hello, Checkbox!](#hello-checkbox)
|
178
181
|
- [Hello, Checkbox Group!](#hello-checkbox-group)
|
179
182
|
- [Hello, Date Time!](#hello-date-time)
|
180
183
|
- [Hello, Table!](#hello-table)
|
181
184
|
- [Hello, Button!](#hello-button)
|
185
|
+
- [Hello, Arrow!](#hello-arrow)
|
182
186
|
- [Hello, Message Box!](#hello-message-box)
|
183
187
|
- [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu)
|
184
188
|
- [Hello, Menu Bar!](#hello-menu-bar)
|
@@ -257,7 +261,7 @@ gem 'opal', '1.0.4'
|
|
257
261
|
gem 'opal-rails', '1.1.2'
|
258
262
|
gem 'opal-async', '~> 1.2.0'
|
259
263
|
gem 'opal-jquery', '~> 0.4.4'
|
260
|
-
gem 'glimmer-dsl-opal', '~> 0.
|
264
|
+
gem 'glimmer-dsl-opal', '~> 0.19.1'
|
261
265
|
gem 'glimmer-dsl-xml', '~> 1.2.0', require: false
|
262
266
|
gem 'glimmer-dsl-css', '~> 1.2.0', require: false
|
263
267
|
|
@@ -321,6 +325,7 @@ shell {
|
|
321
325
|
The following keywords from [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) have fully functional partial support in Opal:
|
322
326
|
|
323
327
|
Widgets:
|
328
|
+
- `arrow`: featured in [Hello, Arrow!](#hello-arrow)
|
324
329
|
- `button`: featured in [Hello, Checkbox!](#hello-checkbox) / [Hello, Button!](#hello-button) / [Hello, Table!](#hello-table) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, Message Box!](#hello-message-box) / [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Hello, Group!](#hello-group) / [Hello, Combo!](#hello-combo) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Contact Manager](#contact-manager) / [Tic Tac Toe](#tic-tac-toe) / [Login](#login)
|
325
330
|
- `browser`: featured in [Hello, Browser!](#hello-browser)
|
326
331
|
- `calendar`: featured in [Hello, Date Time!](#hello-date-time)
|
@@ -344,6 +349,8 @@ Widgets:
|
|
344
349
|
- `shell`: featured in [Hello, Checkbox!](#hello-checkbox) / [Hello, Button!](#hello-button) / [Hello, Table!](#hello-table) / [Hello, Tab!](#hello-tab) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Hello, Group!](#hello-group) / [Hello, Date Time!](#hello-date-time) / [Hello, Custom Shell!](#hello-custom-shell) / [Hello, Computed!](#hello-computed) / [Hello, Combo!](#hello-combo) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Contact Manager](#contact-manager) / [Tic Tac Toe](#tic-tac-toe) / [Login](#login)
|
345
350
|
- `tab_folder`: featured in [Hello, Tab!](#hello-tab)
|
346
351
|
- `tab_item`: featured in [Hello, Tab!](#hello-tab)
|
352
|
+
- `c_tab_folder`: featured in [Hello, C Tab!](#hello-c-tab)
|
353
|
+
- `c_tab_item`: featured in [Hello, C Tab!](#hello-c-tab)
|
347
354
|
- `table`: featured in [Hello, Custom Shell!](#hello-custom-shell) / [Hello, Table!](#hello-table) / [Contact Manager](#contact-manager)
|
348
355
|
- `table_column`: featured in [Hello, Table!](#hello-table) / [Hello, Custom Shell!](#hello-custom-shell) / [Contact Manager](#contact-manager)
|
349
356
|
- `text`: featured in [Hello, Computed!](#hello-computed) / [Login](#login) / [Contact Manager](#contact-manager)
|
@@ -759,6 +766,39 @@ You should see "Hello, List Multi Selection!"
|
|
759
766
|
|
760
767
|
![Glimmer DSL for Opal Hello List Multi Selection](images/glimmer-dsl-opal-hello-list-multi-selection.png)
|
761
768
|
|
769
|
+
#### Hello, Arrow!
|
770
|
+
|
771
|
+
Add the following require statement to `app/assets/javascripts/application.rb`
|
772
|
+
|
773
|
+
```ruby
|
774
|
+
require 'glimmer-dsl-opal/samples/hello/hello_arrow'
|
775
|
+
```
|
776
|
+
|
777
|
+
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
778
|
+
|
779
|
+
![Glimmer DSL for SWT Hello Arrow](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-arrow.png)
|
780
|
+
|
781
|
+
![Glimmer DSL for SWT Hello Arrow](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-arrow-menu.png)
|
782
|
+
|
783
|
+
![Glimmer DSL for SWT Hello Arrow](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-arrow-item-selected.png)
|
784
|
+
|
785
|
+
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
786
|
+
|
787
|
+
Start the Rails server:
|
788
|
+
```
|
789
|
+
rails s
|
790
|
+
```
|
791
|
+
|
792
|
+
Visit `http://localhost:3000`
|
793
|
+
|
794
|
+
You should see "Hello, Arrow!"
|
795
|
+
|
796
|
+
![Glimmer DSL for Opal Hello Arrow](images/glimmer-dsl-opal-hello-arrow.png)
|
797
|
+
|
798
|
+
![Glimmer DSL for Opal Hello Arrow](images/glimmer-dsl-opal-hello-arrow-menu.png)
|
799
|
+
|
800
|
+
![Glimmer DSL for Opal Hello Arrow](images/glimmer-dsl-opal-hello-arrow-item-selected.png)
|
801
|
+
|
762
802
|
#### Hello, Browser!
|
763
803
|
|
764
804
|
Add the following require statement to `app/assets/javascripts/application.rb`
|
@@ -1256,6 +1296,68 @@ You should see "Hello, Group!"
|
|
1256
1296
|
|
1257
1297
|
![Glimmer DSL for Opal Hello Group](images/glimmer-dsl-opal-hello-group.png)
|
1258
1298
|
|
1299
|
+
#### Hello, C Combo!
|
1300
|
+
|
1301
|
+
This is the low level way of using `c_combo`
|
1302
|
+
|
1303
|
+
Add the following require statement to `app/assets/javascripts/application.rb`
|
1304
|
+
|
1305
|
+
```ruby
|
1306
|
+
require 'glimmer-dsl-opal/samples/hello/hello_c_combo'
|
1307
|
+
```
|
1308
|
+
|
1309
|
+
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
1310
|
+
|
1311
|
+
![Glimmer DSL for SWT Hello C Combo](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-c-combo.png)
|
1312
|
+
|
1313
|
+
![Glimmer DSL for SWT Hello C Combo Expanded](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-c-combo-expanded.png)
|
1314
|
+
|
1315
|
+
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
1316
|
+
|
1317
|
+
Start the Rails server:
|
1318
|
+
```
|
1319
|
+
rails s
|
1320
|
+
```
|
1321
|
+
|
1322
|
+
Visit `http://localhost:3000`
|
1323
|
+
|
1324
|
+
You should see "Hello, C Combo!"
|
1325
|
+
|
1326
|
+
![Glimmer DSL for Opal Hello C Combo](images/glimmer-dsl-opal-hello-c-combo.png)
|
1327
|
+
|
1328
|
+
![Glimmer DSL for Opal Hello C Combo Expanded](images/glimmer-dsl-opal-hello-c-combo-expanded.png)
|
1329
|
+
|
1330
|
+
#### Hello, C Tab!
|
1331
|
+
|
1332
|
+
This is the low level way of using `c_tab_folder`/`c_tab_item`
|
1333
|
+
|
1334
|
+
Add the following require statement to `app/assets/javascripts/application.rb`
|
1335
|
+
|
1336
|
+
```ruby
|
1337
|
+
require 'glimmer-dsl-opal/samples/hello/hello_c_tab'
|
1338
|
+
```
|
1339
|
+
|
1340
|
+
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
1341
|
+
|
1342
|
+
![Glimmer DSL for SWT Hello C Tab](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-c-tab.png)
|
1343
|
+
|
1344
|
+
![Glimmer DSL for SWT Hello C Tab Other Tab](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-c-tab-other-tab.png)
|
1345
|
+
|
1346
|
+
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
1347
|
+
|
1348
|
+
Start the Rails server:
|
1349
|
+
```
|
1350
|
+
rails s
|
1351
|
+
```
|
1352
|
+
|
1353
|
+
Visit `http://localhost:3000`
|
1354
|
+
|
1355
|
+
You should see "Hello, C Tab!"
|
1356
|
+
|
1357
|
+
![Glimmer DSL for Opal Hello C Tab](images/glimmer-dsl-opal-hello-c-tab.png)
|
1358
|
+
|
1359
|
+
![Glimmer DSL for Opal Hello C Tab Other Tab](images/glimmer-dsl-opal-hello-c-tab-other-tab.png)
|
1360
|
+
|
1259
1361
|
#### Hello, Checkbox!
|
1260
1362
|
|
1261
1363
|
This is the low level way of using `checkbox`
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.19.1
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
include Glimmer
|
23
|
+
|
24
|
+
shell {
|
25
|
+
row_layout(:vertical) {
|
26
|
+
fill true
|
27
|
+
center true
|
28
|
+
}
|
29
|
+
|
30
|
+
text 'Hello, Arrow!'
|
31
|
+
|
32
|
+
label(:center) {
|
33
|
+
text 'Click the arrow to get a menu.'
|
34
|
+
}
|
35
|
+
|
36
|
+
arrow { # can be customized by passing `:arrow` SWT style + `:left`, `:right`, `:up`, or `:down` (default)
|
37
|
+
@menu = menu {
|
38
|
+
menu_item {
|
39
|
+
text 'Item &1'
|
40
|
+
|
41
|
+
on_widget_selected do
|
42
|
+
message_box {
|
43
|
+
text 'Item 1'
|
44
|
+
message 'Item 1 selected!'
|
45
|
+
}.open
|
46
|
+
end
|
47
|
+
}
|
48
|
+
menu_item {
|
49
|
+
text 'Item &2'
|
50
|
+
|
51
|
+
on_widget_selected do
|
52
|
+
message_box {
|
53
|
+
text 'Item 2'
|
54
|
+
message 'Item 2 selected!'
|
55
|
+
}.open
|
56
|
+
end
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
on_widget_selected do |event|
|
61
|
+
event.widget.menu.visible = true
|
62
|
+
end
|
63
|
+
}
|
64
|
+
|
65
|
+
}.open
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
# This is a sample for the c_combo widget, a more customizable version of combo
|
23
|
+
class HelloCCombo
|
24
|
+
class Person
|
25
|
+
attr_accessor :country, :country_options
|
26
|
+
|
27
|
+
def initialize
|
28
|
+
self.country_options = ['', 'Canada', 'US', 'Mexico']
|
29
|
+
reset_country!
|
30
|
+
end
|
31
|
+
|
32
|
+
def reset_country!
|
33
|
+
self.country = 'Canada'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
include Glimmer::UI::CustomShell
|
38
|
+
|
39
|
+
before_body do
|
40
|
+
@person = Person.new
|
41
|
+
end
|
42
|
+
|
43
|
+
body {
|
44
|
+
shell {
|
45
|
+
row_layout(:vertical) {
|
46
|
+
fill true
|
47
|
+
}
|
48
|
+
|
49
|
+
text 'Hello, C Combo!'
|
50
|
+
|
51
|
+
c_combo(:read_only) {
|
52
|
+
selection <=> [@person, :country] # also binds to country_options by convention
|
53
|
+
font height: 45 # unlike `combo`, `c_combo` changes height when setting the font height
|
54
|
+
}
|
55
|
+
|
56
|
+
button {
|
57
|
+
text 'Reset Selection'
|
58
|
+
|
59
|
+
on_widget_selected do
|
60
|
+
@person.reset_country!
|
61
|
+
end
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
HelloCCombo.launch
|
@@ -0,0 +1,172 @@
|
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
# Country flag images were made by [Freepik](https://www.flaticon.com/authors/freepik) from [www.flaticon.com](http://www.flaticon.com)
|
23
|
+
|
24
|
+
# This is a sample for the Custom Tab widgets (c_tab_folder & c_tab_item), which are more customizable versions of tab_folder and tab_item.
|
25
|
+
class HelloCTab
|
26
|
+
include Glimmer::UI::CustomShell
|
27
|
+
|
28
|
+
body {
|
29
|
+
shell {
|
30
|
+
row_layout
|
31
|
+
text 'Hello, C Tab!'
|
32
|
+
minimum_size 200, 200
|
33
|
+
|
34
|
+
c_tab_folder { # accepts styles: :close
|
35
|
+
layout_data {
|
36
|
+
width 1024
|
37
|
+
height 200
|
38
|
+
}
|
39
|
+
c_tab_item(:close) {
|
40
|
+
text 'English'
|
41
|
+
tool_tip_text 'English Greeting'
|
42
|
+
foreground :blue
|
43
|
+
selection_foreground :dark_blue
|
44
|
+
font name: 'Times New Roman', height: 30, style: [:bold, :italic]
|
45
|
+
image File.expand_path('images/usa.png', __dir__)
|
46
|
+
|
47
|
+
label {
|
48
|
+
text 'Hello, World!'
|
49
|
+
font name: 'Times New Roman', height: 90, style: [:bold, :italic]
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
c_tab_item(:close) {
|
54
|
+
text 'French'
|
55
|
+
tool_tip_text 'French Greeting'
|
56
|
+
foreground :blue
|
57
|
+
selection_foreground :dark_blue
|
58
|
+
font name: 'Times New Roman', height: 30, style: [:bold, :italic]
|
59
|
+
image File.expand_path('images/france.png', __dir__)
|
60
|
+
|
61
|
+
label {
|
62
|
+
text 'Bonjour, Univers!'
|
63
|
+
font name: 'Times New Roman', height: 90, style: [:bold, :italic]
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
c_tab_item(:close) {
|
68
|
+
text 'Spanish'
|
69
|
+
tool_tip_text 'Spanish Greeting'
|
70
|
+
foreground :blue
|
71
|
+
selection_foreground :dark_blue
|
72
|
+
font name: 'Times New Roman', height: 30, style: [:bold, :italic]
|
73
|
+
image File.expand_path('images/mexico.png', __dir__)
|
74
|
+
|
75
|
+
label {
|
76
|
+
text 'Hola, Mundo!'
|
77
|
+
font name: 'Times New Roman', height: 90, style: [:bold, :italic]
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
c_tab_item(:close) {
|
82
|
+
text 'German'
|
83
|
+
tool_tip_text 'German Greeting'
|
84
|
+
foreground :blue
|
85
|
+
selection_foreground :dark_blue
|
86
|
+
font name: 'Times New Roman', height: 30, style: [:bold, :italic]
|
87
|
+
image File.expand_path('images/germany.png', __dir__)
|
88
|
+
|
89
|
+
label {
|
90
|
+
text 'Hallo, Welt!'
|
91
|
+
font name: 'Times New Roman', height: 90, style: [:bold, :italic]
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
c_tab_item(:close) {
|
96
|
+
text 'Italian'
|
97
|
+
tool_tip_text 'Italian Greeting'
|
98
|
+
foreground :blue
|
99
|
+
selection_foreground :dark_blue
|
100
|
+
font name: 'Times New Roman', height: 30, style: [:bold, :italic]
|
101
|
+
image File.expand_path('images/italy.png', __dir__)
|
102
|
+
|
103
|
+
label {
|
104
|
+
text 'Ciao, Mondo!'
|
105
|
+
font name: 'Times New Roman', height: 90, style: [:bold, :italic]
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
109
|
+
c_tab_item(:close) {
|
110
|
+
text 'Dutch'
|
111
|
+
tool_tip_text 'Dutch Greeting'
|
112
|
+
foreground :blue
|
113
|
+
selection_foreground :dark_blue
|
114
|
+
font name: 'Times New Roman', height: 30, style: [:bold, :italic]
|
115
|
+
image File.expand_path('images/netherlands.png', __dir__)
|
116
|
+
|
117
|
+
label {
|
118
|
+
text 'Hallo, Wereld!'
|
119
|
+
font name: 'Times New Roman', height: 90, style: [:bold, :italic]
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
c_tab_item(:close) {
|
124
|
+
text 'Danish'
|
125
|
+
tool_tip_text 'Danish Greeting'
|
126
|
+
foreground :blue
|
127
|
+
selection_foreground :dark_blue
|
128
|
+
font name: 'Times New Roman', height: 30, style: [:bold, :italic]
|
129
|
+
image File.expand_path('images/denmark.png', __dir__)
|
130
|
+
|
131
|
+
label {
|
132
|
+
text 'Hej, Verden!'
|
133
|
+
font name: 'Times New Roman', height: 90, style: [:bold, :italic]
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
c_tab_item(:close) {
|
138
|
+
text 'Finnish'
|
139
|
+
tool_tip_text 'Finnish Greeting'
|
140
|
+
foreground :blue
|
141
|
+
selection_foreground :dark_blue
|
142
|
+
font name: 'Times New Roman', height: 30, style: [:bold, :italic]
|
143
|
+
image File.expand_path('images/finland.png', __dir__)
|
144
|
+
|
145
|
+
label {
|
146
|
+
text 'Hei, Maailma!'
|
147
|
+
font name: 'Times New Roman', height: 90, style: [:bold, :italic]
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
c_tab_item(:close) {
|
152
|
+
text 'Norwegian'
|
153
|
+
tool_tip_text 'Norwegian Greeting'
|
154
|
+
foreground :blue
|
155
|
+
selection_foreground :dark_blue
|
156
|
+
font name: 'Times New Roman', height: 30, style: [:bold, :italic]
|
157
|
+
image File.expand_path('images/norway.png', __dir__)
|
158
|
+
|
159
|
+
label {
|
160
|
+
text 'Hei, Verden!'
|
161
|
+
font name: 'Times New Roman', height: 90, style: [:bold, :italic]
|
162
|
+
}
|
163
|
+
}
|
164
|
+
|
165
|
+
}
|
166
|
+
|
167
|
+
}
|
168
|
+
|
169
|
+
}
|
170
|
+
end
|
171
|
+
|
172
|
+
HelloCTab.launch
|