glimmer-dsl-swt 4.20.13.6 → 4.20.13.10

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 (74) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/README.md +5 -5
  4. data/VERSION +1 -1
  5. data/docs/reference/GLIMMER_SAMPLES.md +13 -0
  6. data/docs/reference/GLIMMER_STYLE_GUIDE.md +2 -1
  7. data/glimmer-dsl-swt.gemspec +0 -0
  8. data/lib/glimmer/rake_task/scaffold.rb +14 -14
  9. data/lib/glimmer/swt/custom/code_text.rb +4 -4
  10. data/lib/glimmer/swt/custom/shape.rb +1 -1
  11. data/lib/glimmer/swt/image_proxy.rb +1 -1
  12. data/samples/elaborate/calculator.rb +2 -2
  13. data/samples/elaborate/contact_manager.rb +2 -2
  14. data/samples/elaborate/klondike_solitaire.rb +93 -0
  15. data/samples/elaborate/klondike_solitaire/model/column_pile.rb +60 -0
  16. data/samples/elaborate/klondike_solitaire/model/dealing_pile.rb +33 -0
  17. data/samples/elaborate/klondike_solitaire/model/dealt_pile.rb +25 -0
  18. data/samples/elaborate/klondike_solitaire/model/foundation_pile.rb +40 -0
  19. data/samples/elaborate/klondike_solitaire/model/game.rb +37 -0
  20. data/samples/elaborate/klondike_solitaire/model/playing_card.rb +86 -0
  21. data/samples/elaborate/klondike_solitaire/view/action_panel.rb +30 -0
  22. data/samples/elaborate/klondike_solitaire/view/column_pile.rb +66 -0
  23. data/samples/elaborate/klondike_solitaire/view/dealing_pile.rb +36 -0
  24. data/samples/elaborate/klondike_solitaire/view/dealt_pile.rb +38 -0
  25. data/samples/elaborate/klondike_solitaire/view/empty_playing_card.rb +33 -0
  26. data/samples/elaborate/klondike_solitaire/view/foundation_pile.rb +59 -0
  27. data/samples/elaborate/klondike_solitaire/view/hidden_playing_card.rb +26 -0
  28. data/samples/elaborate/klondike_solitaire/view/playing_card.rb +35 -0
  29. data/samples/elaborate/klondike_solitaire/view/tableau.rb +41 -0
  30. data/samples/elaborate/login.rb +2 -2
  31. data/samples/elaborate/mandelbrot_fractal.rb +12 -12
  32. data/samples/elaborate/meta_sample.rb +2 -2
  33. data/samples/elaborate/metronome.rb +2 -2
  34. data/samples/elaborate/stock_ticker.rb +8 -8
  35. data/samples/elaborate/tetris.rb +4 -4
  36. data/samples/elaborate/tetris/view/bevel.rb +2 -2
  37. data/samples/elaborate/tetris/view/score_lane.rb +2 -2
  38. data/samples/elaborate/tic_tac_toe.rb +6 -6
  39. data/samples/elaborate/timer.rb +4 -4
  40. data/samples/elaborate/weather.rb +4 -4
  41. data/samples/hello/hello_button.rb +2 -2
  42. data/samples/hello/hello_c_combo.rb +2 -2
  43. data/samples/hello/hello_canvas.rb +4 -4
  44. data/samples/hello/hello_canvas_animation.rb +2 -2
  45. data/samples/hello/hello_canvas_data_binding.rb +2 -2
  46. data/samples/hello/hello_checkbox.rb +2 -2
  47. data/samples/hello/hello_checkbox_group.rb +2 -2
  48. data/samples/hello/hello_code_text.rb +2 -2
  49. data/samples/hello/hello_color_dialog.rb +2 -2
  50. data/samples/hello/hello_combo.rb +2 -2
  51. data/samples/hello/hello_computed.rb +14 -22
  52. data/samples/hello/hello_cool_bar.rb +2 -2
  53. data/samples/hello/hello_cursor.rb +2 -2
  54. data/samples/hello/hello_custom_shape.rb +2 -2
  55. data/samples/hello/hello_custom_shell.rb +2 -2
  56. data/samples/hello/hello_custom_widget.rb +4 -4
  57. data/samples/hello/hello_date_time.rb +2 -2
  58. data/samples/hello/hello_directory_dialog.rb +2 -2
  59. data/samples/hello/hello_file_dialog.rb +2 -2
  60. data/samples/hello/hello_font_dialog.rb +2 -2
  61. data/samples/hello/hello_group.rb +2 -2
  62. data/samples/hello/hello_list_multi_selection.rb +2 -2
  63. data/samples/hello/hello_list_single_selection.rb +2 -2
  64. data/samples/hello/hello_progress_bar.rb +2 -2
  65. data/samples/hello/hello_radio.rb +2 -2
  66. data/samples/hello/hello_radio_group.rb +2 -2
  67. data/samples/hello/hello_scale.rb +2 -2
  68. data/samples/hello/hello_spinner.rb +2 -2
  69. data/samples/hello/hello_table.rb +2 -2
  70. data/samples/hello/hello_text.rb +2 -2
  71. data/samples/hello/hello_tool_bar.rb +2 -2
  72. data/samples/hello/hello_tray_item.rb +2 -2
  73. data/samples/hello/hello_tree.rb +4 -4
  74. metadata +18 -2
