shoes-swt 4.0.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (238) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +84 -0
  3. data/Gemfile +24 -0
  4. data/Guardfile +11 -0
  5. data/LICENSE +31 -0
  6. data/README.md +201 -0
  7. data/lib/shoes/swt.rb +118 -0
  8. data/lib/shoes/swt/animation.rb +46 -0
  9. data/lib/shoes/swt/app.rb +314 -0
  10. data/lib/shoes/swt/arc.rb +71 -0
  11. data/lib/shoes/swt/background.rb +41 -0
  12. data/lib/shoes/swt/border.rb +41 -0
  13. data/lib/shoes/swt/button.rb +18 -0
  14. data/lib/shoes/swt/check.rb +14 -0
  15. data/lib/shoes/swt/check_button.rb +19 -0
  16. data/lib/shoes/swt/color.rb +49 -0
  17. data/lib/shoes/swt/color_factory.rb +32 -0
  18. data/lib/shoes/swt/common/child.rb +16 -0
  19. data/lib/shoes/swt/common/clickable.rb +68 -0
  20. data/lib/shoes/swt/common/container.rb +28 -0
  21. data/lib/shoes/swt/common/fill.rb +38 -0
  22. data/lib/shoes/swt/common/painter.rb +92 -0
  23. data/lib/shoes/swt/common/painter_updates_position.rb +12 -0
  24. data/lib/shoes/swt/common/remove.rb +30 -0
  25. data/lib/shoes/swt/common/resource.rb +29 -0
  26. data/lib/shoes/swt/common/selection_listener.rb +14 -0
  27. data/lib/shoes/swt/common/stroke.rb +42 -0
  28. data/lib/shoes/swt/common/update_position.rb +15 -0
  29. data/lib/shoes/swt/common/visibility.rb +13 -0
  30. data/lib/shoes/swt/dialog.rb +90 -0
  31. data/lib/shoes/swt/disposed_protection.rb +23 -0
  32. data/lib/shoes/swt/download.rb +24 -0
  33. data/lib/shoes/swt/font.rb +32 -0
  34. data/lib/shoes/swt/gradient.rb +92 -0
  35. data/lib/shoes/swt/image.rb +128 -0
  36. data/lib/shoes/swt/image_pattern.rb +31 -0
  37. data/lib/shoes/swt/input_box.rb +73 -0
  38. data/lib/shoes/swt/key_listener.rb +145 -0
  39. data/lib/shoes/swt/line.rb +60 -0
  40. data/lib/shoes/swt/link.rb +31 -0
  41. data/lib/shoes/swt/link_segment.rb +111 -0
  42. data/lib/shoes/swt/list_box.rb +48 -0
  43. data/lib/shoes/swt/mouse_move_listener.rb +67 -0
  44. data/lib/shoes/swt/oval.rb +52 -0
  45. data/lib/shoes/swt/progress.rb +35 -0
  46. data/lib/shoes/swt/radio.rb +29 -0
  47. data/lib/shoes/swt/radio_group.rb +54 -0
  48. data/lib/shoes/swt/rect.rb +30 -0
  49. data/lib/shoes/swt/rect_painter.rb +23 -0
  50. data/lib/shoes/swt/redrawing_aspect.rb +123 -0
  51. data/lib/shoes/swt/shape.rb +133 -0
  52. data/lib/shoes/swt/shoes_layout.rb +43 -0
  53. data/lib/shoes/swt/slot.rb +39 -0
  54. data/lib/shoes/swt/sound.rb +119 -0
  55. data/lib/shoes/swt/star.rb +50 -0
  56. data/lib/shoes/swt/support/jl1.0.1.jar +0 -0
  57. data/lib/shoes/swt/support/jogg-0.0.7.jar +0 -0
  58. data/lib/shoes/swt/support/jorbis-0.0.15.jar +0 -0
  59. data/lib/shoes/swt/support/log4j-1.2.16.jar +0 -0
  60. data/lib/shoes/swt/support/mp3spi1.9.5.jar +0 -0
  61. data/lib/shoes/swt/support/tritonus_share.jar +0 -0
  62. data/lib/shoes/swt/support/vorbisspi1.0.3.jar +0 -0
  63. data/lib/shoes/swt/swt_button.rb +56 -0
  64. data/lib/shoes/swt/text_block.rb +124 -0
  65. data/lib/shoes/swt/text_block/centered_text_segment.rb +22 -0
  66. data/lib/shoes/swt/text_block/cursor_painter.rb +53 -0
  67. data/lib/shoes/swt/text_block/fitter.rb +212 -0
  68. data/lib/shoes/swt/text_block/painter.rb +47 -0
  69. data/lib/shoes/swt/text_block/text_font_factory.rb +50 -0
  70. data/lib/shoes/swt/text_block/text_segment.rb +108 -0
  71. data/lib/shoes/swt/text_block/text_segment_collection.rb +160 -0
  72. data/lib/shoes/swt/text_block/text_style_factory.rb +88 -0
  73. data/lib/shoes/swt/timer.rb +19 -0
  74. data/lib/shoes/swt/tooling/leak_hunter.rb +35 -0
  75. data/lib/shoes/swt/version.rb +5 -0
  76. data/manifests/common.rb +34 -0
  77. data/manifests/shoes-swt.rb +29 -0
  78. data/shoes-swt.gemspec +24 -0
  79. data/spec/code_coverage.rb +14 -0
  80. data/spec/shoes/animation_spec.rb +65 -0
  81. data/spec/shoes/app_spec.rb +484 -0
  82. data/spec/shoes/arc_spec.rb +51 -0
  83. data/spec/shoes/background_spec.rb +53 -0
  84. data/spec/shoes/border_spec.rb +47 -0
  85. data/spec/shoes/builtin_methods_spec.rb +110 -0
  86. data/spec/shoes/button_spec.rb +44 -0
  87. data/spec/shoes/check_spec.rb +35 -0
  88. data/spec/shoes/cli_spec.rb +15 -0
  89. data/spec/shoes/color_spec.rb +408 -0
  90. data/spec/shoes/common/inspect_spec.rb +26 -0
  91. data/spec/shoes/common/remove_spec.rb +38 -0
  92. data/spec/shoes/common/style_normalizer_spec.rb +28 -0
  93. data/spec/shoes/common/style_spec.rb +147 -0
  94. data/spec/shoes/configuration_spec.rb +36 -0
  95. data/spec/shoes/constants_spec.rb +38 -0
  96. data/spec/shoes/dialog_spec.rb +163 -0
  97. data/spec/shoes/dimension_spec.rb +407 -0
  98. data/spec/shoes/dimensions_spec.rb +837 -0
  99. data/spec/shoes/download_spec.rb +142 -0
  100. data/spec/shoes/flow_spec.rb +133 -0
  101. data/spec/shoes/font_spec.rb +37 -0
  102. data/spec/shoes/framework_learning_spec.rb +30 -0
  103. data/spec/shoes/gradient_spec.rb +32 -0
  104. data/spec/shoes/helpers/fake_element.rb +17 -0
  105. data/spec/shoes/helpers/inspect_helpers.rb +5 -0
  106. data/spec/shoes/helpers/sample17_helper.rb +66 -0
  107. data/spec/shoes/image_spec.rb +49 -0
  108. data/spec/shoes/images/shoe.jpg +0 -0
  109. data/spec/shoes/input_box_spec.rb +80 -0
  110. data/spec/shoes/integration_spec.rb +20 -0
  111. data/spec/shoes/internal_app_spec.rb +141 -0
  112. data/spec/shoes/keypress_spec.rb +11 -0
  113. data/spec/shoes/keyrelease_spec.rb +12 -0
  114. data/spec/shoes/line_spec.rb +49 -0
  115. data/spec/shoes/link_spec.rb +105 -0
  116. data/spec/shoes/list_box_spec.rb +74 -0
  117. data/spec/shoes/logger/ruby_spec.rb +8 -0
  118. data/spec/shoes/logger_spec.rb +45 -0
  119. data/spec/shoes/oval_spec.rb +24 -0
  120. data/spec/shoes/point_spec.rb +71 -0
  121. data/spec/shoes/progress_spec.rb +54 -0
  122. data/spec/shoes/radio_spec.rb +32 -0
  123. data/spec/shoes/rect_spec.rb +39 -0
  124. data/spec/shoes/renamed_delegate_spec.rb +70 -0
  125. data/spec/shoes/shape_spec.rb +95 -0
  126. data/spec/shoes/shared_examples/button.rb +6 -0
  127. data/spec/shoes/shared_examples/changeable.rb +26 -0
  128. data/spec/shoes/shared_examples/clickable.rb +5 -0
  129. data/spec/shoes/shared_examples/common_methods.rb +35 -0
  130. data/spec/shoes/shared_examples/dimensions.rb +32 -0
  131. data/spec/shoes/shared_examples/dsl.rb +44 -0
  132. data/spec/shoes/shared_examples/dsl/animate.rb +29 -0
  133. data/spec/shoes/shared_examples/dsl/arc.rb +45 -0
  134. data/spec/shoes/shared_examples/dsl/background.rb +26 -0
  135. data/spec/shoes/shared_examples/dsl/border.rb +10 -0
  136. data/spec/shoes/shared_examples/dsl/button.rb +5 -0
  137. data/spec/shoes/shared_examples/dsl/cap.rb +6 -0
  138. data/spec/shoes/shared_examples/dsl/check.rb +11 -0
  139. data/spec/shoes/shared_examples/dsl/edit_box.rb +8 -0
  140. data/spec/shoes/shared_examples/dsl/edit_line.rb +8 -0
  141. data/spec/shoes/shared_examples/dsl/editable_element.rb +29 -0
  142. data/spec/shoes/shared_examples/dsl/fill.rb +27 -0
  143. data/spec/shoes/shared_examples/dsl/flow.rb +15 -0
  144. data/spec/shoes/shared_examples/dsl/gradient.rb +62 -0
  145. data/spec/shoes/shared_examples/dsl/image.rb +21 -0
  146. data/spec/shoes/shared_examples/dsl/line.rb +9 -0
  147. data/spec/shoes/shared_examples/dsl/nofill.rb +6 -0
  148. data/spec/shoes/shared_examples/dsl/nostroke.rb +6 -0
  149. data/spec/shoes/shared_examples/dsl/oval.rb +88 -0
  150. data/spec/shoes/shared_examples/dsl/pattern.rb +34 -0
  151. data/spec/shoes/shared_examples/dsl/progress.rb +7 -0
  152. data/spec/shoes/shared_examples/dsl/rect.rb +92 -0
  153. data/spec/shoes/shared_examples/dsl/rgb.rb +26 -0
  154. data/spec/shoes/shared_examples/dsl/shape.rb +21 -0
  155. data/spec/shoes/shared_examples/dsl/star.rb +48 -0
  156. data/spec/shoes/shared_examples/dsl/stroke.rb +30 -0
  157. data/spec/shoes/shared_examples/dsl/strokewidth.rb +19 -0
  158. data/spec/shoes/shared_examples/dsl/style.rb +32 -0
  159. data/spec/shoes/shared_examples/dsl/text_elements.rb +81 -0
  160. data/spec/shoes/shared_examples/dsl/video.rb +5 -0
  161. data/spec/shoes/shared_examples/dsl_app_context.rb +8 -0
  162. data/spec/shoes/shared_examples/hover_leave.rb +11 -0
  163. data/spec/shoes/shared_examples/parent.rb +6 -0
  164. data/spec/shoes/shared_examples/scroll.rb +41 -0
  165. data/spec/shoes/shared_examples/shared_element_method.rb +60 -0
  166. data/spec/shoes/shared_examples/slot.rb +331 -0
  167. data/spec/shoes/shared_examples/state.rb +19 -0
  168. data/spec/shoes/shared_examples/style.rb +82 -0
  169. data/spec/shoes/slot_spec.rb +130 -0
  170. data/spec/shoes/sound_spec.rb +15 -0
  171. data/spec/shoes/span_spec.rb +112 -0
  172. data/spec/shoes/spec_helper.rb +24 -0
  173. data/spec/shoes/stack_spec.rb +79 -0
  174. data/spec/shoes/star_spec.rb +31 -0
  175. data/spec/shoes/text_block_dimensions_spec.rb +75 -0
  176. data/spec/shoes/text_block_spec.rb +270 -0
  177. data/spec/shoes/url_spec.rb +68 -0
  178. data/spec/shoes/widget_spec.rb +70 -0
  179. data/spec/shoes_spec.rb +44 -0
  180. data/spec/spec_helper.rb +18 -0
  181. data/spec/swt_shoes/animation_spec.rb +86 -0
  182. data/spec/swt_shoes/app_spec.rb +84 -0
  183. data/spec/swt_shoes/arc_spec.rb +103 -0
  184. data/spec/swt_shoes/background_spec.rb +67 -0
  185. data/spec/swt_shoes/border_spec.rb +52 -0
  186. data/spec/swt_shoes/button_spec.rb +101 -0
  187. data/spec/swt_shoes/check_spec.rb +28 -0
  188. data/spec/swt_shoes/color_factory_spec.rb +49 -0
  189. data/spec/swt_shoes/color_spec.rb +67 -0
  190. data/spec/swt_shoes/common/painter_spec.rb +49 -0
  191. data/spec/swt_shoes/common/remove_spec.rb +53 -0
  192. data/spec/swt_shoes/configuration_spec.rb +12 -0
  193. data/spec/swt_shoes/dialog_spec.rb +106 -0
  194. data/spec/swt_shoes/disposed_protection_spec.rb +49 -0
  195. data/spec/swt_shoes/flow_spec.rb +36 -0
  196. data/spec/swt_shoes/font_spec.rb +33 -0
  197. data/spec/swt_shoes/gradient_spec.rb +31 -0
  198. data/spec/swt_shoes/image_pattern_spec.rb +35 -0
  199. data/spec/swt_shoes/image_spec.rb +100 -0
  200. data/spec/swt_shoes/input_box_spec.rb +116 -0
  201. data/spec/swt_shoes/integration_spec.rb +27 -0
  202. data/spec/swt_shoes/key_listener_spec.rb +325 -0
  203. data/spec/swt_shoes/line_spec.rb +49 -0
  204. data/spec/swt_shoes/link_segment_spec.rb +120 -0
  205. data/spec/swt_shoes/link_spec.rb +54 -0
  206. data/spec/swt_shoes/list_box_spec.rb +56 -0
  207. data/spec/swt_shoes/minimal.png +0 -0
  208. data/spec/swt_shoes/mouse_move_listener_spec.rb +123 -0
  209. data/spec/swt_shoes/oval_spec.rb +51 -0
  210. data/spec/swt_shoes/progress_spec.rb +44 -0
  211. data/spec/swt_shoes/radio_group_spec.rb +73 -0
  212. data/spec/swt_shoes/radio_spec.rb +56 -0
  213. data/spec/swt_shoes/rect_painter_spec.rb +45 -0
  214. data/spec/swt_shoes/rect_spec.rb +19 -0
  215. data/spec/swt_shoes/shape_spec.rb +84 -0
  216. data/spec/swt_shoes/shared_examples/button.rb +21 -0
  217. data/spec/swt_shoes/shared_examples/clickable.rb +85 -0
  218. data/spec/swt_shoes/shared_examples/movable.rb +36 -0
  219. data/spec/swt_shoes/shared_examples/paintable.rb +7 -0
  220. data/spec/swt_shoes/shared_examples/painter.rb +83 -0
  221. data/spec/swt_shoes/shared_examples/pattern.rb +32 -0
  222. data/spec/swt_shoes/shared_examples/removable.rb +41 -0
  223. data/spec/swt_shoes/shared_examples/swt_app_context.rb +23 -0
  224. data/spec/swt_shoes/shared_examples/visibility.rb +15 -0
  225. data/spec/swt_shoes/shell_control_listener_spec.rb +23 -0
  226. data/spec/swt_shoes/slot_spec.rb +24 -0
  227. data/spec/swt_shoes/sound.rb +10 -0
  228. data/spec/swt_shoes/spec_helper.rb +31 -0
  229. data/spec/swt_shoes/star_spec.rb +47 -0
  230. data/spec/swt_shoes/text_block/centered_text_segment_spec.rb +16 -0
  231. data/spec/swt_shoes/text_block/cursor_painter_spec.rb +120 -0
  232. data/spec/swt_shoes/text_block/fitter_spec.rb +213 -0
  233. data/spec/swt_shoes/text_block/painter_spec.rb +212 -0
  234. data/spec/swt_shoes/text_block/text_font_factory_spec.rb +40 -0
  235. data/spec/swt_shoes/text_block/text_segment_collection_spec.rb +256 -0
  236. data/spec/swt_shoes/text_block/text_segment_spec.rb +135 -0
  237. data/spec/swt_shoes/text_block_spec.rb +199 -0
  238. metadata +496 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fc2fdddb4dde0f1851a14ad6d80eba05bbfbcbf8
