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.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +71 -0
  3. data/README.md +14 -5
  4. data/VERSION +1 -1
  5. data/bin/glimmer +3 -3
  6. data/docs/reference/GLIMMER_CONFIGURATION.md +7 -3
  7. data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +451 -112
  8. data/docs/reference/GLIMMER_SAMPLES.md +76 -3
  9. data/glimmer-dsl-swt.gemspec +23 -13
  10. data/lib/ext/glimmer/config.rb +3 -7
  11. data/lib/glimmer/data_binding/list_selection_binding.rb +13 -7
  12. data/lib/glimmer/data_binding/table_items_binding.rb +22 -17
  13. data/lib/glimmer/data_binding/tree_items_binding.rb +19 -15
  14. data/lib/glimmer/data_binding/widget_binding.rb +12 -27
  15. data/lib/glimmer/dsl/swt/{file_dialog_expression.rb → auto_exec_expression.rb} +6 -18
  16. data/lib/glimmer/dsl/swt/checkbox_group_selection_data_binding_expression.rb +9 -6
  17. data/lib/glimmer/dsl/swt/color_expression.rb +1 -1
  18. data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +16 -14
  19. data/lib/glimmer/dsl/swt/custom_widget_expression.rb +4 -1
  20. data/lib/glimmer/dsl/swt/data_binding_expression.rb +1 -2
  21. data/lib/glimmer/dsl/swt/dialog_expression.rb +18 -9
  22. data/lib/glimmer/dsl/swt/dsl.rb +1 -0
  23. data/lib/glimmer/dsl/swt/exec_expression.rb +1 -1
  24. data/lib/glimmer/dsl/swt/font_expression.rb +1 -1
  25. data/lib/glimmer/dsl/swt/image_expression.rb +16 -2
  26. data/lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb +11 -8
  27. data/lib/glimmer/dsl/swt/pixel_expression.rb +1 -1
  28. data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +8 -5
  29. data/lib/glimmer/dsl/swt/shape_expression.rb +2 -2
  30. data/lib/glimmer/dsl/swt/shell_expression.rb +1 -1
  31. data/lib/glimmer/dsl/swt/widget_expression.rb +8 -4
  32. data/lib/glimmer/launcher.rb +3 -0
  33. data/lib/glimmer/rake_task/scaffold.rb +3 -0
  34. data/lib/glimmer/swt/color_proxy.rb +1 -1
  35. data/lib/glimmer/swt/custom/code_text.rb +33 -11
  36. data/lib/glimmer/swt/custom/drawable.rb +57 -1
  37. data/lib/glimmer/swt/custom/shape.rb +332 -48
  38. data/lib/glimmer/swt/custom/shape/arc.rb +60 -0
  39. data/lib/glimmer/{dsl/swt/directory_dialog_expression.rb → swt/custom/shape/focus.rb} +15 -20
  40. data/lib/glimmer/swt/custom/shape/image.rb +112 -0
  41. data/lib/glimmer/swt/custom/shape/line.rb +111 -0
  42. data/lib/glimmer/swt/custom/shape/oval.rb +61 -0
  43. data/lib/glimmer/swt/custom/shape/point.rb +49 -0
  44. data/lib/glimmer/swt/custom/shape/polygon.rb +114 -0
  45. data/lib/glimmer/swt/custom/shape/polyline.rb +115 -0
  46. data/lib/glimmer/swt/custom/shape/rectangle.rb +105 -0
  47. data/lib/glimmer/swt/custom/shape/text.rb +85 -0
  48. data/lib/glimmer/swt/date_time_proxy.rb +9 -3
  49. data/lib/glimmer/swt/dialog_proxy.rb +92 -0
  50. data/lib/glimmer/swt/display_proxy.rb +62 -2
  51. data/lib/glimmer/swt/expand_item_proxy.rb +18 -12
  52. data/lib/glimmer/swt/font_proxy.rb +13 -7
  53. data/lib/glimmer/swt/image_proxy.rb +15 -4
  54. data/lib/glimmer/swt/layout_data_proxy.rb +21 -15
  55. data/lib/glimmer/swt/layout_proxy.rb +19 -15
  56. data/lib/glimmer/swt/menu_proxy.rb +2 -2
  57. data/lib/glimmer/swt/message_box_proxy.rb +21 -7
  58. data/lib/glimmer/swt/properties.rb +3 -0
  59. data/lib/glimmer/swt/proxy_properties.rb +145 -0
  60. data/lib/glimmer/swt/scrolled_composite_proxy.rb +6 -2
  61. data/lib/glimmer/swt/shell_proxy.rb +94 -80
  62. data/lib/glimmer/swt/swt_proxy.rb +16 -0
  63. data/lib/glimmer/swt/tab_item_proxy.rb +5 -3
  64. data/lib/glimmer/swt/table_proxy.rb +32 -11
  65. data/lib/glimmer/swt/transform_proxy.rb +39 -35
  66. data/lib/glimmer/swt/tree_proxy.rb +11 -16
  67. data/lib/glimmer/swt/widget_listener_proxy.rb +6 -2
  68. data/lib/glimmer/swt/widget_proxy.rb +193 -138
  69. data/lib/glimmer/ui.rb +5 -0
  70. data/lib/glimmer/ui/custom_shell.rb +11 -5
  71. data/lib/glimmer/ui/custom_widget.rb +4 -5
  72. data/samples/elaborate/contact_manager.rb +9 -7
  73. data/samples/elaborate/login.rb +27 -21
  74. data/samples/elaborate/mandelbrot_fractal.rb +20 -25
  75. data/samples/elaborate/meta_sample.rb +2 -1
  76. data/samples/elaborate/tetris.rb +3 -1
  77. data/samples/elaborate/tic_tac_toe.rb +18 -14
  78. data/samples/elaborate/tic_tac_toe/board.rb +5 -5
  79. data/samples/elaborate/tic_tac_toe/cell.rb +5 -5
  80. data/samples/elaborate/user_profile.rb +10 -8
  81. data/samples/hello/hello_browser.rb +2 -0
  82. data/samples/hello/hello_button.rb +9 -7
  83. data/samples/hello/hello_canvas.rb +144 -40
  84. data/samples/hello/hello_canvas_animation.rb +2 -0
  85. data/samples/hello/hello_canvas_transform.rb +2 -0
  86. data/samples/hello/hello_checkbox.rb +18 -14
  87. data/samples/hello/hello_checkbox_group.rb +13 -9
  88. data/samples/hello/hello_code_text.rb +2 -0
  89. data/samples/hello/hello_color_dialog.rb +68 -0
  90. data/samples/hello/hello_combo.rb +16 -12
  91. data/samples/hello/hello_computed.rb +9 -7
  92. data/samples/hello/hello_cursor.rb +4 -1
  93. data/samples/hello/hello_custom_shell.rb +18 -21
  94. data/samples/hello/hello_custom_widget.rb +6 -6
  95. data/samples/hello/hello_date_time.rb +16 -12
  96. data/samples/hello/hello_dialog.rb +2 -0
  97. data/samples/hello/hello_directory_dialog.rb +9 -7
  98. data/samples/hello/hello_drag_and_drop.rb +5 -3
  99. data/samples/hello/hello_expand_bar.rb +10 -8
  100. data/samples/hello/hello_file_dialog.rb +9 -7
  101. data/samples/hello/hello_font_dialog.rb +84 -0
  102. data/samples/hello/hello_group.rb +20 -16
  103. data/samples/hello/hello_link.rb +2 -0
  104. data/samples/hello/hello_list_multi_selection.rb +15 -11
  105. data/samples/hello/hello_list_single_selection.rb +15 -11
  106. data/samples/hello/hello_menu_bar.rb +2 -0
  107. data/samples/hello/hello_message_box.rb +2 -0
  108. data/samples/hello/hello_pop_up_context_menu.rb +2 -0
  109. data/samples/hello/hello_progress_bar.rb +5 -5
  110. data/samples/hello/hello_radio.rb +20 -16
  111. data/samples/hello/hello_radio_group.rb +16 -12
  112. data/samples/hello/hello_sash_form.rb +2 -0
  113. data/samples/hello/hello_spinner.rb +9 -7
  114. data/samples/hello/hello_styled_text.rb +19 -17
  115. data/samples/hello/hello_tab.rb +7 -5
  116. data/samples/hello/hello_table.rb +12 -5
  117. data/samples/hello/hello_tree.rb +485 -0
  118. data/samples/hello/hello_world.rb +2 -0
  119. metadata +21 -22
  120. data/lib/glimmer/swt/directory_dialog_proxy.rb +0 -65
  121. data/lib/glimmer/swt/file_dialog_proxy.rb +0 -66
