glimmer-dsl-opal 0.18.0 → 0.19.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 +9 -1
- data/README.md +70 -2
- data/VERSION +1 -1
- 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/swt/c_tab_folder_proxy.rb +43 -0
- data/lib/glimmer/swt/c_tab_item_proxy.rb +96 -0
- 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 +3 -0
- metadata +14 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5617b16e9da429aeac72049da8803530ff80be0573a4a97e9f40dc7d543f3869
|
4
|
+
data.tar.gz: 90b2d967c42ca61c617d874f070c6a63dc79edeb172566a1c38baffa4f3de51c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 671f9759f18ac9c60b0ca61c1a2186b2ce04965262848c649cb184037e904bc9a73190a57312e0b233598fcf689f1d19eec0fd69a30f8b03db22d633567bf18a
|
7
|
+
data.tar.gz: c5a473ce5ea0e281f53684ebc0eb7cb74517cb30318cd355b42b20e3b70d3cf880e530eadc2b0fb2b577cd1fada551afe774b06930dc2d00853e0237d64bef75
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.19.0
|
4
|
+
|
5
|
+
- Change `tab_item` default background/foreground color to better match Glimmer DSL for SWT
|
6
|
+
- Support `tab_item` `tool_tip_text` attribute
|
7
|
+
- Support `tab_item` `image` attribute
|
8
|
+
- Implement `c_tab_folder` & `c_tab_item` (without the dropdown for hidden tabs that is in Glimmer DSL for SWT)
|
9
|
+
- Hello, C Tab! sample
|
10
|
+
|
3
11
|
## 0.18.0
|
4
12
|
|
5
13
|
- Implement `c_combo`
|
@@ -27,7 +35,7 @@
|
|
27
35
|
|
28
36
|
## 0.16.0
|
29
37
|
|
30
|
-
- Support label widget background_image attribute
|
38
|
+
- Support `label` widget `background_image` attribute
|
31
39
|
- Have File.expand_path support expanding paths even if they did not base off of __dir__ or __FILE__
|
32
40
|
- Custom specification of gems having image paths via server-side configuration in Glimmer::Config.gems_having_image_paths
|
33
41
|
|
data/README.md
CHANGED
@@ -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.0 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)
|
@@ -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.0'
|
261
265
|
gem 'glimmer-dsl-xml', '~> 1.2.0', require: false
|
262
266
|
gem 'glimmer-dsl-css', '~> 1.2.0', require: false
|
263
267
|
|
@@ -345,6 +349,8 @@ Widgets:
|
|
345
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)
|
346
350
|
- `tab_folder`: featured in [Hello, Tab!](#hello-tab)
|
347
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)
|
348
354
|
- `table`: featured in [Hello, Custom Shell!](#hello-custom-shell) / [Hello, Table!](#hello-table) / [Contact Manager](#contact-manager)
|
349
355
|
- `table_column`: featured in [Hello, Table!](#hello-table) / [Hello, Custom Shell!](#hello-custom-shell) / [Contact Manager](#contact-manager)
|
350
356
|
- `text`: featured in [Hello, Computed!](#hello-computed) / [Login](#login) / [Contact Manager](#contact-manager)
|
@@ -1290,6 +1296,68 @@ You should see "Hello, Group!"
|
|
1290
1296
|
|
1291
1297
|
![Glimmer DSL for Opal Hello Group](images/glimmer-dsl-opal-hello-group.png)
|
1292
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
|
+
|
1293
1361
|
#### Hello, Checkbox!
|
1294
1362
|
|
1295
1363
|
This is the low level way of using `checkbox`
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.19.0
|
@@ -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
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2020-2021 Andy Maleh
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -20,15 +20,16 @@
|
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
22
|
class HelloTab
|
23
|
-
include Glimmer
|
23
|
+
include Glimmer::UI::CustomShell
|
24
24
|
|
25
|
-
|
25
|
+
body {
|
26
26
|
shell {
|
27
27
|
text 'Hello, Tab!'
|
28
28
|
|
29
29
|
tab_folder {
|
30
30
|
tab_item {
|
31
31
|
text 'English'
|
32
|
+
tool_tip_text 'English Greeting'
|
32
33
|
|
33
34
|
label {
|
34
35
|
text 'Hello, World!'
|
@@ -37,14 +38,15 @@ class HelloTab
|
|
37
38
|
|
38
39
|
tab_item {
|
39
40
|
text 'French'
|
41
|
+
tool_tip_text 'French Greeting'
|
40
42
|
|
41
43
|
label {
|
42
44
|
text 'Bonjour, Univers!'
|
43
45
|
}
|
44
46
|
}
|
45
47
|
}
|
46
|
-
}
|
47
|
-
|
48
|
+
}
|
49
|
+
}
|
48
50
|
end
|
49
51
|
|
50
|
-
HelloTab.
|
52
|
+
HelloTab.launch
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,43 @@
|
|
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
|
+
require 'glimmer/swt/widget_proxy'
|
23
|
+
require 'glimmer/swt/tab_folder_proxy'
|
24
|
+
|
25
|
+
module Glimmer
|
26
|
+
module SWT
|
27
|
+
class CTabFolderProxy < TabFolderProxy
|
28
|
+
attr_reader :closeable_children
|
29
|
+
|
30
|
+
def initialize(parent, args, block)
|
31
|
+
@closeable_children = args.detect { |arg| SWTProxy[:close] == SWTProxy[arg] }
|
32
|
+
super(parent, args, block)
|
33
|
+
end
|
34
|
+
|
35
|
+
def post_initialize_child(child)
|
36
|
+
child.closeable = true if @closeable_children
|
37
|
+
super(child)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,96 @@
|
|
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
|
+
require 'glimmer/swt/tab_item_proxy'
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module SWT
|
26
|
+
class CTabItemProxy < TabItemProxy
|
27
|
+
attr_reader :selection_foreground
|
28
|
+
attr_accessor :closeable
|
29
|
+
|
30
|
+
def initialize(parent, args, block)
|
31
|
+
@closeable = args.detect { |arg| SWTProxy[:close] == SWTProxy[arg] }
|
32
|
+
super(parent, args, block)
|
33
|
+
# TODO attach listener if :close style is set
|
34
|
+
close_dom_element.on('click') { dispose }
|
35
|
+
end
|
36
|
+
|
37
|
+
def foreground=(value)
|
38
|
+
value = ColorProxy.new(value) if value.is_a?(String)
|
39
|
+
@foreground = value
|
40
|
+
tab_dom_element.css('color', foreground.to_css) unless foreground.nil?
|
41
|
+
end
|
42
|
+
|
43
|
+
def selection_foreground=(value)
|
44
|
+
value = ColorProxy.new(value) if value.is_a?(String)
|
45
|
+
@selection_foreground = value
|
46
|
+
if @selection_foreground && tab_dom_element.has_class?('selected')
|
47
|
+
@old_foreground = tab_dom_element.css('color')
|
48
|
+
tab_dom_element.css('color', @selection_foreground.to_css)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def font=(value)
|
53
|
+
@font = value.is_a?(FontProxy) ? value : FontProxy.new(self, value)
|
54
|
+
tab_dom_element.css('font-family', @font.name) unless @font.nil?
|
55
|
+
tab_dom_element.css('font-style', 'italic') if @font&.style == :italic || @font&.style&.to_a&.include?(:italic)
|
56
|
+
tab_dom_element.css('font-weight', 'bold') if @font&.style == :bold || @font&.style&.to_a&.include?(:bold)
|
57
|
+
tab_dom_element.css('font-size', "#{@font.height}px") unless @font.nil?
|
58
|
+
end
|
59
|
+
|
60
|
+
def show
|
61
|
+
super
|
62
|
+
if @selection_foreground
|
63
|
+
@old_foreground = tab_dom_element.css('color')
|
64
|
+
tab_dom_element.css('color', @selection_foreground.to_css)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def hide
|
69
|
+
super
|
70
|
+
if @old_foreground
|
71
|
+
tab_dom_element.css('color', @old_foreground)
|
72
|
+
@old_foreground = nil
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def close_path
|
77
|
+
"#{tab_path} span.ui-icon-close"
|
78
|
+
end
|
79
|
+
|
80
|
+
def close_dom_element
|
81
|
+
Document.find(close_path)
|
82
|
+
end
|
83
|
+
|
84
|
+
def tab_dom
|
85
|
+
@tab_dom ||= html {
|
86
|
+
a(href: '#', id: tab_id, class: "tab") {
|
87
|
+
img {}
|
88
|
+
span { @text }
|
89
|
+
span(class: 'ui-icon ui-icon-close', role: 'presentation') { 'Remove Tab' } if @closeable
|
90
|
+
}
|
91
|
+
}.to_s
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -26,8 +26,8 @@ module Glimmer
|
|
26
26
|
class TabFolderProxy < WidgetProxy
|
27
27
|
STYLE = <<~CSS
|
28
28
|
.tabs .tab.selected {
|
29
|
-
background:
|
30
|
-
color:
|
29
|
+
background: white;
|
30
|
+
color: black;
|
31
31
|
}
|
32
32
|
.tabs .tab {
|
33
33
|
background-color: inherit;
|
@@ -38,6 +38,14 @@ module Glimmer
|
|
38
38
|
padding: 14px 16px;
|
39
39
|
transition: 0.3s;
|
40
40
|
font-size: 17px;
|
41
|
+
text-decoration: none;
|
42
|
+
}
|
43
|
+
.tabs .tab:hover {
|
44
|
+
color: black
|
45
|
+
}
|
46
|
+
.tabs .tab > * {
|
47
|
+
display: inline-block;
|
48
|
+
vertical-align: middle;
|
41
49
|
}
|
42
50
|
.tabs {
|
43
51
|
overflow: hidden;
|
@@ -46,16 +54,10 @@ module Glimmer
|
|
46
54
|
}
|
47
55
|
CSS
|
48
56
|
|
49
|
-
attr_reader :tabs
|
50
|
-
|
51
|
-
def initialize(parent, args, block)
|
52
|
-
super(parent, args, block)
|
53
|
-
@tabs = []
|
54
|
-
end
|
55
|
-
|
56
57
|
def post_initialize_child(child)
|
57
58
|
unless @children.include?(child)
|
58
59
|
@children << child
|
60
|
+
child.closeable = true if @closeable_children
|
59
61
|
tabs_dom_element.append(child.tab_dom)
|
60
62
|
child.render
|
61
63
|
end
|
@@ -85,7 +87,7 @@ module Glimmer
|
|
85
87
|
tab_folder_id = id
|
86
88
|
tab_folder_id_style = css
|
87
89
|
@dom ||= html {
|
88
|
-
div(id: tab_folder_id, style: tab_folder_id_style, class:
|
90
|
+
div(id: tab_folder_id, style: tab_folder_id_style, class: name) {
|
89
91
|
div(id: tabs_id, class: 'tabs')
|
90
92
|
}
|
91
93
|
}.to_s
|
@@ -1,10 +1,31 @@
|
|
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
|
+
|
1
22
|
require 'glimmer/swt/composite_proxy'
|
2
23
|
|
3
24
|
module Glimmer
|
4
25
|
module SWT
|
5
26
|
class TabItemProxy < CompositeProxy
|
6
27
|
include Glimmer
|
7
|
-
attr_reader :text, :content_visible
|
28
|
+
attr_reader :text, :content_visible, :tool_tip_text, :image
|
8
29
|
|
9
30
|
def initialize(parent, args, block)
|
10
31
|
super(parent, args, block)
|
@@ -30,7 +51,33 @@ module Glimmer
|
|
30
51
|
|
31
52
|
def text=(value)
|
32
53
|
@text = value
|
33
|
-
tab_dom_element.html(@text)
|
54
|
+
tab_dom_element.find('span').html(@text)
|
55
|
+
end
|
56
|
+
|
57
|
+
def image=(value)
|
58
|
+
@image = value
|
59
|
+
if @image.is_a?(String)
|
60
|
+
tab_dom_element.find('img').attr('src', @image)
|
61
|
+
tab_dom_element.find('img').css('padding-right', '5px')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def tool_tip_text=(value)
|
66
|
+
@tool_tip_text = value
|
67
|
+
tab_dom_element.attr('title', @tool_tip_text) if !@tool_tip_text.to_s.empty?
|
68
|
+
end
|
69
|
+
|
70
|
+
def dispose
|
71
|
+
tab_index = parent.children.to_a.index(self)
|
72
|
+
tab_dom_element.remove
|
73
|
+
super
|
74
|
+
if @content_visible
|
75
|
+
@content_visible = false
|
76
|
+
parent.hide_all_tab_content
|
77
|
+
tab_to_show = parent.children.to_a[tab_index]
|
78
|
+
tab_to_show ||= parent.children.to_a[tab_index - 1]
|
79
|
+
tab_to_show&.show
|
80
|
+
end
|
34
81
|
end
|
35
82
|
|
36
83
|
def selector
|
@@ -64,8 +111,9 @@ module Glimmer
|
|
64
111
|
# This contains the clickable tab area with tab names
|
65
112
|
def tab_dom
|
66
113
|
@tab_dom ||= html {
|
67
|
-
|
68
|
-
|
114
|
+
a(href: '#', id: tab_id, class: "tab") {
|
115
|
+
img {}
|
116
|
+
span { @text }
|
69
117
|
}
|
70
118
|
}.to_s
|
71
119
|
end
|
@@ -112,6 +112,7 @@ module Glimmer
|
|
112
112
|
@parent = parent
|
113
113
|
@args = args
|
114
114
|
@block = block
|
115
|
+
# TODO consider changing children to an array (why is it a Set if order matters?)
|
115
116
|
@children = Set.new # TODO consider moving to composite
|
116
117
|
@enabled = true
|
117
118
|
@data = {}
|
@@ -975,6 +976,8 @@ require 'glimmer/swt/menu_proxy'
|
|
975
976
|
require 'glimmer/swt/radio_proxy'
|
976
977
|
require 'glimmer/swt/tab_folder_proxy'
|
977
978
|
require 'glimmer/swt/tab_item_proxy'
|
979
|
+
require 'glimmer/swt/c_tab_folder_proxy'
|
980
|
+
require 'glimmer/swt/c_tab_item_proxy'
|
978
981
|
require 'glimmer/swt/table_column_proxy'
|
979
982
|
require 'glimmer/swt/table_item_proxy'
|
980
983
|
require 'glimmer/swt/table_proxy'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-opal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -288,6 +288,7 @@ files:
|
|
288
288
|
- lib/glimmer-dsl-opal/samples/hello/hello_browser.rb
|
289
289
|
- lib/glimmer-dsl-opal/samples/hello/hello_button.rb
|
290
290
|
- lib/glimmer-dsl-opal/samples/hello/hello_c_combo.rb
|
291
|
+
- lib/glimmer-dsl-opal/samples/hello/hello_c_tab.rb
|
291
292
|
- lib/glimmer-dsl-opal/samples/hello/hello_checkbox.rb
|
292
293
|
- lib/glimmer-dsl-opal/samples/hello/hello_checkbox_group.rb
|
293
294
|
- lib/glimmer-dsl-opal/samples/hello/hello_combo.rb
|
@@ -310,6 +311,15 @@ files:
|
|
310
311
|
- lib/glimmer-dsl-opal/samples/hello/hello_table.rb
|
311
312
|
- lib/glimmer-dsl-opal/samples/hello/hello_table/baseball_park.png
|
312
313
|
- lib/glimmer-dsl-opal/samples/hello/hello_world.rb
|
314
|
+
- lib/glimmer-dsl-opal/samples/hello/images/denmark.png
|
315
|
+
- lib/glimmer-dsl-opal/samples/hello/images/finland.png
|
316
|
+
- lib/glimmer-dsl-opal/samples/hello/images/france.png
|
317
|
+
- lib/glimmer-dsl-opal/samples/hello/images/germany.png
|
318
|
+
- lib/glimmer-dsl-opal/samples/hello/images/italy.png
|
319
|
+
- lib/glimmer-dsl-opal/samples/hello/images/mexico.png
|
320
|
+
- lib/glimmer-dsl-opal/samples/hello/images/netherlands.png
|
321
|
+
- lib/glimmer-dsl-opal/samples/hello/images/norway.png
|
322
|
+
- lib/glimmer-dsl-opal/samples/hello/images/usa.png
|
313
323
|
- lib/glimmer-dsl-opal/vendor/jquery-ui-timepicker/GPL-LICENSE.txt
|
314
324
|
- lib/glimmer-dsl-opal/vendor/jquery-ui-timepicker/MIT-LICENSE.txt
|
315
325
|
- lib/glimmer-dsl-opal/vendor/jquery-ui-timepicker/jquery.ui.timepicker.css
|
@@ -376,6 +386,8 @@ files:
|
|
376
386
|
- lib/glimmer/swt/browser_proxy.rb
|
377
387
|
- lib/glimmer/swt/button_proxy.rb
|
378
388
|
- lib/glimmer/swt/c_combo_proxy.rb
|
389
|
+
- lib/glimmer/swt/c_tab_folder_proxy.rb
|
390
|
+
- lib/glimmer/swt/c_tab_item_proxy.rb
|
379
391
|
- lib/glimmer/swt/checkbox_proxy.rb
|
380
392
|
- lib/glimmer/swt/color_proxy.rb
|
381
393
|
- lib/glimmer/swt/combo_proxy.rb
|