glimmer-dsl-swt 4.18.4.10 → 4.18.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +71 -0
- data/README.md +14 -5
- 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 +451 -112
- data/docs/reference/GLIMMER_SAMPLES.md +76 -3
- data/glimmer-dsl-swt.gemspec +23 -13
- 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 +12 -27
- 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 +1 -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 +16 -2
- 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 +8 -5
- data/lib/glimmer/dsl/swt/shape_expression.rb +2 -2
- data/lib/glimmer/dsl/swt/shell_expression.rb +1 -1
- 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 +57 -1
- data/lib/glimmer/swt/custom/shape.rb +332 -48
- data/lib/glimmer/swt/custom/shape/arc.rb +60 -0
- data/lib/glimmer/{dsl/swt/directory_dialog_expression.rb → swt/custom/shape/focus.rb} +15 -20
- data/lib/glimmer/swt/custom/shape/image.rb +112 -0
- data/lib/glimmer/swt/custom/shape/line.rb +111 -0
- data/lib/glimmer/swt/custom/shape/oval.rb +61 -0
- data/lib/glimmer/swt/custom/shape/point.rb +49 -0
- data/lib/glimmer/swt/custom/shape/polygon.rb +114 -0
- data/lib/glimmer/swt/custom/shape/polyline.rb +115 -0
- data/lib/glimmer/swt/custom/shape/rectangle.rb +105 -0
- data/lib/glimmer/swt/custom/shape/text.rb +85 -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 +15 -4
- 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 +6 -2
- data/lib/glimmer/swt/shell_proxy.rb +94 -80
- data/lib/glimmer/swt/swt_proxy.rb +16 -0
- data/lib/glimmer/swt/tab_item_proxy.rb +5 -3
- data/lib/glimmer/swt/table_proxy.rb +32 -11
- data/lib/glimmer/swt/transform_proxy.rb +39 -35
- 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 +193 -138
- data/lib/glimmer/ui.rb +5 -0
- data/lib/glimmer/ui/custom_shell.rb +11 -5
- data/lib/glimmer/ui/custom_widget.rb +4 -5
- data/samples/elaborate/contact_manager.rb +9 -7
- data/samples/elaborate/login.rb +27 -21
- data/samples/elaborate/mandelbrot_fractal.rb +20 -25
- data/samples/elaborate/meta_sample.rb +2 -1
- data/samples/elaborate/tetris.rb +3 -1
- data/samples/elaborate/tic_tac_toe.rb +18 -14
- data/samples/elaborate/tic_tac_toe/board.rb +5 -5
- data/samples/elaborate/tic_tac_toe/cell.rb +5 -5
- data/samples/elaborate/user_profile.rb +10 -8
- data/samples/hello/hello_browser.rb +2 -0
- data/samples/hello/hello_button.rb +9 -7
- data/samples/hello/hello_canvas.rb +144 -40
- data/samples/hello/hello_canvas_animation.rb +2 -0
- data/samples/hello/hello_canvas_transform.rb +2 -0
- data/samples/hello/hello_checkbox.rb +18 -14
- data/samples/hello/hello_checkbox_group.rb +13 -9
- data/samples/hello/hello_code_text.rb +2 -0
- data/samples/hello/hello_color_dialog.rb +68 -0
- data/samples/hello/hello_combo.rb +16 -12
- data/samples/hello/hello_computed.rb +9 -7
- data/samples/hello/hello_cursor.rb +4 -1
- data/samples/hello/hello_custom_shell.rb +18 -21
- data/samples/hello/hello_custom_widget.rb +6 -6
- data/samples/hello/hello_date_time.rb +16 -12
- data/samples/hello/hello_dialog.rb +2 -0
- data/samples/hello/hello_directory_dialog.rb +9 -7
- data/samples/hello/hello_drag_and_drop.rb +5 -3
- data/samples/hello/hello_expand_bar.rb +10 -8
- data/samples/hello/hello_file_dialog.rb +9 -7
- data/samples/hello/hello_font_dialog.rb +84 -0
- data/samples/hello/hello_group.rb +20 -16
- data/samples/hello/hello_link.rb +2 -0
- data/samples/hello/hello_list_multi_selection.rb +15 -11
- data/samples/hello/hello_list_single_selection.rb +15 -11
- data/samples/hello/hello_menu_bar.rb +2 -0
- data/samples/hello/hello_message_box.rb +2 -0
- data/samples/hello/hello_pop_up_context_menu.rb +2 -0
- data/samples/hello/hello_progress_bar.rb +5 -5
- data/samples/hello/hello_radio.rb +20 -16
- data/samples/hello/hello_radio_group.rb +16 -12
- data/samples/hello/hello_sash_form.rb +2 -0
- data/samples/hello/hello_spinner.rb +9 -7
- data/samples/hello/hello_styled_text.rb +19 -17
- data/samples/hello/hello_tab.rb +7 -5
- data/samples/hello/hello_table.rb +12 -5
- data/samples/hello/hello_tree.rb +485 -0
- data/samples/hello/hello_world.rb +2 -0
- metadata +21 -22
- data/lib/glimmer/swt/directory_dialog_proxy.rb +0 -65
- data/lib/glimmer/swt/file_dialog_proxy.rb +0 -66
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2007-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
|
@@ -60,10 +60,10 @@ class TicTacToe
|
|
60
60
|
win
|
61
61
|
end
|
62
62
|
|
63
|
-
def reset
|
63
|
+
def reset!
|
64
64
|
(1..3).each do |row|
|
65
65
|
(1..3).each do |column|
|
66
|
-
self[row, column].reset
|
66
|
+
self[row, column].reset!
|
67
67
|
end
|
68
68
|
end
|
69
69
|
@winning_sign = Cell::EMPTY
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2007-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
|
@@ -25,14 +25,14 @@ class TicTacToe
|
|
25
25
|
attr_accessor :sign, :empty
|
26
26
|
|
27
27
|
def initialize
|
28
|
-
reset
|
28
|
+
reset!
|
29
29
|
end
|
30
30
|
|
31
31
|
def mark(sign)
|
32
32
|
self.sign = sign
|
33
33
|
end
|
34
34
|
|
35
|
-
def reset
|
35
|
+
def reset!
|
36
36
|
self.sign = EMPTY
|
37
37
|
end
|
38
38
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2007-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
|
@@ -19,6 +19,8 @@
|
|
19
19
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
|
+
require 'glimmer-dsl-swt'
|
23
|
+
|
22
24
|
include Glimmer
|
23
25
|
|
24
26
|
shell {
|
@@ -32,21 +34,21 @@ shell {
|
|
32
34
|
grid_layout 2, false
|
33
35
|
layout_data :fill, :fill, true, true
|
34
36
|
label {text "First"}; text {text "Bullet"}
|
35
|
-
label {text "Last"}; text {text "Tooth"}
|
37
|
+
label {text "Last"}; text {text "Tooth"}
|
36
38
|
}
|
37
39
|
|
38
40
|
group {
|
39
41
|
layout_data :fill, :fill, true, true
|
40
42
|
text "Gender"
|
41
43
|
radio {text "Male"; selection true}
|
42
|
-
radio {text "Female"}
|
44
|
+
radio {text "Female"}
|
43
45
|
}
|
44
46
|
|
45
47
|
group {
|
46
48
|
layout_data :fill, :fill, true, true
|
47
49
|
text "Role"
|
48
50
|
check {text "Student"; selection true}
|
49
|
-
check {text "Employee"; selection true}
|
51
|
+
check {text "Employee"; selection true}
|
50
52
|
}
|
51
53
|
|
52
54
|
group {
|
@@ -59,11 +61,11 @@ shell {
|
|
59
61
|
button {
|
60
62
|
text "save"
|
61
63
|
layout_data :right, :center, true, true
|
62
|
-
on_widget_selected {
|
64
|
+
on_widget_selected {
|
63
65
|
message_box {
|
64
66
|
text 'Profile Saved!'
|
65
67
|
message 'User profile has been saved!'
|
66
|
-
}.open
|
68
|
+
}.open
|
67
69
|
}
|
68
70
|
}
|
69
71
|
|
@@ -19,16 +19,18 @@
|
|
19
19
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
|
+
require 'glimmer-dsl-swt'
|
23
|
+
|
22
24
|
class HelloButton
|
23
|
-
include Glimmer
|
25
|
+
include Glimmer::UI::CustomShell
|
24
26
|
|
25
27
|
attr_accessor :count
|
26
28
|
|
27
|
-
|
29
|
+
before_body {
|
28
30
|
@count = 0
|
29
|
-
|
31
|
+
}
|
30
32
|
|
31
|
-
|
33
|
+
body {
|
32
34
|
shell {
|
33
35
|
text 'Hello, Button!'
|
34
36
|
|
@@ -39,8 +41,8 @@ class HelloButton
|
|
39
41
|
self.count += 1
|
40
42
|
}
|
41
43
|
}
|
42
|
-
}
|
43
|
-
|
44
|
+
}
|
45
|
+
}
|
44
46
|
end
|
45
47
|
|
46
|
-
HelloButton.
|
48
|
+
HelloButton.launch
|
@@ -19,46 +19,150 @@
|
|
19
19
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
|
-
|
22
|
+
require 'glimmer-dsl-swt'
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
24
|
+
class HelloCanvas
|
25
|
+
include Glimmer::UI::CustomShell
|
26
|
+
|
27
|
+
attr_accessor :selected_shape
|
28
|
+
|
29
|
+
before_body {
|
30
|
+
@image_object = image(File.expand_path('../../icons/scaffold_app.png', __dir__), width: 50)
|
31
|
+
}
|
32
|
+
|
33
|
+
body {
|
34
|
+
shell {
|
35
|
+
text 'Hello, Canvas!'
|
36
|
+
minimum_size 320, 400
|
37
|
+
|
38
|
+
@canvas = canvas {
|
39
|
+
background :yellow
|
40
|
+
rectangle(0, 0, 220, 400) {
|
41
|
+
background :red
|
42
|
+
}
|
43
|
+
rectangle(50, 20, 300, 150, 30, 50) {
|
44
|
+
background :magenta
|
45
|
+
}
|
46
|
+
rectangle(150, 200, 100, 70, true) {
|
47
|
+
background :dark_magenta
|
48
|
+
foreground :yellow
|
49
|
+
}
|
50
|
+
rectangle(50, 200, 30, 70, false) {
|
51
|
+
background :magenta
|
52
|
+
foreground :dark_blue
|
53
|
+
}
|
54
|
+
rectangle(205, 50, 88, 96) {
|
55
|
+
foreground :yellow
|
56
|
+
3.times { |n|
|
57
|
+
line(45, 70 + n*10, 65 + n*10, 30 + n*10) {
|
58
|
+
foreground :yellow
|
59
|
+
}
|
60
|
+
}
|
61
|
+
10.times {|n|
|
62
|
+
point(15 + n*5, 50 + n*5) {
|
63
|
+
foreground :yellow
|
64
|
+
}
|
65
|
+
}
|
66
|
+
polyline(45, 60, 55, 20, 65, 60, 85, 80, 45, 60)
|
67
|
+
image(@image_object, 0, 5)
|
68
|
+
}
|
69
|
+
text('Picasso', 60, 80) {
|
70
|
+
background :yellow
|
71
|
+
foreground :dark_magenta
|
72
|
+
font name: 'Courier', height: 30
|
73
|
+
}
|
74
|
+
oval(110, 310, 100, 100) {
|
75
|
+
# patterns provide a differnet way to make gradients
|
76
|
+
background_pattern 0, 0, 105, 0, :yellow, rgb(128, 138, 248)
|
77
|
+
}
|
78
|
+
arc(210, 210, 100, 100, 30, -77) {
|
79
|
+
background :red
|
80
|
+
}
|
81
|
+
polygon(250, 210, 260, 170, 270, 210, 290, 230) {
|
82
|
+
background :dark_yellow
|
83
|
+
}
|
84
|
+
|
85
|
+
menu {
|
86
|
+
menu_item {
|
87
|
+
text 'Change Background Color...'
|
88
|
+
enabled bind(self, :selected_shape) {|shape| shape.respond_to?(:background) && shape.background }
|
89
|
+
on_widget_selected {
|
90
|
+
@selected_shape&.background = color_dialog.open
|
91
|
+
self.selected_shape = nil
|
92
|
+
}
|
93
|
+
}
|
94
|
+
menu_item {
|
95
|
+
text 'Change Background Pattern Color 1...'
|
96
|
+
enabled bind(self, :selected_shape) {|shape| shape.respond_to?(:background_pattern) && shape.background_pattern }
|
97
|
+
on_widget_selected {
|
98
|
+
if @selected_shape
|
99
|
+
background_pattern_args = @selected_shape.background_pattern_args
|
100
|
+
background_pattern_args[5] = color_dialog.open
|
101
|
+
@selected_shape.background_pattern = background_pattern_args
|
102
|
+
self.selected_shape = nil
|
103
|
+
end
|
104
|
+
}
|
105
|
+
}
|
106
|
+
menu_item {
|
107
|
+
text 'Change Background Pattern Color 2...'
|
108
|
+
enabled bind(self, :selected_shape) {|shape| shape.respond_to?(:background_pattern) && shape.background_pattern }
|
109
|
+
on_widget_selected {
|
110
|
+
if @selected_shape
|
111
|
+
background_pattern_args = @selected_shape.background_pattern_args
|
112
|
+
background_pattern_args[6] = color_dialog.open
|
113
|
+
@selected_shape.background_pattern = background_pattern_args
|
114
|
+
self.selected_shape = nil
|
115
|
+
end
|
116
|
+
}
|
117
|
+
}
|
118
|
+
menu_item(:separator)
|
119
|
+
menu_item {
|
120
|
+
text 'Change Foreground Color...'
|
121
|
+
enabled bind(self, :selected_shape) {|shape| shape.respond_to?(:foreground) && shape.foreground }
|
122
|
+
on_widget_selected {
|
123
|
+
@selected_shape&.foreground = color_dialog.open
|
124
|
+
self.selected_shape = nil
|
125
|
+
}
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
129
|
+
on_mouse_down { |mouse_event|
|
130
|
+
@drag_detected = false
|
131
|
+
@canvas.cursor = :hand
|
132
|
+
self.selected_shape = @canvas.shape_at_location(mouse_event.x, mouse_event.y)
|
133
|
+
}
|
134
|
+
|
135
|
+
on_drag_detected { |drag_detect_event|
|
136
|
+
@drag_detected = true
|
137
|
+
@drag_current_x = drag_detect_event.x
|
138
|
+
@drag_current_y = drag_detect_event.y
|
139
|
+
}
|
140
|
+
|
141
|
+
on_mouse_move { |mouse_event|
|
142
|
+
if @drag_detected
|
143
|
+
@selected_shape&.move_by(mouse_event.x - @drag_current_x, mouse_event.y - @drag_current_y)
|
144
|
+
@drag_current_x = mouse_event.x
|
145
|
+
@drag_current_y = mouse_event.y
|
146
|
+
end
|
147
|
+
}
|
148
|
+
|
149
|
+
on_menu_detected { |menu_detect_event|
|
150
|
+
@menu_detected = true
|
151
|
+
}
|
152
|
+
|
153
|
+
on_mouse_up { |mouse_event|
|
154
|
+
@canvas.cursor = :arrow
|
155
|
+
@drag_detected = false
|
156
|
+
if @menu_detected
|
157
|
+
@menu_detected = nil
|
158
|
+
else
|
159
|
+
self.selected_shape = nil
|
160
|
+
end
|
161
|
+
}
|
162
|
+
}
|
61
163
|
}
|
62
|
-
polyline(250, 110, 260, 70, 270, 110, 290, 130, 250, 110)
|
63
164
|
}
|
64
|
-
|
165
|
+
end
|
166
|
+
|
167
|
+
HelloCanvas.launch
|
168
|
+
|
@@ -19,15 +19,17 @@
|
|
19
19
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
|
+
require 'glimmer-dsl-swt'
|
23
|
+
|
22
24
|
class HelloCheckbox
|
23
25
|
class Person
|
24
26
|
attr_accessor :skiing, :snowboarding, :snowmobiling, :snowshoeing
|
25
27
|
|
26
28
|
def initialize
|
27
|
-
reset_activities
|
29
|
+
reset_activities!
|
28
30
|
end
|
29
31
|
|
30
|
-
def reset_activities
|
32
|
+
def reset_activities!
|
31
33
|
self.skiing = false
|
32
34
|
self.snowboarding = true
|
33
35
|
self.snowmobiling = false
|
@@ -35,11 +37,13 @@ class HelloCheckbox
|
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
38
|
-
include Glimmer
|
40
|
+
include Glimmer::UI::CustomShell
|
39
41
|
|
40
|
-
|
41
|
-
person = Person.new
|
42
|
-
|
42
|
+
before_body {
|
43
|
+
@person = Person.new
|
44
|
+
}
|
45
|
+
|
46
|
+
body {
|
43
47
|
shell {
|
44
48
|
text 'Hello, Checkbox!'
|
45
49
|
row_layout :vertical
|
@@ -52,22 +56,22 @@ class HelloCheckbox
|
|
52
56
|
composite {
|
53
57
|
checkbox {
|
54
58
|
text 'Skiing'
|
55
|
-
selection bind(person, :skiing)
|
59
|
+
selection bind(@person, :skiing)
|
56
60
|
}
|
57
61
|
|
58
62
|
checkbox {
|
59
63
|
text 'Snowboarding'
|
60
|
-
selection bind(person, :snowboarding)
|
64
|
+
selection bind(@person, :snowboarding)
|
61
65
|
}
|
62
66
|
|
63
67
|
checkbox {
|
64
68
|
text 'Snowmobiling'
|
65
|
-
selection bind(person, :snowmobiling)
|
69
|
+
selection bind(@person, :snowmobiling)
|
66
70
|
}
|
67
71
|
|
68
72
|
checkbox {
|
69
73
|
text 'Snowshoeing'
|
70
|
-
selection bind(person, :snowshoeing)
|
74
|
+
selection bind(@person, :snowshoeing)
|
71
75
|
}
|
72
76
|
}
|
73
77
|
|
@@ -75,11 +79,11 @@ class HelloCheckbox
|
|
75
79
|
text 'Reset Activities'
|
76
80
|
|
77
81
|
on_widget_selected do
|
78
|
-
person.reset_activities
|
82
|
+
@person.reset_activities!
|
79
83
|
end
|
80
84
|
}
|
81
|
-
}
|
82
|
-
|
85
|
+
}
|
86
|
+
}
|
83
87
|
end
|
84
88
|
|
85
|
-
HelloCheckbox.
|
89
|
+
HelloCheckbox.launch
|