@@ -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
  # This sample demonstrates the use of a `checkbox_group` (aka `check_group`) in Glimmer, which provides terser syntax
23
25
  # than HelloCheckbox for representing multiple checkbox buttons (`button(:check)`) by relying on data-binding to
24
26
  # automatically spawn the `checkbox` widgets (`button(:check)`) based on available options on the model.
@@ -39,11 +41,13 @@ class HelloCheckboxGroup
39
41
  end
40
42
  end
41
43
 
42
- include Glimmer
44
+ include Glimmer::UI::CustomShell
43
45
 
44
- def launch
45
- person = Person.new
46
-
46
+ before_body {
47
+ @person = Person.new
48
+ }
49
+
50
+ body {
47
51
  shell {
48
52
  text 'Hello, Checkbox Group!'
49
53
  row_layout :vertical
@@ -54,18 +58,18 @@ class HelloCheckboxGroup
54
58
  }
55
59
 
56
60
  checkbox_group {
57
- selection bind(person, :activities)
61
+ selection bind(@person, :activities)
58
62
  }
59
63
 
60
64
  button {
61
65
  text 'Reset Activities'
62
66
 
63
67
  on_widget_selected do
64
- person.reset_activities
68
+ @person.reset_activities
65
69
  end
66
70
  }
67
- }.open
68
- end
71
+ }
72
+ }
69
73
  end
