glimmer-dsl-swt 4.17.10.7 → 4.18.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +42 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.md +508 -60
  5. data/RUBY_VERSION +1 -1
  6. data/VERSION +1 -1
  7. data/bin/girb +1 -1
  8. data/bin/girb_runner.rb +1 -1
  9. data/bin/glimmer +1 -1
  10. data/glimmer-dsl-swt.gemspec +58 -30
  11. data/lib/ext/glimmer.rb +1 -1
  12. data/lib/ext/glimmer/config.rb +7 -7
  13. data/lib/glimmer-dsl-swt.rb +3 -1
  14. data/lib/glimmer/Rakefile +1 -1
  15. data/lib/glimmer/data_binding/list_selection_binding.rb +1 -1
  16. data/lib/glimmer/data_binding/observable_widget.rb +1 -1
  17. data/lib/glimmer/data_binding/shine.rb +1 -1
  18. data/lib/glimmer/data_binding/table_items_binding.rb +1 -1
  19. data/lib/glimmer/data_binding/tree_items_binding.rb +1 -1
  20. data/lib/glimmer/data_binding/widget_binding.rb +1 -1
  21. data/lib/glimmer/dsl/swt/animation_expression.rb +43 -0
  22. data/lib/glimmer/dsl/swt/async_exec_expression.rb +1 -1
  23. data/lib/glimmer/dsl/swt/bind_expression.rb +1 -1
  24. data/lib/glimmer/dsl/swt/block_property_expression.rb +1 -1
  25. data/lib/glimmer/dsl/swt/checkbox_group_selection_data_binding_expression.rb +1 -1
  26. data/lib/glimmer/dsl/swt/color_expression.rb +1 -1
  27. data/lib/glimmer/dsl/swt/column_properties_expression.rb +1 -1
  28. data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +1 -1
  29. data/lib/glimmer/dsl/swt/cursor_expression.rb +1 -1
  30. data/lib/glimmer/dsl/swt/custom_widget_expression.rb +1 -1
  31. data/lib/glimmer/dsl/swt/data_binding_expression.rb +1 -1
  32. data/lib/glimmer/dsl/swt/dialog_expression.rb +1 -1
  33. data/lib/glimmer/dsl/swt/directory_dialog_expression.rb +1 -1
  34. data/lib/glimmer/dsl/swt/display_expression.rb +1 -1
  35. data/lib/glimmer/dsl/swt/dnd_expression.rb +1 -1
  36. data/lib/glimmer/dsl/swt/dsl.rb +5 -4
  37. data/lib/glimmer/dsl/swt/exec_expression.rb +5 -5
  38. data/lib/glimmer/dsl/swt/expand_item_expression.rb +1 -1
  39. data/lib/glimmer/dsl/swt/file_dialog_expression.rb +1 -1
  40. data/lib/glimmer/dsl/swt/font_expression.rb +8 -6
  41. data/lib/glimmer/dsl/swt/image_expression.rb +1 -1
  42. data/lib/glimmer/dsl/swt/layout_data_expression.rb +1 -1
  43. data/lib/glimmer/dsl/swt/layout_expression.rb +1 -1
  44. data/lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb +1 -1
  45. data/lib/glimmer/dsl/swt/menu_bar_expression.rb +1 -1
  46. data/lib/glimmer/dsl/swt/menu_expression.rb +1 -1
  47. data/lib/glimmer/dsl/swt/message_box_expression.rb +1 -1
  48. data/lib/glimmer/dsl/swt/observe_expression.rb +1 -1
  49. data/lib/glimmer/dsl/swt/property_expression.rb +4 -4
  50. data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +1 -1
  51. data/lib/glimmer/dsl/swt/rgb_expression.rb +1 -1
  52. data/lib/glimmer/dsl/swt/rgba_expression.rb +1 -1
  53. data/lib/glimmer/dsl/swt/shape_expression.rb +56 -0
  54. data/lib/glimmer/dsl/swt/shell_expression.rb +1 -1
  55. data/lib/glimmer/dsl/swt/swt_expression.rb +1 -1
  56. data/lib/glimmer/dsl/swt/sync_exec_expression.rb +1 -1
  57. data/lib/glimmer/dsl/swt/tab_item_expression.rb +1 -1
  58. data/lib/glimmer/dsl/swt/table_items_data_binding_expression.rb +1 -1
  59. data/lib/glimmer/dsl/swt/tree_items_data_binding_expression.rb +1 -1
  60. data/lib/glimmer/dsl/swt/tree_properties_expression.rb +1 -1
  61. data/lib/glimmer/dsl/swt/widget_expression.rb +7 -3
  62. data/lib/glimmer/dsl/swt/widget_listener_expression.rb +1 -1
  63. data/lib/glimmer/launcher.rb +1 -1
  64. data/lib/glimmer/rake_task.rb +1 -1
  65. data/lib/glimmer/rake_task/list.rb +1 -1
  66. data/lib/glimmer/rake_task/package.rb +1 -1
  67. data/lib/glimmer/rake_task/scaffold.rb +1 -1
  68. data/lib/glimmer/swt/color_proxy.rb +1 -1
  69. data/lib/glimmer/swt/cursor_proxy.rb +1 -1
  70. data/lib/glimmer/swt/custom/animation.rb +116 -0
  71. data/lib/glimmer/swt/custom/checkbox_group.rb +1 -1
  72. data/lib/glimmer/swt/custom/drawable.rb +43 -0
  73. data/lib/glimmer/swt/custom/radio_group.rb +1 -1
  74. data/lib/glimmer/swt/custom/shape.rb +135 -0
  75. data/lib/glimmer/swt/date_time_proxy.rb +1 -1
  76. data/lib/glimmer/swt/directory_dialog_proxy.rb +1 -1
  77. data/lib/glimmer/swt/display_proxy.rb +16 -1
  78. data/lib/glimmer/swt/dnd_proxy.rb +1 -1
  79. data/lib/glimmer/swt/expand_item_proxy.rb +1 -1
  80. data/lib/glimmer/swt/file_dialog_proxy.rb +1 -1
  81. data/lib/glimmer/swt/font_proxy.rb +4 -4
  82. data/lib/glimmer/swt/image_proxy.rb +12 -11
  83. data/lib/glimmer/swt/layout_data_proxy.rb +1 -1
  84. data/lib/glimmer/swt/layout_proxy.rb +8 -4
  85. data/lib/glimmer/swt/menu_proxy.rb +10 -5
  86. data/lib/glimmer/swt/message_box_proxy.rb +1 -1
  87. data/lib/glimmer/swt/packages.rb +1 -1
  88. data/lib/glimmer/swt/properties.rb +49 -0
  89. data/lib/glimmer/swt/sash_form_proxy.rb +2 -2
  90. data/lib/glimmer/swt/scrolled_composite_proxy.rb +1 -1
  91. data/lib/glimmer/swt/shell_proxy.rb +3 -2
  92. data/lib/glimmer/swt/style_constantizable.rb +9 -5
  93. data/lib/glimmer/swt/styled_text_proxy.rb +1 -1
  94. data/lib/glimmer/swt/swt_proxy.rb +1 -1
  95. data/lib/glimmer/swt/tab_item_proxy.rb +1 -1
  96. data/lib/glimmer/swt/table_column_proxy.rb +1 -1
  97. data/lib/glimmer/swt/table_proxy.rb +1 -1
  98. data/lib/glimmer/swt/tree_proxy.rb +26 -22
  99. data/lib/glimmer/swt/widget_listener_proxy.rb +1 -1
  100. data/lib/glimmer/swt/widget_proxy.rb +54 -28
  101. data/lib/glimmer/ui/custom_shell.rb +1 -1
  102. data/lib/glimmer/ui/custom_widget.rb +1 -1
  103. data/lib/glimmer/util/proc_tracker.rb +1 -1
  104. data/samples/elaborate/contact_manager.rb +1 -1
  105. data/samples/elaborate/contact_manager/contact.rb +1 -1
  106. data/samples/elaborate/contact_manager/contact_manager_presenter.rb +1 -1
  107. data/samples/elaborate/contact_manager/contact_repository.rb +1 -1
  108. data/samples/elaborate/login.rb +1 -1
  109. data/samples/elaborate/meta_sample.rb +80 -20
  110. data/samples/elaborate/tic_tac_toe.rb +2 -2
  111. data/samples/elaborate/tic_tac_toe/board.rb +1 -1
  112. data/samples/elaborate/tic_tac_toe/cell.rb +1 -1
  113. data/samples/elaborate/user_profile.rb +1 -1
  114. data/samples/hello/hello_browser.rb +3 -1
  115. data/samples/hello/hello_button.rb +1 -1
  116. data/samples/hello/hello_canvas.rb +62 -0
  117. data/samples/hello/hello_canvas_animation.rb +66 -0
  118. data/samples/hello/hello_checkbox.rb +1 -1
  119. data/samples/hello/hello_checkbox_group.rb +1 -1
  120. data/samples/hello/hello_combo.rb +1 -1
  121. data/samples/hello/hello_computed.rb +10 -4
  122. data/samples/hello/hello_computed/contact.rb +1 -1
  123. data/samples/hello/hello_custom_shell.rb +1 -1
  124. data/samples/hello/hello_custom_widget.rb +1 -1
  125. data/samples/hello/hello_date_time.rb +1 -1
  126. data/samples/hello/hello_dialog.rb +78 -0
  127. data/samples/hello/hello_directory_dialog.rb +1 -1
  128. data/samples/hello/hello_drag_and_drop.rb +1 -1
  129. data/samples/hello/hello_expand_bar.rb +1 -1
  130. data/samples/hello/hello_file_dialog.rb +1 -1
  131. data/samples/hello/hello_group.rb +1 -1
  132. data/samples/hello/hello_link.rb +1 -1
  133. data/samples/hello/hello_list_multi_selection.rb +1 -1
  134. data/samples/hello/hello_list_single_selection.rb +1 -1
  135. data/samples/hello/hello_menu_bar.rb +185 -29
  136. data/samples/hello/hello_message_box.rb +10 -9
  137. data/samples/hello/hello_pop_up_context_menu.rb +34 -7
  138. data/samples/hello/hello_radio.rb +1 -1
  139. data/samples/hello/hello_radio_group.rb +1 -1
  140. data/samples/hello/hello_sash_form.rb +1 -1
  141. data/samples/hello/hello_spinner.rb +1 -1
  142. data/samples/hello/hello_styled_text.rb +1 -1
  143. data/samples/hello/hello_tab.rb +1 -1
  144. data/samples/hello/hello_table.rb +1 -1
  145. data/samples/hello/hello_world.rb +1 -1
  146. data/vendor/swt/linux/swt.jar +0 -0
  147. data/vendor/swt/mac/swt.jar +0 -0
  148. data/vendor/swt/windows/swt.jar +0 -0
  149. metadata +54 -32
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2020 Andy Maleh
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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2020 Andy Maleh
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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2020 Andy Maleh
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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2020 Andy Maleh
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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2020 Andy Maleh
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
@@ -1,4 +1,9 @@
1
+ require 'fileutils'
2
+ require 'etc'
3
+
1
4
  class Sample
