samples/hello/hello_checkbox_group.rb in glimmer-dsl-swt-4.18.4.3 vs samples/hello/hello_checkbox_group.rb in glimmer-dsl-swt-4.18.4.4
- old
+ new
@@ -1,71 +1,71 @@
-# Copyright (c) 2007-2021 Andy Maleh
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-# This sample demonstrates the use of a `checkbox_group` (aka `check_group`) in Glimmer, which provides terser syntax
-# than HelloCheckbox for representing multiple checkbox buttons (`button(:check)`) by relying on data-binding to
-# automatically spawn the `checkbox` widgets (`button(:check)`) based on available options on the model.
-class HelloCheckboxGroup
- class Person
- attr_accessor :activities
-
- def initialize
- reset_activities
- end
-
- def activities_options
- ['Skiing', 'Snowboarding', 'Snowmobiling', 'Snowshoeing']
- end
-
- def reset_activities
- self.activities = ['Snowboarding']
- end
- end
-
- include Glimmer
-
- def launch
- person = Person.new
-
- shell {
- text 'Hello, Checkbox Group!'
- row_layout :vertical
-
- label {
- text 'Check all snow activities you are interested in:'
- font style: :bold
- }
-
- checkbox_group {
- selection bind(person, :activities)
- }
-
- button {
- text 'Reset Activities'
-
- on_widget_selected do
- person.reset_activities
- end
- }
- }.open
- end
-end
-
-HelloCheckboxGroup.new.launch
+# Copyright (c) 2007-2021 Andy Maleh
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+# This sample demonstrates the use of a `checkbox_group` (aka `check_group`) in Glimmer, which provides terser syntax
+# than HelloCheckbox for representing multiple checkbox buttons (`button(:check)`) by relying on data-binding to
+# automatically spawn the `checkbox` widgets (`button(:check)`) based on available options on the model.
+class HelloCheckboxGroup
+ class Person
+ attr_accessor :activities
+
+ def initialize
+ reset_activities
+ end
+
+ def activities_options
+ ['Skiing', 'Snowboarding', 'Snowmobiling', 'Snowshoeing']
+ end
+
+ def reset_activities
+ self.activities = ['Snowboarding']
+ end
+ end
+
+ include Glimmer
+
+ def launch
+ person = Person.new
+
+ shell {
+ text 'Hello, Checkbox Group!'
+ row_layout :vertical
+
+ label {
+ text 'Check all snow activities you are interested in:'
+ font style: :bold
+ }
+
+ checkbox_group {
+ selection bind(person, :activities)
+ }
+
+ button {
+ text 'Reset Activities'
+
+ on_widget_selected do
+ person.reset_activities
+ end
+ }
+ }.open
+ end
+end
+
+HelloCheckboxGroup.new.launch