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
@@ -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 HelloDirectoryDialog
|
23
|
-
include Glimmer
|
25
|
+
include Glimmer::UI::CustomShell
|
24
26
|
|
25
27
|
attr_accessor :selected_directory
|
26
28
|
|
27
|
-
|
29
|
+
before_body {
|
28
30
|
@selected_directory = 'Please select a directory.'
|
29
|
-
|
31
|
+
}
|
30
32
|
|
31
|
-
|
33
|
+
body {
|
32
34
|
shell {
|
33
35
|
minimum_size 400, 0
|
34
36
|
grid_layout
|
@@ -53,8 +55,8 @@ class HelloDirectoryDialog
|
|
53
55
|
self.selected_directory = directory_dialog.open
|
54
56
|
}
|
55
57
|
}
|
56
|
-
}
|
57
|
-
|
58
|
+
}
|
59
|
+
}
|
58
60
|
end
|
59
61
|
|
60
|
-
HelloDirectoryDialog.
|
62
|
+
HelloDirectoryDialog.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
|
@@ -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
|
class Location
|
23
25
|
attr_accessor :country
|
24
26
|
|
@@ -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,10 +19,12 @@
|
|
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 HelloExpandBar
|
23
|
-
include Glimmer
|
25
|
+
include Glimmer::UI::CustomShell
|
24
26
|
|
25
|
-
|
27
|
+
body {
|
26
28
|
shell {
|
27
29
|
grid_layout(1, false) {
|
28
30
|
margin_width 0
|
@@ -103,8 +105,8 @@ class HelloExpandBar
|
|
103
105
|
}
|
104
106
|
|
105
107
|
}
|
106
|
-
}
|
107
|
-
|
108
|
+
}
|
109
|
+
}
|
108
110
|
end
|
109
111
|
|
110
|
-
HelloExpandBar.
|
112
|
+
HelloExpandBar.launch
|
@@ -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 HelloFileDialog
|
23
|
-
include Glimmer
|
25
|
+
include Glimmer::UI::CustomShell
|
24
26
|
|
25
27
|
attr_accessor :selected_file
|
26
28
|
|
27
|
-
|
29
|
+
before_body {
|
28
30
|
@selected_file = 'Please select a file.'
|
29
|
-
|
31
|
+
}
|
30
32
|
|
31
|
-
|
33
|
+
body {
|
32
34
|
shell {
|
33
35
|
minimum_size 400, 0
|
34
36
|
grid_layout
|
@@ -53,8 +55,8 @@ class HelloFileDialog
|
|
53
55
|
self.selected_file = file_dialog.open
|
54
56
|
}
|
55
57
|
}
|
56
|
-
}
|
57
|
-
|
58
|
+
}
|
59
|
+
}
|
58
60
|
end
|
59
61
|
|
60
|
-
HelloFileDialog.
|
62
|
+
HelloFileDialog.launch
|
@@ -0,0 +1,84 @@
|
|
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
|
+
require 'glimmer-dsl-swt'
|
23
|
+
|
24
|
+
class HelloFontDialog
|
25
|
+
include Glimmer::UI::CustomShell
|
26
|
+
|
27
|
+
attr_accessor :selected_font_data
|
28
|
+
|
29
|
+
before_body {
|
30
|
+
@selected_font_data = FontData.new('Times New Roman', 40, swt(:bold))
|
31
|
+
}
|
32
|
+
|
33
|
+
body {
|
34
|
+
shell {
|
35
|
+
grid_layout {
|
36
|
+
margin_width 15
|
37
|
+
margin_width 15
|
38
|
+
}
|
39
|
+
minimum_size 400, 0
|
40
|
+
|
41
|
+
text 'Hello, Font Dialog!'
|
42
|
+
|
43
|
+
label {
|
44
|
+
text 'Selected Font:'
|
45
|
+
font height: 14, style: :bold
|
46
|
+
}
|
47
|
+
|
48
|
+
label(:center) {
|
49
|
+
layout_data(:fill, :center, true, true) {
|
50
|
+
vertical_indent 15
|
51
|
+
height_hint 200
|
52
|
+
}
|
53
|
+
background :white
|
54
|
+
font bind(self, 'selected_font_data')
|
55
|
+
text bind(self, 'selected_font_data') {|font_data|
|
56
|
+
style = case font_data.style
|
57
|
+
when swt(:normal)
|
58
|
+
'Normal'
|
59
|
+
when swt(:italic)
|
60
|
+
'Italic'
|
61
|
+
when swt(:bold)
|
62
|
+
'Bold'
|
63
|
+
when swt(:bold, :italic)
|
64
|
+
'Bold Italic'
|
65
|
+
end
|
66
|
+
"#{font_data.name}\n#{font_data.height}\n#{style}"
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
button {
|
71
|
+
text "Choose Font..."
|
72
|
+
|
73
|
+
on_widget_selected {
|
74
|
+
self.selected_font_data = font_dialog {
|
75
|
+
font_list [@selected_font_data]
|
76
|
+
}.open
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
}
|
81
|
+
}
|
82
|
+
end
|
83
|
+
|
84
|
+
HelloFontDialog.launch
|
@@ -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 HelloGroup
|
23
25
|
class Person
|
24
26
|
attr_accessor :male, :female, :child, :teen, :adult, :senior
|
25
27
|
|
26
28
|
def initialize
|
27
|
-
reset
|
29
|
+
reset!
|
28
30
|
end
|
29
31
|
|
30
|
-
def reset
|
32
|
+
def reset!
|
31
33
|
self.male = nil
|
32
34
|
self.female = nil
|
33
35
|
self.child = nil
|
@@ -37,11 +39,13 @@ class HelloGroup
|
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
40
|
-
include Glimmer
|
42
|
+
include Glimmer::UI::CustomShell
|
41
43
|
|
42
|
-
|
43
|
-
person = Person.new
|
44
|
-
|
44
|
+
before_body {
|
45
|
+
@person = Person.new
|
46
|
+
}
|
47
|
+
|
48
|
+
body {
|
45
49
|
shell {
|
46
50
|
text 'Hello, Group!'
|
47
51
|
row_layout :vertical
|
@@ -54,12 +58,12 @@ class HelloGroup
|
|
54
58
|
|
55
59
|
radio {
|
56
60
|
text 'Male'
|
57
|
-
selection bind(person, :male)
|
61
|
+
selection bind(@person, :male)
|
58
62
|
}
|
59
63
|
|
60
64
|
radio {
|
61
65
|
text 'Female'
|
62
|
-
selection bind(person, :female)
|
66
|
+
selection bind(@person, :female)
|
63
67
|
}
|
64
68
|
}
|
65
69
|
|
@@ -71,22 +75,22 @@ class HelloGroup
|
|
71
75
|
|
72
76
|
radio {
|
73
77
|
text 'Child'
|
74
|
-
selection bind(person, :child)
|
78
|
+
selection bind(@person, :child)
|
75
79
|
}
|
76
80
|
|
77
81
|
radio {
|
78
82
|
text 'Teen'
|
79
|
-
selection bind(person, :teen)
|
83
|
+
selection bind(@person, :teen)
|
80
84
|
}
|
81
85
|
|
82
86
|
radio {
|
83
87
|
text 'Adult'
|
84
|
-
selection bind(person, :adult)
|
88
|
+
selection bind(@person, :adult)
|
85
89
|
}
|
86
90
|
|
87
91
|
radio {
|
88
92
|
text 'Senior'
|
89
|
-
selection bind(person, :senior)
|
93
|
+
selection bind(@person, :senior)
|
90
94
|
}
|
91
95
|
}
|
92
96
|
|
@@ -94,11 +98,11 @@ class HelloGroup
|
|
94
98
|
text 'Reset'
|
95
99
|
|
96
100
|
on_widget_selected do
|
97
|
-
person.reset
|
101
|
+
@person.reset!
|
98
102
|
end
|
99
103
|
}
|
100
|
-
}
|
101
|
-
|
104
|
+
}
|
105
|
+
}
|
102
106
|
end
|
103
107
|
|
104
|
-
HelloGroup.
|
108
|
+
HelloGroup.launch
|
data/samples/hello/hello_link.rb
CHANGED
@@ -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
|
class HelloListMultiSelection
|
23
25
|
class Person
|
24
26
|
attr_accessor :provinces, :provinces_options
|
@@ -40,35 +42,37 @@ class HelloListMultiSelection
|
|
40
42
|
'Saskatchewan',
|
41
43
|
'Yukon'
|
42
44
|
]
|
43
|
-
reset_provinces
|
45
|
+
reset_provinces!
|
44
46
|
end
|
45
47
|
|
46
|
-
def reset_provinces
|
48
|
+
def reset_provinces!
|
47
49
|
self.provinces = ['Quebec', 'Manitoba', 'Alberta']
|
48
50
|
end
|
49
51
|
end
|
50
52
|
|
51
|
-
include Glimmer
|
53
|
+
include Glimmer::UI::CustomShell
|
54
|
+
|
55
|
+
before_body {
|
56
|
+
@person = Person.new
|
57
|
+
}
|
52
58
|
|
53
|
-
|
54
|
-
person = Person.new
|
55
|
-
|
59
|
+
body {
|
56
60
|
shell {
|
57
61
|
grid_layout
|
58
62
|
|
59
63
|
text 'Hello, List Multi Selection!'
|
60
64
|
|
61
65
|
list(:multi) {
|
62
|
-
selection bind(person, :provinces)
|
66
|
+
selection bind(@person, :provinces) # also binds to provinces_options by convention
|
63
67
|
}
|
64
68
|
|
65
69
|
button {
|
66
70
|
text 'Reset Selections To Default Values'
|
67
71
|
|
68
|
-
on_widget_selected { person.reset_provinces }
|
72
|
+
on_widget_selected { @person.reset_provinces! }
|
69
73
|
}
|
70
|
-
}
|
71
|
-
|
74
|
+
}
|
75
|
+
}
|
72
76
|
end
|
73
77
|
|
74
|
-
HelloListMultiSelection.
|
78
|
+
HelloListMultiSelection.launch
|
@@ -19,41 +19,45 @@
|
|
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 HelloListSingleSelection
|
23
25
|
class Person
|
24
26
|
attr_accessor :country, :country_options
|
25
27
|
|
26
28
|
def initialize
|
27
29
|
self.country_options = ['', 'Canada', 'US', 'Mexico']
|
28
|
-
reset_country
|
30
|
+
reset_country!
|
29
31
|
end
|
30
32
|
|
31
|
-
def reset_country
|
33
|
+
def reset_country!
|
32
34
|
self.country = 'Canada'
|
33
35
|
end
|
34
36
|
end
|
35
37
|
|
36
|
-
include Glimmer
|
38
|
+
include Glimmer::UI::CustomShell
|
39
|
+
|
40
|
+
before_body {
|
41
|
+
@person = Person.new
|
42
|
+
}
|
37
43
|
|
38
|
-
|
39
|
-
person = Person.new
|
40
|
-
|
44
|
+
body {
|
41
45
|
shell {
|
42
46
|
grid_layout
|
43
47
|
|
44
48
|
text 'Hello, List Single Selection!'
|
45
49
|
|
46
50
|
list {
|
47
|
-
selection bind(person, :country)
|
51
|
+
selection bind(@person, :country) # also binds to country_options by convention
|
48
52
|
}
|
49
53
|
|
50
54
|
button {
|
51
55
|
text 'Reset Selection To Default Value'
|
52
56
|
|
53
|
-
on_widget_selected { person.reset_country }
|
57
|
+
on_widget_selected { @person.reset_country! }
|
54
58
|
}
|
55
|
-
}
|
56
|
-
|
59
|
+
}
|
60
|
+
}
|
57
61
|
end
|
58
62
|
|
59
|
-
HelloListSingleSelection.
|
63
|
+
HelloListSingleSelection.launch
|