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
@@ -219,7 +219,7 @@ class MetaSampleApplication
|
|
219
219
|
SampleDirectory.sample_directories.each { |sample_directory|
|
220
220
|
expand_item {
|
221
221
|
layout_data(:fill, :fill, true, true)
|
222
|
-
text " #{sample_directory.name} Samples"
|
222
|
+
text " #{sample_directory.name} Samples (#{sample_directory.samples.count})"
|
223
223
|
|
224
224
|
radio_group { |radio_group_proxy|
|
225
225
|
row_layout(:vertical) {
|
data/samples/elaborate/tetris.rb
CHANGED
@@ -182,6 +182,7 @@ class Tetris
|
|
182
182
|
time = Time.now
|
183
183
|
sleep @game.delay
|
184
184
|
break if @game.game_over? || body_root.disposed?
|
185
|
+
# ensure entire game tetromino down movement happens as one GUI update event with sync_exec (to avoid flicker/stutter)
|
185
186
|
sync_exec {
|
186
187
|
@game.down! unless @game.paused?
|
187
188
|
}
|
@@ -22,11 +22,21 @@
|
|
22
22
|
require_relative "tic_tac_toe/board"
|
23
23
|
|
24
24
|
class TicTacToe
|
25
|
-
include Glimmer
|
25
|
+
include Glimmer::UI::CustomShell
|
26
26
|
|
27
|
-
|
27
|
+
before_body {
|
28
28
|
@tic_tac_toe_board = Board.new
|
29
|
-
|
29
|
+
}
|
30
|
+
|
31
|
+
after_body {
|
32
|
+
observe(@tic_tac_toe_board, :game_status) { |game_status|
|
33
|
+
display_win_message if game_status == Board::WIN
|
34
|
+
display_draw_message if game_status == Board::DRAW
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
body {
|
39
|
+
shell {
|
30
40
|
text "Tic-Tac-Toe"
|
31
41
|
minimum_size 176, 200
|
32
42
|
composite {
|
@@ -46,11 +56,7 @@ class TicTacToe
|
|
46
56
|
}
|
47
57
|
}
|
48
58
|
}
|
49
|
-
|
50
|
-
display_win_message if game_status == Board::WIN
|
51
|
-
display_draw_message if game_status == Board::DRAW
|
52
|
-
}
|
53
|
-
end
|
59
|
+
}
|
54
60
|
|
55
61
|
def display_win_message
|
56
62
|
display_game_over_message("Player #{@tic_tac_toe_board.winning_sign} has won!")
|
@@ -65,12 +71,8 @@ class TicTacToe
|
|
65
71
|
text 'Game Over'
|
66
72
|
message message_text
|
67
73
|
}.open
|
68
|
-
@tic_tac_toe_board.reset
|
69
|
-
end
|
70
|
-
|
71
|
-
def open
|
72
|
-
@shell.open
|
74
|
+
@tic_tac_toe_board.reset!
|
73
75
|
end
|
74
76
|
end
|
75
77
|
|
76
|
-
TicTacToe.
|
78
|
+
TicTacToe.launch
|
@@ -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
|
|
@@ -20,15 +20,15 @@
|
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
22
|
class HelloButton
|
23
|
-
include Glimmer
|
23
|
+
include Glimmer::UI::CustomShell
|
24
24
|
|
25
25
|
attr_accessor :count
|
26
26
|
|
27
|
-
|
27
|
+
before_body {
|
28
28
|
@count = 0
|
29
|
-
|
29
|
+
}
|
30
30
|
|
31
|
-
|
31
|
+
body {
|
32
32
|
shell {
|
33
33
|
text 'Hello, Button!'
|
34
34
|
|
@@ -39,8 +39,8 @@ class HelloButton
|
|
39
39
|
self.count += 1
|
40
40
|
}
|
41
41
|
}
|
42
|
-
}
|
43
|
-
|
42
|
+
}
|
43
|
+
}
|
44
44
|
end
|
45
45
|
|
46
|
-
HelloButton.
|
46
|
+
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
|
-
|
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
|
-
|
22
|
+
class HelloCanvas
|
23
|
+
include Glimmer::UI::CustomShell
|
24
|
+
|
25
|
+
attr_accessor :selected_shape
|
26
|
+
|
27
|
+
before_body {
|
28
|
+
@image_object = image(File.expand_path('../../icons/scaffold_app.png', __dir__), width: 50)
|
29
|
+
}
|
30
|
+
|
31
|
+
body {
|
32
|
+
shell {
|
33
|
+
text 'Hello, Canvas!'
|
34
|
+
minimum_size 320, 400
|
35
|
+
|
36
|
+
@canvas = canvas {
|
37
|
+
background :yellow
|
38
|
+
rectangle(0, 0, 220, 400) {
|
39
|
+
transform {
|
40
|
+
}
|
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
|
+
}
|
57
|
+
text('Picasso', 60, 80) {
|
58
|
+
background :yellow
|
59
|
+
foreground :dark_magenta
|
60
|
+
font name: 'Courier', height: 30
|
61
|
+
}
|
62
|
+
oval(110, 310, 100, 100) {
|
63
|
+
# patterns provide a differnet way to make gradients
|
64
|
+
background_pattern 0, 0, 105, 0, :yellow, rgb(128, 138, 248)
|
65
|
+
}
|
66
|
+
arc(210, 210, 100, 100, 30, -77) {
|
67
|
+
background :red
|
68
|
+
}
|
69
|
+
polygon(250, 210, 260, 170, 270, 210, 290, 230) {
|
70
|
+
background :dark_yellow
|
71
|
+
}
|
72
|
+
polyline(250, 110, 260, 70, 270, 110, 290, 130, 250, 110)
|
73
|
+
3.times { |n|
|
74
|
+
line(250, 120 + n*10, 270 + n*10, 80 + n*10) {
|
75
|
+
foreground :yellow
|
76
|
+
}
|
77
|
+
}
|
78
|
+
10.times {|n|
|
79
|
+
point(220 + n*5, 100 + n*5) {
|
80
|
+
foreground :yellow
|
81
|
+
}
|
82
|
+
}
|
83
|
+
image(@image_object, 205, 55)
|
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
|
+
|
@@ -24,10 +24,10 @@ class HelloCheckbox
|
|
24
24
|
attr_accessor :skiing, :snowboarding, :snowmobiling, :snowshoeing
|
25
25
|
|
26
26
|
def initialize
|
27
|
-
reset_activities
|
27
|
+
reset_activities!
|
28
28
|
end
|
29
29
|
|
30
|
-
def reset_activities
|
30
|
+
def reset_activities!
|
31
31
|
self.skiing = false
|
32
32
|
self.snowboarding = true
|
33
33
|
self.snowmobiling = false
|
@@ -35,11 +35,13 @@ class HelloCheckbox
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
include Glimmer
|
38
|
+
include Glimmer::UI::CustomShell
|
39
39
|
|
40
|
-
|
41
|
-
person = Person.new
|
42
|
-
|
40
|
+
before_body {
|
41
|
+
@person = Person.new
|
42
|
+
}
|
43
|
+
|
44
|
+
body {
|
43
45
|
shell {
|
44
46
|
text 'Hello, Checkbox!'
|
45
47
|
row_layout :vertical
|
@@ -52,22 +54,22 @@ class HelloCheckbox
|
|
52
54
|
composite {
|
53
55
|
checkbox {
|
54
56
|
text 'Skiing'
|
55
|
-
selection bind(person, :skiing)
|
57
|
+
selection bind(@person, :skiing)
|
56
58
|
}
|
57
59
|
|
58
60
|
checkbox {
|
59
61
|
text 'Snowboarding'
|
60
|
-
selection bind(person, :snowboarding)
|
62
|
+
selection bind(@person, :snowboarding)
|
61
63
|
}
|
62
64
|
|
63
65
|
checkbox {
|
64
66
|
text 'Snowmobiling'
|
65
|
-
selection bind(person, :snowmobiling)
|
67
|
+
selection bind(@person, :snowmobiling)
|
66
68
|
}
|
67
69
|
|
68
70
|
checkbox {
|
69
71
|
text 'Snowshoeing'
|
70
|
-
selection bind(person, :snowshoeing)
|
72
|
+
selection bind(@person, :snowshoeing)
|
71
73
|
}
|
72
74
|
}
|
73
75
|
|
@@ -75,11 +77,11 @@ class HelloCheckbox
|
|
75
77
|
text 'Reset Activities'
|
76
78
|
|
77
79
|
on_widget_selected do
|
78
|
-
person.reset_activities
|
80
|
+
@person.reset_activities!
|
79
81
|
end
|
80
82
|
}
|
81
|
-
}
|
82
|
-
|
83
|
+
}
|
84
|
+
}
|
83
85
|
end
|
84
86
|
|
85
|
-
HelloCheckbox.
|
87
|
+
HelloCheckbox.launch
|
@@ -39,11 +39,13 @@ class HelloCheckboxGroup
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
include Glimmer
|
42
|
+
include Glimmer::UI::CustomShell
|
43
43
|
|
44
|
-
|
45
|
-
person = Person.new
|
46
|
-
|
44
|
+
before_body {
|
45
|
+
@person = Person.new
|
46
|
+
}
|
47
|
+
|
48
|
+
body {
|
47
49
|
shell {
|
48
50
|
text 'Hello, Checkbox Group!'
|
49
51
|
row_layout :vertical
|
@@ -54,18 +56,18 @@ class HelloCheckboxGroup
|
|
54
56
|
}
|
55
57
|
|
56
58
|
checkbox_group {
|
57
|
-
selection bind(person, :activities)
|
59
|
+
selection bind(@person, :activities)
|
58
60
|
}
|
59
61
|
|
60
62
|
button {
|
61
63
|
text 'Reset Activities'
|
62
64
|
|
63
65
|
on_widget_selected do
|
64
|
-
person.reset_activities
|
66
|
+
@person.reset_activities
|
65
67
|
end
|
66
68
|
}
|
67
|
-
}
|
68
|
-
|
69
|
+
}
|
70
|
+
}
|
69
71
|
end
|
70
72
|
|
71
|
-
HelloCheckboxGroup.
|
73
|
+
HelloCheckboxGroup.launch
|