5
+ include Glimmer::DataBinding::ObservableModel
6
+
2
7
  attr_accessor :sample_directory, :file, :selected
3
8
 
4
9
  def initialize(file, sample_directory: )
@@ -19,12 +24,39 @@ class Sample
19
24
  @name
20
25
  end
21
26
 
22
- def content
23
- @content = File.read(file)
27
+ def code
28
+ reset_code! if @code.nil?
29
+ @code
24
30
  end
25
-
26
- def launch
27
- load file
31
+
32
+ def reset_code!
33
+ @code = File.read(file)
34
+ notify_observers('code')
35
+ end
36
+
37
+ def editable
38
+ File.basename(file) != 'meta_sample.rb'
39
+ end
40
+ alias launchable editable
41
+
42
+ def launch(modified_code)
43
+ parent_directory = File.basename(File.dirname(file))
44
+ modified_file_parent_directory = File.join(Etc.getpwuid.dir, '.glimmer', 'samples', parent_directory)
45
+ launch_file = modified_file = File.join(modified_file_parent_directory, File.basename(file))
46
+ begin
47
+ FileUtils.mkdir_p(modified_file_parent_directory)
48
+ FileUtils.cp_r(file, modified_file_parent_directory)
49
+ FileUtils.cp_r(file.sub(/\.rb/, ''), modified_file_parent_directory) if File.exist?(file.sub(/\.rb/, ''))
50
+ File.write(modified_file, modified_code)
51
+ rescue => e
52
+ puts 'Error writing sample modifications. Launching original sample.'
53
+ puts e.full_message
54
+ launch_file = file # load original file if failed to write changes
55
+ end
56
+ load(launch_file)
57
+ ensure
58
+ FileUtils.rm_rf(modified_file)
59
+ FileUtils.rm_rf(modified_file.sub(/\.rb/, ''))
28
60
  end
