glimmer-dsl-swt 4.18.4.8 → 4.18.5.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 +70 -0
- data/README.md +24 -11
- data/VERSION +1 -1
- data/bin/glimmer +3 -3
- data/docs/reference/GLIMMER_CONFIGURATION.md +7 -3
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +353 -145
- data/docs/reference/GLIMMER_SAMPLES.md +207 -41
- data/glimmer-dsl-swt.gemspec +33 -15
- data/lib/ext/glimmer/config.rb +3 -7
- data/lib/glimmer/data_binding/list_selection_binding.rb +13 -7
- data/lib/glimmer/data_binding/table_items_binding.rb +22 -17
- data/lib/glimmer/data_binding/tree_items_binding.rb +19 -15
- data/lib/glimmer/data_binding/widget_binding.rb +13 -15
- data/lib/glimmer/dsl/swt/{file_dialog_expression.rb → auto_exec_expression.rb} +6 -18
- data/lib/glimmer/dsl/swt/checkbox_group_selection_data_binding_expression.rb +9 -6
- data/lib/glimmer/dsl/swt/color_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +16 -14
- data/lib/glimmer/dsl/swt/custom_widget_expression.rb +4 -1
- data/lib/glimmer/dsl/swt/data_binding_expression.rb +2 -2
- data/lib/glimmer/dsl/swt/dialog_expression.rb +18 -9
- data/lib/glimmer/dsl/swt/dsl.rb +1 -0
- data/lib/glimmer/dsl/swt/exec_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/font_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/image_expression.rb +18 -3
- data/lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb +11 -8
- data/lib/glimmer/dsl/swt/pixel_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +9 -5
- data/lib/glimmer/dsl/swt/shape_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/shell_expression.rb +5 -2
- data/lib/glimmer/dsl/swt/widget_expression.rb +8 -4
- data/lib/glimmer/launcher.rb +3 -0
- data/lib/glimmer/rake_task/scaffold.rb +3 -0
- data/lib/glimmer/swt/color_proxy.rb +1 -1
- data/lib/glimmer/swt/custom/code_text.rb +33 -11
- data/lib/glimmer/swt/custom/drawable.rb +50 -2
- data/lib/glimmer/swt/custom/radio_group.rb +2 -1
- data/lib/glimmer/swt/custom/shape.rb +166 -34
- data/lib/glimmer/{dsl/swt/directory_dialog_expression.rb → swt/custom/shape/arc.rb} +15 -20
- data/lib/glimmer/swt/custom/shape/focus.rb +43 -0
- data/lib/glimmer/swt/custom/shape/image.rb +86 -0
- data/lib/glimmer/swt/custom/shape/line.rb +58 -0
- data/lib/glimmer/swt/custom/shape/oval.rb +43 -0
- data/lib/glimmer/swt/custom/shape/point.rb +52 -0
- data/lib/glimmer/swt/custom/shape/polygon.rb +73 -0
- data/lib/glimmer/swt/custom/shape/polyline.rb +73 -0
- data/lib/glimmer/swt/custom/shape/rectangle.rb +87 -0
- data/lib/glimmer/swt/custom/shape/text.rb +73 -0
- data/lib/glimmer/swt/date_time_proxy.rb +9 -3
- data/lib/glimmer/swt/dialog_proxy.rb +92 -0
- data/lib/glimmer/swt/display_proxy.rb +62 -2
- data/lib/glimmer/swt/expand_item_proxy.rb +18 -12
- data/lib/glimmer/swt/font_proxy.rb +13 -7
- data/lib/glimmer/swt/image_proxy.rb +16 -5
- data/lib/glimmer/swt/layout_data_proxy.rb +21 -15
- data/lib/glimmer/swt/layout_proxy.rb +19 -15
- data/lib/glimmer/swt/menu_proxy.rb +2 -2
- data/lib/glimmer/swt/message_box_proxy.rb +21 -7
- data/lib/glimmer/swt/properties.rb +3 -0
- data/lib/glimmer/swt/proxy_properties.rb +145 -0
- data/lib/glimmer/swt/scrolled_composite_proxy.rb +20 -7
- data/lib/glimmer/swt/shell_proxy.rb +96 -80
- data/lib/glimmer/swt/swt_proxy.rb +17 -0
- data/lib/glimmer/swt/tab_item_proxy.rb +6 -3
- data/lib/glimmer/swt/table_proxy.rb +32 -11
- data/lib/glimmer/swt/transform_proxy.rb +26 -38
- data/lib/glimmer/swt/tree_proxy.rb +11 -16
- data/lib/glimmer/swt/widget_listener_proxy.rb +6 -2
- data/lib/glimmer/swt/widget_proxy.rb +194 -137
- data/lib/glimmer/ui.rb +5 -0
- data/lib/glimmer/ui/custom_shell.rb +13 -7
- data/lib/glimmer/ui/custom_widget.rb +4 -5
- data/samples/elaborate/contact_manager.rb +7 -7
- data/samples/elaborate/login.rb +25 -21
- data/samples/elaborate/mandelbrot_fractal.rb +346 -39
- data/samples/elaborate/meta_sample.rb +1 -1
- data/samples/elaborate/tetris.rb +1 -0
- data/samples/elaborate/tic_tac_toe.rb +16 -14
- data/samples/elaborate/tic_tac_toe/board.rb +5 -5
- data/samples/elaborate/tic_tac_toe/cell.rb +5 -5
- data/samples/hello/hello_button.rb +7 -7
- data/samples/hello/hello_canvas.rb +145 -41
- data/samples/hello/hello_checkbox.rb +16 -14
- data/samples/hello/hello_checkbox_group.rb +11 -9
- data/samples/hello/hello_color_dialog.rb +66 -0
- data/samples/hello/hello_combo.rb +14 -12
- data/samples/hello/hello_computed.rb +7 -7
- data/samples/hello/hello_cursor.rb +58 -0
- data/samples/hello/hello_custom_shell.rb +17 -21
- data/samples/hello/hello_custom_widget.rb +4 -6
- data/samples/hello/hello_date_time.rb +14 -12
- data/samples/hello/hello_directory_dialog.rb +7 -7
- data/samples/hello/hello_expand_bar.rb +8 -8
- data/samples/hello/hello_file_dialog.rb +7 -7
- data/samples/hello/hello_font_dialog.rb +82 -0
- data/samples/hello/hello_group.rb +18 -16
- data/samples/hello/hello_list_multi_selection.rb +13 -11
- data/samples/hello/hello_list_single_selection.rb +13 -11
- data/samples/hello/hello_progress_bar.rb +125 -0
- data/samples/hello/hello_radio.rb +18 -16
- data/samples/hello/hello_radio_group.rb +14 -12
- data/samples/hello/hello_spinner.rb +7 -7
- data/samples/hello/hello_tab.rb +5 -5
- data/samples/hello/hello_table.rb +10 -5
- data/samples/hello/hello_tree.rb +485 -0
- metadata +30 -23
- data/lib/glimmer/swt/directory_dialog_proxy.rb +0 -65
- data/lib/glimmer/swt/file_dialog_proxy.rb +0 -66
@@ -20,15 +20,15 @@
|
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
22
|
class HelloFileDialog
|
23
|
-
include Glimmer
|
23
|
+
include Glimmer::UI::CustomShell
|
24
24
|
|
25
25
|
attr_accessor :selected_file
|
26
26
|
|
27
|
-
|
27
|
+
before_body {
|
28
28
|
@selected_file = 'Please select a file.'
|
29
|
-
|
29
|
+
}
|
30
30
|
|
31
|
-
|
31
|
+
body {
|
32
32
|
shell {
|
33
33
|
minimum_size 400, 0
|
34
34
|
grid_layout
|
@@ -53,8 +53,8 @@ class HelloFileDialog
|
|
53
53
|
self.selected_file = file_dialog.open
|
54
54
|
}
|
55
55
|
}
|
56
|
-
}
|
57
|
-
|
56
|
+
}
|
57
|
+
}
|
58
58
|
end
|
59
59
|
|
60
|
-
HelloFileDialog.
|
60
|
+
HelloFileDialog.launch
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# Copyright (c) 2007-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 HelloFontDialog
|
23
|
+
include Glimmer::UI::CustomShell
|
24
|
+
|
25
|
+
attr_accessor :selected_font_data
|
26
|
+
|
27
|
+
before_body {
|
28
|
+
@selected_font_data = FontData.new('Times New Roman', 40, swt(:bold))
|
29
|
+
}
|
30
|
+
|
31
|
+
body {
|
32
|
+
shell {
|
33
|
+
grid_layout {
|
34
|
+
margin_width 15
|
35
|
+
margin_width 15
|
36
|
+
}
|
37
|
+
minimum_size 400, 0
|
38
|
+
|
39
|
+
text 'Hello, Font Dialog!'
|
40
|
+
|
41
|
+
label {
|
42
|
+
text 'Selected Font:'
|
43
|
+
font height: 14, style: :bold
|
44
|
+
}
|
45
|
+
|
46
|
+
label(:center) {
|
47
|
+
layout_data(:fill, :center, true, true) {
|
48
|
+
vertical_indent 15
|
49
|
+
height_hint 200
|
50
|
+
}
|
51
|
+
background :white
|
52
|
+
font bind(self, 'selected_font_data')
|
53
|
+
text bind(self, 'selected_font_data') {|font_data|
|
54
|
+
style = case font_data.style
|
55
|
+
when swt(:normal)
|
56
|
+
'Normal'
|
57
|
+
when swt(:italic)
|
58
|
+
'Italic'
|
59
|
+
when swt(:bold)
|
60
|
+
'Bold'
|
61
|
+
when swt(:bold, :italic)
|
62
|
+
'Bold Italic'
|
63
|
+
end
|
64
|
+
"#{font_data.name}\n#{font_data.height}\n#{style}"
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
button {
|
69
|
+
text "Choose Font..."
|
70
|
+
|
71
|
+
on_widget_selected {
|
72
|
+
self.selected_font_data = font_dialog {
|
73
|
+
font_list [@selected_font_data]
|
74
|
+
}.open
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
}
|
79
|
+
}
|
80
|
+
end
|
81
|
+
|
82
|
+
HelloFontDialog.launch
|
@@ -24,10 +24,10 @@ class HelloGroup
|
|
24
24
|
attr_accessor :male, :female, :child, :teen, :adult, :senior
|
25
25
|
|
26
26
|
def initialize
|
27
|
-
reset
|
27
|
+
reset!
|
28
28
|
end
|
29
29
|
|
30
|
-
def reset
|
30
|
+
def reset!
|
31
31
|
self.male = nil
|
32
32
|
self.female = nil
|
33
33
|
self.child = nil
|
@@ -37,11 +37,13 @@ class HelloGroup
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
include Glimmer
|
40
|
+
include Glimmer::UI::CustomShell
|
41
41
|
|
42
|
-
|
43
|
-
person = Person.new
|
44
|
-
|
42
|
+
before_body {
|
43
|
+
@person = Person.new
|
44
|
+
}
|
45
|
+
|
46
|
+
body {
|
45
47
|
shell {
|
46
48
|
text 'Hello, Group!'
|
47
49
|
row_layout :vertical
|
@@ -54,12 +56,12 @@ class HelloGroup
|
|
54
56
|
|
55
57
|
radio {
|
56
58
|
text 'Male'
|
57
|
-
selection bind(person, :male)
|
59
|
+
selection bind(@person, :male)
|
58
60
|
}
|
59
61
|
|
60
62
|
radio {
|
61
63
|
text 'Female'
|
62
|
-
selection bind(person, :female)
|
64
|
+
selection bind(@person, :female)
|
63
65
|
}
|
64
66
|
}
|
65
67
|
|
@@ -71,22 +73,22 @@ class HelloGroup
|
|
71
73
|
|
72
74
|
radio {
|
73
75
|
text 'Child'
|
74
|
-
selection bind(person, :child)
|
76
|
+
selection bind(@person, :child)
|
75
77
|
}
|
76
78
|
|
77
79
|
radio {
|
78
80
|
text 'Teen'
|
79
|
-
selection bind(person, :teen)
|
81
|
+
selection bind(@person, :teen)
|
80
82
|
}
|
81
83
|
|
82
84
|
radio {
|
83
85
|
text 'Adult'
|
84
|
-
selection bind(person, :adult)
|
86
|
+
selection bind(@person, :adult)
|
85
87
|
}
|
86
88
|
|
87
89
|
radio {
|
88
90
|
text 'Senior'
|
89
|
-
selection bind(person, :senior)
|
91
|
+
selection bind(@person, :senior)
|
90
92
|
}
|
91
93
|
}
|
92
94
|
|
@@ -94,11 +96,11 @@ class HelloGroup
|
|
94
96
|
text 'Reset'
|
95
97
|
|
96
98
|
on_widget_selected do
|
97
|
-
person.reset
|
99
|
+
@person.reset!
|
98
100
|
end
|
99
101
|
}
|
100
|
-
}
|
101
|
-
|
102
|
+
}
|
103
|
+
}
|
102
104
|
end
|
103
105
|
|
104
|
-
HelloGroup.
|
106
|
+
HelloGroup.launch
|
@@ -40,35 +40,37 @@ class HelloListMultiSelection
|
|
40
40
|
'Saskatchewan',
|
41
41
|
'Yukon'
|
42
42
|
]
|
43
|
-
reset_provinces
|
43
|
+
reset_provinces!
|
44
44
|
end
|
45
45
|
|
46
|
-
def reset_provinces
|
46
|
+
def reset_provinces!
|
47
47
|
self.provinces = ['Quebec', 'Manitoba', 'Alberta']
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
include Glimmer
|
51
|
+
include Glimmer::UI::CustomShell
|
52
52
|
|
53
|
-
|
54
|
-
person = Person.new
|
55
|
-
|
53
|
+
before_body {
|
54
|
+
@person = Person.new
|
55
|
+
}
|
56
|
+
|
57
|
+
body {
|
56
58
|
shell {
|
57
59
|
grid_layout
|
58
60
|
|
59
61
|
text 'Hello, List Multi Selection!'
|
60
62
|
|
61
63
|
list(:multi) {
|
62
|
-
selection bind(person, :provinces)
|
64
|
+
selection bind(@person, :provinces) # also binds to provinces_options by convention
|
63
65
|
}
|
64
66
|
|
65
67
|
button {
|
66
68
|
text 'Reset Selections To Default Values'
|
67
69
|
|
68
|
-
on_widget_selected { person.reset_provinces }
|
70
|
+
on_widget_selected { @person.reset_provinces! }
|
69
71
|
}
|
70
|
-
}
|
71
|
-
|
72
|
+
}
|
73
|
+
}
|
72
74
|
end
|
73
75
|
|
74
|
-
HelloListMultiSelection.
|
76
|
+
HelloListMultiSelection.launch
|
@@ -25,35 +25,37 @@ class HelloListSingleSelection
|
|
25
25
|
|
26
26
|
def initialize
|
27
27
|
self.country_options = ['', 'Canada', 'US', 'Mexico']
|
28
|
-
reset_country
|
28
|
+
reset_country!
|
29
29
|
end
|
30
30
|
|
31
|
-
def reset_country
|
31
|
+
def reset_country!
|
32
32
|
self.country = 'Canada'
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
include Glimmer
|
36
|
+
include Glimmer::UI::CustomShell
|
37
37
|
|
38
|
-
|
39
|
-
person = Person.new
|
40
|
-
|
38
|
+
before_body {
|
39
|
+
@person = Person.new
|
40
|
+
}
|
41
|
+
|
42
|
+
body {
|
41
43
|
shell {
|
42
44
|
grid_layout
|
43
45
|
|
44
46
|
text 'Hello, List Single Selection!'
|
45
47
|
|
46
48
|
list {
|
47
|
-
selection bind(person, :country)
|
49
|
+
selection bind(@person, :country) # also binds to country_options by convention
|
48
50
|
}
|
49
51
|
|
50
52
|
button {
|
51
53
|
text 'Reset Selection To Default Value'
|
52
54
|
|
53
|
-
on_widget_selected { person.reset_country }
|
55
|
+
on_widget_selected { @person.reset_country! }
|
54
56
|
}
|
55
|
-
}
|
56
|
-
|
57
|
+
}
|
58
|
+
}
|
57
59
|
end
|
58
60
|
|
59
|
-
HelloListSingleSelection.
|
61
|
+
HelloListSingleSelection.launch
|
@@ -0,0 +1,125 @@
|
|
1
|
+
# Copyright (c) 2007-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 HelloProgressBar
|
23
|
+
include Glimmer::UI::CustomShell
|
24
|
+
|
25
|
+
class ProgressModel
|
26
|
+
attr_accessor :minimum, :maximum, :selection, :delay
|
27
|
+
end
|
28
|
+
|
29
|
+
before_body {
|
30
|
+
@progress_model = ProgressModel.new
|
31
|
+
@progress_model.minimum = 0
|
32
|
+
@progress_model.maximum = 100
|
33
|
+
@progress_model.selection = 0
|
34
|
+
@progress_model.delay = 0.01
|
35
|
+
}
|
36
|
+
|
37
|
+
body {
|
38
|
+
shell {
|
39
|
+
grid_layout(4, true)
|
40
|
+
|
41
|
+
text 'Hello, Progress Bar!'
|
42
|
+
|
43
|
+
progress_bar(:indeterminate) {
|
44
|
+
layout_data(:fill, :center, true, false) {
|
45
|
+
horizontal_span 4
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
label {
|
50
|
+
text 'Minimum'
|
51
|
+
}
|
52
|
+
|
53
|
+
label {
|
54
|
+
text 'Maximum'
|
55
|
+
}
|
56
|
+
|
57
|
+
label {
|
58
|
+
text 'Selection'
|
59
|
+
}
|
60
|
+
|
61
|
+
label {
|
62
|
+
text 'Delay in Seconds'
|
63
|
+
}
|
64
|
+
|
65
|
+
spinner {
|
66
|
+
selection bind(@progress_model, :minimum)
|
67
|
+
}
|
68
|
+
|
69
|
+
spinner {
|
70
|
+
selection bind(@progress_model, :maximum)
|
71
|
+
}
|
72
|
+
|
73
|
+
spinner {
|
74
|
+
selection bind(@progress_model, :selection)
|
75
|
+
}
|
76
|
+
|
77
|
+
spinner {
|
78
|
+
digits 2
|
79
|
+
minimum 1
|
80
|
+
maximum 200
|
81
|
+
selection bind(@progress_model, :delay, on_read: ->(v) {v.to_f*100.0}, on_write: ->(v) {v.to_f/100.0})
|
82
|
+
}
|
83
|
+
|
84
|
+
progress_bar {
|
85
|
+
layout_data(:fill, :center, true, false) {
|
86
|
+
horizontal_span 4
|
87
|
+
}
|
88
|
+
minimum bind(@progress_model, :minimum)
|
89
|
+
maximum bind(@progress_model, :maximum)
|
90
|
+
selection bind(@progress_model, :selection)
|
91
|
+
}
|
92
|
+
|
93
|
+
progress_bar(:vertical) {
|
94
|
+
layout_data(:fill, :center, true, false) {
|
95
|
+
horizontal_span 4
|
96
|
+
}
|
97
|
+
minimum bind(@progress_model, :minimum)
|
98
|
+
maximum bind(@progress_model, :maximum)
|
99
|
+
selection bind(@progress_model, :selection)
|
100
|
+
}
|
101
|
+
|
102
|
+
button {
|
103
|
+
layout_data(:fill, :center, true, false) {
|
104
|
+
horizontal_span 4
|
105
|
+
}
|
106
|
+
text "Start"
|
107
|
+
|
108
|
+
on_widget_selected {
|
109
|
+
# if a previous thread is running, then kill first
|
110
|
+
# (killing is not dangerous since it is only a thread about updating progress)
|
111
|
+
@current_thread&.kill
|
112
|
+
@current_thread = Thread.new {
|
113
|
+
@progress_model.selection = @progress_model.minimum
|
114
|
+
(@progress_model.minimum..@progress_model.maximum).to_a.each do |n|
|
115
|
+
@progress_model.selection = n
|
116
|
+
sleep(@progress_model.delay)
|
117
|
+
end
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}
|
121
|
+
}
|
122
|
+
}
|
123
|
+
end
|
124
|
+
|
125
|
+
HelloProgressBar.launch
|
@@ -24,10 +24,10 @@ class HelloRadio
|
|
24
24
|
attr_accessor :male, :female, :child, :teen, :adult, :senior
|
25
25
|
|
26
26
|
def initialize
|
27
|
-
reset
|
27
|
+
reset!
|
28
28
|
end
|
29
29
|
|
30
|
-
def reset
|
30
|
+
def reset!
|
31
31
|
self.male = nil
|
32
32
|
self.female = nil
|
33
33
|
self.child = nil
|
@@ -37,11 +37,13 @@ class HelloRadio
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
include Glimmer
|
40
|
+
include Glimmer::UI::CustomShell
|
41
41
|
|
42
|
-
|
43
|
-
person = Person.new
|
44
|
-
|
42
|
+
before_body {
|
43
|
+
@person = Person.new
|
44
|
+
}
|
45
|
+
|
46
|
+
body {
|
45
47
|
shell {
|
46
48
|
text 'Hello, Radio!'
|
47
49
|
row_layout :vertical
|
@@ -56,12 +58,12 @@ class HelloRadio
|
|
56
58
|
|
57
59
|
radio {
|
58
60
|
text 'Male'
|
59
|
-
selection bind(person, :male)
|
61
|
+
selection bind(@person, :male)
|
60
62
|
}
|
61
63
|
|
62
64
|
radio {
|
63
65
|
text 'Female'
|
64
|
-
selection bind(person, :female)
|
66
|
+
selection bind(@person, :female)
|
65
67
|
}
|
66
68
|
}
|
67
69
|
|
@@ -75,22 +77,22 @@ class HelloRadio
|
|
75
77
|
|
76
78
|
radio {
|
77
79
|
text 'Child'
|
78
|
-
selection bind(person, :child)
|
80
|
+
selection bind(@person, :child)
|
79
81
|
}
|
80
82
|
|
81
83
|
radio {
|
82
84
|
text 'Teen'
|
83
|
-
selection bind(person, :teen)
|
85
|
+
selection bind(@person, :teen)
|
84
86
|
}
|
85
87
|
|
86
88
|
radio {
|
87
89
|
text 'Adult'
|
88
|
-
selection bind(person, :adult)
|
90
|
+
selection bind(@person, :adult)
|
89
91
|
}
|
90
92
|
|
91
93
|
radio {
|
92
94
|
text 'Senior'
|
93
|
-
selection bind(person, :senior)
|
95
|
+
selection bind(@person, :senior)
|
94
96
|
}
|
95
97
|
}
|
96
98
|
|
@@ -98,11 +100,11 @@ class HelloRadio
|
|
98
100
|
text 'Reset'
|
99
101
|
|
100
102
|
on_widget_selected do
|
101
|
-
person.reset
|
103
|
+
@person.reset!
|
102
104
|
end
|
103
105
|
}
|
104
|
-
}
|
105
|
-
|
106
|
+
}
|
107
|
+
}
|
106
108
|
end
|
107
109
|
|
108
|
-
HelloRadio.
|
110
|
+
HelloRadio.launch
|