4
+ data.tar.gz: 46f67fe6b3e5862691160e72ffe11fdeb2c16fb2
5
+ SHA512:
6
+ metadata.gz: efd9df04dd3ff0ab42b48199549fdd8e106bc1800253596b8c08faf38ff31f685f9fbabbe1b79a467a7121f2fb4fba65861f00182f92ebe8a342d8c839d97b7b
7
+ data.tar.gz: 0f90a7302a227e3781dc04438b0a238a786d2f9fbfade0ae3627225fd22de5350704243c5d19d25dfd501820ff300f65a2f59740ab6382e31eca7a07020f03b4
data/CHANGELOG ADDED
@@ -0,0 +1,84 @@
1
+ 4.0.0.pre2 (438 commits)
2
+ ----------------
3
+
4
+ New features (1)
5
+ ----------------
6
+
7
+ * Shoes 4.0.0.pre1 was a single gem. Now we ship as as three gems [e16a0c4]:
8
+
9
+ * shoes -- Home to the shoes executable. Declares dependencies on other
10
+ shoes gems for ease of installation.
11
+ * shoes-dsl -- Code for the Shoes DSL. No direct UI rendering and will be
12
+ reused with all future backends.
13
+ * shoes-swt -- The first Shoes backend, implemented in JRuby on the SWT
14
+ library via the swt gem.
15
+
16
+ * Full style-setting functionality (element#style, setters, hash, app level) [56d91f8]
17
+
18
+ Improvements (36)
19
+ -----------------
20
+
21
+ * Update SWT to 4.4 [536ffae]
22
+ * Update packaging dependency to 0.2.0 now supporting rubyzip > 1.0 [c3dd289]
23
+ * Update all elements to use new style methods [1b76aa3, 29498d1, d569a77, e6eec90, 54e5edf, 1238977, 2dc222f, dbeffff, 25b2ec6, cb865a6, 49fa0a1]
24
+ * Update list of app level styles and partially fix rotate angle issues [2affdbb]
25
+ * Shoes application context improved to avoid conflicts between user-defined and shoes-defined methods. [732108a]
26
+ * Builtin methods are also available from the Shoes class [de37d59]
27
+ * #gray, #rgb and #gradient builtin methods [8f7ee92]
28
+ * Removed redrawing triggers after Dimension methods [61a55ba]
29
+ * Apply fraction from progress initialize [b241240]
30
+ * Trigger redraw on hover/leave for slot and image update [ae5dfb5]
31
+ * Nobody Knows Shoes samples added [68e84e6]
32
+ * Add sample56 snapshot [e7eb0d3]
33
+ * Add scroll* methods to slots. Scrolling functionality not implemented yet. [6fb0e79]
34
+ * Click passes element, not coordinates to most blocks [78ecb23]
35
+ * Allow button calls without a button name [a315ef4]
36
+ * Add common #to_s and #inspect methods for DSL objects [350c4dc]
37
+ * Disposal for Images and Patterns. [ddcd9fb]
38
+ * Move Swt::TextBlock related classes to subdirectory. [226e03f]
39
+ * Revise TextBlock cursor to be more like other text functionality. [f016ee7]
40
+ * Updated manual to show correct syntax for rect. [2fee530]
41
+ * App#parent method to show the parent of the slot currently evaled [48e811f]
42
+ * Add keypress to close app cleanly when running leak hunter and dispose of app-level resources. [af4d6bb]
43
+
44
+ Bug Fixes (32)
45
+ --------------
46
+
47
+ * Fix running bin/shoes.bat from source [fe47075]
48
+ * Move shoes executable from shoes-dsl to shoes [92583e6]
49
+ * Fix for crash on empty link text [3da3159]
50
+ * Hide only the elements of a slot, not its parent contents [f2ea17c]
51
+ * Fix crash for Border when hiding [1c2ab74]
52
+ * Methods defined in widgets are available in URL instances [3a94afb]
53
+ * Make texts know their TextBlock and hence their visibility [7b4ea24]
54
+ * Non resizable apps can not be maximized (fixes resizable on mac) #872 [b08b215]
55
+ * Keypress#remove removes the keys listener and does not blow up [498588c]
56
+ * Run shape blocks with app as self [dbb0a46]
57
+ * When an element is removed or removed, cursor shouldn't change shape over that location. [918288f, 7fcd93a]
58
+ * Removing children from slot should trigger redraw [be35743]
59
+ * Fix for allowing widgets to use widget DSL methods [99d22e1]
60
+ * Fix for secret on edit lines [79c4c98]
61
+ * Fix crash computing height with hidden elements [41ebafe]
62
+ * Fix for unbounded height crash on centering [11fc3ae]
63
+ * Windows build requires shoes.bat from ext/install [232ec68]
64
+ * Reuse created fonts in the factory [7959bd8]
65
+ * Disposal of Shape SWT resources. [650365b]
66
+ * Fix for offsetting of second text segments [97fe79b]
67
+ * Consider relatively positioned elements for slot height [3e71126]
68
+ * Fix fatal exceptions in samples/simple-calc.rb [d53d588]
69
+ * Fix slot clearing [3697802]
70
+ * Don't clear top_slot when clear is called, clear current_slot [a57778c]
71
+ * Handling for text centering [87405f5]
72
+ * Fix common remove to allow removal of slots [c25df7e]
73
+ * Clear transform after painting each object, to avoid side effects on other painters [5a57ce3]
74
+ * Fix off by one error in slot positioning. [baee69a]
75
+ * Dispose of transform resources. [265600c]
76
+ * Only report start/end relative to the parent if there is one [c82e763]
77
+ * Links must be cleared on TextBlock#replace [4b90786]
78
+
79
+ Contributors (16)
80
+ -----------------
81
+
82
+ Jason R. Clark, Eric Watson, Tobias Pfeiffer, KC Erb, Charles Chamberlain,
83
+ George, Marcell Monteiro Cruz, Glenn Murray, Jason Clark, Tim Krajcar,
84
+ glenn-murray-bse, KCErb, PeterWAWood, Suirtimed, ashbb, Carlos R Tirado
data/Gemfile ADDED
@@ -0,0 +1,24 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec :name => 'shoes'
4
+ gemspec :name => 'shoes-dsl'
5
+ gemspec :name => 'shoes-swt'
6
+
7
+ group :development do
8
+ gem "guard"
9
+ gem "guard-rspec"
10
+ gem "pry"
11
+
12
+ gem "rspec", "~>3.0.0"
13
+ gem "rspec-its", "~>1.0.1"
14
+ gem "rake"
15
+
16
+ gem "yard"
17
+ gem "kramdown"
18
+ gem 'simplecov'
19
+ gem 'coveralls'
20
+ gem "codeclimate-test-reporter"
21
+ gem 'jruby-lint'
22
+ gem 'webmock'
23
+ gem 'hometown'
24
+ end
data/Guardfile ADDED
@@ -0,0 +1,11 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'rspec' do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
7
+ watch(%r{^lib/shoes/mock/(.+)\.rb$}) { |m| "spec/shoes/#{m[1]}_spec.rb" }
8
+ watch(%r{^lib/shoes/swt/(.+)\.rb$}) { |m| "spec/swt_shoes/#{m[1]}_spec.rb" }
9
+ watch('lib/shoes/dsl.rb') { |m| "spec/swt_shoes/dsl_spec.rb" }
10
+ end
11
+
data/LICENSE ADDED
@@ -0,0 +1,31 @@
1
+ Copyright (C) 2011 Steve Klabnik, Peter Fitzgibbons
2
+ Copyright (c) 2008 why the lucky stiff
3
+ Except:
4
+ fonts/Coolvetica.ttf (c) 1999 Ray Larabie
5
+ fonts/Lacuna.ttf (c) 2003 Glashaus, designed by Peter Hoffman
6
+ samples/expert-minesweeper.rb (c) 2008 que
7
+ samples/expert-othello.rb (c) 2008 Tieg Zaharia
8
+ samples/expert-tankspank.rb (c) 2008 Kevin C.
9
+ samples/good-clock.rb (c) 2008 Thomas Bell
10
+ samples/good-reminder.rb (c) 2008 Oliver Smith
11
+
12
+ Permission is hereby granted, free of charge, to any person
13
+ obtaining a copy of this software and associated documentation
14
+ files (the "Software"), to deal in the Software without restriction,
15
+ including without limitation the rights to use, copy, modify, merge,
16
+ publish, distribute, sublicense, and/or sell copies of the Software,
17
+ and to permit persons to whom the Software is furnished to do so,
18
+ subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be
21
+ included in all copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
24
+ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
25
+ TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
26
+ PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
27
+ SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
28
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
29
+ OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,201 @@
1
+ # shoes4 [![Build Status](https://secure.travis-ci.org/shoes/shoes4.svg?branch=master)](http://travis-ci.org/shoes/shoes4)[![Code Climate](https://img.shields.io/codeclimate/github/shoes/shoes4.svg)](https://codeclimate.com/github/shoes/shoes4)[![Coverage Status](https://img.shields.io/coveralls/shoes/shoes4.svg)](https://coveralls.io/r/shoes/shoes4?branch=master)[![Dependency Status](https://img.shields.io/gemnasium/shoes/shoes4.svg)](https://gemnasium.com/shoes/shoes4)
2
+
3
+ Shoes 4 : the next version of Shoes
4
+
5
+ ## Pre-alpha
6
+
7
+ Hi there, thanks for checking by! Shoes 4 is still pre-alpha software. It currently supports almost all of the shoes DSL, but there are still some spots where you might get surprising results. If you're not too adventurous just yet you can still use the [old shoes](https://github.com/shoes/shoes)!
8
+
9
+ There is a first [preview release](https://rubygems.org/gems/shoes/versions/4.0.0.pre1) now :)
10
+
11
+ ## Installing Shoes4
12
+
13
+ There are two ways to get your hands on shoes 4 - the preview gem release and installing it straight from github. For both you need a current [JRuby](http://www.jruby.org/) installation.
14
+
15
+
16
+ ### Get a JDK and JRuby
17
+
18
+ So your first step is to install a [JDK](http://www.oracle.com/technetwork/java/javase/downloads/) (shoes also works with [OpenJDK](http://openjdk.java.net/)) and [JRuby](http://jruby.org). Make sure to grab the appropriate JRuby version for your operating system. On Linux/Mac you can also use ruby installation tools to install JRuby. For instance [rvm](http://rvm.io/):
19
+
20
+ $ rvm install jruby
21
+
22
+ **Important JRuby version note:** JRuby 1.7.14 and 1.7.15 have a bug where `bundle install` won't work with shoes4. Make sure to use JRuby 1.7.16 or JRuby-1.7.13 with shoes4.
23
+
24
+ **JDK version note:** While shoes4 should generally work with JDK version 6 and up we recommend to use newer version. Also within the JDK major version make sure to have the latest updates installed, we had cases where newer versions resolved bugs.
25
+
26
+ ### Installing Shoes4 as a gem
27
+
28
+ #### *nix (Mac OSX/Linux)
29
+
30
+ $ gem install shoes --pre
31
+
32
+ #### Windows
33
+
34
+ C:\tmp> jruby -S gem install shoes --pre
35
+
36
+ ### Installing Shoes4 from github
37
+
38
+ If you want to be on the bleeding edge or want to contribute code you need to install it straight from the github repository.
39
+
40
+ #### *nix (Mac OSX/Linux)
41
+
42
+ 1. Fork the repository and clone your fork, or
43
+
44
+ $ git clone git://github.com/shoes/shoes4.git
45
+
46
+ 2. Set up your local environment
47
+
48
+ $ cd shoes4
49
+ $ gem install bundler && bundle install
50
+
51
+ Note: If you got rvm, rbenv or something like that installed it might complain that you should use jruby version xx. That's because we keep our .ruby-version files up to date. You should be able to run it with a JRuby version >= 1.7.0. We recommend up to date versions though.
52
+
53
+ 3. You're ready to go!
54
+
55
+ #### Windows
56
+
57
+ 1. Fork the repository and clone your fork, or
58
+
59
+ C:\tmp> git clone git://github.com/shoes/shoes4.git
60
+
61
+ 2. Set up your local environment
62
+
63
+ C:\tmp>cd shoes4
64
+ C:\tmp\shoes4>jruby -S gem install bundler
65
+ C:\tmp\shoes4>jruby -S bundle install
66
+
67
+ 3. You're ready to go!
68
+
69
+ ## Running a Shoes App
70
+
71
+ Shoes 4 comes with a command-line app runner. Just pass it the filename of your Shoes app.
72
+
73
+ $ bin/shoes samples/simple-sound.rb
74
+
75
+ **Note:** For Windows, `C:\tmp\shoes4>bin\shoes samples\simple-sound.rb` If you installed Shoes4 as a gem, just do `C:\tmp> shoes path\to\file.rb`
76
+
77
+ There is also a simple ruby starter script which you may use as follows:
78
+
79
+ $ bin/ruby-shoes samples/simple-sound.rb
80
+
81
+ This does not work yet on Mac as JRuby (the JVM) needs some additional parameters. Here you can just do the following (which basically is what bin/shoes does):
82
+
83
+ $ jruby -J-XstartOnFirstThread bin/ruby-shoes samples/simple-sound.rb
84
+
85
+ Another alternative yet is to put `require 'shoes'` at the top of your applications, then you can simply do
86
+
87
+ $ jruby path/to/file.rb
88
+
89
+ On OS X you still need to supply the additional parameters to JRuby
90
+
91
+ $ jruby -J-XstartOnFirstThread path/to/file.rb
92
+
93
+ ## Want to see what shoes can do?
94
+
95
+ You can run `rake samples` and random samples we believe are working will be run until you quit with Ctr + C. Some of them are really simple, while others are more complex or even games!
96
+ If you notice any issue with those samples please [let us know](https://github.com/shoes/shoes4/issues/new)!
97
+
98
+ ## Packaging a Shoes App
99
+
100
+ Packaging is just a baby, so be gentle.
101
+
102
+ In order to package an app, you need to have the Shoes gem installed in your environment. If you didn't do the gem installation you can always generate a gem and install it from the current source:
103
+
104
+ $ rake install:all
105
+
106
+ Now, you can package an app. But first, look here:
107
+
108
+ - The packager will include ***everything*** in the directory of your shoes script and below, unless you tell it not to.
109
+ - The packager will probably not work properly if it detects a `.gemspec` or a `Gemfile`. It uses Warbler, which always looks for those files. If you run the specs, you may notice some warnings like this:
110
+
111
+ > warning: Bundler \`path' components are not currently supported.
112
+ > The \`shoes-4.0.0.pre1' component was not bundled.
113
+ > Your application may fail to boot!
114
+
115
+ That's Warbler talking. Actually, we sneak the Shoes gem in anyway, but don't tell.
116
+
117
+ Okay, now for real. The simplest thing is to put your script in a directory by itself and then:
118
+
119
+ $ bin/shoes -p swt:app path/to/directory-of/your-shoes-app.rb
120
+
121
+ This will produce a Mac app, which you can then find at `path/to/directory-of/pkg/Shoes App.app`.
122
+
123
+ You can also package a shoes app up as a jar through:
124
+
125
+ $ bin/shoes -p swt:jar path/to/directory-of/your-shoes-app.rb
126
+
127
+ You can find the jar in the same directory as above, i.e. path/to/directory-of/pkg/your-shoes-app.jar
128
+
129
+ If you want more control (like you want to name your app something besides "Shoes App", or you don't want to include all of those files we talked about before), make an `app.yaml` file. See [the example](https://github.com/shoes/shoes4/blob/master/app.yaml) for more details.
130
+
131
+ ***Note:*** *If you use an `app.yaml`, you will have to customize or comment out each option. The example is just an example ;)*
132
+
133
+ When you have an `app.yaml` file right next to your script, you have three options:
134
+
135
+ $ bin/shoes -p swt:app path/to/directory-of/your-shoes-app.rb
136
+ $ bin/shoes -p swt:app path/to/directory-of/app.yaml
137
+ $ bin/shoes -p swt:app path/to/directory-of
138
+
139
+ The packager will find your instructions using any of those commands. Again, you'll find your app in the `pkg` directory inside your project's directory. Find out more at `bin/shoes --help`.
140
+
141
+ Oh, and you can also just run your Shoes apps with `bin/shoes`.
142
+
143
+ ## Want to contribute?
144
+
145
+ That's awesome, thank you!
146
+
147
+ You can go ahead an try to fix one of our [issues](https://github.com/shoes/shoes4/issues).
148
+ We have introduced a new tag 'Newcomer Friendly' for issues we believe are suitable to get started with shoes contributing. These issues either are relatively easy to accomplish or don't depend on a lot of other shoes code (e.g. completely new features) so that it's easier to get started.
149
+ Please feel free to tackle any issue - we will help you if needed. The tag is just a suggestion! =)
150
+
151
+ Also there is a list of samples that already work at samples/README, along with all the other samples. You can try to get a new sample to run. In order to do so you can run `rake non_samples` to run a random sample we think does not work. If you just want to list the non working samples you can also run `rake list_non_samples`.
152
+
153
+ With all you do, please make sure to write specs as Shoes 4 is developed TDD-style (see the [Running Specs](https://github.com/shoes/shoes4#running-specs) section below). So make sure that you don't break any tests :-)
154
+
155
+ If you feel unsure about testing or your implementation just open an issue or a pull request. Pull requests don't need to be done - they are great discussion starters! We're happy to help you get your contribution ready to be merged in order to help build Shoes 4!
156
+
157
+ In fact we greatly appreciate early pull requests to review code and help you find your way around Shoes4! =)
158
+
159
+ If you have questions, also feel free to drop by on the #shoes channel on FreeNode irc. People might not respond instantly, but after some time someone will respond :-)
160
+
161
+ It sometimes is also a good way to refactor some code or write some specs in order to get familiar with a project. If you want to try this approach you can have a look at our [Code Climate](https://codeclimate.com/github/shoes/shoes4) to find candidates for refactoring or after running the specs locally take a peak into the coverage directory and open index.html - it shows you our current coverage data. See something that isn't covered and maybe you can write a spec for it?
162
+
163
+ Refer to the following section for information on how to run the specs, that were mentioned before :-)
164
+
165
+ ## Running Specs
166
+
167
+ Shoes 4 is developed in a TDD style. You should be writing and running the specs :)
168
+
169
+ There are two kinds of Shoes 4 specs:
170
+
171
+ 1. **Integration specs:** These specify the functionality of the Shoes
172
+ DSL. They can be run with any compatible Shoes backend. Shoes 4 comes
173
+ with a mock backend and an Swt backend that can run the integration
174
+ specs.
175
+
176
+ 2. **Isolation specs:** These specify the internal behavior of a Shoes
177
+ backend, in isolation from the DSL. Shoes 4 comes with an isolation spec
178
+ suite for the Swt backend.
179
+
180
+ There are rake tasks for running specs. Some examples:
181
+
182
+ $ rake spec # Run the whole spec suite
183
+ $ rake spec:shoes # Run integration specs using the mock backend
184
+ $ rake spec:swt # Run integration specs using the Swt backend, plus isolation specs for the Swt backend
185
+ $ rake spec:swt:isolation # Run isolation specs for the Swt backend
186
+ $ rake spec:swt:integration # Run integration specs using the Swt backend
187
+ $ rake spec[Shape] # Run the whole spec suite, but only for Shape
188
+ $ rake spec:shoes[Shape] # Run integration specs for Shape using the mock backend
189
+ $ rake spec:swt[Shape] # Run integration and isolation specs for Shape, using the Swt backend
190
+ $ rake spec:swt:isolation[Shape] # Run isolation specs for Shape using the Swt backend
191
+
192
+ **Note:** For Windows, `C:\tmp\shoes4>jruby -S rake spec`
193
+
194
+ ## Contact
195
+
196
+ Want to get in touch with the shoes community? That's great! You can get in touch here:
197
+
198
+ * You can join the mailing list, simply send an email to shoes@librelist.com - you can also check out [the archives](http://librelist.com/browser/shoes/)
199
+ * We also have an irc channel #shoes on freenode - a lot of people are idling there so it might take some time to react
200
+
201
+ However we try to keep most discussions about the development in this repository/its issues so everyone can see them and look them up.
data/lib/shoes/swt.rb ADDED
@@ -0,0 +1,118 @@
1
+ require 'java'
2
+ require 'swt'
3
+ require 'after_do'
4
+ require 'shoes'
5
+
6
+ module Swt
7
+ include_package 'org.eclipse.swt.graphics'
8
+ include_package 'org.eclipse.swt.events'
9
+ include_package 'org.eclipse.swt.dnd'
10
+
11
+ module Events
12
+ import org.eclipse.swt.events.PaintListener
13
+ import org.eclipse.swt.events.MouseMoveListener
14
+ end
15
+
16
+ module Widgets
17
+ import org.eclipse.swt.widgets
18
+ import org.eclipse.swt.widgets.Layout
19
+ end
20
+
21
+ module Graphics
22
+ import org.eclipse.swt.graphics
23
+ import org.eclipse.swt.graphics.Pattern
24
+ end
25
+ end
26
+
27
+ class Shoes
28
+ module Swt
29
+ extend ::Shoes::Common::Registration
30
+
31
+ module Shoes
32
+ def self.app(opts={}, &blk)
33
+ Shoes::App.new(opts, &blk)
34
+ Shoes.logger.debug "Exiting Shoes.app"
35
+ end
36
+
37
+ def self.logger
38
+ ::Shoes.logger
39
+ end
40
+
41
+ def self.display
42
+ ::Swt::Widgets::Display.getCurrent
43
+ end
44
+
45
+ ::Swt::Widgets::Display.new.getFontList(nil, true).each{|f| ::Shoes::FONTS << f.getName}
46
+ ::Shoes::FONTS.uniq!
47
+ end
48
+ end
49
+ end
50
+
51
+ Shoes.configuration.backend = :swt
52
+
53
+ require 'shoes/swt/disposed_protection'
54
+ require 'shoes/swt/color'
55
+ require 'shoes/swt/color_factory'
56
+ require 'shoes/swt/common/child'
57
+ require 'shoes/swt/common/remove'
58
+ require 'shoes/swt/common/clickable'
59
+ require 'shoes/swt/common/container'
60
+ require 'shoes/swt/common/fill'
61
+ require 'shoes/swt/common/resource'
62
+ require 'shoes/swt/common/painter'
63
+ require 'shoes/swt/common/painter_updates_position'
64
+ require 'shoes/swt/common/visibility'
65
+ require 'shoes/swt/common/selection_listener'
66
+ require 'shoes/swt/common/stroke'
67
+ require 'shoes/swt/common/update_position'
68
+
69
+ require 'shoes/swt/input_box'
70
+ require 'shoes/swt/rect_painter.rb'
71
+ require 'shoes/swt/swt_button'
72
+ require 'shoes/swt/check_button'
73
+ require 'shoes/swt/radio_group'
74
+ require 'shoes/swt/text_block/painter'
75
+
76
+ require 'shoes/swt/app'
77
+ require 'shoes/swt/animation'
78
+ require 'shoes/swt/arc'
79
+ require 'shoes/swt/background'
80
+ require 'shoes/swt/border'
81
+ require 'shoes/swt/button'
82
+ require 'shoes/swt/check'
83
+ require 'shoes/swt/dialog'
84
+ require 'shoes/swt/download'
85
+ require 'shoes/swt/font'
86
+ require 'shoes/swt/gradient'
87
+ require 'shoes/swt/image'
88
+ require 'shoes/swt/image_pattern'
89
+ require 'shoes/swt/key_listener'
90
+ require 'shoes/swt/line'
91
+ require 'shoes/swt/link'
92
+ require 'shoes/swt/link_segment'
93
+ require 'shoes/swt/list_box'
94
+ require 'shoes/swt/mouse_move_listener'
95
+ require 'shoes/swt/oval'
96
+ require 'shoes/swt/progress'
97
+ require 'shoes/swt/radio'
98
+ require 'shoes/swt/rect'
99
+ require 'shoes/swt/shape'
100
+ require 'shoes/swt/shoes_layout'
101
+ require 'shoes/swt/slot'
102
+ require 'shoes/swt/star'
103
+ require 'shoes/swt/sound'
104
+ require 'shoes/swt/text_block'
105
+ require 'shoes/swt/timer'
106
+
107
+ require 'shoes/swt/text_block/text_segment'
108
+ require 'shoes/swt/text_block/centered_text_segment'
109
+ require 'shoes/swt/text_block/text_segment_collection'
110
+ require 'shoes/swt/text_block/cursor_painter'
111
+ require 'shoes/swt/text_block/fitter'
112
+ require 'shoes/swt/text_block/text_font_factory'
113
+ require 'shoes/swt/text_block/text_style_factory'
114
+
115
+ require 'shoes/swt/tooling/leak_hunter' if ENV["LEAK_HUNTER"]
116
+
117
+ # redrawing aspect needs to know all the classes
118
+ require 'shoes/swt/redrawing_aspect'