glimmer-dsl-opal 0.16.0 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f8072dfb955151aa374817c0f2f175bf9c7adfd115eca1bbd6df6c2c3b0725e4
4
- data.tar.gz: 94304037d23dfe1719087fc93d3dc9056be7701f6fdac1044bfe2719e61e43b0
3
+ metadata.gz: 4ab5de6b12c9bf8235c4be10e8dd721c49e529a73febec568959dcbd7820f463
4
+ data.tar.gz: 706a679e3791114993c964a43d54332b7941f30c513ae4f03c5ce114c2b97014
5
5
  SHA512:
6
- metadata.gz: 7f85477240562b1eb7c3bfb3e147577bf6ac7f265c54b6d5acad7ae295a65b1226ff41798eb2a8d41804d2c56d999992f6e6e98b64bde1bed5708c52c46862f0
7
- data.tar.gz: 847b86e900e53586993c74982b37d68ede27f399982188187de524dec31b1d5ffdf0ffc31694da38510060f3e5224c71acc7ca85d75fdef398a8e42c287ca666
6
+ metadata.gz: 6dd624ce1693ec8094b8518b0c9c1f73c3362cbca7e72d03313baeac082413b4cbea245ec2593cb8e70296e11651bb20cd14f16ddb003091ef1da18f48bae044
7
+ data.tar.gz: cc6b2ea990fedec4b9bd70e8b5a030117a5d8cb828d9ca65c23055e4b90af9e2360dff795c22d44650083a1ec6aca6b61e408f87def3e4fea17986372cb004d3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.18.0
4
+
5
+ - Implement `c_combo`
6
+ - Hello, C Combo! sample
7
+
8
+ ## 0.17.0
9
+
10
+ - Support `menu` `visible` attribute to enable programmatic display of menu
11
+ - Support `arrow` widget
12
+ - Hello, Arrow! sample
13
+
14
+ ## 0.16.2
15
+
16
+ - Support `grid_layout` `margin_top`, `margin_right`, `margin_bottom`, and `margin_left` attributes
17
+ - Support `row_layout` `wrap` and `justify` attributes
18
+ - Hello, Layout! sample
19
+ - Partial CGI implementation to have `escapeHTML` (alias: `escape_html`) method
20
+ - HTML Escape label text content
21
+ - Fix issue with `row_layout` `fill` attribute not working
22
+
23
+ ## 0.16.1
24
+
25
+ - Support `grid_layout` `make_columns_equal_width`, `horizontal_spacing`, and `vertical_spacing` attributes
26
+ - Hello, Composite! sample
27
+
3
28
  ## 0.16.0
4
29
 