29
61
  end
30
62
 
@@ -111,18 +143,25 @@ end
111
143
  class MetaSampleApplication
112
144
  include Glimmer
113
145
 
146
+ def initialize
147
+ selected_sample_directory = SampleDirectory.sample_directories.first
148
+ selected_sample = selected_sample_directory.samples.first
149
+ selected_sample_directory.selected_sample_name = selected_sample.name
150
+ end
151
+
114
152
  def launch
153
+ Display.setAppName('Glimmer Meta-Sample')
115
154
  shell {
116
155
  minimum_size 1280, 768
117
156
  text 'Glimmer Meta-Sample (The Sample of Samples)'
118
-
119
- on_swt_show {
120
- SampleDirectory.selected_sample = SampleDirectory.all_samples.first
121
- }
157
+ image File.expand_path('../../icons/scaffold_app.png', __dir__)
122
158
 
123
159
  sash_form {
124
160
  composite {
125
- grid_layout 1, false
161
+ grid_layout(1, false) {
162
+ margin_width 0
163
+ margin_height 0
164
+ }
126
165
 
127
166
  expand_bar {
128
167
  layout_data(:fill, :fill, true, true)
@@ -131,7 +170,7 @@ class MetaSampleApplication
131
170
  SampleDirectory.sample_directories.each { |sample_directory|
132
171
  expand_item {
133
172
  layout_data(:fill, :fill, true, true)
134
- text "#{sample_directory.name} Samples"
173
+ text " #{sample_directory.name} Samples"
135
174
 
136
175
  radio_group { |radio_group_proxy|
137
176
  row_layout(:vertical) {
@@ -144,22 +183,43 @@ class MetaSampleApplication
144
183
  }
145
184
  }
146
185
 
147
- button {
186
+ composite {
187
+ fill_layout
148
188
  layout_data(:fill, :center, true, false) {
149
189
  height_hint 120
150
190
  }
151
- text 'Launch Sample'
152
- font height: 30
153
- on_widget_selected {
154
- SampleDirectory.selected_sample.launch
191
+
192
+ button {
193
+ text 'Launch'
194
+ font height: 30
195
+ enabled bind(SampleDirectory, 'selected_sample.launchable')
196
+
197
+ on_widget_selected {
198
+ begin
199
+ SampleDirectory.selected_sample.launch(@code_text.text)
200
+ rescue StandardError, SyntaxError => launch_error
201
+ message_box {
202
+ text 'Error Launching'
203
+ message launch_error.full_message
204
+ }.open
205
+ end
206
+ }
207
+ }
208
+ button {
209
+ text 'Reset'
210
+ font height: 30
211
+ enabled bind(SampleDirectory, 'selected_sample.editable')
212
+
213
+ on_widget_selected {
214
+ SampleDirectory.selected_sample.reset_code!
215
+ }
155
216
  }
156
217
  }
157
218
  }
158
219
 
159
- code_text {
160
- text bind(SampleDirectory, 'selected_sample.content')
161
- editable false
162
- caret nil
220
+ @code_text = code_text {
221
+ text bind(SampleDirectory, 'selected_sample.code', read_only: true)
222
+ editable bind(SampleDirectory, 'selected_sample.editable')
163
223
  }
164
224
 
165
225
  weights 4, 9
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2020 Andy Maleh
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
@@ -61,7 +61,7 @@ class TicTacToe
61
61
  end
62
62
 
63
63
  def display_game_over_message(message_text)
64
- message_box(@shell) {
64
+ message_box {
65
65
  text 'Game Over'
66
66
  message message_text
67
67
  }.open
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2020 Andy Maleh
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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2020 Andy Maleh
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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2020 Andy Maleh
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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2020 Andy Maleh
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
@@ -22,7 +22,9 @@
22
22
  include Glimmer
23
23
 
24
24
  shell {
25
+ text 'Hello, Browser!'
25
26
  minimum_size 1024, 860
27
+
26
28
  browser {
27
29
  url 'https://brightonresort.com/about'
28
30
  }
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2020 Andy Maleh
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
@@ -0,0 +1,62 @@
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
+ include Glimmer
23
+
24
+ shell {
25
+ text 'Hello, Canvas!'
26
+ minimum_size 320, 400
27
+
28
+ canvas {
29
+ background :yellow
30
+ rectangle(0, 0, 220, 400, fill: true) {
31
+ background :red
32
+ }
33
+ round_rectangle(50, 20, 300, 150, 30, 50, fill: true) {
34
+ background :magenta
35
+ }
36
+ gradient_rectangle(150, 200, 100, 70, true, fill: true) {
37
+ background :dark_magenta
38
+ foreground :yellow
39
+ }
40
+ gradient_rectangle(50, 200, 30, 70, false, fill: true) {
41
+ background :magenta
42
+ foreground :dark_blue
43
+ }
44
+ rectangle(200, 80, 108, 36) {
45
+ foreground color(:dark_blue)
46
+ }
47
+ text('Picasso', 60, 80) {
48
+ background :yellow
49
+ foreground :dark_magenta
50
+ font name: 'Courier', height: 30
51
+ }
52
+ oval(110, 310, 100, 100, fill: true) {
53
+ background rgb(128, 138, 248)
54
+ }
55
+ arc(210, 210, 100, 100, 30, -77, fill: true) {
56
+ background :red
57
+ }
58
+ polygon([250, 210, 260, 170, 270, 210, 290, 230, 250, 210]) {
59
+ background :dark_yellow
60
+ }
61
+ }
62
+ }.open
@@ -0,0 +1,66 @@
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
+ include Glimmer
23
+
24
+ shell {
25
+ text 'Hello, Canvas Animation!'
26
+ minimum_size 800, 420
27
+
28
+ canvas {
29
+ animation {
30
+ every 0.01 # in seconds (one hundredth)
31
+
32
+ frame { |index| # frame block loops indefinitely (unless frame_count is set to an integer)
33
+ background rgb(index%255, 100, 200) # sets canvas background color
34
+
35
+ oval(0, 0, 400, 400) { # x, y, width, height
36
+ foreground :black # sets oval background color
37
+ }
38
+ arc(0, 0, 400, 400, -1*index%360, 10, fill: true) { # x, y, width, height, start angle, arc angle
39
+ background rgb(200, 200, 50) # sets arc background color
40
+ }
41
+ }
42
+ }
43
+ }
44
+
45
+ canvas {
46
+ colors = [:yellow, :red]
47
+ animation {
48
+ every 0.25 # in seconds (one quarter)
49
+ cycle colors # cycles array of colors into the second variable of the frame block below
50
+
51
+ frame { |index, color| # frame block loops indefinitely (unless frame_count or cycle_count is set to an integer)
52
+ outside_color = colors[index % 2]
53
+ inside_color = colors[(index + 1) % 2]
54
+
55
+ background outside_color # sets canvas background color
56
+
57
+ rectangle(0, 0, 200, 200, fill: true) {
58
+ background inside_color # sets rectangle background color
59
+ }
60
+ rectangle(200, 200, 200, 200, fill: true) {
61
+ background inside_color # sets rectangle background color
62
+ }
63
+ }
64
+ }
65
+ }
66
+ }.open
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2020 Andy Maleh
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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2020 Andy Maleh
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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2020 Andy Maleh
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
@@ -1,5 +1,5 @@
1
- # Copyright (c) 2007-2020 Andy Maleh
2
- #
1
+ # Copyright (c) 2007-2021 Andy Maleh
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
@@ -35,6 +35,7 @@ class HelloComputed
35
35
  def launch
36
36
  shell {
37
37
  text 'Hello, Computed!'
38
+
38
39
  composite {
39
40
  grid_layout {
40
41
  num_columns 2
@@ -42,6 +43,7 @@ class HelloComputed
42
43
  horizontal_spacing 20
43
44
  vertical_spacing 10
44
45
  }
46
+
45
47
  label {text 'First &Name: '}
46
48
  text {
47
49
  text bind(@contact, :first_name)
@@ -50,6 +52,7 @@ class HelloComputed
50
52
  grab_excess_horizontal_space true
51
53
  }
52
54
  }
55
+
53
56
  label {text '&Last Name: '}
54
57
  text {
55
58
  text bind(@contact, :last_name)
@@ -58,6 +61,7 @@ class HelloComputed
58
61
  grab_excess_horizontal_space true
59
62
  }
60
63
  }
64
+
61
65
  label {text '&Year of Birth: '}
62
66
  text {
63
67
  text bind(@contact, :year_of_birth)
@@ -66,6 +70,7 @@ class HelloComputed
66
70
  grab_excess_horizontal_space true
67
71
  }
68
72
  }
73
+
69
74
  label {text 'Name: '}
70
75
  label {
71
76
  text bind(@contact, :name, computed_by: [:first_name, :last_name])
@@ -74,6 +79,7 @@ class HelloComputed
74
79
  grab_excess_horizontal_space true
75
80
  }
76
81
  }
82
+
77
83
  label {text 'Age: '}
78
84
  label {
79
85
  text bind(@contact, :age, on_write: :to_i, computed_by: [:year_of_birth])