glimmer-dsl-swt 4.17.10.6 → 4.18.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +39 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.md +369 -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 +54 -34
  11. data/lib/ext/glimmer.rb +1 -1
  12. data/lib/ext/glimmer/config.rb +1 -1
  13. data/lib/glimmer-dsl-swt.rb +2 -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/async_exec_expression.rb +1 -1
  22. data/lib/glimmer/dsl/swt/bind_expression.rb +1 -1
  23. data/lib/glimmer/dsl/swt/block_property_expression.rb +1 -1
  24. data/lib/glimmer/dsl/swt/checkbox_group_selection_data_binding_expression.rb +1 -1
  25. data/lib/glimmer/dsl/swt/color_expression.rb +1 -1
  26. data/lib/glimmer/dsl/swt/column_properties_expression.rb +1 -1
  27. data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +1 -1
  28. data/lib/glimmer/dsl/swt/cursor_expression.rb +1 -1
  29. data/lib/glimmer/dsl/swt/custom_widget_expression.rb +1 -1
  30. data/lib/glimmer/dsl/swt/data_binding_expression.rb +1 -1
  31. data/lib/glimmer/dsl/swt/dialog_expression.rb +1 -1
  32. data/lib/glimmer/dsl/swt/directory_dialog_expression.rb +1 -1
  33. data/lib/glimmer/dsl/swt/display_expression.rb +1 -1
  34. data/lib/glimmer/dsl/swt/dnd_expression.rb +1 -1
  35. data/lib/glimmer/dsl/swt/dsl.rb +1 -1
  36. data/lib/glimmer/dsl/swt/exec_expression.rb +5 -5
  37. data/lib/glimmer/dsl/swt/expand_item_expression.rb +1 -1
  38. data/lib/glimmer/dsl/swt/file_dialog_expression.rb +1 -1
  39. data/lib/glimmer/dsl/swt/font_expression.rb +1 -1
  40. data/lib/glimmer/dsl/swt/image_expression.rb +1 -1
  41. data/lib/glimmer/dsl/swt/layout_data_expression.rb +1 -1
  42. data/lib/glimmer/dsl/swt/layout_expression.rb +1 -1
  43. data/lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb +1 -1
  44. data/lib/glimmer/dsl/swt/menu_bar_expression.rb +1 -1
  45. data/lib/glimmer/dsl/swt/menu_expression.rb +1 -1
  46. data/lib/glimmer/dsl/swt/message_box_expression.rb +1 -1
  47. data/lib/glimmer/dsl/swt/observe_expression.rb +1 -1
  48. data/lib/glimmer/dsl/swt/property_expression.rb +1 -1
  49. data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +1 -1
  50. data/lib/glimmer/dsl/swt/rgb_expression.rb +1 -1
  51. data/lib/glimmer/dsl/swt/rgba_expression.rb +1 -1
  52. data/lib/glimmer/dsl/swt/shell_expression.rb +1 -1
  53. data/lib/glimmer/dsl/swt/swt_expression.rb +1 -1
  54. data/lib/glimmer/dsl/swt/sync_exec_expression.rb +1 -1
  55. data/lib/glimmer/dsl/swt/tab_item_expression.rb +1 -1
  56. data/lib/glimmer/dsl/swt/table_items_data_binding_expression.rb +1 -1
  57. data/lib/glimmer/dsl/swt/tree_items_data_binding_expression.rb +1 -1
  58. data/lib/glimmer/dsl/swt/tree_properties_expression.rb +1 -1
  59. data/lib/glimmer/dsl/swt/widget_expression.rb +1 -1
  60. data/lib/glimmer/dsl/swt/widget_listener_expression.rb +1 -1
  61. data/lib/glimmer/launcher.rb +1 -1
  62. data/lib/glimmer/rake_task.rb +1 -1
  63. data/lib/glimmer/rake_task/list.rb +1 -1
  64. data/lib/glimmer/rake_task/package.rb +1 -1
  65. data/lib/glimmer/rake_task/scaffold.rb +1 -1
  66. data/lib/glimmer/swt/color_proxy.rb +1 -1
  67. data/lib/glimmer/swt/cursor_proxy.rb +1 -1
  68. data/lib/glimmer/swt/custom/checkbox_group.rb +1 -1
  69. data/lib/glimmer/swt/custom/radio_group.rb +1 -1
  70. data/lib/glimmer/swt/date_time_proxy.rb +1 -1
  71. data/lib/glimmer/swt/directory_dialog_proxy.rb +1 -1
  72. data/lib/glimmer/swt/display_proxy.rb +1 -1
  73. data/lib/glimmer/swt/dnd_proxy.rb +1 -1
  74. data/lib/glimmer/swt/expand_item_proxy.rb +1 -1
  75. data/lib/glimmer/swt/file_dialog_proxy.rb +1 -1
  76. data/lib/glimmer/swt/font_proxy.rb +1 -1
  77. data/lib/glimmer/swt/image_proxy.rb +12 -11
  78. data/lib/glimmer/swt/layout_data_proxy.rb +1 -1
  79. data/lib/glimmer/swt/layout_proxy.rb +8 -4
  80. data/lib/glimmer/swt/menu_proxy.rb +10 -6
  81. data/lib/glimmer/swt/message_box_proxy.rb +1 -1
  82. data/lib/glimmer/swt/packages.rb +1 -1
  83. data/lib/glimmer/swt/sash_form_proxy.rb +2 -2
  84. data/lib/glimmer/swt/scrolled_composite_proxy.rb +1 -1
  85. data/lib/glimmer/swt/shell_proxy.rb +1 -1
  86. data/lib/glimmer/swt/style_constantizable.rb +9 -5
  87. data/lib/glimmer/swt/styled_text_proxy.rb +1 -1
  88. data/lib/glimmer/swt/swt_proxy.rb +1 -1
  89. data/lib/glimmer/swt/tab_item_proxy.rb +1 -1
  90. data/lib/glimmer/swt/table_column_proxy.rb +1 -1
  91. data/lib/glimmer/swt/table_proxy.rb +1 -1
  92. data/lib/glimmer/swt/tree_proxy.rb +26 -22
  93. data/lib/glimmer/swt/widget_listener_proxy.rb +1 -1
  94. data/lib/glimmer/swt/widget_proxy.rb +70 -25
  95. data/lib/glimmer/ui/custom_shell.rb +1 -1
  96. data/lib/glimmer/ui/custom_widget.rb +1 -1
  97. data/lib/glimmer/util/proc_tracker.rb +1 -1
  98. data/samples/elaborate/contact_manager.rb +1 -1
  99. data/samples/elaborate/contact_manager/contact.rb +1 -1
  100. data/samples/elaborate/contact_manager/contact_manager_presenter.rb +1 -1
  101. data/samples/elaborate/contact_manager/contact_repository.rb +1 -1
  102. data/samples/elaborate/login.rb +1 -1
  103. data/samples/elaborate/meta_sample.rb +80 -20
  104. data/samples/elaborate/tic_tac_toe.rb +2 -2
  105. data/samples/elaborate/tic_tac_toe/board.rb +1 -1
  106. data/samples/elaborate/tic_tac_toe/cell.rb +1 -1
  107. data/samples/elaborate/user_profile.rb +1 -1
  108. data/samples/hello/hello_browser.rb +3 -1
  109. data/samples/hello/hello_button.rb +1 -1
  110. data/samples/hello/hello_checkbox.rb +1 -1
  111. data/samples/hello/hello_checkbox_group.rb +1 -1
  112. data/samples/hello/hello_combo.rb +1 -1
  113. data/samples/hello/hello_computed.rb +10 -4
  114. data/samples/hello/hello_computed/contact.rb +1 -1
  115. data/samples/hello/hello_custom_shell.rb +1 -1
  116. data/samples/hello/hello_custom_widget.rb +1 -1
  117. data/samples/hello/hello_date_time.rb +1 -1
  118. data/samples/hello/hello_dialog.rb +78 -0
  119. data/samples/hello/hello_directory_dialog.rb +1 -1
  120. data/samples/hello/hello_drag_and_drop.rb +1 -1
  121. data/samples/hello/hello_expand_bar.rb +1 -1
  122. data/samples/hello/hello_file_dialog.rb +1 -1
  123. data/samples/hello/hello_group.rb +1 -1
  124. data/samples/hello/hello_link.rb +4 -6
  125. data/samples/hello/hello_list_multi_selection.rb +1 -1
  126. data/samples/hello/hello_list_single_selection.rb +1 -1
  127. data/samples/hello/hello_menu_bar.rb +185 -29
  128. data/samples/hello/hello_message_box.rb +10 -9
  129. data/samples/hello/hello_pop_up_context_menu.rb +34 -7
  130. data/samples/hello/hello_radio.rb +1 -1
  131. data/samples/hello/hello_radio_group.rb +1 -1
  132. data/samples/hello/hello_sash_form.rb +1 -1
  133. data/samples/hello/hello_spinner.rb +1 -1
  134. data/samples/hello/hello_styled_text.rb +1 -1
  135. data/samples/hello/hello_tab.rb +1 -1
  136. data/samples/hello/hello_table.rb +1 -1
  137. data/samples/hello/hello_world.rb +1 -1
  138. data/vendor/swt/linux/swt.jar +0 -0
  139. data/vendor/swt/mac/swt.jar +0 -0
  140. data/vendor/swt/windows/swt.jar +0 -0
  141. metadata +74 -42