5
30
  - Support label widget background_image attribute
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 0.16.0 (Pure Ruby Web GUI)
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.16.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))
146
+ **Alpha Version** 0.18.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)
@@ -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 0.16.0 (Pure Ruby Web GUI)](#-glimmer-dsl-for-opal-0160-pure-ruby-web-gui)
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)
@@ -163,6 +163,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
163
163
  - [Hello Samples](#hello-samples)
164
164
  - [Hello, World!](#hello-world)
165
165
  - [Hello, Combo!](#hello-combo)
166
+ - [Hello, Composite!](#hello-composite)
166
167
  - [Hello, Computed!](#hello-computed)
167
168
  - [Hello, List Single Selection!](#hello-list-single-selection)
168
169
  - [Hello, List Multi Selection!](#hello-list-multi-selection)
@@ -223,7 +224,8 @@ Alternatively, web developers may directly use [Glimmer DSL for Opal](https://ru
223
224
  ## Pre-requisites
224
225
 
225
226
  - Rails 5: [https://github.com/rails/rails/tree/5-2-stable](https://github.com/rails/rails/tree/5-2-stable)
226
- - Opal 1: [https://github.com/opal/opal-rails](https://github.com/opal/opal-rails)
227
+ - Opal 1.0.4: [https://github.com/opal/opal](https://github.com/opal/opal)
228
+ - Opal-Rails 1.1.2: [https://github.com/opal/opal-rails](https://github.com/opal/opal-rails)
227
229
  - jQuery 3: [https://code.jquery.com/](https://code.jquery.com/) (jQuery 3.5.1 is included in the [glimmer-dsl-opal](https://rubygems.org/gems/glimmer-dsl-opal) gem)
228
230
  - jQuery-UI 1.12: [https://code.jquery.com/](https://jqueryui.com/) (jQuery-UI 1.12.1 is included in the [glimmer-dsl-opal](https://rubygems.org/gems/glimmer-dsl-opal) gem)
229
231
  - jQuery-UI Timepicker 0.3: [https://code.jquery.com/](https://fgelinas.com/code/timepicker/) (jQuery-UI Timepicker 0.3.3 is included in the [glimmer-dsl-opal](https://rubygems.org/gems/glimmer-dsl-opal) gem)
@@ -251,10 +253,11 @@ rails new glimmer_app_server
251
253
  Add the following to `Gemfile`:
252
254
 
253
255
  ```
254
- gem 'opal-rails', '~> 1.1.2'
256
+ gem 'opal', '1.0.4'
257
+ gem 'opal-rails', '1.1.2'
255
258
  gem 'opal-async', '~> 1.2.0'
256
259
  gem 'opal-jquery', '~> 0.4.4'
257
- gem 'glimmer-dsl-opal', '~> 0.16.0'
260
+ gem 'glimmer-dsl-opal', '~> 0.18.0'
258
261
  gem 'glimmer-dsl-xml', '~> 1.2.0', require: false
259
262
  gem 'glimmer-dsl-css', '~> 1.2.0', require: false
260
263
 
@@ -318,6 +321,7 @@ shell {
318
321
  The following keywords from [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) have fully functional partial support in Opal:
319
322
 
320
323
  Widgets:
324
+ - `arrow`: featured in [Hello, Arrow!](#hello-arrow)
321
325
  - `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)
322
326
  - `browser`: featured in [Hello, Browser!](#hello-browser)
323
327
  - `calendar`: featured in [Hello, Date Time!](#hello-date-time)
@@ -490,7 +494,7 @@ HelloCombo.launch
490
494
  ```
491
495
  Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
492
496
 
493
- ![Glimmer DSL for SWT Hello Combo](https://github.com/AndyObtiva/glimmer/blob/master/images/glimmer-hello-combo.png)
497
+ ![Glimmer DSL for SWT Hello Combo](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/images/glimmer-hello-combo.png)
494
498
 
495
499
  Glimmer app on the web (using `glimmer-dsl-opal` gem):
496
500
 
@@ -505,6 +509,31 @@ You should see "Hello, Combo!"
505
509
 
506
510
  ![Glimmer DSL for Opal Hello Combo](images/glimmer-dsl-opal-hello-combo.png)
507
511
 
512
+ #### Hello, Composite!
513
+
514
+ Add the following require statement to `app/assets/javascripts/application.rb`
515
+
516
+ ```ruby
517
+ require 'glimmer-dsl-opal/samples/hello/hello_composite'
518
+ ```
519
+
520
+ Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
521
+
522
+ ![Glimmer DSL for SWT Hello Composite](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/images/glimmer-hello-composite.png)
523
+
524
+ Glimmer app on the web (using `glimmer-dsl-opal` gem):
525
+
526
+ Start the Rails server:
527
+ ```
528
+ rails s
529
+ ```
530
+
531
+ Visit `http://localhost:3000`
532
+
533
+ You should see "Hello, Composite!"
534
+
535
+ ![Glimmer DSL for Opal Hello Composite](images/glimmer-dsl-opal-hello-composite.png)
536
+
508
537
  #### Hello, Computed!
509
538
 
510
539
  Add the following require statement to `app/assets/javascripts/application.rb`
@@ -628,6 +657,58 @@ You should see "Hello, Computed!"
628
657
 
629
658
  ![Glimmer DSL for Opal Hello Computed](images/glimmer-dsl-opal-hello-computed.png)
630
659
 
660
+ #### Hello, Layout!
661
+
662
+ Add the following require statement to `app/assets/javascripts/application.rb`
663
+
664
+
665
+ ```ruby
666
+ require 'glimmer-dsl-opal/samples/hello/hello_layout'
667
+ ```
668
+
669
+ Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
670
+
671
+ ![Glimmer DSL for SWT Hello Layout](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-layout-tab1.png)
672
+
673
+ ![Glimmer DSL for SWT Hello Layout](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-layout-tab2.png)
674
+
675
+ ![Glimmer DSL for SWT Hello Layout](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-layout-tab3.png)
676
+
677
+ ![Glimmer DSL for SWT Hello Layout](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-layout-tab4.png)
678
+
679
+ ![Glimmer DSL for SWT Hello Layout](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-layout-tab5.png)
680
+
681
+ ![Glimmer DSL for SWT Hello Layout](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-layout-tab6.png)
682
+
683
+ ![Glimmer DSL for SWT Hello Layout](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-layout-tab7.png)
684
+
685
+ Glimmer app on the web (using `glimmer-dsl-opal` gem):
686
+
687
+ Start the Rails server:
688
+ ```
689
+ rails s
690
+ ```
691
+
692
+ Visit `http://localhost:3000`
693
+
694
+ You should see "Hello, Layout!"
695
+
696
+ ![Glimmer DSL for Opal Hello Layout](images/glimmer-dsl-opal-hello-layout-tab1.png)
697
+
698
+ ![Glimmer DSL for Opal Hello Layout](images/glimmer-dsl-opal-hello-layout-tab2.png)
699
+
700
+ ![Glimmer DSL for Opal Hello Layout](images/glimmer-dsl-opal-hello-layout-tab3.png)
701
+
702
+ ![Glimmer DSL for Opal Hello Layout](images/glimmer-dsl-opal-hello-layout-tab4.png)
703
+
704
+ ![Glimmer DSL for Opal Hello Layout](images/glimmer-dsl-opal-hello-layout-tab4-shrunk.png)
705
+
706
+ ![Glimmer DSL for Opal Hello Layout](images/glimmer-dsl-opal-hello-layout-tab5.png)
707
+
708
+ ![Glimmer DSL for Opal Hello Layout](images/glimmer-dsl-opal-hello-layout-tab6.png)
709
+
710
+ ![Glimmer DSL for Opal Hello Layout](images/glimmer-dsl-opal-hello-layout-tab7.png)
711
+
631
712
  #### Hello, List Single Selection!
632
713
 
633
714
  Add the following require statement to `app/assets/javascripts/application.rb`
@@ -679,6 +760,39 @@ You should see "Hello, List Multi Selection!"
679
760
 
680
761
  ![Glimmer DSL for Opal Hello List Multi Selection](images/glimmer-dsl-opal-hello-list-multi-selection.png)
681
762
 
763
+ #### Hello, Arrow!
764
+
765
+ Add the following require statement to `app/assets/javascripts/application.rb`
766
+
767
+ ```ruby
768
+ require 'glimmer-dsl-opal/samples/hello/hello_arrow'
769
+ ```
770
+
771
+ Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
772
+
773
+ ![Glimmer DSL for SWT Hello Arrow](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-arrow.png)
774
+
775
+ ![Glimmer DSL for SWT Hello Arrow](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-arrow-menu.png)
776
+
777
+ ![Glimmer DSL for SWT Hello Arrow](https://github.com/AndyObtiva/glimmer-dsl-swt/raw/master/images/glimmer-hello-arrow-item-selected.png)
778
+
779
+ Glimmer app on the web (using `glimmer-dsl-opal` gem):
780
+
781
+ Start the Rails server:
782
+ ```
783
+ rails s
784
+ ```
785
+
786
+ Visit `http://localhost:3000`
787
+
788
+ You should see "Hello, Arrow!"
789
+
790
+ ![Glimmer DSL for Opal Hello Arrow](images/glimmer-dsl-opal-hello-arrow.png)
791
+
792
+ ![Glimmer DSL for Opal Hello Arrow](images/glimmer-dsl-opal-hello-arrow-menu.png)
793
+
794
+ ![Glimmer DSL for Opal Hello Arrow](images/glimmer-dsl-opal-hello-arrow-item-selected.png)
795
+
682
796
  #### Hello, Browser!
683
797
 
684
798
  Add the following require statement to `app/assets/javascripts/application.rb`
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.16.0
1
+ 0.18.0
data/lib/cgi.rb ADDED
@@ -0,0 +1,14 @@
1
+ class CGI
2
+ class << self
3
+ def escapeHTML(string)
4
+ string.
5
+ gsub('&', '&amp;').
6
+ gsub('<', '&lt;').
7
+ gsub('>', '&gt;').
8
+ gsub("'", '&apos;').
9
+ gsub('"', '&quot;')
10
+ end
11
+ alias escape_html escapeHTML
12
+
13
+ end
14
+ end
@@ -50,6 +50,7 @@ if RUBY_ENGINE == 'opal'
50
50
  require 'to_collection'
51
51
  require 'pure-struct'
52
52
  require 'os'
53
+ require 'cgi'
53
54
  require 'file'
54
55
  require 'display'
55
56
  require 'glimmer-dsl-opal/vendor/jquery'
@@ -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,69 @@
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
+ class HelloComposite
23
+ include Glimmer::UI::CustomShell
24
+
25
+ body {
26
+ shell {
27
+ # shell (which is a composite) has fill_layout(:horizontal) by default with no margins
28
+ # we override below
29
+ fill_layout(:vertical)
30
+ text 'Hello, Composite!'
31
+
32
+ composite { # composite simply contains widgets for visual organization via a layout
33
+ # it has grid_layout(1, false) as its default layout
34
+ label {
35
+ text "Field is above its text widget"
36
+ }
37
+ text {
38
+ layout_data :fill, :center, true, false # fill horizontally, align center vertically, grab remaining horizontal space, but not vertical
39
+ }
40
+ }
41
+
42
+ composite { # composite simply contains widgets for visual organization via a layout
43
+ grid_layout 2, true
44
+
45
+ label {
46
+ text "Field has equal width to its text widget's"
47
+ }
48
+ text {
49
+ layout_data :fill, :center, true, false # fill horizontally, align center vertically, grab remaining horizontal space, but not vertical
50
+ }
51
+ }
52
+
53
+ composite { # composite simply contains widgets for visual organization via a layout
54
+ grid_layout 2, false
55
+
56
+ label {
57
+ text "Field has inequal width"
58
+ }
59
+
60
+ text {
61
+ layout_data :fill, :center, true, false # fill horizontally, align center vertically, grab remaining horizontal space, but not vertical
62
+ }
63
+ }
64
+ }
65
+
66
+ }
67
+ end
68
+
69
+ HelloComposite.launch