glimmer-dsl-opal 0.1.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +48 -0
  3. data/README.md +948 -169
  4. data/VERSION +1 -1
  5. data/lib/glimmer-dsl-opal.rb +31 -7
  6. data/lib/glimmer-dsl-opal/ext/date.rb +13 -0
  7. data/lib/glimmer-dsl-opal/ext/exception.rb +5 -0
  8. data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/contact_manager.rb +0 -0
  9. data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/contact_manager/contact.rb +0 -0
  10. data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/contact_manager/contact_manager_presenter.rb +0 -0
  11. data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/contact_manager/contact_repository.rb +24 -99
  12. data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/login.rb +0 -0
  13. data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/tic_tac_toe.rb +0 -0
  14. data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/tic_tac_toe/board.rb +0 -0
  15. data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/tic_tac_toe/cell.rb +0 -0
  16. data/lib/{samples → glimmer-dsl-opal/samples}/hello/hello_browser.rb +0 -0
  17. data/lib/glimmer-dsl-opal/samples/hello/hello_checkbox.rb +85 -0
  18. data/lib/glimmer-dsl-opal/samples/hello/hello_checkbox_group.rb +68 -0
  19. data/lib/glimmer-dsl-opal/samples/hello/hello_combo.rb +63 -0
  20. data/lib/{samples → glimmer-dsl-opal/samples}/hello/hello_computed.rb +0 -0
  21. data/lib/{samples → glimmer-dsl-opal/samples}/hello/hello_computed/contact.rb +0 -0
  22. data/lib/glimmer-dsl-opal/samples/hello/hello_custom_shell.rb +155 -0
  23. data/lib/glimmer-dsl-opal/samples/hello/hello_custom_widget.rb +86 -0
  24. data/lib/glimmer-dsl-opal/samples/hello/hello_group.rb +104 -0
  25. data/lib/{samples → glimmer-dsl-opal/samples}/hello/hello_list_multi_selection.rb +0 -0
  26. data/lib/{samples → glimmer-dsl-opal/samples}/hello/hello_list_single_selection.rb +1 -1
  27. data/lib/glimmer-dsl-opal/samples/hello/hello_radio.rb +108 -0
  28. data/lib/glimmer-dsl-opal/samples/hello/hello_radio_group.rb +84 -0
  29. data/lib/glimmer-dsl-opal/samples/hello/hello_tab.rb +50 -0
  30. data/lib/glimmer-dsl-opal/samples/hello/hello_world.rb +29 -0
  31. data/lib/{jquery.js → glimmer-dsl-opal/vendor/jquery.js} +0 -0
  32. data/lib/glimmer-dsl-swt.rb +37 -0
  33. data/lib/glimmer/data_binding/element_binding.rb +2 -1
  34. data/lib/glimmer/data_binding/ext/observable_model.rb +1 -1
  35. data/lib/glimmer/dsl/opal/async_exec_expression.rb +23 -7
  36. data/lib/glimmer/dsl/opal/checkbox_group_selection_data_binding_expression.rb +61 -0
  37. data/lib/glimmer/dsl/opal/color_expression.rb +38 -0
  38. data/lib/glimmer/dsl/opal/custom_widget_expression.rb +94 -0
  39. data/lib/glimmer/dsl/opal/display_expression.rb +40 -0
  40. data/lib/glimmer/dsl/opal/dsl.rb +14 -0
  41. data/lib/glimmer/dsl/opal/exec_expression.rb +55 -0
  42. data/lib/glimmer/dsl/opal/font_expression.rb +47 -0
  43. data/lib/glimmer/dsl/opal/layout_expression.rb +1 -1
  44. data/lib/glimmer/dsl/opal/property_expression.rb +6 -2
  45. data/lib/glimmer/dsl/opal/radio_group_selection_data_binding_expression.rb +61 -0
  46. data/lib/glimmer/dsl/opal/rgb_expression.rb +32 -0
  47. data/lib/glimmer/dsl/opal/rgba_expression.rb +32 -0
  48. data/lib/glimmer/dsl/opal/shell_expression.rb +19 -2
  49. data/lib/glimmer/dsl/opal/swt_expression.rb +46 -0
  50. data/lib/glimmer/dsl/opal/sync_exec_expression.rb +33 -0
  51. data/lib/glimmer/dsl/opal/widget_expression.rb +2 -1
  52. data/lib/glimmer/dsl/opal/widget_listener_expression.rb +16 -3
  53. data/lib/glimmer/swt.rb +499 -0
  54. data/lib/glimmer/swt/browser_proxy.rb +1 -1
  55. data/lib/glimmer/swt/button_proxy.rb +17 -3
  56. data/lib/glimmer/swt/checkbox_proxy.rb +80 -0
  57. data/lib/glimmer/swt/color_proxy.rb +119 -0
  58. data/lib/glimmer/swt/combo_proxy.rb +13 -12
  59. data/lib/glimmer/swt/composite_proxy.rb +8 -8
  60. data/lib/glimmer/swt/custom/checkbox_group.rb +142 -0
  61. data/lib/glimmer/swt/custom/radio_group.rb +143 -0
  62. data/lib/glimmer/swt/display_proxy.rb +79 -0
  63. data/lib/glimmer/swt/fill_layout_proxy.rb +84 -0
  64. data/lib/glimmer/swt/font_proxy.rb +79 -0
  65. data/lib/glimmer/swt/grid_layout_proxy.rb +45 -4
  66. data/lib/glimmer/swt/group_proxy.rb +38 -0
  67. data/lib/glimmer/swt/label_proxy.rb +28 -4
  68. data/lib/glimmer/swt/layout_data_proxy.rb +59 -6
  69. data/lib/glimmer/swt/layout_proxy.rb +17 -14
  70. data/lib/glimmer/swt/list_proxy.rb +19 -14
  71. data/lib/glimmer/swt/make_shift_shell_proxy.rb +38 -0
  72. data/lib/glimmer/swt/message_box_proxy.rb +5 -8
  73. data/lib/glimmer/swt/radio_proxy.rb +81 -0
  74. data/lib/glimmer/swt/row_layout_proxy.rb +128 -0
  75. data/lib/glimmer/swt/scrolled_composite_proxy.rb +20 -0
  76. data/lib/glimmer/swt/shell_proxy.rb +51 -26
  77. data/lib/glimmer/swt/style_constantizable.rb +154 -0
  78. data/lib/glimmer/swt/styled_text_proxy.rb +44 -0
  79. data/lib/glimmer/swt/swt_proxy.rb +53 -0
  80. data/lib/glimmer/swt/tab_folder_proxy.rb +8 -8
  81. data/lib/glimmer/swt/tab_item_proxy.rb +15 -32
  82. data/lib/glimmer/swt/table_proxy.rb +0 -18
  83. data/lib/glimmer/swt/widget_proxy.rb +173 -54
  84. data/lib/glimmer/ui/custom_shell.rb +92 -0
  85. data/lib/glimmer/ui/custom_widget.rb +292 -0
  86. data/lib/glimmer/util/proc_tracker.rb +39 -0
  87. data/lib/net/http.rb +17 -0
  88. data/lib/uri.rb +64 -0
  89. metadata +108 -57
  90. data/lib/glimmer/opal/display_proxy.rb +0 -23
  91. data/lib/glimmer/opal/element_proxy.rb +0 -312
  92. data/lib/samples/elaborate/launch +0 -6
  93. data/lib/samples/hello/hello_combo.rb +0 -34
  94. data/lib/samples/hello/hello_tab.rb +0 -24
  95. data/lib/samples/hello/hello_world.rb +0 -8
  96. data/lib/samples/hello/launch +0 -10
  97. data/lib/samples/launch +0 -4
