glimmer-dsl-swt 4.17.4.0 → 4.17.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +34 -0
  3. data/README.md +191 -29
  4. data/VERSION +1 -1
  5. data/glimmer-dsl-swt.gemspec +18 -5
  6. data/lib/glimmer/dsl/swt/checkbox_group_selection_data_binding_expression.rb +61 -0
  7. data/lib/glimmer/dsl/swt/custom_widget_expression.rb +2 -0
  8. data/lib/glimmer/dsl/swt/dsl.rb +2 -0
  9. data/lib/glimmer/dsl/swt/expand_item_expression.rb +60 -0
  10. data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +61 -0
  11. data/lib/glimmer/dsl/swt/widget_expression.rb +1 -0
  12. data/lib/glimmer/swt/custom/checkbox_group.rb +160 -0
  13. data/lib/glimmer/swt/custom/code_text.rb +20 -13
  14. data/lib/glimmer/swt/custom/radio_group.rb +155 -0
  15. data/lib/glimmer/swt/expand_item_proxy.rb +97 -0
  16. data/lib/glimmer/swt/image_proxy.rb +5 -0
  17. data/lib/glimmer/swt/menu_proxy.rb +1 -1
  18. data/lib/glimmer/swt/sash_form_proxy.rb +1 -1
  19. data/lib/glimmer/swt/styled_text_proxy.rb +43 -0
  20. data/lib/glimmer/swt/tab_item_proxy.rb +1 -1
  21. data/lib/glimmer/swt/widget_proxy.rb +94 -35
  22. data/lib/glimmer/ui/custom_widget.rb +3 -0
  23. data/samples/elaborate/meta_sample.rb +36 -31
  24. data/samples/hello/hello_checkbox.rb +85 -0
  25. data/samples/hello/hello_checkbox_group.rb +68 -0
  26. data/samples/hello/hello_combo.rb +12 -12
  27. data/samples/hello/hello_expand_bar.rb +110 -0
  28. data/samples/hello/hello_list_multi_selection.rb +23 -23
  29. data/samples/hello/hello_list_single_selection.rb +14 -13
  30. data/samples/hello/hello_radio.rb +108 -0
  31. data/samples/hello/hello_radio_group.rb +84 -0
  32. data/samples/hello/hello_styled_text.rb +138 -0
  33. metadata +17 -4
@@ -0,0 +1,85 @@
1
+ # Copyright (c) 2007-2020 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 HelloCheckbox
23
+ class Person
24
+ attr_accessor :skiing, :snowboarding, :snowmobiling, :snowshoeing
25
+
26
+ def initialize
27
+ reset_activities
28
+ end
29
+
30
+ def reset_activities
31
+ self.skiing = false
32
+ self.snowboarding = true
33
+ self.snowmobiling = false
34
+ self.snowshoeing = false
35
+ end
36
+ end
37
+
38
+ include Glimmer
39
+
40
+ def launch
41
+ person = Person.new
42
+
43
+ shell {
44
+ text 'Hello, Checkbox!'
45
+ row_layout :vertical
46
+
47
+ label {
48
+ text 'Check all snow activities you are interested in:'
49
+ font style: :bold
50
+ }
51
+
52
+ composite {
53
+ checkbox {
54
+ text 'Skiing'
55
+ selection bind(person, :skiing)
56
+ }
57
+
58
+ checkbox {
59
+ text 'Snowboarding'
60
+ selection bind(person, :snowboarding)
61
+ }
62
+
63
+ checkbox {
64
+ text 'Snowmobiling'
65
+ selection bind(person, :snowmobiling)
66
+ }
67
+
68
+ checkbox {
69
+ text 'Snowshoeing'
70
+ selection bind(person, :snowshoeing)
71
+ }
72
+ }
73
+
74
+ button {
75
+ text 'Reset Activities'
76
+
77
+ on_widget_selected do
78
+ person.reset_activities
79
+ end
80
+ }
81
+ }.open
82
+ end
83
+ end
84
+
85
+ HelloCheckbox.new.launch
@@ -0,0 +1,68 @@
1
+ # Copyright (c) 2007-2020 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 HelloCheckboxGroup
23
+ class Person
24
+ attr_accessor :activities
25
+
26
+ def initialize
27
+ reset_activities
28
+ end
29
+
30
+ def activities_options
31
+ ['Skiing', 'Snowboarding', 'Snowmobiling', 'Snowshoeing']
32
+ end
33
+
34
+ def reset_activities
35
+ self.activities = ['Snowboarding']
36
+ end
37
+ end
38
+
39
+ include Glimmer
40
+
41
+ def launch
42
+ person = Person.new
43
+
44
+ shell {
45
+ text 'Hello, Checkbox Group!'
46
+ row_layout :vertical
47
+
48
+ label {
49
+ text 'Check all snow activities you are interested in:'
50
+ font style: :bold
51
+ }
52
+
53
+ checkbox_group {
54
+ selection bind(person, :activities)
55
+ }
56
+
57
+ button {
58
+ text 'Reset Activities'
59
+
60
+ on_widget_selected do
61
+ person.reset_activities
62
+ end
63
+ }
64
+ }.open
65
+ end
66
+ end
67
+
68
+ HelloCheckboxGroup.new.launch
@@ -19,20 +19,20 @@
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
- class Person
23
- attr_accessor :country, :country_options
24
-
25
- def initialize
26
- self.country_options = ['', 'Canada', 'US', 'Mexico']
27
- reset_country
28
- end
29
-
30
- def reset_country
31
- self.country = 'Canada'
22
+ class HelloCombo
23
+ class Person
24
+ attr_accessor :country, :country_options
25
+
26
+ def initialize
27
+ self.country_options = ['', 'Canada', 'US', 'Mexico']
28
+ reset_country
29
+ end
30
+
31
+ def reset_country
32
+ self.country = 'Canada'
33
+ end
32
34
  end