@@ -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
@@ -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])
@@ -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
@@ -0,0 +1,78 @@
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
+ row_layout :vertical
26
+
27
+ text 'Hello, Dialog!'
28
+
29
+ 7.times { |n|
30
+ dialog_number = n + 1
31
+
32
+ button {
33
+ layout_data {
34
+ width 200
35
+ height 50
36
+ }
37
+ text "Dialog #{dialog_number}"
38
+
39
+ on_widget_selected {
40
+ dialog { |dialog_proxy|
41
+ row_layout(:vertical) {
42
+ center true
43
+ }
44
+
45
+ text "Dialog #{dialog_number}"
46
+
47
+ label {
48
+ text "Given `dialog` is modal, you cannot interact with the main window till the dialog is closed."
49
+ }
50
+ composite {
51
+ row_layout {
52
+ margin_height 0
53
+ margin_top 0
54
+ margin_bottom 0
55
+ }
56
+
57
+ label {
58
+ text "Unlike `message_box`, `dialog` can contain arbitrary widgets:"
59
+ }
60
+ radio {
61
+ text 'Radio'
62
+ }
63
+ checkbox {
64
+ text 'Checkbox'
65
+ }
66
+ }
67
+ button {
68
+ text 'Close'
69
+
70
+ on_widget_selected {
71
+ dialog_proxy.close
72
+ }
73
+ }
74
+ }.open
75
+ }
76
+ }
77
+ }
78
+ }.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
@@ -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
@@ -38,9 +38,9 @@ shell { |main_shell|
38
38
 
39
39
  You may click on any <a>link</a> to get help.
40
40
 
41
- How do you know <a href="href">which link</a> you clicked?
41
+ How do you know <a href="which-link-href-value">which link</a> you clicked?
42
42
 
43
- Just keep clicking <a href="all-links">links</a> to find out!
43
+ Just keep clicking <a href="all links">links</a> to find out!
44
44
  MULTI_LINE_STRING
45
45
 
46
46
  on_widget_selected { |selection_event|
@@ -69,10 +69,8 @@ shell { |main_shell|
69
69
  @help_shell.location = Point.new(x, y)
70
70
  }
71
71
  on_focus_lost {
72
- @help_shell.close
73
- }
74
- on_shell_closed {
75
72
  @selected_link = nil
73
+ @help_shell.close
76
74
  }
77
75
  }
78
76
  @help_shell.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
@@ -21,50 +21,52 @@
21
21
 
22
22
  include Glimmer
23
23
 
24
- shell { |shell_proxy|
24
+ COLORS = [:white, :red, :yellow, :green, :blue, :magenta, :gray, :black]
25
+
26
+ shell {
27
+ grid_layout {
28
+ margin_width 0
29
+ margin_height 0
30
+ }
31
+
25
32
  text 'Hello, Menu Bar!'
26
- grid_layout
27
- label(:center) {
28
- font height: 16
29
- text 'Check Out The File Menu and History Menu in The Menu Bar Above!'
33
+
34
+ @label = label(:center) {
35
+ font height: 50
36
+ text 'Check Out The Menu Bar Above!'
30
37
  }
38
+
31
39
  menu_bar {
32
40
  menu {
33
41
  text '&File'
34
42
  menu_item {
35
- text 'E&xit'
36
- on_widget_selected {
37
- exit(0)
38
- }
39
- }
40
- menu_item(0) {
41
43
  text '&New'
44
+ accelerator :command, :N
45
+
42
46
  on_widget_selected {
43
- message_box(shell_proxy) {
44
- text 'New File'
45
- message 'New File Contents'
47
+ message_box {
48
+ text 'New'
49
+ message 'New file created.'
46
50
  }.open
47
51
  }
48
52
  }
49
- menu(1) {
50
- text '&Options'
51
- menu_item(:radio) {
52
- text 'Option 1'
53
- }
54
- menu_item(:separator)
55
- menu_item(:check) {
56
- text 'Option 3'
53
+ menu_item {
54
+ text '&Open...'
55
+ accelerator :command, :O
56
+
57
+ on_widget_selected {
58
+ message_box {
59
+ text 'Open'
60
+ message 'Opening File...'
61
+ }.open
57
62
  }
58
63
  }
59
- }
60
- menu {
61
- text '&History'
62
64
  menu {
63
- text '&Recent'
65
+ text 'Open &Recent'
64
66
  menu_item {
65
67
  text 'File 1'
66
68
  on_widget_selected {
67
- message_box(shell_proxy) {
69
+ message_box {
68
70
  text 'File 1'
69
71
  message 'File 1 Contents'
70
72
  }.open
@@ -73,13 +75,167 @@ shell { |shell_proxy|
73
75
  menu_item {
74
76
  text 'File 2'
75
77
  on_widget_selected {
76
- message_box(shell_proxy) {
78
+ message_box {
77
79
  text 'File 2'
78
80
  message 'File 2 Contents'
79
81
  }.open
80
82
  }
81
83
  }
82
84
  }
85
+ menu_item(:separator)
86
+ menu_item {
87
+ text 'E&xit'
88
+
89
+ on_widget_selected {
90
+ exit(0)
91
+ }
92
+ }
93
+ }
94
+ menu {
95
+ text '&Edit'
96
+ menu_item {
97
+ text 'Cut'
98
+ accelerator :command, :X
99
+ }
100
+ menu_item {
101
+ text 'Copy'
102
+ accelerator :command, :C
103
+ }
104
+ menu_item {
105
+ text 'Paste'
106
+ accelerator :command, :V
107
+ }
108
+ }
109
+ menu {
110
+ text '&Options'
111
+
112
+ menu_item(:radio) {
113
+ text '&Enabled'
114
+
115
+ on_widget_selected {
116
+ @select_one_menu.enabled = true
117
+ @select_multiple_menu.enabled = true
118
+ }
119
+ }
120
+ @select_one_menu = menu {
121
+ text '&Select One'
122
+ enabled false
123
+
124
+ menu_item(:radio) {
125
+ text 'Option 1'
126
+ }
127
+ menu_item(:radio) {
128
+ text 'Option 2'
129
+ }
130
+ menu_item(:radio) {
131
+ text 'Option 3'
132
+ }
133
+ }
134
+ @select_multiple_menu = menu {
135
+ text '&Select Multiple'
136
+ enabled false
137
+
138
+ menu_item(:check) {
139
+ text 'Option 4'
140
+ }
141
+ menu_item(:check) {
142
+ text 'Option 5'
143
+ }
144
+ menu_item(:check) {
145
+ text 'Option 6'
146
+ }
147
+ }
148
+ }
149
+ menu {
150
+ text '&Format'
151
+ menu {
152
+ text '&Background Color'
153
+ COLORS.each { |color_style|
154
+ menu_item(:radio) {
155
+ text color_style.to_s.split('_').map(&:capitalize).join(' ')
156
+
157
+ on_widget_selected {
158
+ @label.background = color_style
159
+ }
160
+ }
161
+ }
162
+ }
163
+ menu {
164
+ text 'Foreground &Color'
165
+ COLORS.each { |color_style|
166
+ menu_item(:radio) {
167
+ text color_style.to_s.split('_').map(&:capitalize).join(' ')
168
+
169
+ on_widget_selected {
170
+ @label.foreground = color_style
171
+ }
172
+ }
173
+ }
174
+ }
175
+ }
176
+ menu {
177
+ text '&View'
178
+ menu_item(:radio) {
179
+ text 'Small'
180
+
181
+ on_widget_selected {
182
+ @label.font = {height: 25}
183
+ @label.parent.pack
184
+ }
185
+ }
186
+ menu_item(:radio) {
187
+ text 'Medium'
188
+ selection true
189
+
190
+ on_widget_selected {
191
+ @label.font = {height: 50}
192
+ @label.parent.pack
193
+ }
194
+ }
195
+ menu_item(:radio) {
196
+ text 'Large'
197
+
198
+ on_widget_selected {
199
+ @label.font = {height: 75}
200
+ @label.parent.pack
201
+ }
202
+ }
203
+ }
204
+ menu {
205
+ text '&Help'
206
+ menu_item {
207
+ text '&Manual'
208
+ accelerator :command, :shift, :M
209
+
210
+ on_widget_selected {
211
+ message_box {
212
+ text 'Manual'
213
+ message 'Manual Contents'
214
+ }.open
215
+ }
216
+ }
217
+ menu_item {
218
+ text '&Tutorial'
219
+ accelerator :command, :shift, :T
220
+
221
+ on_widget_selected {
222
+ message_box {
223
+ text 'Tutorial'
224
+ message 'Tutorial Contents'
225
+ }.open
226
+ }
227
+ }
228
+ menu_item(:separator)
229
+ menu_item {
230
+ text '&Report an Issue...'
231
+
232
+ on_widget_selected {
233
+ message_box {
234
+ text 'Report an Issue'
235
+ message 'Reporting an issue...'
236
+ }.open
237
+ }
238
+ }
83
239
  }
84
240
  }
85
241
  }.open