@@ -39,9 +39,9 @@ class HelloCheckbox
39
39
 
40
40
  include Glimmer::UI::CustomShell
41
41
 
42
- before_body {
42
+ before_body do
43
43
  @person = Person.new
44
- }
44
+ end
45
45
 
46
46
  body {
47
47
  shell {
@@ -43,9 +43,9 @@ class HelloCheckboxGroup
43
43
 
44
44
  include Glimmer::UI::CustomShell
45
45
 
46
- before_body {
46
+ before_body do
47
47
  @person = Person.new
48
- }
48
+ end
49
49
 
50
50
  body {
51
51
  shell {
@@ -26,7 +26,7 @@ class HelloCodeText
26
26
 
27
27
  attr_accessor :ruby_code, :js_code, :html_code
28
28
 
29
- before_body {
29
+ before_body do
30
30
  self.ruby_code = <<~RUBY
31
31
  greeting = 'Hello, World!'
32
32
 
@@ -73,7 +73,7 @@ class HelloCodeText
73
73
  </body>
74
74
  </html>
75
75
  HTML
76
- }
76
+ end
77
77
 
78
78
  body {
79
79
  shell {
@@ -26,9 +26,9 @@ class HelloColorDialog
26
26
 
27
27
  attr_accessor :selected_color
28
28
 
29
- before_body {
29
+ before_body do
30
30
  self.selected_color = :black
31
- }
31
+ end
32
32
 
33
33
  body {
34
34
  shell {
@@ -37,9 +37,9 @@ class HelloCombo
37
37
 
38
38
  include Glimmer::UI::CustomShell
39
39
 
40
- before_body {
40
+ before_body do
41
41
  @person = Person.new
42
- }
42
+ end
43
43
 
44
44
  body {
45
45
  shell {
@@ -44,13 +44,13 @@ class HelloComputed
44
44
 
45
45
  include Glimmer::UI::CustomShell
46
46
 
47
- before_body {
47
+ before_body do
48
48
  @contact = Contact.new(
49
49
  first_name: 'Barry',
50
50
  last_name: 'McKibbin',
51
51
  year_of_birth: 1985
52
52
  )
53
- }
53
+ end
54
54
 
55
55
  body {
56
56
  shell {
@@ -66,51 +66,43 @@ class HelloComputed
66
66
 
67
67
  label {text 'First &Name: '}
68
68
  text {
69
+ fill_horizontally_layout_data
69
70
  text <=> [@contact, :first_name]
70
- layout_data {
71
- horizontal_alignment :fill
72
- grab_excess_horizontal_space true
73
- }
74
71
  }
75
72
 
76
73
  label {text '&Last Name: '}
77
74
  text {
75
+ fill_horizontally_layout_data
78
76
  text <=> [@contact, :last_name]
79
- layout_data {
80
- horizontal_alignment :fill
81
- grab_excess_horizontal_space true
82
- }
83
77
  }
84
78
 
85
79
  label {text '&Year of Birth: '}
86
80
  text {
81
+ fill_horizontally_layout_data
87
82
  text <=> [@contact, :year_of_birth]
88
- layout_data {
89
- horizontal_alignment :fill
90
- grab_excess_horizontal_space true
91
- }
92
83
  }
93
84
 
94
85
  label {text 'Name: '}
95
86
  label {
87
+ fill_horizontally_layout_data
96
88
  text <= [@contact, :name, computed_by: [:first_name, :last_name]]
97
- layout_data {
98
- horizontal_alignment :fill
99
- grab_excess_horizontal_space true
100
- }
101
89
  }
102
90
 
103
91
  label {text 'Age: '}
104
92
  label {
93
+ fill_horizontally_layout_data
105
94
  text <= [@contact, :age, on_write: :to_i, computed_by: [:year_of_birth]]
106
- layout_data {
107
- horizontal_alignment :fill
108
- grab_excess_horizontal_space true
109
- }
110
95
  }
111
96
  }
112
97
  }
113
98
  }
99
+
100
+ def fill_horizontally_layout_data
101
+ layout_data {
102
+ horizontal_alignment :fill
103
+ grab_excess_horizontal_space true
104
+ }
105
+ end
114
106
  end
115
107
 
116
108
  HelloComputed.launch
@@ -30,9 +30,9 @@ class HelloCoolBar
30
30
  (10..30).to_a.map(&:to_s)
31
31
  end
32
32
 
33
- before_body {
33
+ before_body do
34
34
  self.font_size = '30'
35
- }
35
+ end
36
36
 
37
37
  body {
38
38
  shell {
@@ -31,11 +31,11 @@ class HelloCursor
31
31
  Glimmer::SWT::SWTProxy.cursor_options
32
32
  end
33
33
 
34
- after_body {
34
+ after_body do
35
35
  observe(self, :selected_cursor) {
36
36
  body_root.cursor = selected_cursor
37
37
  }
38
- }
38
+ end
39
39
 
40
40
  body {
41
41
  shell {
@@ -27,12 +27,12 @@ class StickFigure
27
27
 
28
28
  options :x, :y, :width, :height
29
29
 
30
- before_body {
30
+ before_body do
31
31
  @head_width = width*0.2
32
32
  @head_height = height*0.2
33
33
  @trunk_height = height*0.4
34
34
  @extremity_length = height*0.4
35
- }
35
+ end
36
36
 
37
37
  body {
38
38
  shape(x + @head_width/2.0 + @extremity_length, y) {
@@ -34,9 +34,9 @@ class EmailShell
34
34
  # single option with default value
35
35
  option :to, default: '"John Irwin" <john.irwin@example.com>'
36
36
 
37
- before_body {
37
+ before_body do
38
38
  @swt_style |= swt(:shell_trim, :modeless)
39
- }
39
+ end
40
40
 
41
41
  body {
42
42
  # pass received swt_style through to shell to customize it (e.g. :dialog_trim for a blocking shell)
@@ -34,12 +34,12 @@ class GreetingLabel
34
34
  # internal attribute (not a custom widget option)
35
35
  attr_accessor :color
36
36
 
37
- before_body {
37
+ before_body do
38
38
  @font = {height: 24, style: :bold}
39
39
  @color = :black
40
- }
40
+ end
41
41
 
42
- after_body {
42
+ after_body do
43
43
  return if colors.nil?
44
44
 
45
45
  Thread.new {
@@ -48,7 +48,7 @@ class GreetingLabel
48
48
  sleep(1)
49
49
  }
50
50
  }
51
- }
51
+ end
52
52
 
53
53
  body {
54
54
  # pass received swt_style through to label to customize (e.g. :center to center text)
@@ -28,10 +28,10 @@ class HelloDateTime
28
28
 
29
29
  include Glimmer::UI::CustomShell
30
30
 
31
- before_body {
31
+ before_body do
32
32
  @person = Person.new
33
33
  @person.date_of_birth = DateTime.new(2013, 7, 12, 18, 37, 23)
34
- }
34
+ end
35
35
 
36
36
  body {
37
37
  shell {
@@ -26,9 +26,9 @@ class HelloDirectoryDialog
26
26
 
27
27
  attr_accessor :selected_directory
28
28
 
29
- before_body {
29
+ before_body do
30
30
  @selected_directory = 'Please select a directory.'
31
- }
31
+ end
32
32
 
33
33
  body {
34
34
  shell {
@@ -26,9 +26,9 @@ class HelloFileDialog
26
26
 
27
27
  attr_accessor :selected_file
28
28
 
29
- before_body {
29
+ before_body do
30
30
  @selected_file = 'Please select a file.'
31
- }
31
+ end
32
32
 
33
33
  body {
34
34
  shell {
@@ -26,9 +26,9 @@ class HelloFontDialog
26
26
 
27
27
  attr_accessor :selected_font_data
28
28
 
29
- before_body {
29
+ before_body do
30
30
  @selected_font_data = FontData.new('Times New Roman', 40, swt(:bold))
31
- }
31
+ end
32
32
 
33
33
  body {
34
34
  shell {
@@ -41,9 +41,9 @@ class HelloGroup
41
41
 
42
42
  include Glimmer::UI::CustomShell
43
43
 
44
- before_body {
44
+ before_body do
45
45
  @person = Person.new
46
- }
46
+ end
47
47
 
48
48
  body {
49
49
  shell {
@@ -52,9 +52,9 @@ class HelloListMultiSelection
52
52
 
53
53
  include Glimmer::UI::CustomShell
54
54
 
55
- before_body {
55
+ before_body do
56
56
  @person = Person.new
57
- }
57
+ end
58
58
 
59
59
  body {
60
60
  shell {
@@ -37,9 +37,9 @@ class HelloListSingleSelection
37
37
 
38
38
  include Glimmer::UI::CustomShell
39
39
 
40
- before_body {
40
+ before_body do
41
41
  @person = Person.new
42
- }
42
+ end
43
43
 
44
44
  body {
45
45
  shell {
@@ -28,13 +28,13 @@ class HelloProgressBar
28
28
  attr_accessor :minimum, :maximum, :selection, :delay
29
29
  end
30
30
 
31
- before_body {
31
+ before_body do
32
32
  @progress_model = ProgressModel.new
33
33
  @progress_model.minimum = 0
34
34
  @progress_model.maximum = 100
35
35
  @progress_model.selection = 0
36
36
  @progress_model.delay = 0.01
37
- }
37
+ end
38
38
 
39
39
  body {
40
40
  shell {
@@ -41,9 +41,9 @@ class HelloRadio
41
41
 
42
42
  include Glimmer::UI::CustomShell
43
43
 
44
- before_body {
44
+ before_body do
45
45
  @person = Person.new
46
- }
46
+ end
47
47
 
48
48
  body {
49
49
  shell {
@@ -48,9 +48,9 @@ class HelloRadioGroup
48
48
 
49
49
  include Glimmer::UI::CustomShell
50
50
 
51
- before_body {
51
+ before_body do
52
52
  @person = Person.new
53
- }
53
+ end
54
54
 
55
55
  body {
56
56
  shell {
@@ -26,9 +26,9 @@ class HelloScale
26
26
 
27
27
  attr_accessor :value
28
28
 
29
- before_body {
29
+ before_body do
30
30
  @value = 50
31
- }
31
+ end
32
32
 
33
33
  body {
34
34
  shell {
@@ -28,10 +28,10 @@ class HelloSpinner
28
28
 
29
29
  include Glimmer::UI::CustomShell
30
30
 
31
- before_body {
31
+ before_body do
32
32
  @person = Person.new
33
33
  @person.donation = 500 # in cents
34
- }
34
+ end
35
35
 
36
36
  body {
37
37
  shell {
@@ -183,9 +183,9 @@ class HelloTable
183
183
 
184
184
  include Glimmer::UI::CustomShell
185
185
 
186
- before_body {
186
+ before_body do
187
187
  Display.app_name = 'Hello, Table!'
188
- }
188
+ end
189
189
 
190
190
  body {
191
191
  shell {
@@ -5,7 +5,7 @@ class HelloText
5
5
 
6
6
  attr_accessor :default, :center, :left, :right, :password, :telephone, :read_only, :wrap, :multi
7
7
 
8
- before_body {
8
+ before_body do
9
9
  self.default = 'default is :border style'
10
10
  self.center = 'centered'
11
11
  self.left = 'left-aligned'
@@ -15,7 +15,7 @@ class HelloText
15
15
  self.read_only = 'Telephone area code is 555'
16
16
  self.wrap = 'wraps if text content is too long like this example'
17
17
  self.multi = "multi-line enables hitting enter,\nbut does not wrap by default"
18
- }
18
+ end
19
19
 
20
20
  body {
21
21
  shell {
@@ -30,9 +30,9 @@ class HelloToolBar
30
30
  (10..30).to_a.map(&:to_s)
31
31
  end
32
32
 
33
- before_body {
33
+ before_body do
34
34
  self.font_size = '30'
35
- }
35
+ end
36
36
 
37
37
  body {
38
38
  shell {
@@ -27,7 +27,7 @@ class HelloTrayItem
27
27
  # boolean that indicates if application is visible
28
28
  attr_accessor :show_application
29
29
 
30
- before_body {
30
+ before_body do
31
31
  # application starts visible
32
32
  @show_application = true
33
33
  # pre-render an icon image using the Canvas Shape DSL
@@ -48,7 +48,7 @@ class HelloTrayItem
48
48
  foreground :white
49
49
  }
50
50
  }
51
- }
51
+ end
52
52
 
53
53
  body {
54
54
  shell(:shell_trim, :on_top) { # make it always appear on top of everything