33
- end
34
35
 
35
- class HelloCombo
36
36
  include Glimmer
37
37
 
38
38
  def launch
@@ -0,0 +1,110 @@
1
+ # Copyright (c) 2007-2020 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 HelloExpandBar
23
+ include Glimmer
24
+
25
+ def launch
26
+ shell {
27
+ grid_layout(1, false) {
28
+ margin_width 0
29
+ margin_height 0
30
+ }
31
+ minimum_size 320, 240
32
+ text 'Hello, Expand Bar!'
33
+
34
+ @status_label = label(:center) {
35
+ text ' '
36
+ layout_data :fill, :center, true, false
37
+ font height: 24
38
+ }
39
+
40
+ expand_bar {
41
+ layout_data :fill, :fill, true, true
42
+
43
+ expand_item {
44
+ text 'Productivity'
45
+
46
+ button {
47
+ text 'Word Processing'
48
+ }
49
+ button {
50
+ text 'Spreadsheets'
51
+ }
52
+ button {
53
+ text 'Presentations'
54
+ }
55
+ button {
56
+ text 'Database'
57
+ }
58
+ composite # just filler
59
+ }
60
+
61
+ expand_item {
62
+ text 'Tools'
63
+
64
+ button {
65
+ text 'Calculator'
66
+ }
67
+ button {
68
+ text 'Unit Converter'
69
+ }
70
+ button {
71
+ text 'Currency Converter'
72
+ }
73
+ button {
74
+ text 'Scientific Calculator'
75
+ }
76
+ composite # just filler
77
+ }
78
+
79
+ expand_item {
80
+ text 'Reading'
81
+
82
+ button {
83
+ text 'eBooks'
84
+ }
85
+ button {
86
+ text 'News'
87
+ }
88
+ button {
89
+ text 'Blogs'
90
+ }
91
+ button {
92
+ text 'Papers'
93
+ }
94
+ composite # just filler
95
+ }
96
+
97
+ on_item_expanded { |expand_event|
98
+ @status_label.text = "#{expand_event.item.text} Expanded!"
99
+ }
100
+
101
+ on_item_collapsed { |expand_event|
102
+ @status_label.text = "#{expand_event.item.text} Collapsed!"
103
+ }
104
+
105
+ }
106
+ }.open
107
+ end
108
+ end
109
+
110
+ HelloExpandBar.new.launch
@@ -19,30 +19,30 @@
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
- class Person
23
- attr_accessor :provinces, :provinces_options
24
-
25
- def initialize
26
- self.provinces_options=[
27
- "",
28
- "Quebec",
29
- "Ontario",
30
- "Manitoba",
31
- "Saskatchewan",
32
- "Alberta",
33
- "British Columbia",
34
- "Nova Skotia",
35
- "Newfoundland"
36
- ]
37
- self.provinces = ["Quebec", "Manitoba", "Alberta"]
38
- end
39
-
40
- def reset_provinces
41
- self.provinces = ["Quebec", "Manitoba", "Alberta"]
42
- end
43
- end
44
-
45
22
  class HelloListMultiSelection