70
74
 
71
- HelloCheckboxGroup.new.launch
75
+ HelloCheckboxGroup.launch
@@ -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
  include Glimmer
23
25
 
24
26
  shell {
@@ -0,0 +1,68 @@
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 HelloColorDialog
25
+ include Glimmer::UI::CustomShell
26
+
27
+ attr_accessor :selected_color
28
+
29
+ before_body {
30
+ self.selected_color = :black
31
+ }
32
+
33
+ body {
34
+ shell {
35
+ minimum_size 220, 0
36
+ grid_layout
37
+
38
+ text 'Hello, Color Dialog!'
39
+
40
+ label {
41
+ layout_data :center, :center, true, false
42
+ text 'Selected Color:'
43
+ font height: 14, style: :bold
44
+ }
45
+
46
+ canvas(:border) {
47
+ layout_data :center, :center, true, false
48
+ background bind(self, :selected_color)
49
+
50
+ on_mouse_up {
51
+ self.selected_color = color_dialog.open
52
+ }
53
+ }
54
+
55
+ button {
56
+ layout_data :center, :center, true, false
57
+ text "Choose Color..."
58
+
59
+ on_widget_selected {
60
+ self.selected_color = color_dialog.open
61
+ }
62
+ }
63
+
64
+ }
65
+ }
66
+ end
67
+
68
+ HelloColorDialog.launch
@@ -19,45 +19,49 @@
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 HelloCombo
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
- def launch
39
- person = Person.new
40
-
44
+ body {
41
45
  shell {
42
46
  row_layout(:vertical) {
43
- pack false
47
+ fill true
44
48
  }
45
49
 
46
50
  text 'Hello, Combo!'
47
51
 
48
52
  combo(:read_only) {
49
- selection bind(person, :country)
53
+ selection bind(@person, :country) # also binds to country_options by convention
50
54
  }
51
55
 
52
56
  button {
53
57
  text 'Reset Selection'
54
58
 
55
59
  on_widget_selected do
56
- person.reset_country
60
+ @person.reset_country!
57
61
  end
58
62
  }
59
- }.open
60
- end
63
+ }
64
+ }
61
65
  end