@@ -0,0 +1,155 @@
1
+ # Copyright (c) 2020 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 'date'
23
+
24
+ # This class declares an `email_shell` custom shell, aka custom window (by convention)
25
+ # Used to view an email message
26
+ class EmailShell
27
+ include Glimmer::UI::CustomShell
28
+
29
+ # multiple options without default values
30
+ options :date, :subject, :from, :message
31
+
32
+ # single option with default value
33
+ option :to, default: '"John Irwin" <john.irwin@example.com>'
34
+
35
+ before_body {
36
+ @swt_style |= swt(:shell_trim, :modeless)
37
+ }
38
+
39
+ body {
40
+ # pass received swt_style through to shell to customize it (e.g. :dialog_trim for a blocking shell)
41
+ shell(swt_style) {
42
+ grid_layout(2, false)
43
+
44
+ text subject
45
+
46
+ label {
47
+ text 'Date:'
48
+ }
49
+ label {
50
+ text date
51
+ }
52
+
53
+ label {
54
+ text 'From:'
55
+ }
56
+ label {
57
+ text from
58
+ }
59
+
60
+ label {
61
+ text 'To:'
62
+ }
63
+ label {
64
+ text to
65
+ }
66
+
67
+ label {
68
+ text 'Subject:'
69
+ }
70
+ label {
71
+ text subject
72
+ }
73
+
74
+ label {
75
+ layout_data(:fill, :fill, true, true) {
76
+ horizontal_span 2 #TODO implement
77
+ vertical_indent 10
78
+ }
79
+
80
+ background :white
81
+ text message
82
+ }
83
+ }
84
+ }
85
+
86
+ end
87
+
88
+ class HelloCustomShell
89
+ # including Glimmer enables the Glimmer DSL syntax, including auto-discovery of the `email_shell` custom widget
90
+ include Glimmer
91
+
92
+ Email = Struct.new(:date, :subject, :from, :message, keyword_init: true)
93
+ EmailSystem = Struct.new(:emails, keyword_init: true)
94
+
95
+ def initialize
96
+ @email_system = EmailSystem.new(
97
+ emails: [
98
+ Email.new(date: DateTime.new(2029, 10, 22, 11, 3, 0).strftime('%F %I:%M %p'), subject: '3rd Week Report', from: '"Dianne Tux" <dianne.tux@example.com>', message: "Hello,\n\nI was wondering if you'd like to go over the weekly report sometime this afternoon.\n\nDianne"),
99
+ Email.new(date: DateTime.new(2029, 10, 21, 8, 1, 0).strftime('%F %I:%M %p'), subject: 'Glimmer Upgrade v100.0', from: '"Robert McGabbins" <robert.mcgabbins@example.com>', message: "Team,\n\nWe are upgrading to Glimmer version 100.0.\n\nEveryone pull the latest code!\n\nRegards,\n\nRobert McGabbins"),
100
+ Email.new(date: DateTime.new(2029, 10, 19, 16, 58, 0).strftime('%F %I:%M %p'), subject: 'Christmas Party', from: '"Lisa Ferreira" <lisa.ferreira@example.com>', message: "Merry Christmas,\n\nAll office Christmas Party arrangements have been set\n\nMake sure to bring a Secret Santa gift\n\nBest regards,\n\nLisa Ferreira"),
101
+ Email.new(date: DateTime.new(2029, 10, 16, 9, 43, 0).strftime('%F %I:%M %p'), subject: 'Glimmer Upgrade v99.0', from: '"Robert McGabbins" <robert.mcgabbins@example.com>', message: "Team,\n\nWe are upgrading to Glimmer version 99.0.\n\nEveryone pull the latest code!\n\nRegards,\n\nRobert McGabbins"),
102
+ Email.new(date: DateTime.new(2029, 10, 15, 11, 2, 0).strftime('%F %I:%M %p'), subject: '2nd Week Report', from: '"Dianne Tux" <dianne.tux@example.com>', message: "Hello,\n\nI was wondering if you'd like to go over the weekly report sometime this afternoon.\n\nDianne"),
103
+ Email.new(date: DateTime.new(2029, 10, 2, 10, 34, 0).strftime('%F %I:%M %p'), subject: 'Glimmer Upgrade v98.0', from: '"Robert McGabbins" <robert.mcgabbins@example.com>', message: "Team,\n\nWe are upgrading to Glimmer version 98.0.\n\nEveryone pull the latest code!\n\nRegards,\n\nRobert McGabbins"),
104
+ ]
105
+ )
106
+ end
107
+
108
+ def launch
109
+ shell {
110
+ grid_layout
111
+
112
+ text 'Hello, Custom Shell!'
113
+
114
+ label {
115
+ font height: 24, style: :bold
116
+ text 'Emails:'
117
+ }
118
+
119
+ label {
120
+ font height: 18
121
+ text 'Click an email to view its message'
122
+ }
123
+
124
+ table {
125
+ layout_data :fill, :fill, true, true
126
+
127
+ table_column {
128
+ text 'Date:'
129
+ width 180
130
+ }
131
+ table_column {
132
+ text 'Subject:'
133
+ width 180
134
+ }
135
+ table_column {
136
+ text 'From:'
137
+ width 360
138
+ }
139
+
140
+ items bind(@email_system, :emails), column_properties(:date, :subject, :from)
141
+
142
+ on_mouse_up { |event|
143
+ email = event.table_item.get_data
144
+ Thread.new do
145
+ async_exec {
146
+ email_shell(date: email.date, subject: email.subject, from: email.from, message: email.message).open
147
+ }
148
+ end
149
+ }
150
+ }
151
+ }.open
152
+ end
153
+ end
154
+
155
+ HelloCustomShell.new.launch
@@ -0,0 +1,86 @@
1
+ # Copyright (c) 2020 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 class declares a `greeting_label` custom widget (by convention)
23
+ class GreetingLabel
24
+ include Glimmer::UI::CustomWidget
25
+
26
+ # multiple options without default values
27
+ options :name, :colors
28
+
29
+ # single option with default value
30
+ option :greeting, default: 'Hello'
31
+
32
+ # internal attribute (not a custom widget option)
33
+ attr_accessor :color
34
+
35
+ before_body {
36
+ @font = {height: 24, style: :bold}
37
+ @color = :black
38
+ }
39
+
40
+ after_body {
41
+ return if colors.nil?
42
+
43
+ Thread.new {
44
+ colors.cycle { |color|
45
+ async_exec {
46
+ self.color = color
47
+ }
48
+ sleep(1)
49
+ }
50
+ }
51
+ }
52
+
53
+ body {
54
+ # pass received swt_style through to label to customize (e.g. :center to center text)
55
+ label(swt_style) {
56
+ text "#{greeting}, #{name}!"
57
+ font @font
58
+ foreground bind(self, :color)
59
+ }
60
+ }
61
+
62
+ end
63
+
64
+ # including Glimmer enables the Glimmer DSL syntax, including auto-discovery of the `greeting_label` custom widget
65
+ include Glimmer
66
+
67
+ shell {
68
+ fill_layout :vertical
69
+
70
+ minimum_size 215, 215
71
+ text 'Hello, Custom Widget!'
72
+
73
+ # custom widget options are passed in a hash
74
+ greeting_label(name: 'Sean')
75
+
76
+ # pass :center SWT style followed by custom widget options hash
77
+ greeting_label(:center, name: 'Laura', greeting: 'Aloha') #
78
+
79
+ greeting_label(:right, name: 'Rick') {
80
+ # you can nest attributes under custom widgets just like any standard widget
81
+ foreground :red
82
+ }
83
+
84
+ # the colors option cycles between colors for the label foreground every second
85
+ greeting_label(:center, name: 'Mary', greeting: 'Aloha', colors: [:red, :dark_green, :blue])
86
+ }.open
@@ -0,0 +1,104 @@
1
+ # Copyright (c) 2020 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 HelloGroup
23
+ class Person
24
+ attr_accessor :male, :female, :child, :teen, :adult, :senior
25
+
26
+ def initialize
27
+ reset
28
+ end
29
+
30
+ def reset
31
+ self.male = nil
32
+ self.female = nil
33
+ self.child = nil
34
+ self.teen = nil
35
+ self.adult = true
36
+ self.senior = nil
37
+ end
38
+ end
39
+
40
+ include Glimmer
41
+
42
+ def launch
43
+ person = Person.new
44
+
45
+ shell {
46
+ text 'Hello, Group!'
47
+ row_layout :vertical
48
+
49
+ group {
50
+ row_layout
51
+
52
+ text 'Gender'
53
+ font style: :bold
54
+
55
+ radio {
56
+ text 'Male'
57
+ selection bind(person, :male)
58
+ }
59
+
60
+ radio {
61
+ text 'Female'
62
+ selection bind(person, :female)
63
+ }
64
+ }
65
+
66
+ group {
67
+ row_layout
68
+
69
+ text 'Age Group'
70
+ font style: :bold
71
+
72
+ radio {
73
+ text 'Child'
74
+ selection bind(person, :child)
75
+ }
76
+
77
+ radio {
78
+ text 'Teen'
79
+ selection bind(person, :teen)
80
+ }
81
+
82
+ radio {
83
+ text 'Adult'
84
+ selection bind(person, :adult)
85
+ }
86
+
87
+ radio {
88
+ text 'Senior'
89
+ selection bind(person, :senior)
90
+ }
91
+ }
92
+
93
+ button {
94
+ text 'Reset'
95
+
96
+ on_widget_selected do
97
+ person.reset
98
+ end
99
+ }
100
+ }.open
101
+ end
102
+ end
103
+
104
+ HelloGroup.new.launch
@@ -1,4 +1,4 @@
1
- class Person
1
+ class Person
2
2
  attr_accessor :country, :country_options