23
+ class Person
24
+ attr_accessor :provinces, :provinces_options
25
+
26
+ def initialize
27
+ self.provinces_options=[
28
+ "",
29
+ "Quebec",
30
+ "Ontario",
31
+ "Manitoba",
32
+ "Saskatchewan",
33
+ "Alberta",
34
+ "British Columbia",
35
+ "Nova Skotia",
36
+ "Newfoundland"
37
+ ]
38
+ self.provinces = ["Quebec", "Manitoba", "Alberta"]
39
+ end
40
+
41
+ def reset_provinces
42
+ self.provinces = ["Quebec", "Manitoba", "Alberta"]
43
+ end
44
+ end
45
+
46
46
  include Glimmer
47
47
 
48
48
  def launch
@@ -19,21 +19,22 @@
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
- class Person
23
- attr_accessor :country, :country_options
24
-
25
- def initialize
26
- self.country_options=["", "Canada", "US", "Mexico"]
27
- self.country = "Canada"
28
- end
29
-
30
- def reset_country
31
- self.country = "Canada"
32
- end
33
- end
34
-
35
22
  class HelloListSingleSelection
23
+ class Person
24
+ attr_accessor :country, :country_options
25
+
26
+ def initialize
27
+ self.country_options=["", "Canada", "US", "Mexico"]
28
+ self.country = "Canada"
29
+ end
30
+
31
+ def reset_country
32
+ self.country = "Canada"
33
+ end
34
+ end
35
+
36
36
  include Glimmer
37
+
37
38
  def launch
38
39
  person = Person.new
39
40
 
@@ -0,0 +1,108 @@
1
+ # Copyright (c) 2007-2020 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 HelloRadio
23
+ class Person
24
+ attr_accessor :male, :female, :child, :teen, :adult, :senior
25
+
26
+ def initialize
27
+ reset
28
+ end
29
+
30
+ def reset
31
+ self.male = nil
32
+ self.female = nil
33
+ self.child = nil
34
+ self.teen = nil
35
+ self.adult = true
36
+ self.senior = nil
37
+ end
38
+ end
39
+
40
+ include Glimmer
41
+
42
+ def launch
43
+ person = Person.new
44
+
45
+ shell {
46
+ text 'Hello, Radio!'
47
+ row_layout :vertical
48
+
49
+ label {
50
+ text 'Gender:'
51
+ font style: :bold
52
+ }
53
+
54
+ composite {
55
+ row_layout
56
+
57
+ radio {
58
+ text 'Male'
59
+ selection bind(person, :male)
60
+ }
61
+
62
+ radio {
63
+ text 'Female'
64
+ selection bind(person, :female)
65
+ }
66
+ }
67
+
68
+ label {
69
+ text 'Age Group:'
70
+ font style: :bold
71
+ }
72
+
73
+ composite {
74
+ row_layout
75
+
76
+ radio {
77
+ text 'Child'
78
+ selection bind(person, :child)
79
+ }
80
+
81
+ radio {
82
+ text 'Teen'
83
+ selection bind(person, :teen)
84
+ }
85
+
86
+ radio {
87
+ text 'Adult'
88
+ selection bind(person, :adult)
89
+ }
90
+
91
+ radio {
92
+ text 'Senior'
93
+ selection bind(person, :senior)
94
+ }
95
+ }
96
+
97
+ button {
98
+ text 'Reset'
99
+
100
+ on_widget_selected do
101
+ person.reset
102
+ end
103
+ }
104
+ }.open
105
+ end
106
+ end
107
+
108
+ HelloRadio.new.launch