62
66
 
63
- HelloCombo.new.launch
67
+ HelloCombo.launch
@@ -19,20 +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
+ require 'glimmer-dsl-swt'
23
+
22
24
  require_relative 'hello_computed/contact'
23
25
 
24
26
  class HelloComputed
25
- include Glimmer
27
+ include Glimmer::UI::CustomShell
26
28
 
27
- def initialize
29
+ before_body {
28
30
  @contact = Contact.new(
29
31
  first_name: 'Barry',
30
32
  last_name: 'McKibbin',
31
33
  year_of_birth: 1985
32
34
  )
33
- end
35
+ }
34
36
 
35
- def launch
37
+ body {
36
38
  shell {
37
39
  text 'Hello, Computed!'
38
40
 
@@ -89,8 +91,8 @@ class HelloComputed
89
91
  }
90
92
  }
91
93
  }
92
- }.open
93
- end
94
+ }
95
+ }
94
96
  end
95
97
 
96
- HelloComputed.new.launch
98
+ HelloComputed.launch
@@ -19,13 +19,16 @@
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 HelloCursor
23
25
  include Glimmer::UI::CustomShell
24
26
 
25
27
  attr_accessor :selected_cursor
26
28
 
29
+ # This method matches the name of the :selected_cursor property by convention
27
30
  def selected_cursor_options
28
- org.eclipse.swt.SWT.constants.select {|c| c.to_s.start_with?('CURSOR_')}.map {|c| c.to_s.sub('CURSOR_', '').downcase}
31
+ Glimmer::SWT::SWTProxy.cursor_options
29
32
  end
30
33
 
31
34
  after_body {
@@ -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,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'
22
23
  require 'date'
23
24
 
24
25
  # This class declares an `email_shell` custom shell, aka custom window (by convention)
25
26
  # Used to view an email message
26
27
  class EmailShell
28
+ # including Glimmer::UI::CustomShell enables declaring as an `email_shell` custom widget Glimmer GUI DSL keyword
27
29
  include Glimmer::UI::CustomShell
28
30
 
29
- # multiple options without default values
30
- options :date, :subject, :from, :message
31
+ # multiple options without default values
32
+ options :parent_shell, :date, :subject, :from, :message
31
33
 
32
34
  # single option with default value
33
35
  option :to, default: '"John Irwin" <john.irwin@example.com>'
@@ -38,10 +40,10 @@ class EmailShell
38
40
 
39
41
  body {
40
42
  # pass received swt_style through to shell to customize it (e.g. :dialog_trim for a blocking shell)
41
- shell(swt_style) {
43
+ shell(parent_shell, swt_style) {
42
44
  grid_layout(2, false)
43
45
 
44
- text subject
46
+ text subject
45
47
 
46
48
  label {
47
49
  text 'Date:'
@@ -78,7 +80,7 @@ class EmailShell
78
80
  }
79
81
 
80
82
  background :white
81
- text message
83
+ text message
82
84
  }
83
85
  }
84
86
  }
@@ -86,13 +88,12 @@ class EmailShell
86
88
  end
87
89
 
88
90
  class HelloCustomShell
89
- # including Glimmer enables the Glimmer DSL syntax, including auto-discovery of the `email_shell` custom widget
90
- include Glimmer
91
+ include Glimmer::UI::CustomShell
91
92
 
92
93
  Email = Struct.new(:date, :subject, :from, :message, keyword_init: true)
93
94
  EmailSystem = Struct.new(:emails, keyword_init: true)
94
95
 
95
- def initialize
96
+ before_body {
96
97
  @email_system = EmailSystem.new(
97
98
  emails: [
98
99
  Email.new(date: DateTime.new(2029, 10, 22, 11, 3, 0).strftime('%F %I:%M %p'), subject: '3rd Week Report', from: '"Dianne Tux" <dianne.tux@example.com>', message: "Hello,\n\nI was wondering if you'd like to go over the weekly report sometime this afternoon.\n\nDianne"),
@@ -103,9 +104,9 @@ class HelloCustomShell
103
104
  Email.new(date: DateTime.new(2029, 10, 2, 10, 34, 0).strftime('%F %I:%M %p'), subject: 'Glimmer Upgrade v98.0', from: '"Robert McGabbins" <robert.mcgabbins@example.com>', message: "Team,\n\nWe are upgrading to Glimmer version 98.0.\n\nEveryone pull the latest code!\n\nRegards,\n\nRobert McGabbins"),
104
105
  ]
105
106
  )
106
- end
107
+ }
107
108
 
108
- def launch
109
+ body {
109
110
  shell {
110
111
  grid_layout
111
112
 
@@ -141,15 +142,11 @@ class HelloCustomShell
141
142
 
142
143
  on_mouse_up { |event|
143
144
  email = event.table_item.get_data
144
- Thread.new do
145
- async_exec {
146
- email_shell(date: email.date, subject: email.subject, from: email.from, message: email.message).open
147
- }
148
- end
145
+ email_shell(parent_shell: self, date: email.date, subject: email.subject, from: email.from, message: email.message).open
149
146
  }
150
147
  }
151
- }.open
152
- end
148
+ }
149
+ }
153
150
  end