3
3
 
4
4
  def initialize
@@ -0,0 +1,108 @@
1
+ # Copyright (c) 2020 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 HelloRadio
23
+ class Person
24
+ attr_accessor :male, :female, :child, :teen, :adult, :senior
25
+
26
+ def initialize
27
+ reset
28
+ end
29
+
30
+ def reset
31
+ self.male = nil
32
+ self.female = nil
33
+ self.child = nil
34
+ self.teen = nil
35
+ self.adult = true
36
+ self.senior = nil
37
+ end
38
+ end
39
+
40
+ include Glimmer
41
+
42
+ def launch
43
+ person = Person.new
44
+
45
+ shell {
46
+ text 'Hello, Radio!'
47
+ row_layout :vertical
48
+
49
+ label {
50
+ text 'Gender:'
51
+ font style: :bold
52
+ }
53
+
54
+ composite {
55
+ row_layout
56
+
57
+ radio {
58
+ text 'Male'
59
+ selection bind(person, :male)
60
+ }
61
+
62
+ radio {
63
+ text 'Female'
64
+ selection bind(person, :female)
65
+ }
66
+ }
67
+
68
+ label {
69
+ text 'Age Group:'
70
+ font style: :bold
71
+ }
72
+
73
+ composite {
74
+ row_layout
75
+
76
+ radio {
77
+ text 'Child'
78
+ selection bind(person, :child)
79
+ }
80
+
81
+ radio {
82
+ text 'Teen'
83
+ selection bind(person, :teen)
84
+ }
85
+
86
+ radio {
87
+ text 'Adult'
88
+ selection bind(person, :adult)
89
+ }
90
+
91
+ radio {
92
+ text 'Senior'
93
+ selection bind(person, :senior)
94
+ }
95
+ }
96
+
97
+ button {
98
+ text 'Reset'
99
+
100
+ on_widget_selected do
101
+ person.reset
102
+ end
103
+ }
104
+ }.open
105
+ end
106
+ end
107
+
108
+ HelloRadio.new.launch