154
151
 
155
- HelloCustomShell.new.launch
152
+ HelloCustomShell.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
  # This class declares a `greeting_label` custom widget (by convention)
23
25
  class GreetingLabel
24
26
  include Glimmer::UI::CustomWidget
@@ -42,9 +44,7 @@ class GreetingLabel
42
44
 
43
45
  Thread.new {
44
46
  colors.cycle { |color|
45
- async_exec {
46
- self.color = color
47
- }
47
+ self.color = color
48
48
  sleep(1)
49
49
  }
50
50
  }
@@ -19,17 +19,21 @@
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 HelloDateTime
23
25
  class Person
24
26
  attr_accessor :date_of_birth
25
27
  end
26
28
 
27
- include Glimmer
29
+ include Glimmer::UI::CustomShell
30
+
31
+ before_body {
32
+ @person = Person.new
33
+ @person.date_of_birth = DateTime.new(2013, 7, 12, 18, 37, 23)
34
+ }
28
35
 
29
- def launch
30
- person = Person.new
31
- person.date_of_birth = DateTime.new(2013, 7, 12, 18, 37, 23)
32
-
36
+ body {
33
37
  shell {
34
38
  row_layout :vertical
35
39
 
@@ -42,22 +46,22 @@ class HelloDateTime
42
46
  }
43
47
 
44
48
  date { # alias for date_time(:date)
45
- date_time bind(person, :date_of_birth)
49
+ date_time bind(@person, :date_of_birth)
46
50
  }
47
51
 
48
52
  date_drop_down { # alias for date_time(:date, :drop_down)
49
- date_time bind(person, :date_of_birth)
53
+ date_time bind(@person, :date_of_birth)
50
54
  }
51
55
 
52
56
  time { # alias for date_time(:time)
53
- date_time bind(person, :date_of_birth)
57
+ date_time bind(@person, :date_of_birth)
54
58
  }
55
59
 
56
60
  calendar { # alias for date_time(:calendar)
57
- date_time bind(person, :date_of_birth)
61
+ date_time bind(@person, :date_of_birth)
58
62
  }
59
- }.open
60
- end
63
+ }
64
+ }
61
65
  end
62
66
 
63
- HelloDateTime.new.launch
67
+ HelloDateTime.launch