shoesgem 0.1424.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (808) hide show
  1. data/LICENSE +30 -0
  2. data/README.rdoc +31 -0
  3. data/lib/shoes.rb +4 -0
  4. data/shoes/CHANGELOG.txt +21 -0
  5. data/shoes/COPYING.txt +30 -0
  6. data/shoes/README.txt +117 -0
  7. data/shoes/VERSION.txt +1 -0
  8. data/shoes/fonts/Coolvetica.ttf +0 -0
  9. data/shoes/fonts/Lacuna.ttf +0 -0
  10. data/shoes/freetype6.dll +0 -0
  11. data/shoes/lib/shoes/cache.rb +54 -0
  12. data/shoes/lib/shoes/data.rb +39 -0
  13. data/shoes/lib/shoes/help.rb +421 -0
  14. data/shoes/lib/shoes/image.rb +25 -0
  15. data/shoes/lib/shoes/inspect.rb +128 -0
  16. data/shoes/lib/shoes/log.rb +48 -0
  17. data/shoes/lib/shoes/minitar.rb +986 -0
  18. data/shoes/lib/shoes/override.rb +38 -0
  19. data/shoes/lib/shoes/pack.rb +503 -0
  20. data/shoes/lib/shoes/search.rb +46 -0
  21. data/shoes/lib/shoes/setup.rb +329 -0
  22. data/shoes/lib/shoes/shy.rb +131 -0
  23. data/shoes/lib/shoes/shybuilder.rb +44 -0
  24. data/shoes/lib/shoes.rb +522 -0
  25. data/shoes/libcairo-2.dll +0 -0
  26. data/shoes/libeay32.dll +0 -0
  27. data/shoes/libexpat-1.dll +0 -0
  28. data/shoes/libfontconfig-1.dll +0 -0
  29. data/shoes/libgio-2.0-0.dll +0 -0
  30. data/shoes/libglib-2.0-0.dll +0 -0
  31. data/shoes/libgmodule-2.0-0.dll +0 -0
  32. data/shoes/libgobject-2.0-0.dll +0 -0
  33. data/shoes/libgthread-2.0-0.dll +0 -0
  34. data/shoes/libiconv2.dll +0 -0
  35. data/shoes/libjpeg-8.dll +0 -0
  36. data/shoes/libpango-1.0-0.dll +0 -0
  37. data/shoes/libpangocairo-1.0-0.dll +0 -0
  38. data/shoes/libpangoft2-1.0-0.dll +0 -0
  39. data/shoes/libpangowin32-1.0-0.dll +0 -0
  40. data/shoes/libpng14-14.dll +0 -0
  41. data/shoes/libportaudio-2.dll +0 -0
  42. data/shoes/libshoes.dll +0 -0
  43. data/shoes/libssl32.dll +0 -0
  44. data/shoes/libungif4.dll +0 -0
  45. data/shoes/msvcrt-ruby191.dll +0 -0
  46. data/shoes/readline5.dll +0 -0
  47. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/fast_xs.so +0 -0
  48. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/blankslate.rb +63 -0
  49. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/builder.rb +216 -0
  50. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/elements.rb +510 -0
  51. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/htmlinfo.rb +691 -0
  52. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/inspect.rb +103 -0
  53. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/modules.rb +40 -0
  54. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/parse.rb +38 -0
  55. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/tag.rb +202 -0
  56. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/tags.rb +164 -0
  57. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/traverse.rb +838 -0
  58. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/xchar.rb +94 -0
  59. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot.rb +26 -0
  60. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot_scan.so +0 -0
  61. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/add/core.rb +135 -0
  62. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/add/rails.rb +58 -0
  63. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/common.rb +354 -0
  64. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/ext/generator.so +0 -0
  65. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/ext/parser.so +0 -0
  66. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/ext.rb +13 -0
  67. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/version.rb +9 -0
  68. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json.rb +8 -0
  69. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/constants.rb +49 -0
  70. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/database.rb +721 -0
  71. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/driver/dl/api.rb +152 -0
  72. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/driver/dl/driver.rb +307 -0
  73. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/driver/native/driver.rb +219 -0
  74. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/errors.rb +68 -0
  75. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/pragmas.rb +271 -0
  76. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/resultset.rb +180 -0
  77. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/statement.rb +231 -0
  78. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/translator.rb +109 -0
  79. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/value.rb +57 -0
  80. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/version.rb +16 -0
  81. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3.rb +1 -0
  82. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3_api.so +0 -0
  83. data/shoes/ruby/gems/1.9.1/specifications/hpricot-0.8.1.gemspec +32 -0
  84. data/shoes/ruby/gems/1.9.1/specifications/json-shoes-1.1.3.gemspec +34 -0
  85. data/shoes/ruby/gems/1.9.1/specifications/sqlite3-ruby-1.2.5-x86-mswin32.gemspec +46 -0
  86. data/shoes/ruby/lib/English.rb +155 -0
  87. data/shoes/ruby/lib/Win32API.rb +28 -0
  88. data/shoes/ruby/lib/abbrev.rb +103 -0
  89. data/shoes/ruby/lib/base64.rb +91 -0
  90. data/shoes/ruby/lib/benchmark.rb +573 -0
  91. data/shoes/ruby/lib/bigdecimal/jacobian.rb +85 -0
  92. data/shoes/ruby/lib/bigdecimal/ludcmp.rb +86 -0
  93. data/shoes/ruby/lib/bigdecimal/math.rb +237 -0
  94. data/shoes/ruby/lib/bigdecimal/newton.rb +77 -0
  95. data/shoes/ruby/lib/bigdecimal/util.rb +53 -0
  96. data/shoes/ruby/lib/cgi/cookie.rb +144 -0
  97. data/shoes/ruby/lib/cgi/core.rb +786 -0
  98. data/shoes/ruby/lib/cgi/html.rb +1021 -0
  99. data/shoes/ruby/lib/cgi/session/pstore.rb +111 -0
  100. data/shoes/ruby/lib/cgi/session.rb +537 -0
  101. data/shoes/ruby/lib/cgi/util.rb +181 -0
  102. data/shoes/ruby/lib/cgi.rb +274 -0
  103. data/shoes/ruby/lib/cmath.rb +233 -0
  104. data/shoes/ruby/lib/complex.rb +24 -0
  105. data/shoes/ruby/lib/csv.rb +2320 -0
  106. data/shoes/ruby/lib/date/format.rb +1313 -0
  107. data/shoes/ruby/lib/date.rb +1834 -0
  108. data/shoes/ruby/lib/debug.rb +907 -0
  109. data/shoes/ruby/lib/delegate.rb +311 -0
  110. data/shoes/ruby/lib/digest/hmac.rb +274 -0
  111. data/shoes/ruby/lib/digest/sha2.rb +74 -0
  112. data/shoes/ruby/lib/digest.rb +50 -0
  113. data/shoes/ruby/lib/dl/callback.rb +69 -0
  114. data/shoes/ruby/lib/dl/cparser.rb +109 -0
  115. data/shoes/ruby/lib/dl/func.rb +153 -0
  116. data/shoes/ruby/lib/dl/import.rb +215 -0
  117. data/shoes/ruby/lib/dl/pack.rb +173 -0
  118. data/shoes/ruby/lib/dl/stack.rb +146 -0
  119. data/shoes/ruby/lib/dl/struct.rb +213 -0
  120. data/shoes/ruby/lib/dl/types.rb +40 -0
  121. data/shoes/ruby/lib/dl/value.rb +112 -0
  122. data/shoes/ruby/lib/drb/acl.rb +146 -0
  123. data/shoes/ruby/lib/drb/drb.rb +1778 -0
  124. data/shoes/ruby/lib/drb/eq.rb +16 -0
  125. data/shoes/ruby/lib/drb/extserv.rb +71 -0
  126. data/shoes/ruby/lib/drb/extservm.rb +85 -0
  127. data/shoes/ruby/lib/drb/gw.rb +122 -0
  128. data/shoes/ruby/lib/drb/invokemethod.rb +34 -0
  129. data/shoes/ruby/lib/drb/observer.rb +22 -0
  130. data/shoes/ruby/lib/drb/ssl.rb +190 -0
  131. data/shoes/ruby/lib/drb/timeridconv.rb +91 -0
  132. data/shoes/ruby/lib/drb/unix.rb +108 -0
  133. data/shoes/ruby/lib/drb.rb +2 -0
  134. data/shoes/ruby/lib/e2mmap.rb +172 -0
  135. data/shoes/ruby/lib/erb.rb +902 -0
  136. data/shoes/ruby/lib/fileutils.rb +1592 -0
  137. data/shoes/ruby/lib/find.rb +81 -0
  138. data/shoes/ruby/lib/forwardable.rb +270 -0
  139. data/shoes/ruby/lib/ftsearch/analysis/analyzer.rb +16 -0
  140. data/shoes/ruby/lib/ftsearch/analysis/simple_identifier_analyzer.rb +23 -0
  141. data/shoes/ruby/lib/ftsearch/analysis/whitespace_analyzer.rb +22 -0
  142. data/shoes/ruby/lib/ftsearch/document_map_reader.rb +106 -0
  143. data/shoes/ruby/lib/ftsearch/document_map_writer.rb +46 -0
  144. data/shoes/ruby/lib/ftsearch/field_infos.rb +46 -0
  145. data/shoes/ruby/lib/ftsearch/fragment_writer.rb +114 -0
  146. data/shoes/ruby/lib/ftsearch/fulltext_reader.rb +52 -0
  147. data/shoes/ruby/lib/ftsearch/fulltext_writer.rb +75 -0
  148. data/shoes/ruby/lib/ftsearch/suffix_array_reader.rb +275 -0
  149. data/shoes/ruby/lib/ftsearch/suffix_array_writer.rb +99 -0
  150. data/shoes/ruby/lib/ftsearch/util.rb +21 -0
  151. data/shoes/ruby/lib/getoptlong.rb +610 -0
  152. data/shoes/ruby/lib/gserver.rb +253 -0
  153. data/shoes/ruby/lib/i386-mingw32/bigdecimal.so +0 -0
  154. data/shoes/ruby/lib/i386-mingw32/binject.so +0 -0
  155. data/shoes/ruby/lib/i386-mingw32/bloops.so +0 -0
  156. data/shoes/ruby/lib/i386-mingw32/continuation.so +0 -0
  157. data/shoes/ruby/lib/i386-mingw32/coverage.so +0 -0
  158. data/shoes/ruby/lib/i386-mingw32/curses.so +0 -0
  159. data/shoes/ruby/lib/i386-mingw32/digest/bubblebabble.so +0 -0
  160. data/shoes/ruby/lib/i386-mingw32/digest/md5.so +0 -0
  161. data/shoes/ruby/lib/i386-mingw32/digest/rmd160.so +0 -0
  162. data/shoes/ruby/lib/i386-mingw32/digest/sha1.so +0 -0
  163. data/shoes/ruby/lib/i386-mingw32/digest/sha2.so +0 -0
  164. data/shoes/ruby/lib/i386-mingw32/digest.so +0 -0
  165. data/shoes/ruby/lib/i386-mingw32/dl.so +0 -0
  166. data/shoes/ruby/lib/i386-mingw32/enc/big5.so +0 -0
  167. data/shoes/ruby/lib/i386-mingw32/enc/cp949.so +0 -0
  168. data/shoes/ruby/lib/i386-mingw32/enc/emacs_mule.so +0 -0
  169. data/shoes/ruby/lib/i386-mingw32/enc/encdb.so +0 -0
  170. data/shoes/ruby/lib/i386-mingw32/enc/euc_jp.so +0 -0
  171. data/shoes/ruby/lib/i386-mingw32/enc/euc_kr.so +0 -0
  172. data/shoes/ruby/lib/i386-mingw32/enc/euc_tw.so +0 -0
  173. data/shoes/ruby/lib/i386-mingw32/enc/gb18030.so +0 -0
  174. data/shoes/ruby/lib/i386-mingw32/enc/gb2312.so +0 -0
  175. data/shoes/ruby/lib/i386-mingw32/enc/gbk.so +0 -0
  176. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_1.so +0 -0
  177. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_10.so +0 -0
  178. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_11.so +0 -0
  179. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_13.so +0 -0
  180. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_14.so +0 -0
  181. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_15.so +0 -0
  182. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_16.so +0 -0
  183. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_2.so +0 -0
  184. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_3.so +0 -0
  185. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_4.so +0 -0
  186. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_5.so +0 -0
  187. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_6.so +0 -0
  188. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_7.so +0 -0
  189. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_8.so +0 -0
  190. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_9.so +0 -0
  191. data/shoes/ruby/lib/i386-mingw32/enc/koi8_r.so +0 -0
  192. data/shoes/ruby/lib/i386-mingw32/enc/koi8_u.so +0 -0
  193. data/shoes/ruby/lib/i386-mingw32/enc/shift_jis.so +0 -0
  194. data/shoes/ruby/lib/i386-mingw32/enc/trans/big5.so +0 -0
  195. data/shoes/ruby/lib/i386-mingw32/enc/trans/chinese.so +0 -0
  196. data/shoes/ruby/lib/i386-mingw32/enc/trans/escape.so +0 -0
  197. data/shoes/ruby/lib/i386-mingw32/enc/trans/gb18030.so +0 -0
  198. data/shoes/ruby/lib/i386-mingw32/enc/trans/gbk.so +0 -0
  199. data/shoes/ruby/lib/i386-mingw32/enc/trans/iso2022.so +0 -0
  200. data/shoes/ruby/lib/i386-mingw32/enc/trans/japanese.so +0 -0
  201. data/shoes/ruby/lib/i386-mingw32/enc/trans/japanese_euc.so +0 -0
  202. data/shoes/ruby/lib/i386-mingw32/enc/trans/japanese_sjis.so +0 -0
  203. data/shoes/ruby/lib/i386-mingw32/enc/trans/korean.so +0 -0
  204. data/shoes/ruby/lib/i386-mingw32/enc/trans/single_byte.so +0 -0
  205. data/shoes/ruby/lib/i386-mingw32/enc/trans/transdb.so +0 -0
  206. data/shoes/ruby/lib/i386-mingw32/enc/trans/utf_16_32.so +0 -0
  207. data/shoes/ruby/lib/i386-mingw32/enc/utf_16be.so +0 -0
  208. data/shoes/ruby/lib/i386-mingw32/enc/utf_16le.so +0 -0
  209. data/shoes/ruby/lib/i386-mingw32/enc/utf_32be.so +0 -0
  210. data/shoes/ruby/lib/i386-mingw32/enc/utf_32le.so +0 -0
  211. data/shoes/ruby/lib/i386-mingw32/enc/windows_1251.so +0 -0
  212. data/shoes/ruby/lib/i386-mingw32/etc.so +0 -0
  213. data/shoes/ruby/lib/i386-mingw32/fcntl.so +0 -0
  214. data/shoes/ruby/lib/i386-mingw32/fiber.so +0 -0
  215. data/shoes/ruby/lib/i386-mingw32/ftsearchrt.so +0 -0
  216. data/shoes/ruby/lib/i386-mingw32/gdbm.so +0 -0
  217. data/shoes/ruby/lib/i386-mingw32/iconv.so +0 -0
  218. data/shoes/ruby/lib/i386-mingw32/io/wait.so +0 -0
  219. data/shoes/ruby/lib/i386-mingw32/json/ext/generator.so +0 -0
  220. data/shoes/ruby/lib/i386-mingw32/json/ext/parser.so +0 -0
  221. data/shoes/ruby/lib/i386-mingw32/mathn/complex.so +0 -0
  222. data/shoes/ruby/lib/i386-mingw32/mathn/rational.so +0 -0
  223. data/shoes/ruby/lib/i386-mingw32/nkf.so +0 -0
  224. data/shoes/ruby/lib/i386-mingw32/openssl.so +0 -0
  225. data/shoes/ruby/lib/i386-mingw32/racc/cparse.so +0 -0
  226. data/shoes/ruby/lib/i386-mingw32/rbconfig.rb +196 -0
  227. data/shoes/ruby/lib/i386-mingw32/readline.so +0 -0
  228. data/shoes/ruby/lib/i386-mingw32/ripper.so +0 -0
  229. data/shoes/ruby/lib/i386-mingw32/sdbm.so +0 -0
  230. data/shoes/ruby/lib/i386-mingw32/socket.so +0 -0
  231. data/shoes/ruby/lib/i386-mingw32/stringio.so +0 -0
  232. data/shoes/ruby/lib/i386-mingw32/strscan.so +0 -0
  233. data/shoes/ruby/lib/i386-mingw32/syck.so +0 -0
  234. data/shoes/ruby/lib/i386-mingw32/win32ole.so +0 -0
  235. data/shoes/ruby/lib/i386-mingw32/zlib.so +0 -0
  236. data/shoes/ruby/lib/io/nonblock.rb +23 -0
  237. data/shoes/ruby/lib/ipaddr.rb +813 -0
  238. data/shoes/ruby/lib/irb/cmd/chws.rb +32 -0
  239. data/shoes/ruby/lib/irb/cmd/fork.rb +38 -0
  240. data/shoes/ruby/lib/irb/cmd/help.rb +36 -0
  241. data/shoes/ruby/lib/irb/cmd/load.rb +66 -0
  242. data/shoes/ruby/lib/irb/cmd/nop.rb +38 -0
  243. data/shoes/ruby/lib/irb/cmd/pushws.rb +38 -0
  244. data/shoes/ruby/lib/irb/cmd/subirb.rb +42 -0
  245. data/shoes/ruby/lib/irb/completion.rb +207 -0
  246. data/shoes/ruby/lib/irb/context.rb +255 -0
  247. data/shoes/ruby/lib/irb/ext/change-ws.rb +61 -0
  248. data/shoes/ruby/lib/irb/ext/history.rb +109 -0
  249. data/shoes/ruby/lib/irb/ext/loader.rb +119 -0
  250. data/shoes/ruby/lib/irb/ext/math-mode.rb +36 -0
  251. data/shoes/ruby/lib/irb/ext/multi-irb.rb +240 -0
  252. data/shoes/ruby/lib/irb/ext/save-history.rb +100 -0
  253. data/shoes/ruby/lib/irb/ext/tracer.rb +60 -0
  254. data/shoes/ruby/lib/irb/ext/use-loader.rb +64 -0
  255. data/shoes/ruby/lib/irb/ext/workspaces.rb +55 -0
  256. data/shoes/ruby/lib/irb/extend-command.rb +272 -0
  257. data/shoes/ruby/lib/irb/frame.rb +66 -0
  258. data/shoes/ruby/lib/irb/help.rb +35 -0
  259. data/shoes/ruby/lib/irb/init.rb +288 -0
  260. data/shoes/ruby/lib/irb/input-method.rb +142 -0
  261. data/shoes/ruby/lib/irb/lc/error.rb +29 -0
  262. data/shoes/ruby/lib/irb/lc/help-message +38 -0
  263. data/shoes/ruby/lib/irb/lc/ja/encoding_aliases.rb +8 -0
  264. data/shoes/ruby/lib/irb/lc/ja/error.rb +27 -0
  265. data/shoes/ruby/lib/irb/lc/ja/help-message +39 -0
  266. data/shoes/ruby/lib/irb/locale.rb +195 -0
  267. data/shoes/ruby/lib/irb/magic-file.rb +36 -0
  268. data/shoes/ruby/lib/irb/notifier.rb +144 -0
  269. data/shoes/ruby/lib/irb/output-method.rb +69 -0
  270. data/shoes/ruby/lib/irb/ruby-lex.rb +1188 -0
  271. data/shoes/ruby/lib/irb/ruby-token.rb +270 -0
  272. data/shoes/ruby/lib/irb/slex.rb +282 -0
  273. data/shoes/ruby/lib/irb/src_encoding.rb +4 -0
  274. data/shoes/ruby/lib/irb/version.rb +15 -0
  275. data/shoes/ruby/lib/irb/workspace.rb +108 -0
  276. data/shoes/ruby/lib/irb/ws-for-case-2.rb +14 -0
  277. data/shoes/ruby/lib/irb/xmp.rb +97 -0
  278. data/shoes/ruby/lib/irb.rb +354 -0
  279. data/shoes/ruby/lib/json/add/core.rb +135 -0
  280. data/shoes/ruby/lib/json/add/rails.rb +58 -0
  281. data/shoes/ruby/lib/json/common.rb +354 -0
  282. data/shoes/ruby/lib/json/editor.rb +1371 -0
  283. data/shoes/ruby/lib/json/ext.rb +15 -0
  284. data/shoes/ruby/lib/json/version.rb +9 -0
  285. data/shoes/ruby/lib/json.rb +297 -0
  286. data/shoes/ruby/lib/kconv.rb +282 -0
  287. data/shoes/ruby/lib/logger.rb +732 -0
  288. data/shoes/ruby/lib/mathn.rb +206 -0
  289. data/shoes/ruby/lib/matrix.rb +1381 -0
  290. data/shoes/ruby/lib/minitest/autorun.rb +9 -0
  291. data/shoes/ruby/lib/minitest/mock.rb +37 -0
  292. data/shoes/ruby/lib/minitest/spec.rb +89 -0
  293. data/shoes/ruby/lib/minitest/unit.rb +497 -0
  294. data/shoes/ruby/lib/mkmf.rb +1958 -0
  295. data/shoes/ruby/lib/monitor.rb +265 -0
  296. data/shoes/ruby/lib/mutex_m.rb +91 -0
  297. data/shoes/ruby/lib/net/ftp.rb +981 -0
  298. data/shoes/ruby/lib/net/http.rb +2399 -0
  299. data/shoes/ruby/lib/net/https.rb +136 -0
  300. data/shoes/ruby/lib/net/imap.rb +3500 -0
  301. data/shoes/ruby/lib/net/pop.rb +1000 -0
  302. data/shoes/ruby/lib/net/protocol.rb +382 -0
  303. data/shoes/ruby/lib/net/smtp.rb +1014 -0
  304. data/shoes/ruby/lib/net/telnet.rb +759 -0
  305. data/shoes/ruby/lib/observer.rb +193 -0
  306. data/shoes/ruby/lib/open-uri.rb +832 -0
  307. data/shoes/ruby/lib/open3.rb +98 -0
  308. data/shoes/ruby/lib/openssl/bn.rb +35 -0
  309. data/shoes/ruby/lib/openssl/buffering.rb +242 -0
  310. data/shoes/ruby/lib/openssl/cipher.rb +65 -0
  311. data/shoes/ruby/lib/openssl/digest.rb +61 -0
  312. data/shoes/ruby/lib/openssl/ssl.rb +178 -0
  313. data/shoes/ruby/lib/openssl/x509.rb +155 -0
  314. data/shoes/ruby/lib/openssl.rb +24 -0
  315. data/shoes/ruby/lib/optparse/date.rb +17 -0
  316. data/shoes/ruby/lib/optparse/shellwords.rb +6 -0
  317. data/shoes/ruby/lib/optparse/time.rb +10 -0
  318. data/shoes/ruby/lib/optparse/uri.rb +6 -0
  319. data/shoes/ruby/lib/optparse/version.rb +70 -0
  320. data/shoes/ruby/lib/optparse.rb +1810 -0
  321. data/shoes/ruby/lib/ostruct.rb +145 -0
  322. data/shoes/ruby/lib/pathname.rb +1099 -0
  323. data/shoes/ruby/lib/pp.rb +532 -0
  324. data/shoes/ruby/lib/prettyprint.rb +896 -0
  325. data/shoes/ruby/lib/prime.rb +471 -0
  326. data/shoes/ruby/lib/profile.rb +10 -0
  327. data/shoes/ruby/lib/profiler.rb +59 -0
  328. data/shoes/ruby/lib/pstore.rb +543 -0
  329. data/shoes/ruby/lib/racc/parser.rb +441 -0
  330. data/shoes/ruby/lib/rake/classic_namespace.rb +8 -0
  331. data/shoes/ruby/lib/rake/clean.rb +33 -0
  332. data/shoes/ruby/lib/rake/gempackagetask.rb +97 -0
  333. data/shoes/ruby/lib/rake/loaders/makefile.rb +35 -0
  334. data/shoes/ruby/lib/rake/packagetask.rb +185 -0
  335. data/shoes/ruby/lib/rake/rake_test_loader.rb +5 -0
  336. data/shoes/ruby/lib/rake/rdoctask.rb +147 -0
  337. data/shoes/ruby/lib/rake/runtest.rb +23 -0
  338. data/shoes/ruby/lib/rake/tasklib.rb +23 -0
  339. data/shoes/ruby/lib/rake/testtask.rb +161 -0
  340. data/shoes/ruby/lib/rake/win32.rb +34 -0
  341. data/shoes/ruby/lib/rake.rb +2465 -0
  342. data/shoes/ruby/lib/rational.rb +19 -0
  343. data/shoes/ruby/lib/rbconfig/datadir.rb +24 -0
  344. data/shoes/ruby/lib/rdoc/code_objects.rb +1061 -0
  345. data/shoes/ruby/lib/rdoc/diagram.rb +340 -0
  346. data/shoes/ruby/lib/rdoc/dot.rb +249 -0
  347. data/shoes/ruby/lib/rdoc/generator/chm/chm.rb +100 -0
  348. data/shoes/ruby/lib/rdoc/generator/chm.rb +113 -0
  349. data/shoes/ruby/lib/rdoc/generator/html/common.rb +24 -0
  350. data/shoes/ruby/lib/rdoc/generator/html/frameless.rb +92 -0
  351. data/shoes/ruby/lib/rdoc/generator/html/hefss.rb +150 -0
  352. data/shoes/ruby/lib/rdoc/generator/html/html.rb +769 -0
  353. data/shoes/ruby/lib/rdoc/generator/html/kilmer.rb +151 -0
  354. data/shoes/ruby/lib/rdoc/generator/html/kilmerfactory.rb +427 -0
  355. data/shoes/ruby/lib/rdoc/generator/html/one_page_html.rb +122 -0
  356. data/shoes/ruby/lib/rdoc/generator/html.rb +445 -0
  357. data/shoes/ruby/lib/rdoc/generator/ri.rb +226 -0
  358. data/shoes/ruby/lib/rdoc/generator/texinfo/class.texinfo.erb +44 -0
  359. data/shoes/ruby/lib/rdoc/generator/texinfo/file.texinfo.erb +6 -0
  360. data/shoes/ruby/lib/rdoc/generator/texinfo/method.texinfo.erb +6 -0
  361. data/shoes/ruby/lib/rdoc/generator/texinfo/texinfo.erb +28 -0
  362. data/shoes/ruby/lib/rdoc/generator/texinfo.rb +81 -0
  363. data/shoes/ruby/lib/rdoc/generator/xml/rdf.rb +113 -0
  364. data/shoes/ruby/lib/rdoc/generator/xml/xml.rb +123 -0
  365. data/shoes/ruby/lib/rdoc/generator/xml.rb +117 -0
  366. data/shoes/ruby/lib/rdoc/generator.rb +1082 -0
  367. data/shoes/ruby/lib/rdoc/known_classes.rb +68 -0
  368. data/shoes/ruby/lib/rdoc/markup/attribute_manager.rb +265 -0
  369. data/shoes/ruby/lib/rdoc/markup/formatter.rb +14 -0
  370. data/shoes/ruby/lib/rdoc/markup/fragments.rb +337 -0
  371. data/shoes/ruby/lib/rdoc/markup/inline.rb +101 -0
  372. data/shoes/ruby/lib/rdoc/markup/lines.rb +152 -0
  373. data/shoes/ruby/lib/rdoc/markup/preprocess.rb +75 -0
  374. data/shoes/ruby/lib/rdoc/markup/to_flow.rb +185 -0
  375. data/shoes/ruby/lib/rdoc/markup/to_html.rb +403 -0
  376. data/shoes/ruby/lib/rdoc/markup/to_html_crossref.rb +148 -0
  377. data/shoes/ruby/lib/rdoc/markup/to_latex.rb +328 -0
  378. data/shoes/ruby/lib/rdoc/markup/to_test.rb +50 -0
  379. data/shoes/ruby/lib/rdoc/markup/to_texinfo.rb +69 -0
  380. data/shoes/ruby/lib/rdoc/markup.rb +378 -0
  381. data/shoes/ruby/lib/rdoc/options.rb +638 -0
  382. data/shoes/ruby/lib/rdoc/parser/c.rb +661 -0
  383. data/shoes/ruby/lib/rdoc/parser/f95.rb +1835 -0
  384. data/shoes/ruby/lib/rdoc/parser/perl.rb +165 -0
  385. data/shoes/ruby/lib/rdoc/parser/ruby.rb +2829 -0
  386. data/shoes/ruby/lib/rdoc/parser/simple.rb +38 -0
  387. data/shoes/ruby/lib/rdoc/parser.rb +142 -0
  388. data/shoes/ruby/lib/rdoc/rdoc.rb +293 -0
  389. data/shoes/ruby/lib/rdoc/ri/cache.rb +187 -0
  390. data/shoes/ruby/lib/rdoc/ri/descriptions.rb +156 -0
  391. data/shoes/ruby/lib/rdoc/ri/display.rb +392 -0
  392. data/shoes/ruby/lib/rdoc/ri/driver.rb +669 -0
  393. data/shoes/ruby/lib/rdoc/ri/formatter.rb +616 -0
  394. data/shoes/ruby/lib/rdoc/ri/paths.rb +99 -0
  395. data/shoes/ruby/lib/rdoc/ri/reader.rb +106 -0
  396. data/shoes/ruby/lib/rdoc/ri/util.rb +79 -0
  397. data/shoes/ruby/lib/rdoc/ri/writer.rb +68 -0
  398. data/shoes/ruby/lib/rdoc/ri.rb +8 -0
  399. data/shoes/ruby/lib/rdoc/stats.rb +115 -0
  400. data/shoes/ruby/lib/rdoc/template.rb +64 -0
  401. data/shoes/ruby/lib/rdoc/tokenstream.rb +33 -0
  402. data/shoes/ruby/lib/rdoc.rb +395 -0
  403. data/shoes/ruby/lib/resolv-replace.rb +63 -0
  404. data/shoes/ruby/lib/resolv.rb +2262 -0
  405. data/shoes/ruby/lib/rexml/attlistdecl.rb +62 -0
  406. data/shoes/ruby/lib/rexml/attribute.rb +188 -0
  407. data/shoes/ruby/lib/rexml/cdata.rb +67 -0
  408. data/shoes/ruby/lib/rexml/child.rb +96 -0
  409. data/shoes/ruby/lib/rexml/comment.rb +80 -0
  410. data/shoes/ruby/lib/rexml/doctype.rb +270 -0
  411. data/shoes/ruby/lib/rexml/document.rb +231 -0
  412. data/shoes/ruby/lib/rexml/dtd/attlistdecl.rb +10 -0
  413. data/shoes/ruby/lib/rexml/dtd/dtd.rb +51 -0
  414. data/shoes/ruby/lib/rexml/dtd/elementdecl.rb +17 -0
  415. data/shoes/ruby/lib/rexml/dtd/entitydecl.rb +56 -0
  416. data/shoes/ruby/lib/rexml/dtd/notationdecl.rb +39 -0
  417. data/shoes/ruby/lib/rexml/element.rb +1246 -0
  418. data/shoes/ruby/lib/rexml/encoding.rb +71 -0
  419. data/shoes/ruby/lib/rexml/encodings/CP-1252.rb +103 -0
  420. data/shoes/ruby/lib/rexml/encodings/EUC-JP.rb +35 -0
  421. data/shoes/ruby/lib/rexml/encodings/ICONV.rb +22 -0
  422. data/shoes/ruby/lib/rexml/encodings/ISO-8859-1.rb +7 -0
  423. data/shoes/ruby/lib/rexml/encodings/ISO-8859-15.rb +72 -0
  424. data/shoes/ruby/lib/rexml/encodings/SHIFT-JIS.rb +37 -0
  425. data/shoes/ruby/lib/rexml/encodings/SHIFT_JIS.rb +1 -0
  426. data/shoes/ruby/lib/rexml/encodings/UNILE.rb +34 -0
  427. data/shoes/ruby/lib/rexml/encodings/US-ASCII.rb +30 -0
  428. data/shoes/ruby/lib/rexml/encodings/UTF-16.rb +35 -0
  429. data/shoes/ruby/lib/rexml/encodings/UTF-8.rb +18 -0
  430. data/shoes/ruby/lib/rexml/entity.rb +166 -0
  431. data/shoes/ruby/lib/rexml/formatters/default.rb +109 -0
  432. data/shoes/ruby/lib/rexml/formatters/pretty.rb +139 -0
  433. data/shoes/ruby/lib/rexml/formatters/transitive.rb +58 -0
  434. data/shoes/ruby/lib/rexml/functions.rb +388 -0
  435. data/shoes/ruby/lib/rexml/instruction.rb +70 -0
  436. data/shoes/ruby/lib/rexml/light/node.rb +196 -0
  437. data/shoes/ruby/lib/rexml/namespace.rb +47 -0
  438. data/shoes/ruby/lib/rexml/node.rb +75 -0
  439. data/shoes/ruby/lib/rexml/output.rb +24 -0
  440. data/shoes/ruby/lib/rexml/parent.rb +166 -0
  441. data/shoes/ruby/lib/rexml/parseexception.rb +51 -0
  442. data/shoes/ruby/lib/rexml/parsers/baseparser.rb +530 -0
  443. data/shoes/ruby/lib/rexml/parsers/lightparser.rb +58 -0
  444. data/shoes/ruby/lib/rexml/parsers/pullparser.rb +196 -0
  445. data/shoes/ruby/lib/rexml/parsers/sax2parser.rb +247 -0
  446. data/shoes/ruby/lib/rexml/parsers/streamparser.rb +46 -0
  447. data/shoes/ruby/lib/rexml/parsers/treeparser.rb +100 -0
  448. data/shoes/ruby/lib/rexml/parsers/ultralightparser.rb +56 -0
  449. data/shoes/ruby/lib/rexml/parsers/xpathparser.rb +698 -0
  450. data/shoes/ruby/lib/rexml/quickpath.rb +263 -0
  451. data/shoes/ruby/lib/rexml/rexml.rb +31 -0
  452. data/shoes/ruby/lib/rexml/sax2listener.rb +97 -0
  453. data/shoes/ruby/lib/rexml/source.rb +258 -0
  454. data/shoes/ruby/lib/rexml/streamlistener.rb +92 -0
  455. data/shoes/ruby/lib/rexml/syncenumerator.rb +32 -0
  456. data/shoes/ruby/lib/rexml/text.rb +404 -0
  457. data/shoes/ruby/lib/rexml/undefinednamespaceexception.rb +8 -0
  458. data/shoes/ruby/lib/rexml/validation/relaxng.rb +559 -0
  459. data/shoes/ruby/lib/rexml/validation/validation.rb +155 -0
  460. data/shoes/ruby/lib/rexml/validation/validationexception.rb +9 -0
  461. data/shoes/ruby/lib/rexml/xmldecl.rb +119 -0
  462. data/shoes/ruby/lib/rexml/xmltokens.rb +18 -0
  463. data/shoes/ruby/lib/rexml/xpath.rb +77 -0
  464. data/shoes/ruby/lib/rexml/xpath_parser.rb +792 -0
  465. data/shoes/ruby/lib/rinda/rinda.rb +283 -0
  466. data/shoes/ruby/lib/rinda/ring.rb +271 -0
  467. data/shoes/ruby/lib/rinda/tuplespace.rb +642 -0
  468. data/shoes/ruby/lib/ripper/core.rb +70 -0
  469. data/shoes/ruby/lib/ripper/filter.rb +70 -0
  470. data/shoes/ruby/lib/ripper/lexer.rb +179 -0
  471. data/shoes/ruby/lib/ripper/sexp.rb +99 -0
  472. data/shoes/ruby/lib/ripper.rb +4 -0
  473. data/shoes/ruby/lib/rss/0.9.rb +427 -0
  474. data/shoes/ruby/lib/rss/1.0.rb +452 -0
  475. data/shoes/ruby/lib/rss/2.0.rb +111 -0
  476. data/shoes/ruby/lib/rss/atom.rb +748 -0
  477. data/shoes/ruby/lib/rss/content/1.0.rb +10 -0
  478. data/shoes/ruby/lib/rss/content/2.0.rb +12 -0
  479. data/shoes/ruby/lib/rss/content.rb +31 -0
  480. data/shoes/ruby/lib/rss/converter.rb +170 -0
  481. data/shoes/ruby/lib/rss/dublincore/1.0.rb +13 -0
  482. data/shoes/ruby/lib/rss/dublincore/2.0.rb +13 -0
  483. data/shoes/ruby/lib/rss/dublincore/atom.rb +17 -0
  484. data/shoes/ruby/lib/rss/dublincore.rb +161 -0
  485. data/shoes/ruby/lib/rss/image.rb +193 -0
  486. data/shoes/ruby/lib/rss/itunes.rb +410 -0
  487. data/shoes/ruby/lib/rss/maker/0.9.rb +467 -0
  488. data/shoes/ruby/lib/rss/maker/1.0.rb +434 -0
  489. data/shoes/ruby/lib/rss/maker/2.0.rb +223 -0
  490. data/shoes/ruby/lib/rss/maker/atom.rb +172 -0
  491. data/shoes/ruby/lib/rss/maker/base.rb +880 -0
  492. data/shoes/ruby/lib/rss/maker/content.rb +21 -0
  493. data/shoes/ruby/lib/rss/maker/dublincore.rb +124 -0
  494. data/shoes/ruby/lib/rss/maker/entry.rb +163 -0
  495. data/shoes/ruby/lib/rss/maker/feed.rb +430 -0
  496. data/shoes/ruby/lib/rss/maker/image.rb +111 -0
  497. data/shoes/ruby/lib/rss/maker/itunes.rb +242 -0
  498. data/shoes/ruby/lib/rss/maker/slash.rb +33 -0
  499. data/shoes/ruby/lib/rss/maker/syndication.rb +18 -0
  500. data/shoes/ruby/lib/rss/maker/taxonomy.rb +118 -0
  501. data/shoes/ruby/lib/rss/maker/trackback.rb +61 -0
  502. data/shoes/ruby/lib/rss/maker.rb +44 -0
  503. data/shoes/ruby/lib/rss/parser.rb +568 -0
  504. data/shoes/ruby/lib/rss/rexmlparser.rb +54 -0
  505. data/shoes/ruby/lib/rss/rss.rb +1313 -0
  506. data/shoes/ruby/lib/rss/slash.rb +49 -0
  507. data/shoes/ruby/lib/rss/syndication.rb +67 -0
  508. data/shoes/ruby/lib/rss/taxonomy.rb +145 -0
  509. data/shoes/ruby/lib/rss/trackback.rb +288 -0
  510. data/shoes/ruby/lib/rss/utils.rb +111 -0
  511. data/shoes/ruby/lib/rss/xml-stylesheet.rb +105 -0
  512. data/shoes/ruby/lib/rss/xml.rb +71 -0
  513. data/shoes/ruby/lib/rss/xmlparser.rb +93 -0
  514. data/shoes/ruby/lib/rss/xmlscanner.rb +121 -0
  515. data/shoes/ruby/lib/rss.rb +19 -0
  516. data/shoes/ruby/lib/rubygems/builder.rb +88 -0
  517. data/shoes/ruby/lib/rubygems/command.rb +406 -0
  518. data/shoes/ruby/lib/rubygems/command_manager.rb +146 -0
  519. data/shoes/ruby/lib/rubygems/commands/build_command.rb +53 -0
  520. data/shoes/ruby/lib/rubygems/commands/cert_command.rb +86 -0
  521. data/shoes/ruby/lib/rubygems/commands/check_command.rb +75 -0
  522. data/shoes/ruby/lib/rubygems/commands/cleanup_command.rb +91 -0
  523. data/shoes/ruby/lib/rubygems/commands/contents_command.rb +74 -0
  524. data/shoes/ruby/lib/rubygems/commands/dependency_command.rb +188 -0
  525. data/shoes/ruby/lib/rubygems/commands/environment_command.rb +128 -0
  526. data/shoes/ruby/lib/rubygems/commands/fetch_command.rb +62 -0
  527. data/shoes/ruby/lib/rubygems/commands/generate_index_command.rb +57 -0
  528. data/shoes/ruby/lib/rubygems/commands/help_command.rb +172 -0
  529. data/shoes/ruby/lib/rubygems/commands/install_command.rb +148 -0
  530. data/shoes/ruby/lib/rubygems/commands/list_command.rb +35 -0
  531. data/shoes/ruby/lib/rubygems/commands/lock_command.rb +110 -0
  532. data/shoes/ruby/lib/rubygems/commands/mirror_command.rb +111 -0
  533. data/shoes/ruby/lib/rubygems/commands/outdated_command.rb +33 -0
  534. data/shoes/ruby/lib/rubygems/commands/pristine_command.rb +93 -0
  535. data/shoes/ruby/lib/rubygems/commands/query_command.rb +233 -0
  536. data/shoes/ruby/lib/rubygems/commands/rdoc_command.rb +82 -0
  537. data/shoes/ruby/lib/rubygems/commands/search_command.rb +37 -0
  538. data/shoes/ruby/lib/rubygems/commands/server_command.rb +48 -0
  539. data/shoes/ruby/lib/rubygems/commands/sources_command.rb +152 -0
  540. data/shoes/ruby/lib/rubygems/commands/specification_command.rb +77 -0
  541. data/shoes/ruby/lib/rubygems/commands/stale_command.rb +27 -0
  542. data/shoes/ruby/lib/rubygems/commands/uninstall_command.rb +73 -0
  543. data/shoes/ruby/lib/rubygems/commands/unpack_command.rb +95 -0
  544. data/shoes/ruby/lib/rubygems/commands/update_command.rb +181 -0
  545. data/shoes/ruby/lib/rubygems/commands/which_command.rb +87 -0
  546. data/shoes/ruby/lib/rubygems/config_file.rb +266 -0
  547. data/shoes/ruby/lib/rubygems/custom_require.rb +46 -0
  548. data/shoes/ruby/lib/rubygems/defaults.rb +89 -0
  549. data/shoes/ruby/lib/rubygems/dependency.rb +119 -0
  550. data/shoes/ruby/lib/rubygems/dependency_installer.rb +258 -0
  551. data/shoes/ruby/lib/rubygems/dependency_list.rb +165 -0
  552. data/shoes/ruby/lib/rubygems/digest/digest_adapter.rb +40 -0
  553. data/shoes/ruby/lib/rubygems/digest/md5.rb +23 -0
  554. data/shoes/ruby/lib/rubygems/digest/sha1.rb +17 -0
  555. data/shoes/ruby/lib/rubygems/digest/sha2.rb +17 -0
  556. data/shoes/ruby/lib/rubygems/doc_manager.rb +214 -0
  557. data/shoes/ruby/lib/rubygems/exceptions.rb +84 -0
  558. data/shoes/ruby/lib/rubygems/ext/builder.rb +56 -0
  559. data/shoes/ruby/lib/rubygems/ext/configure_builder.rb +24 -0
  560. data/shoes/ruby/lib/rubygems/ext/ext_conf_builder.rb +23 -0
  561. data/shoes/ruby/lib/rubygems/ext/rake_builder.rb +27 -0
  562. data/shoes/ruby/lib/rubygems/ext.rb +18 -0
  563. data/shoes/ruby/lib/rubygems/format.rb +87 -0
  564. data/shoes/ruby/lib/rubygems/gem_openssl.rb +83 -0
  565. data/shoes/ruby/lib/rubygems/gem_path_searcher.rb +100 -0
  566. data/shoes/ruby/lib/rubygems/gem_runner.rb +58 -0
  567. data/shoes/ruby/lib/rubygems/indexer/abstract_index_builder.rb +88 -0
  568. data/shoes/ruby/lib/rubygems/indexer/latest_index_builder.rb +35 -0
  569. data/shoes/ruby/lib/rubygems/indexer/marshal_index_builder.rb +17 -0
  570. data/shoes/ruby/lib/rubygems/indexer/master_index_builder.rb +54 -0
  571. data/shoes/ruby/lib/rubygems/indexer/quick_index_builder.rb +50 -0
  572. data/shoes/ruby/lib/rubygems/indexer.rb +370 -0
  573. data/shoes/ruby/lib/rubygems/install_update_options.rb +113 -0
  574. data/shoes/ruby/lib/rubygems/installer.rb +578 -0
  575. data/shoes/ruby/lib/rubygems/local_remote_options.rb +134 -0
  576. data/shoes/ruby/lib/rubygems/old_format.rb +148 -0
  577. data/shoes/ruby/lib/rubygems/package/f_sync_dir.rb +24 -0
  578. data/shoes/ruby/lib/rubygems/package/tar_header.rb +245 -0
  579. data/shoes/ruby/lib/rubygems/package/tar_input.rb +219 -0
  580. data/shoes/ruby/lib/rubygems/package/tar_output.rb +143 -0
  581. data/shoes/ruby/lib/rubygems/package/tar_reader/entry.rb +99 -0
  582. data/shoes/ruby/lib/rubygems/package/tar_reader.rb +86 -0
  583. data/shoes/ruby/lib/rubygems/package/tar_writer.rb +180 -0
  584. data/shoes/ruby/lib/rubygems/package.rb +95 -0
  585. data/shoes/ruby/lib/rubygems/platform.rb +178 -0
  586. data/shoes/ruby/lib/rubygems/remote_fetcher.rb +344 -0
  587. data/shoes/ruby/lib/rubygems/require_paths_builder.rb +15 -0
  588. data/shoes/ruby/lib/rubygems/requirement.rb +163 -0
  589. data/shoes/ruby/lib/rubygems/rubygems_version.rb +6 -0
  590. data/shoes/ruby/lib/rubygems/security.rb +786 -0
  591. data/shoes/ruby/lib/rubygems/server.rb +629 -0
  592. data/shoes/ruby/lib/rubygems/source_index.rb +559 -0
  593. data/shoes/ruby/lib/rubygems/source_info_cache.rb +393 -0
  594. data/shoes/ruby/lib/rubygems/source_info_cache_entry.rb +56 -0
  595. data/shoes/ruby/lib/rubygems/spec_fetcher.rb +249 -0
  596. data/shoes/ruby/lib/rubygems/specification.rb +1262 -0
  597. data/shoes/ruby/lib/rubygems/test_utilities.rb +131 -0
  598. data/shoes/ruby/lib/rubygems/timer.rb +25 -0
  599. data/shoes/ruby/lib/rubygems/uninstaller.rb +242 -0
  600. data/shoes/ruby/lib/rubygems/user_interaction.rb +360 -0
  601. data/shoes/ruby/lib/rubygems/validator.rb +208 -0
  602. data/shoes/ruby/lib/rubygems/version.rb +167 -0
  603. data/shoes/ruby/lib/rubygems/version_option.rb +48 -0
  604. data/shoes/ruby/lib/rubygems.rb +888 -0
  605. data/shoes/ruby/lib/scanf.rb +703 -0
  606. data/shoes/ruby/lib/securerandom.rb +182 -0
  607. data/shoes/ruby/lib/set.rb +1274 -0
  608. data/shoes/ruby/lib/shell/builtin-command.rb +160 -0
  609. data/shoes/ruby/lib/shell/command-processor.rb +593 -0
  610. data/shoes/ruby/lib/shell/error.rb +25 -0
  611. data/shoes/ruby/lib/shell/filter.rb +109 -0
  612. data/shoes/ruby/lib/shell/process-controller.rb +319 -0
  613. data/shoes/ruby/lib/shell/system-command.rb +159 -0
  614. data/shoes/ruby/lib/shell/version.rb +15 -0
  615. data/shoes/ruby/lib/shell.rb +300 -0
  616. data/shoes/ruby/lib/shellwords.rb +156 -0
  617. data/shoes/ruby/lib/singleton.rb +313 -0
  618. data/shoes/ruby/lib/sync.rb +307 -0
  619. data/shoes/ruby/lib/tempfile.rb +218 -0
  620. data/shoes/ruby/lib/test/unit/assertions.rb +122 -0
  621. data/shoes/ruby/lib/test/unit/testcase.rb +12 -0
  622. data/shoes/ruby/lib/test/unit.rb +66 -0
  623. data/shoes/ruby/lib/thread.rb +367 -0
  624. data/shoes/ruby/lib/thwait.rb +168 -0
  625. data/shoes/ruby/lib/time.rb +869 -0
  626. data/shoes/ruby/lib/timeout.rb +108 -0
  627. data/shoes/ruby/lib/tmpdir.rb +138 -0
  628. data/shoes/ruby/lib/tracer.rb +166 -0
  629. data/shoes/ruby/lib/tsort.rb +290 -0
  630. data/shoes/ruby/lib/ubygems.rb +10 -0
  631. data/shoes/ruby/lib/un.rb +304 -0
  632. data/shoes/ruby/lib/uri/common.rb +727 -0
  633. data/shoes/ruby/lib/uri/ftp.rb +198 -0
  634. data/shoes/ruby/lib/uri/generic.rb +1128 -0
  635. data/shoes/ruby/lib/uri/http.rb +100 -0
  636. data/shoes/ruby/lib/uri/https.rb +20 -0
  637. data/shoes/ruby/lib/uri/ldap.rb +190 -0
  638. data/shoes/ruby/lib/uri/ldaps.rb +12 -0
  639. data/shoes/ruby/lib/uri/mailto.rb +266 -0
  640. data/shoes/ruby/lib/uri.rb +29 -0
  641. data/shoes/ruby/lib/weakref.rb +80 -0
  642. data/shoes/ruby/lib/webrick/accesslog.rb +75 -0
  643. data/shoes/ruby/lib/webrick/cgi.rb +260 -0
  644. data/shoes/ruby/lib/webrick/compat.rb +15 -0
  645. data/shoes/ruby/lib/webrick/config.rb +100 -0
  646. data/shoes/ruby/lib/webrick/cookie.rb +110 -0
  647. data/shoes/ruby/lib/webrick/htmlutils.rb +25 -0
  648. data/shoes/ruby/lib/webrick/httpauth/authenticator.rb +79 -0
  649. data/shoes/ruby/lib/webrick/httpauth/basicauth.rb +65 -0
  650. data/shoes/ruby/lib/webrick/httpauth/digestauth.rb +344 -0
  651. data/shoes/ruby/lib/webrick/httpauth/htdigest.rb +91 -0
  652. data/shoes/ruby/lib/webrick/httpauth/htgroup.rb +61 -0
  653. data/shoes/ruby/lib/webrick/httpauth/htpasswd.rb +83 -0
  654. data/shoes/ruby/lib/webrick/httpauth/userdb.rb +29 -0
  655. data/shoes/ruby/lib/webrick/httpauth.rb +45 -0
  656. data/shoes/ruby/lib/webrick/httpproxy.rb +288 -0
  657. data/shoes/ruby/lib/webrick/httprequest.rb +402 -0
  658. data/shoes/ruby/lib/webrick/httpresponse.rb +326 -0
  659. data/shoes/ruby/lib/webrick/https.rb +63 -0
  660. data/shoes/ruby/lib/webrick/httpserver.rb +217 -0
  661. data/shoes/ruby/lib/webrick/httpservlet/abstract.rb +70 -0
  662. data/shoes/ruby/lib/webrick/httpservlet/cgi_runner.rb +47 -0
  663. data/shoes/ruby/lib/webrick/httpservlet/cgihandler.rb +110 -0
  664. data/shoes/ruby/lib/webrick/httpservlet/erbhandler.rb +54 -0
  665. data/shoes/ruby/lib/webrick/httpservlet/filehandler.rb +435 -0
  666. data/shoes/ruby/lib/webrick/httpservlet/prochandler.rb +33 -0
  667. data/shoes/ruby/lib/webrick/httpservlet.rb +22 -0
  668. data/shoes/ruby/lib/webrick/httpstatus.rb +132 -0
  669. data/shoes/ruby/lib/webrick/httputils.rb +392 -0
  670. data/shoes/ruby/lib/webrick/httpversion.rb +49 -0
  671. data/shoes/ruby/lib/webrick/log.rb +88 -0
  672. data/shoes/ruby/lib/webrick/server.rb +210 -0
  673. data/shoes/ruby/lib/webrick/ssl.rb +126 -0
  674. data/shoes/ruby/lib/webrick/utils.rb +175 -0
  675. data/shoes/ruby/lib/webrick/version.rb +13 -0
  676. data/shoes/ruby/lib/webrick.rb +29 -0
  677. data/shoes/ruby/lib/win32/registry.rb +832 -0
  678. data/shoes/ruby/lib/win32/resolv.rb +370 -0
  679. data/shoes/ruby/lib/win32/sspi.rb +330 -0
  680. data/shoes/ruby/lib/win32ole/property.rb +16 -0
  681. data/shoes/ruby/lib/xmlrpc/base64.rb +81 -0
  682. data/shoes/ruby/lib/xmlrpc/client.rb +625 -0
  683. data/shoes/ruby/lib/xmlrpc/config.rb +40 -0
  684. data/shoes/ruby/lib/xmlrpc/create.rb +290 -0
  685. data/shoes/ruby/lib/xmlrpc/datetime.rb +142 -0
  686. data/shoes/ruby/lib/xmlrpc/httpserver.rb +178 -0
  687. data/shoes/ruby/lib/xmlrpc/marshal.rb +76 -0
  688. data/shoes/ruby/lib/xmlrpc/parser.rb +813 -0
  689. data/shoes/ruby/lib/xmlrpc/server.rb +778 -0
  690. data/shoes/ruby/lib/xmlrpc/utils.rb +165 -0
  691. data/shoes/ruby/lib/yaml/baseemitter.rb +242 -0
  692. data/shoes/ruby/lib/yaml/basenode.rb +216 -0
  693. data/shoes/ruby/lib/yaml/constants.rb +45 -0
  694. data/shoes/ruby/lib/yaml/dbm.rb +111 -0
  695. data/shoes/ruby/lib/yaml/encoding.rb +33 -0
  696. data/shoes/ruby/lib/yaml/error.rb +34 -0
  697. data/shoes/ruby/lib/yaml/loader.rb +14 -0
  698. data/shoes/ruby/lib/yaml/rubytypes.rb +446 -0
  699. data/shoes/ruby/lib/yaml/store.rb +43 -0
  700. data/shoes/ruby/lib/yaml/stream.rb +40 -0
  701. data/shoes/ruby/lib/yaml/stringio.rb +83 -0
  702. data/shoes/ruby/lib/yaml/syck.rb +19 -0
  703. data/shoes/ruby/lib/yaml/tag.rb +91 -0
  704. data/shoes/ruby/lib/yaml/types.rb +192 -0
  705. data/shoes/ruby/lib/yaml/yamlnode.rb +54 -0
  706. data/shoes/ruby/lib/yaml/ypath.rb +52 -0
  707. data/shoes/ruby/lib/yaml.rb +440 -0
  708. data/shoes/samples/class-book.rb +43 -0
  709. data/shoes/samples/class-book.yaml +387 -0
  710. data/shoes/samples/expert-definr.rb +23 -0
  711. data/shoes/samples/expert-funnies.rb +51 -0
  712. data/shoes/samples/expert-irb.rb +112 -0
  713. data/shoes/samples/expert-minesweeper.rb +267 -0
  714. data/shoes/samples/expert-othello.rb +319 -0
  715. data/shoes/samples/expert-pong.rb +62 -0
  716. data/shoes/samples/expert-tankspank.rb +385 -0
  717. data/shoes/samples/good-arc.rb +37 -0
  718. data/shoes/samples/good-clock.rb +51 -0
  719. data/shoes/samples/good-follow.rb +26 -0
  720. data/shoes/samples/good-reminder.rb +174 -0
  721. data/shoes/samples/good-vjot.rb +56 -0
  722. data/shoes/samples/simple-accordion.rb +75 -0
  723. data/shoes/samples/simple-anim-shapes.rb +17 -0
  724. data/shoes/samples/simple-anim-text.rb +13 -0
  725. data/shoes/samples/simple-arc.rb +23 -0
  726. data/shoes/samples/simple-bounce.rb +24 -0
  727. data/shoes/samples/simple-calc.rb +70 -0
  728. data/shoes/samples/simple-control-sizes.rb +24 -0
  729. data/shoes/samples/simple-curve.rb +26 -0
  730. data/shoes/samples/simple-dialogs.rb +29 -0
  731. data/shoes/samples/simple-downloader.rb +27 -0
  732. data/shoes/samples/simple-draw.rb +13 -0
  733. data/shoes/samples/simple-editor.rb +28 -0
  734. data/shoes/samples/simple-form.rb +28 -0
  735. data/shoes/samples/simple-form.shy +0 -0
  736. data/shoes/samples/simple-mask.rb +21 -0
  737. data/shoes/samples/simple-menu.rb +31 -0
  738. data/shoes/samples/simple-menu1.rb +35 -0
  739. data/shoes/samples/simple-rubygems.rb +29 -0
  740. data/shoes/samples/simple-slide.rb +45 -0
  741. data/shoes/samples/simple-sphere.rb +28 -0
  742. data/shoes/samples/simple-timer.rb +13 -0
  743. data/shoes/samples/simple-video.rb +13 -0
  744. data/shoes/shoes +21 -0
  745. data/shoes/shoes.exe +0 -0
  746. data/shoes/shoes.exe.manifest +17 -0
  747. data/shoes/sqlite3.dll +0 -0
  748. data/shoes/static/Shoes.icns +0 -0
  749. data/shoes/static/Thumbs.db +0 -0
  750. data/shoes/static/app-icon.png +0 -0
  751. data/shoes/static/avatar.png +0 -0
  752. data/shoes/static/code_highlighter.js +188 -0
  753. data/shoes/static/code_highlighter_ruby.js +26 -0
  754. data/shoes/static/icon-debug.png +0 -0
  755. data/shoes/static/icon-error.png +0 -0
  756. data/shoes/static/icon-info.png +0 -0
  757. data/shoes/static/icon-warn.png +0 -0
  758. data/shoes/static/listbox_button1.png +0 -0
  759. data/shoes/static/listbox_button2.png +0 -0
  760. data/shoes/static/man-app.png +0 -0
  761. data/shoes/static/man-builds.png +0 -0
  762. data/shoes/static/man-editor-notepad.png +0 -0
  763. data/shoes/static/man-editor-osx.png +0 -0
  764. data/shoes/static/man-ele-background.png +0 -0
  765. data/shoes/static/man-ele-border.png +0 -0
  766. data/shoes/static/man-ele-button.png +0 -0
  767. data/shoes/static/man-ele-check.png +0 -0
  768. data/shoes/static/man-ele-editbox.png +0 -0
  769. data/shoes/static/man-ele-editline.png +0 -0
  770. data/shoes/static/man-ele-image.png +0 -0
  771. data/shoes/static/man-ele-listbox.png +0 -0
  772. data/shoes/static/man-ele-progress.png +0 -0
  773. data/shoes/static/man-ele-radio.png +0 -0
  774. data/shoes/static/man-ele-shape.png +0 -0
  775. data/shoes/static/man-ele-textblock.png +0 -0
  776. data/shoes/static/man-ele-video.png +0 -0
  777. data/shoes/static/man-intro-dmg.png +0 -0
  778. data/shoes/static/man-intro-exe.png +0 -0
  779. data/shoes/static/man-look-tiger.png +0 -0
  780. data/shoes/static/man-look-ubuntu.png +0 -0
  781. data/shoes/static/man-look-vista.png +0 -0
  782. data/shoes/static/man-run-osx.png +0 -0
  783. data/shoes/static/man-run-vista.png +0 -0
  784. data/shoes/static/man-run-xp.png +0 -0
  785. data/shoes/static/man-shot1.png +0 -0
  786. data/shoes/static/manual-en.txt +2783 -0
  787. data/shoes/static/manual-ja.txt +2780 -0
  788. data/shoes/static/manual.css +167 -0
  789. data/shoes/static/menu-corner1.png +0 -0
  790. data/shoes/static/menu-corner2.png +0 -0
  791. data/shoes/static/menu-gray.png +0 -0
  792. data/shoes/static/menu-left.png +0 -0
  793. data/shoes/static/menu-right.png +0 -0
  794. data/shoes/static/menu-top.png +0 -0
  795. data/shoes/static/shoes-dmg.jpg +0 -0
  796. data/shoes/static/shoes-icon-blue.png +0 -0
  797. data/shoes/static/shoes-icon.png +0 -0
  798. data/shoes/static/shoes-manual-apps.gif +0 -0
  799. data/shoes/static/stripe.png +0 -0
  800. data/shoes/static/stubs/blank.exe +0 -0
  801. data/shoes/static/stubs/blank.hfz +0 -0
  802. data/shoes/static/stubs/blank.run +375 -0
  803. data/shoes/static/stubs/cocoa-install +0 -0
  804. data/shoes/static/stubs/sh-install +48 -0
  805. data/shoes/static/tutor-back.png +0 -0
  806. data/shoes/zlib.dll +0 -0
  807. data/shoes/zlib1.dll +0 -0
  808. metadata +887 -0
@@ -0,0 +1,2783 @@
1
+ = Hello! =
2
+
3
+ Shoes is a tiny graphics toolkit. It's simple and straightforward. Shoes was born to be easy! Really, it was made for absolute beginners. There's really nothing to it.
4
+
5
+ You see, the trivial Shoes program can be just one line:
6
+
7
+ {{{
8
+ #!ruby
9
+ Shoes.app { button("Click me!") { alert("Good job.") } }
10
+ }}}
11
+
12
+ Shoes programs are written in a language called Ruby. When Shoes is handed this simple line of Ruby code, a window appears with a button inside reading "Click me!" When the button is clicked, a message pops up.
13
+
14
+ On Linux, here's how this might look: !{:margin_left => 100}man-shot1.png!
15
+
16
+ While lots of Shoes apps are graphical games and art programs, you can also layout text and edit controls easily. !{:margin_left => 40}shoes-manual-apps.gif!
17
+
18
+ And, ideally, Shoes programs will run on any of the major platforms out there. Microsoft Windows, Apple's Mac OS X, Linux and many others.
19
+
20
+ ^So, welcome to Shoes' built-in manual. This manual is a Shoes program itself!^
21
+
22
+ == Introducing Shoes ==
23
+
24
+ How does Shoes look on OS X and Windows? Does it really look okay? Is it all ugly and awkward? People must immediately convulse! It must be so watered down trying to do everything.
25
+
26
+ Well, before getting into the stuff about installing and running Shoes, time to just check out some screenshots, to give you an idea of what you can do.
27
+
28
+ ==== Mac OS X ====
29
+
30
+ Shoes runs on Apple Mac OS X Leopard, as well as Tiger. Shoes supports PowerPC machines as well, however, there is no video support on that platform. !man-look-tiger.png!
31
+
32
+ This is the `simple-sphere.rb` sample running on Tiger. Notice that the app runs inside a normal OS X window border.
33
+
34
+ The whole sphere is drawn with blurred ovals and shadows. You can draw and animate shapes and apply effects to those shapes in Shoes.
35
+
36
+ ==== Windows ====
37
+
38
+ Shoes runs on all versions of '''Microsoft Windows XP''', '''Microsoft Windows Vista''', and anything else '''Windows 2000''' compatible. !man-look-vista.png!
39
+
40
+ Above is pictured the `simple-clock.rb` sample running on Windows Vista. This example is also draws ovals and lines to build the clock, which is animated to repaint itself several times each second.
41
+
42
+ Notice the text on the top of the app, showing the current time. Shoes has the skills to layout words using any color, bold, italics, underlines, and supports loading fonts from a file.
43
+
44
+ ==== Linux ====
45
+
46
+ Here's a screenshot of the `simple-downloader.rb` sample running on '''Ubuntu Linux'''. !man-look-ubuntu.png!
47
+
48
+ Notice the buttons and progress bars. These types of controls look different on OS X and Windows. The text and links would look the same, though.
49
+
50
+ Shapes, text, images and videos all look the same on every platforms. However, native controls (like edit lines and edit boxes) will match the look of the window theme. Shoes will try to keep native controls all within the size you give them, only the look will vary.
51
+
52
+ == Installing Shoes ==
53
+
54
+ Okay, on to installing Shoes. I'm sure you're wondering: do I need to install Ruby? Do I need to unzip anything? What commands to I need to type?
55
+
56
+ Nope. You don't need Ruby. You don't need WinZip. Nothing to type.
57
+
58
+ On most systems, starting Shoes is just a matter of running the installer and clicking the Shoes icon. Shoes comes with everything built in. We'll talk through all the steps, though, just to be clear about it.
59
+
60
+ ==== Step 1: Installing Shoes ====
61
+
62
+ You'll want to visit [[http://shoooes.net/ shoooes.net]] to download the Shoes installer. Usually, you'll just want one of the installers on the top corner of the home page. !man-builds.png!
63
+
64
+ Here's how to run the installer:
65
+
66
+ * On '''Mac OS X''', you'll have a file ending with '''.dmg'''. Double-click this file and a window should appear with a '''Shoes''' icon and an '''Applications''' folder. Following the arrow, drag the Shoes icon into the '''Applications''' folder. !man-intro-dmg.png!
67
+ * On '''Windows''', you'll download a '''.exe''' file. Double-click this file and follow the instructions. !man-intro-exe.png!
68
+ * On '''Linux''', you'll download a file ending with '''.run'''. Double-click this file and Shoes will start up. (You can also run this file from a prompt as if it was a shell script. In fact, it is a shell script!)
69
+
70
+ ==== Step 2: Start a New Text File ====
71
+
72
+ Shoes programs are just plain text files ending with a '''.rb''' extension.
73
+
74
+ Here are a few ways to create a blank text file:
75
+
76
+ * On '''Mac OS X''', visit your '''Applications''' folder and double-click on the '''TextEdit''' app. A blank editor window should come up. Now, go to the '''Format''' menu and select the '''Make Plain Text''' option. Okay, you're all set! !man-editor-osx.png!
77
+ * On '''Windows''', go to the Start menu. Select '''All Programs''', then '''Accessories''', then '''Notepad'''. !man-editor-notepad.png!
78
+ * On '''Linux''', most distros come with '''gedit'''. You might try running that. Or, if your distro is KDE-based, run '''kate'''.
79
+
80
+ Now, in your blank window, type in the following:
81
+
82
+ {{{
83
+ Shoes.app do
84
+ background "#DFA"
85
+ para "Welcome to Shoes"
86
+ end
87
+ }}}
88
+
89
+ Save to your desktop as `welcome.rb`.
90
+
91
+ ==== Step 3: Run It! Go Shoes! ====
92
+
93
+ To run your program:
94
+
95
+ * On '''Mac OS X''', visit your '''Applications''' folder again. This time, double-click the '''Shoes''' icon in that folder. You should see the red shoes icon appear in the dock. Drag your `welcome.rb` from the desktop on to that dock icon. !man-run-osx.png!
96
+ * On '''Windows''', get to the Start menu. Go into '''All Programs''', then '''Shoes''', then '''Shoes'''. A file selector box should come up. Browse to your desktop and select `welcome.rb`. Click '''OK''' and you're on your way. !man-run-xp.png! !man-run-vista.png!
97
+ * On '''Linux''', run Shoes just like you did in step one. You should see a file selector box. Browse to your desktop, select `welcome.rb` and hit '''OK'''.
98
+
99
+ So, not much of a program yet. But it's something! You've got the knack of it, at least!
100
+
101
+ ==== What Can You Make With Shoes? ====
102
+
103
+ Well, you can make windowing applications. But Shoes is inspired by the web, so applications tend to use images and text layout rather than a lot of widgets. For example, Shoes doesn't come with tabbed controls or toolbars. Shoes is a ''tiny'' toolkit, remember?
104
+
105
+ Still, Shoes does have a few widgets like buttons and edit boxes. And many missing elements (like tabbed controls or toolbars) can be simulated with images.
106
+
107
+ Shoes is written in part thanks to a very good art engine called Cairo, which is used for drawing with shapes and colors. In this way, Shoes is inspired by NodeBox and Processing, two very good languages for drawing animated graphics.
108
+
109
+ == The Rules of Shoes ==
110
+
111
+ Time to stop guessing how Shoes works. Some of the tricky things will come back to haunt you. I've boiled down the central rules to Shoes. These are the things you MUST know to really make it all work.
112
+
113
+ These are general rules found throughout Shoes. While Shoes has an overall philosophy of simplicity and clarity, there are a few points that need to be studied and remembered.
114
+
115
+ ==== Shoes Tricky Blocks ====
116
+
117
+ Okay, this is absolutely crucial. Shoes does a trick with blocks. This trick makes everything easier to read. But it also can make blocks harder to use once you're in deep.
118
+
119
+ '''Let's take a normal Ruby block:'''
120
+
121
+ {{{
122
+ ary = ['potion', 'swords', 'shields']
123
+ ary.each do |item|
124
+ puts item
125
+ end
126
+ }}}
127
+
128
+ In Shoes, these sorts of blocks work the same. This block above loops through the array and stores each object in the `item` variable. The `item` variable disappears (goes out of scope) when the block ends.
129
+
130
+ One other thing to keep in mind is that `self` stays the same inside normal Ruby blocks. Whatever `self` was before the call to `each`, it is the same inside the `each` block.
131
+
132
+ '''Both of these things are also true for most Shoes blocks.'''
133
+
134
+ {{{
135
+ Shoes.app do
136
+ stack do
137
+ para "First"
138
+ para "Second"
139
+ para "Third"
140
+ end
141
+ end
142
+ }}}
143
+
144
+ Here we have two blocks. The first block is sent to `Shoes.app`. This `app` block changes `self`.
145
+
146
+ The other block is the `stack` block. That block does NOT change self.
147
+
148
+ '''For what reason does the `app` block change self?''' Let's start by spelling out that last example completely.
149
+
150
+ {{{
151
+ Shoes.app do
152
+ self.stack do
153
+ self.para "First"
154
+ self.para "Second"
155
+ self.para "Third"
156
+ end
157
+ end
158
+ }}}
159
+
160
+ All of the `self`s in the above example are the App object. Shoes uses Ruby's `instance_eval` to change self inside the `app` block. So the method calls to `stack` and `para` get sent to the app.
161
+
162
+ '''This also is why you can use instance variables throughout a Shoes app:'''
163
+
164
+ {{{
165
+ Shoes.app do
166
+ @s = stack do
167
+ @p1 = para "First"
168
+ @p2 = para "Second"
169
+ @p3 = para "Third"
170
+ end
171
+ end
172
+ }}}
173
+
174
+ These instance variables will all end up inside the App object.
175
+
176
+ '''Whenever you create a new window, `self` is also changed.''' So, this means the [[Element.window]] and [[Element.dialog]] methods, in addition to Shoes.app.
177
+
178
+ {{{
179
+ Shoes.app :title => "MAIN" do
180
+ para self
181
+ button "Spawn" do
182
+ window :title => "CHILD" do
183
+ para self
184
+ end
185
+ end
186
+ end
187
+ }}}
188
+
189
+ ==== Block Redirection ====
190
+
191
+ The `stack` block is a different story, though. It doesn't change `self` and it's basically a regular block.
192
+
193
+ '''But there's a trick:''' when you attach a `stack` and give it a block, the App object places that stack in its memory. The stack gets popped off when the block ends. So all drawing inside the block gets '''redirected''' from the App's top slot to the new stack.
194
+
195
+ So those three `para`s will get drawn on the `stack`, even though they actually get sent to the App object first.
196
+
197
+ {{{
198
+ Shoes.app do
199
+ stack do
200
+ para "First"
201
+ para "Second"
202
+ para "Third"
203
+ end
204
+ end
205
+ }}}
206
+
207
+ A bit tricky, you see? This can bite you even if you know about it.
208
+
209
+ One way it'll get you is if you try to edit a stack somewhere else in your program, outside the `app` block.
210
+
211
+ Like let's say you pass around a stack object. And you have a class that edits that object.
212
+
213
+ {{{
214
+ class Messenger
215
+ def initialize(stack)
216
+ @stack = stack
217
+ end
218
+ def add(msg)
219
+ @stack.append do
220
+ para msg
221
+ end
222
+ end
223
+ end
224
+ }}}
225
+
226
+ So, let's assume you pass the stack object into your Messenger class when the app starts. And, later, when a message comes in, the `add` method gets used to append a paragraph to that stack. Should work, right?
227
+
228
+ Nope, it won't work. The `para` method won't be found. The App object isn't around any more. And it's the one with the `para` method.
229
+
230
+ Fortunately, each Shoes object has an `app` method that will let you reopen the App object so you can do somefurther editing.
231
+
232
+ {{{
233
+ class Messenger
234
+ def initialize(stack)
235
+ @stack = stack
236
+ end
237
+ def add(msg)
238
+ @stack.app do
239
+ @stack.append do
240
+ para msg
241
+ end
242
+ end
243
+ end
244
+ end
245
+ }}}
246
+
247
+ As you can imagine, the `app` object changes `self` to the App object.
248
+
249
+ So the rules here are:
250
+
251
+ 1. '''Methods named "app" or which create new windows alter `self` to the App object.'''[[BR]](This is true for both Shoes.app and Slot.app, as well as [[Element.window]] and [[Element.dialog]].)[[BR]]2. '''Blocks attached to stacks, flows or any manipulation method (such as append) do not change self. Instead, they pop the slot on to the app's editing stack.'''
252
+
253
+ ==== Careful With Fixed Heights ====
254
+
255
+ Fixed widths on slots are great so you can split the window into columns.
256
+
257
+ {{{
258
+ Shoes.app do
259
+ flow do
260
+ stack :width => 200 do
261
+ caption "Column one"
262
+ para "is 200 pixels wide"
263
+ end
264
+ stack :width => -200 do
265
+ caption "Column two"
266
+ para "is 100% minus 200 pixels wide"
267
+ end
268
+ end
269
+ end
270
+ }}}
271
+
272
+ Fixed heights on slots should be less common. Usually you want your text and images to just flow down the window as far as they can. Height usually happens naturally.
273
+
274
+ The important thing here is that fixed heights actually force slots to behave differently. To be sure that the end of the slot is chopped off perfectly, the slot becomes a '''nested window'''. A new layer is created by the operating system to keep the slot in a fixed square.
275
+
276
+ On difference between normal slots and nested window slots is that the latter can have scrollbars.
277
+
278
+ {{{
279
+ Shoes.app do
280
+ stack :width => 200, :height => 200, :scroll => true do
281
+ background "#DFA"
282
+ 100.times do |i|
283
+ para "Paragraph No. #{i}"
284
+ end
285
+ end
286
+ end
287
+ }}}
288
+
289
+ These nested windows require more memory. They tax the application a bit more. So if you're experiencing some slowness with hundreds of fixed-height slots, try a different approach.
290
+
291
+ ==== Image and Shape Blocks ====
292
+
293
+ Most beginners start littering the window with shapes. It's just easier to throw all your rectangles and ovals in a slot.
294
+
295
+ '''However, bear in mind that Shoes will create objects for all those shapes!'''
296
+
297
+ {{{
298
+ Shoes.app do
299
+ fill black(0.1)
300
+ 100.times do |i|
301
+ oval i, i, i * 2
302
+ end
303
+ end
304
+ }}}
305
+
306
+ In this example, one-hundred Oval objects are created. This isn't too bad. But things would be slimmer if we made these into a single shape.
307
+
308
+ {{{
309
+ Shoes.app do
310
+ fill black(0.1)
311
+ shape do
312
+ 100.times do |i|
313
+ oval i, i, i * 2
314
+ end
315
+ end
316
+ end
317
+ }}}
318
+
319
+ Oh, wait. The ovals aren't filled in this time! That's because the ovals have been combined into a single hhuge shape. And Shoes isn't sure where to fill in this case.
320
+
321
+ So you usually only want to combine into a single shape when you're dealing strictly with outlines.
322
+
323
+ Another option is to combine all those ovals into a single image.
324
+
325
+ {{{
326
+ Shoes.app do
327
+ fill black(0.1)
328
+ image 300, 300 do
329
+ 100.times do |i|
330
+ oval i, i, i * 2
331
+ end
332
+ end
333
+ end
334
+ }}}
335
+
336
+ There we go! The ovals are all combined into a single 300 x 300 pixel image. In this case, storing that image in memory might be much bigger than having one-hundred ovals around. But when you're dealing with thousands of shapes, the image block can be cheaper.
337
+
338
+ The point is: it's easy to group shapes together into image or shape blocks, so give it a try if you're looking to gain some speed. Shape blocks particularly will save you some memory and speed.
339
+
340
+ ==== UTF-8 Everywhere ====
341
+
342
+ Ruby itself isn't Unicode aware. And UTF-8 is a type of Unicode. (See [[http://en.wikipedia.org/wiki/UTF-8 Wikipedia]] for a full explanation of UTF-8.)
343
+
344
+ However, UTF-8 is common on the web. And lots of different platforms support it. So to cut down on the amount of conversion that Shoes has to do, Shoes expects all strings to be in UTF-8 format.
345
+
346
+ This is great because you can show a myriad of languages (Russian, Japanese, Spanish, English) using UTF-8 in Shoes. Just be sure that your text editor uses UTF-8!
347
+
348
+ To illustrate:
349
+
350
+ {{{
351
+ Shoes.app do
352
+ stack :margin => 10 do
353
+ @edit = edit_box :width => 1.0 do
354
+ @para.text = @edit.text
355
+ end
356
+ @para = para ""
357
+ end
358
+ end
359
+ }}}
360
+
361
+ This app will copy anything you paste into the edit box and display it in a Shoes paragraph. You can try copying some foreign text (such as Greek or Japanese) into this box to see how it displays.
362
+
363
+ This is a good test because it proves that the edit box gives back UTF-8 characters. And the paragraph can be set to any UTF-8 characters.
364
+
365
+ '''Important note:''' if some UTF-8 characters don't display for you, you will need to change the paragraph's font. This is especially common on OS X.
366
+
367
+ So, a good Japanese font on OS X is '''AppleGothic'''.
368
+
369
+ {{{
370
+ Shoes.app do
371
+ para "てすと (te-su-to)", :font => "AppleGothic, Arial"
372
+ end
373
+ }}}
374
+
375
+ Again, anything which takes a string in Shoes will need a UTF-8 string. Edit boxes, edit lines, list boxes, window titles and text blocks all take UTF-8. If you give a string with bad characters in it, an error will show up in the console.
376
+
377
+ ==== The Main App and Its Requires ====
378
+
379
+ Each Shoes app is given a little room where it can create itself. You can create classes and set variables and they won't be seen by other Shoes programs. Each program runs inside its own anonymous class.
380
+
381
+ {{{
382
+ main = self
383
+ Shoes.app do
384
+ para main.to_s
385
+ end
386
+ }}}
387
+
388
+ This anonymous class is called `(shoes)` and it's just an empty, unnamed class. The `Shoes` module is mixed into this class (using `include Shoes`) so that you can use either `Para` or `Shoes::Para` when referring to the paragraph class.
389
+
390
+ The advantages of this approach are:
391
+
392
+ * Shoes apps cannot share local variables.
393
+ * Classes created in the main app code are temporary.
394
+ * The Shoes module can be mixed in to the anonymous class, but not the top-level environment of Ruby itself.
395
+ * Garbage collection can clean up apps entirely once they complete.
396
+
397
+ The second part is especially important to remember.
398
+
399
+ {{{
400
+ class Storage; end
401
+
402
+ Shoes.app do
403
+ para Storage.new
404
+ end
405
+ }}}
406
+
407
+ The `Storage` class will disappear once the app completes. Other apps aren't able to use the Storage class. And it can't be gotten to from files that are loaded using `require`.
408
+
409
+ When you `require` code, though, that code will stick around. It will be kept in the Ruby top-level environment.
410
+
411
+ So, the rule is: '''keep your temporary classes in the code with the app and keep your permanent classes in requires.'''
412
+
413
+ = Shoes =
414
+
415
+ Shoes is all about drawing windows and the stuff inside those windows. Let's focus on the window itself, for now. The other sections [[Slots]] and [[Elements]] cover everything that goes inside the window.
416
+
417
+ For here on, the manual reads more like a dictionary. Each page is mostly a list of methods you can use for each topic covered. The idea is to be very thorough and clear about everything.
418
+
419
+ So, if you've hit this far in the manual and you're still hazy about getting started, you should probably either go back to the [[Hello! beginning]] of the manual. Or you could try [[http://hackety.org/press/ Nobody Knows Shoes]], the beginner's leaflet on the web.
420
+
421
+ ==== Finding Your Way ====
422
+
423
+ This section covers:
424
+
425
+ * [[Built-in Built-in methods]] - general methods available anywhere in a Shoes program.
426
+ * [[App The App window]] - methods found attached to every main Shoes window.
427
+ * [[Styles The Styles Master List]] - a complete list of every style in Shoes.
428
+ * [[Classes The Classes list]] - a chart showing what Shoes classes subclass what.
429
+ * [[Colors The Colors list]] - a chart of all built-in colors and the [[Built-in.rgb]] numbers for each.
430
+
431
+ If you find yourself paging around a lot and not finding something, give the [[Search]] page a try. It's the quickest way to get around.
432
+
433
+ After this general reference, there are two other more specific sections:
434
+
435
+ * [[Slots]] - covering [[Element.stack]] and [[Element.flow]], the two types of slots.
436
+ * [[Elements]] - documentation for all the buttons, shapes, images, and so on.
437
+
438
+ Two really important pages in there are the [[Element Element Creation]] page (which lists all the elements you can add) and the [[Common Common Methods]] page (which lists methods you'll find on any slot or element.)
439
+
440
+ == Built-in Methods ==
441
+
442
+ These methods can be used anywhere throughout Shoes programs.
443
+
444
+ All of these commands are unusual because you don't attach them with a dot.
445
+ '''Every other method in this manual must be attached to an object with a dot.'''
446
+ But these are built-in methods (also called: Kernel methods.) Which means no dot!
447
+
448
+ A common one is `alert`:
449
+
450
+ {{{
451
+ #!ruby
452
+ alert "No dots in sight"
453
+ }}}
454
+
455
+ Compare that to the method `reverse`, which isn't a Kernel method and is only available for Arrays and Strings:
456
+
457
+ {{{
458
+ #!ruby
459
+ "Plaster of Paris".reverse
460
+ #=> "siraP fo retsalP"
461
+ [:dogs, :cows, :snakes].reverse
462
+ #=> [:snakes, :cows, :dogs]
463
+ }}}
464
+
465
+ Most Shoes methods for drawing and making buttons and so on are attached to slots. See the section on [[Slots]] for more.
466
+
467
+ ==== Built-in Constants ====
468
+
469
+ Shoes also has a handful of built-in constants which may prove useful if you are trying to sniff out what release of Shoes is running.
470
+
471
+ '''Shoes::RELEASE_NAME''' contains a string with the name of the Shoes release. All Shoes releases are named, starting with Curious.
472
+
473
+ '''Shoes::RELEASE_ID''' contains a number representing the Shoes release. So, for example, Curious is number 1, as it was the first official release.
474
+
475
+ '''Shoes::REVISION''' is the Subversion revision number for this build.
476
+
477
+ '''Shoes::FONTS''' is a complete list of fonts available to the app. This list includes any fonts loaded by the [[Built-in.font]] method.
478
+
479
+ === alert(message: a string) » nil ===
480
+
481
+ Pops up a window containing a short message.
482
+
483
+ {{{
484
+ #!ruby
485
+ alert("I'm afraid I must interject!")
486
+ }}}
487
+
488
+ Please use alerts sparingly, as they are incredibly annoying! If you are using alerts to show messages to help you debug your program, try checking out the [[Built-in.debug]] or [[Built-in.info]] methods.
489
+
490
+ === ask(message: a string) » a string ===
491
+
492
+ Pops up a window and asks a question. For example, you may want to ask someone their name.
493
+
494
+ {{{
495
+ #!ruby
496
+ name = ask("Please, enter your name:")
497
+ }}}
498
+
499
+ When the above script is run, the person at the computer will see a window with a blank box for entering their name. The name will then be saved in the `name` variable.
500
+
501
+ === ask_color(title: a string) » Shoes::Color ===
502
+
503
+ Pops up a color picker window. The program will wait for a color to be picked, then gives you back a Color object. See the `Color` help for some ways you can use this color.
504
+
505
+ {{{
506
+ #!ruby
507
+ backcolor = ask_color("Pick a background")
508
+ Shoes.app do
509
+ background backcolor
510
+ end
511
+ }}}
512
+
513
+ === ask_open_file() » a string ===
514
+
515
+ Pops up an "Open file..." window. It's the standard window which shows all of your folders and lets you select a file to open. Hands you back the name of the file.
516
+
517
+ {{{
518
+ #!ruby
519
+ filename = ask_open_file
520
+ puts File.read(filename)
521
+ }}}
522
+
523
+ === ask_save_file() » a string ===
524
+
525
+ Pops up a "Save file..." window, similiar to `ask_open_file`, described previously.
526
+
527
+ {{{
528
+ #!ruby
529
+ save_as = ask_save_file
530
+ }}}
531
+
532
+ === ask_open_folder() » a string ===
533
+
534
+ Pops up an "Open folder..." window. It's the standard window which shows all of your folders and lets you select a folder to open. Hands you back the name of the folder.
535
+
536
+ {{{
537
+ #!ruby
538
+ folder = ask_open_folder
539
+ puts Dir[folder].entries
540
+ }}}
541
+
542
+ === ask_save_folder() » a string ===»
543
+
544
+ Pops up a "Save folder..." window, similiar to `ask_open_folder`, described previously. On OS X, this method currently behaves like an alias of `ask_open_folder`.
545
+
546
+ {{{
547
+ #!ruby
548
+ save_to = ask_save_folder
549
+ }}}
550
+
551
+
552
+ === confirm(question: a string) » true or false ===
553
+
554
+ Pops up a yes-or-no question. If the person at the computer, clicks '''yes''', you'll get back a `true`. If not, you'll get back `false`.
555
+
556
+ {{{
557
+ #!ruby
558
+ if confirm("Draw a circle?")
559
+ oval :top => 0, :left => 0, :radius => 50
560
+ end
561
+ }}}
562
+
563
+ === debug(message: a string) » nil ===
564
+
565
+ Sends a debug message to the Shoes console. You can bring up the Shoes console by pressing `Alt-/` on any Shoes window (or `⌘-/` on OS X.)
566
+
567
+ {{{
568
+ #!ruby
569
+ debug("Running Shoes on " + RUBY_PLATFORM)
570
+ }}}
571
+
572
+ Also check out the [[Built-in.error]], [[Built-in.warn]] and [[Built-in.info]] methods.
573
+
574
+ === error(message: a string) » nil ===
575
+
576
+ Sends an error message to the Shoes console. This method should only be used to log errors. Try the [[Built-in.debug]] method for logging messages to yourself.
577
+
578
+ Oh, and, rather than a string, you may also hand exceptions directly to this method and they'll be formatted appropriately.
579
+
580
+ === exit() ===
581
+
582
+ Stops your program. Call this anytime you want to suddenly call it quits.
583
+
584
+ '''PLEASE NOTE:''' If you need to use Ruby's own `exit` method (like in a forked Ruby process,) call `Kernel.exit`.
585
+
586
+ === font(message: a string) » an array of font family names ===
587
+
588
+ Loads a TrueType (or other type of font) from a file. While TrueType is supported by all platforms, your platform may support other types of fonts. Shoes uses each operating system's built-in font system to make this work.
589
+
590
+ Here's a rough idea of what fonts work on which platforms:
591
+
592
+ * Bitmap fonts (.bdf, .pcf, .snf) - Linux
593
+ * Font resource (.fon) - Windows
594
+ * Windows bitmap font file (.fnt) - Linux, Windows
595
+ * PostScript OpenType font (.otf) - Mac OS X, Linux, Windows
596
+ * Type1 multiple master (.mmm) - Windows
597
+ * Type1 font bits (.pfb) - Linux, Windows
598
+ * Type1 font metrics (.pfm) - Linux, Windows
599
+ * TrueType font (.ttf) - Mac OS X, Linux, Windows
600
+ * TrueType collection (.ttc) - Mac OS X, Linux, Windows
601
+
602
+ If the font is properly loaded, you'll get back an array of font names found in the file. Otherwise, `nil` is returned if no fonts were found in the file.
603
+
604
+ Also of interest: the `Shoes::FONTS` constant is a complete list of fonts available to you on this platform. You can check for a certain font by using `include?`.
605
+
606
+ {{{
607
+ if Shoes::FONTS.include? "Helvetica"
608
+ alert "Helvetica is available on this system."
609
+ else
610
+ alert "You do not have the Helvetica font."
611
+ end
612
+ }}}
613
+
614
+ If you have trouble with fonts showing up, make sure your app loads the font before it is used. Especially on OS X, if fonts are used before they are loaded, the font cache will tend to ignore loaded fonts.
615
+
616
+ === gradient(color1, color2) » Shoes::Pattern ===
617
+
618
+ Builds a linear gradient from two colors. For each color, you may pass in a Shoes::Color object or a string describing the color.
619
+
620
+ === gray(the numbers: darkness, alpha) » Shoes::Color ===
621
+
622
+ Create a grayscale color from a level of darkness and, optionally, an alpha level.
623
+
624
+ {{{
625
+ black = gray(0.0)
626
+ white = gray(1.0)
627
+ }}}
628
+
629
+ === info(message: a string) » nil ===
630
+
631
+ Logs an informational message to the user in the Shoes console. So, where debug messages are designed to help the program figure out what's happening, `info` messages tell the user extra information about the program.
632
+
633
+ {{{
634
+ #!ruby
635
+ info("You just ran the info example on Shoes #{Shoes::RELEASE_NAME}.")
636
+ }}}
637
+
638
+ For example, whenever a Shy file loads, Shoes prints an informational message in the console describing the author of the Shy and its version.
639
+
640
+ === rgb(a series of numbers: red, green, blue, alpha) » Shoes::Color ===
641
+
642
+ Create a color from red, green and blue components. An alpha level (indicating transparency) can also be added, optionally.
643
+
644
+ When passing in a whole number, use values from 0 to 255.
645
+
646
+ {{{
647
+ blueviolet = rgb(138, 43, 226)
648
+ darkgreen = rgb(0, 100, 0)
649
+ }}}
650
+
651
+ Or, use a decimal number from 0.0 to 1.0.
652
+
653
+ {{{
654
+ blueviolet = rgb(0.54, 0.17, 0.89)
655
+ darkgreen = rgb(0, 0.4, 0)
656
+ }}}
657
+
658
+ This method may also be called as `Shoes.rgb`.
659
+
660
+ === warn(message: a string) » nil ===
661
+
662
+ Logs a warning for the user. A warning is not a catastrophic error (see [[Built-in.error]] for that.) It is just a notice that the program will be changing in the future or that certain parts of the program aren't reliable yet.
663
+
664
+ To view warnings and errors, open the Shoes console with `Alt-/` (or `⌘-/` on OS X.)
665
+
666
+ == The App Object ==
667
+
668
+ An App is a single window running code at a URL. When you switch URLs, a new App object is created and filled up with stacks, flows and other Shoes elements.
669
+
670
+ The App is the window itself. Which may be closed or cleared and filled with new elements. !{:margin_left => 100}man-app.png!
671
+
672
+ The App itself, in slot/box terminology, is a flow. See the ''Slots'' section for more, but this just means that any elements placed directly at the top-level will flow.
673
+
674
+ === Shoes.app(styles) { ... } » Shoes::App ===
675
+
676
+ Starts up a Shoes app window. This is the starting place for making a Shoes program. Inside the block, you fill the window with various Shoes elements (buttons, artwork, etc.) and, outside the block, you use the `styles` to describe how big the window is. Perhaps also the name of the app or if it's resizable.
677
+
678
+ {{{
679
+ #!ruby
680
+ Shoes.app(:title => "White Circle",
681
+ :width => 200, :height => 200, :resizable => false) {
682
+ background black
683
+ fill white
684
+ oval :top => 20, :left => 20, :radius => 160
685
+ }
686
+ }}}
687
+
688
+ In the case above, a small window is built. 200 pixels by 200 pixels. It's not resizable. And, inside the window, two elements: a black background and a white circle.
689
+
690
+ Once an app is created, it is added to the [[App.Shoes.APPS]] list. If you want an app to spawn more windows, see the [[Element.window]] method and the [[Element.dialog]] method.
691
+
692
+ === Shoes.APPS() » An array of Shoes::App objects ===
693
+
694
+ Builds a complete list of all the Shoes apps that are open right now. Once an app is closed, it is removed from the list. Yes, you can run many apps at once in Shoes. It's completely encouraged.
695
+
696
+ === clipboard() » a string ===
697
+
698
+ Returns a string containing all of the text that's on the system clipboard. This is the global clipboard that every program on the computer cuts and pastes into.
699
+
700
+ === clipboard = a string ===
701
+
702
+ Stores `a string` of text in the system clipboard.
703
+
704
+ === close() ===
705
+
706
+ Closes the app window. If multiple windows are open and you want to close the entire application, use the built-in method `exit`.
707
+
708
+ === download(url: a string, styles) ===
709
+
710
+ Starts a download thread (much like XMLHttpRequest, if you're familiar with JavaScript.) This method returns immediately and runs the download in the background. Each download thread also fires `start`, `progress` and `finish` events. You can send the download to a file or just get back a string (in the `finish` event.)
711
+
712
+ If you attach a block to a download, it'll get called as the `finish` event.
713
+
714
+ {{{
715
+ #!ruby
716
+ Shoes.app do
717
+ stack do
718
+ title "Searching Google", :size => 16
719
+ @status = para "One moment..."
720
+
721
+ # Search Google for 'shoes' and print the HTTP headers
722
+ download "http://www.google.com/search?q=shoes" do |goog|
723
+ @status.text = "Headers: " + goog.response.headers.inspect
724
+ end
725
+ end
726
+ end
727
+ }}}
728
+
729
+ And, if we wanted to use the downloaded data, we'd get it using `goog.response.body`. This example is truly the simplest form of `download`: pulling some web data down into memory and handling it once it's done.
730
+
731
+ Another simple use of `download` is to save some web data to a file, using the `:save` style.
732
+
733
+ {{{
734
+ #!ruby
735
+ Shoes.app do
736
+ stack do
737
+ title "Downloading Google image", :size => 16
738
+ @status = para "One moment..."
739
+
740
+ download "http://www.google.com/logos/nasa50th.gif",
741
+ :save => "nasa50th.gif" do
742
+ @status.text = "Okay, is downloaded."
743
+ end
744
+ end
745
+ end
746
+ }}}
747
+
748
+ In this case, you can still get the headers for the downloaded file, but `response.body` will be `nil`, since the data wasn't saved to memory. You will need to open the file to get the downloaded goods.
749
+
750
+ If you need to send certain headers or actions to the web server, you can use the `:method`, `:headers` and `:body` styles to customize the HTTP request. (And, if you need to go beyond these, you can always break out Ruby's OpenURI class.)
751
+
752
+ {{{
753
+ #!ruby
754
+ Shoes.app do
755
+ stack do
756
+ title "POSTing to Google", :size => 16
757
+ @status = para "One moment..."
758
+
759
+ download "http://www.stevex.net/dump.php",
760
+ :method => "POST", :body => "v=1.0&q=shoes" do |dump|
761
+ require 'hpricot'
762
+ @status.text = Hpricot(dump.response.body).inner_text
763
+ end
764
+ end
765
+ end
766
+ }}}
767
+
768
+ As you can see from the above example, Shoes includes the Hpricot library for parsing HTML.
769
+
770
+ === location() » a string ===
771
+
772
+ Gets a string containing the URL of the current app.
773
+
774
+ === mouse() » an array of numbers: button, left, top ===
775
+
776
+ Identifies the mouse cursor's location, along with which button is being pressed.
777
+
778
+ {{{
779
+ #!ruby
780
+ Shoes.app do
781
+ @p = para
782
+ animate do
783
+ button, left, top = self.mouse
784
+ @p.replace "mouse: #{button}, #{left}, #{top}"
785
+ end
786
+ end
787
+ }}}
788
+
789
+ === owner() » Shoes::App ===
790
+
791
+ Gets the app which launched this app. In most cases, this will be `nil`. But if this app was launched using the [[Element.window]] method, the owner will be the app which called `window`.
792
+
793
+ === started?() » true or false ===
794
+
795
+ Has the window been fully constructed and displayed? This is useful for threaded code which may try to use the window before it is completely built. (Also see the `start` event which fires once the window is open.)
796
+
797
+ === visit(url: a string) ===
798
+
799
+ Changes the location, in order to view a different Shoes URL.
800
+
801
+ Absolute URLs (such as http://google.com) are okay, but Shoes will be expecting a Shoes application to be at that address. (So, google.com won't work, as it's an HTML app.)
802
+
803
+ == The Styles Master List ==
804
+
805
+ You want to mess with the look of things? Well, throughout Shoes, styles are used to change the way elements appear. In some cases, you can even style an entire class of elements. (Like giving all paragraphs a certain font.)
806
+
807
+ Styles are easy to spot. They usually show up when the element is created.
808
+
809
+ {{{
810
+ Shoes.app :title => "A Styling Sample" do
811
+ para "Red with an underline", :stroke => red, :underline => "single"
812
+ end
813
+ }}}
814
+
815
+ Here we've got a `:title` style on the app. And on the paragraph inside the app, a red `:stroke` style and an `:underline` style.
816
+
817
+ The style hash can also be changed by using the [[Common.style]] method, available on every element and slot.
818
+
819
+ {{{
820
+ Shoes.app :title => "A Styling Sample" do
821
+ @text = para "Red with an underline"
822
+ @text.style(:stroke => red, :underline => "single")
823
+ end
824
+ }}}
825
+
826
+ Most styles can also be set by calling them as methods. (I'd use the manual search to find the method.)
827
+
828
+ {{{
829
+ Shoes.app :title => "A Styling Sample" do
830
+ @text = para "Red with an underline"
831
+ @text.stroke = red
832
+ @text.underline = "single"
833
+ end
834
+ }}}
835
+
836
+ Rather than making you plow through the whole manual to figure out what styles go where, this helpful page speeds through every style in Shoes and suggests where that style is used.
837
+
838
+ === :align » a string ===
839
+
840
+ For: ''banner, caption, code, del, em, ins, inscription, link, para, span, strong, sub, sup, subtitle, tagline, title''
841
+
842
+ The alignment of the text. It is either:
843
+
844
+ * "left" - Align the text to the left.
845
+ * "center" - Align the text in the center.
846
+ * "right" - Align the text to the right.
847
+
848
+ === :angle » a number ===
849
+
850
+ For: ''background, border, gradient''.
851
+
852
+ The angle at which to apply a gradient. Normally, gradient colors range from top to bottom. If the `:angle` is set to 90, the gradient will rotate 90 degrees counter-clockwise and the gradient will go from left to right.
853
+
854
+ === :attach » a slot or element ===
855
+
856
+ For: ''flow, stack''.
857
+
858
+ Pins a slot relative to another slot or element. Also, one may write `:attach => Window` to position the slot at the window's top, left corner. Taking this a bit further, the style `:top => 10, :left => 10, :attach => Window` would place the slot at (10, 10) in the window's coordinates.
859
+
860
+ If a slot is attached to an element that moves, the slot will move with it. If the attachment is reset to `nil`, the slot will flow in with the other objects that surround, as normal.
861
+
862
+ === :autoplay » true or false ===
863
+
864
+ For: ''video''.
865
+
866
+ Should this video begin playing after it appears? If set to `true`, the video will start without asking the user.
867
+
868
+ === :bottom » a number ===
869
+
870
+ For: ''all slots and elements''.
871
+
872
+ Sets the pixel coordinate of an element's lower edge. The edge is placed relative to its container's lower edge. So, `:bottom => 0` will align the element so that its bottom edge and the bottom edge of its slot touch.
873
+
874
+ === :cap » :curve or :rect or :project ===
875
+
876
+ For: ''arc, arrow, border, flow, image, mask, rect, star, shape, stack''.
877
+
878
+ Sets the shape of the line endpoint, whether curved or square. See the [[Art.cap]] method for more explanation.
879
+
880
+ === :center » true or false ===
881
+
882
+ For: ''arc, image, oval, rect, shape''.
883
+
884
+ Indicates whether the `:top` and `:left` coordinates refer to the center of the shape or not. If set to `true`, this is similar to setting the [[Art.transform]] method to `:center`.
885
+
886
+ === :change » a proc ===
887
+
888
+ For: ''edit_box, edit_line, list_box''.
889
+
890
+ The `change` event handler is stored in this style. See the [[EditBox.change]] method for the edit_box, as an example.
891
+
892
+ === :checked » true or false ===
893
+
894
+ For: ''check, radio''.
895
+
896
+ Is this checkbox or radio button checked? If set to `true`, the box is checked. Also see the [[Check.checked=]] method.
897
+
898
+ === :choose » a string ===
899
+
900
+ For: ''list_box''.
901
+
902
+ Sets the currently chosen item in the list. More information at [[ListBox.choose]].
903
+
904
+ === :click » a proc ===
905
+
906
+ For: ''arc, arrow, banner, button, caption, check, flow, image, inscription, line, link, mask, oval, para, radio, rect, shape, stack, star, subtitle, tagline, title''.
907
+
908
+ The `click` event handler is stored in this style. See the [[Events.click]] method for a description.
909
+
910
+ === :curve » a number ===
911
+
912
+ For: ''background, border, rect''.
913
+
914
+ The radius of curved corners on each of these rectangular elements. As an example, if this is set to 6, the corners of the rectangle are given a curve with a 6-pixel radius.
915
+
916
+ === :displace_left » a number ===
917
+
918
+ For: ''all slots and elements''.
919
+
920
+ Moves a shape, text block or any other kind of object to the left or right. A positive number displaces to the right by the given number of pixels; a negative number displaces to the left. Displacing an object doesn't effect the actual layout of the page. Before using this style, be sure to read the [[Position.displace]] docs, since its behavior can be a bit surprising.
921
+
922
+ === :displace_top » a number ===
923
+
924
+ For: ''all slots and elements''.
925
+
926
+ Moves a shape, text block or any other kind of object up or down. A positive number moves the object down by this number of pixels; a negative number moves it up. Displacing doesn't effect the actual layout of the page or the object's true coordinates. Read the [[Position.displace]] docs, since its behavior can be a bit surprising.
927
+
928
+ === :emphasis » a string ===
929
+
930
+ For: ''banner, caption, code, del, em, ins, inscription, link, para, span, strong, sub, sup, subtitle, tagline, title''.
931
+
932
+ Styles the text with an emphasis (commonly italicized.)
933
+
934
+ This style recognizes three possible settings:
935
+
936
+ * "normal" - the font is upright.
937
+ * "oblique" - the font is slanted, but in a roman style.
938
+ * "italic" - the font is slanted in an italic style.
939
+
940
+ === :family » a string ===
941
+
942
+ For: ''banner, caption, code, del, em, ins, inscription, link, para, span, strong, sub, sup, subtitle, tagline, title''.
943
+
944
+ Styles the text with a given font family. The string should contain the family name or a comma-separated list of families.
945
+
946
+ === :fill » a hex code, a Shoes::Color or a range of either ===
947
+
948
+ For: ''arc, arrow, background, banner, caption, code, del, em, flow, image, ins, inscription, line, link, mask, oval, para, rect, shape, span, stack, star, strong, sub, sup, subtitle, tagline, title''.
949
+
950
+ The color of the background pen. For shapes, this is the fill color, the paint inside the shape. For text stuffs, this color is painted in the background (as if marked with a highlighter pen.)
951
+
952
+ === :font » a string ===
953
+
954
+ For: ''banner, caption, code, del, em, ins, inscription, link, para, span, strong, sub, sup, subtitle, tagline, title''.
955
+
956
+ Styles the text with a font description. The string is pretty flexible, but can take the form "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]", where FAMILY-LIST is a comma separated list of families optionally terminated by a comma, STYLE_OPTIONS is a whitespace separated list of words where each WORD describes one of style, variant, weight, stretch, or gravity, and SIZE is a decimal number (size in points) or optionally followed by the unit modifier "px" for absolute size. Any one of the options may be absent. If FAMILY-LIST is absent, then the default font family (Arial) will be used.
957
+
958
+ === :group » a string ===
959
+
960
+ For: ''radio''.
961
+
962
+ Indicates what group a radio button belongs to. Without this setting, radio buttons are grouped together with other radio buttons in their immediate slot. "Grouping" radio buttons doesn't mean they'll be grouped next to each other on the screen. It means that only one radio button from the group can be selected at a time.
963
+
964
+ By giving this style a string, the radio button will be grouped with other radio buttons that have the same group name.
965
+
966
+ === :height » a number ===
967
+
968
+ For: ''all slots and elements''.
969
+
970
+ Sets the pixel height of this object. If the number is a decimal number, the height becomes a percentage of its parent's height (with 0.0 being 0% and 1.0 being 100%.)
971
+
972
+ === :hidden » true or false ===
973
+
974
+ For: ''all slots and elements''.
975
+
976
+ Hides or shows this object. Any object with `:hidden => true` are not displayed on the screen. Neither are its children.
977
+
978
+ === :inner » a number ===
979
+
980
+ For: ''star''.
981
+
982
+ The size of the inner radius (in pixels.) The inner radius describes the solid circle within the star where the points begin to separate.
983
+
984
+ === :items » an array ===
985
+
986
+ For: ''list_box''.
987
+
988
+ The list of selections in the list box. See the [[Element.list_box]] method for an example.
989
+
990
+ === :justify » true or false ===
991
+
992
+ For: ''banner, caption, code, del, em, ins, inscription, link, para, span, strong, sub, sup, subtitle, tagline, title''
993
+
994
+ Evenly spaces the text horizontally.
995
+
996
+ === :kerning » a number ===
997
+
998
+ For: ''banner, caption, code, del, em, ins, inscription, link, para, span, strong, sub, sup, subtitle, tagline, title''.
999
+
1000
+ Adds to the natural spacing between letters, in pixels.
1001
+
1002
+ === :leading » a number ===
1003
+
1004
+ For: ''banner, caption, inscription, para, subtitle, tagline, title''.
1005
+
1006
+ Sets the spacing between lines in a text block. Defaults to 4 pixels.
1007
+
1008
+ === :left » a number ===
1009
+
1010
+ For: ''all slots and elements''.
1011
+
1012
+ Sets the left coordinate of this object to a specific pixel. Setting `:left => 10` places the object's left edge ten pixels away from the left edge of the slot containing it. If this style is left unset (or set to `nil`,) the object will flow in with the other objects surrounding it.
1013
+
1014
+ === :margin » a number or an array of four numbers ===
1015
+
1016
+ For: ''all slots and elements''.
1017
+
1018
+ Margins space an element out from its surroundings. Each element has a left, top, right, and bottom margin. If the `:margin` style is set to a single number, the spacing around the element uniformly matches that number. In other words, if `:margin => 8` is set, all the margins around the element are set to eight pixels in length.
1019
+
1020
+ This style can also be given an array of four numbers in the form `[left, top, right, bottom]`.
1021
+
1022
+ === :margin_bottom » a number ===
1023
+
1024
+ For: ''all slots and elements''.
1025
+
1026
+ Sets the bottom margin of the element to a specific pixel size.
1027
+
1028
+ === :margin_left » a number ===
1029
+
1030
+ For: ''all slots and elements''.
1031
+
1032
+ Sets the left margin of the element to a specific pixel size.
1033
+
1034
+ === :margin_right » a number ===
1035
+
1036
+ For: ''all slots and elements''.
1037
+
1038
+ Sets the right margin of the element to a specific pixel size.
1039
+
1040
+ === :margin_top » a number ===
1041
+
1042
+ For: ''all slots and elements''.
1043
+
1044
+ Sets the top margin of the element to a specific pixel size.
1045
+
1046
+ === :outer » a number ===
1047
+
1048
+ For: ''star''.
1049
+
1050
+ Sets the outer radius (half of the ''total'' width) of the star, in pixels.
1051
+
1052
+ === :points » a number ===
1053
+
1054
+ For: ''star''.
1055
+
1056
+ How many points does this star have? A style of `:points => 5` creates a five-pointed star.
1057
+
1058
+ === :radius » a number ===
1059
+
1060
+ For: ''arc, arrow, background, border, gradient, oval, rect, shape''.
1061
+
1062
+ Sets the radius (half of the diameter or total width) for each of these elements. Setting this is equivalent to setting both `:width` and `:height` to double this number.
1063
+
1064
+ === :right » a number ===
1065
+
1066
+ For: ''all slots and elements''.
1067
+
1068
+ Sets the pixel coordinate of an element's right edge. The edge is placed relative to its container's rightmost edge. So, `:right => 0` will align the element so that its own right edge and the right edge of its slot touch. Whereas `:right => 20` will position the right edge of the element off to the left of its slot's right edge by twenty pixels.
1069
+
1070
+ === :rise » a number ===
1071
+
1072
+ For: ''banner, caption, code, del, em, ins, inscription, link, para, span, strong, sub, sup, subtitle, tagline, title''.
1073
+
1074
+ Lifts or plunges the font baseline for some text. For example, a [[Element.sup]] has a `:rise` of 10 pixels. Conversely, the [[Element.sub]] element has a `:rise` of -10 pixels.
1075
+
1076
+ === :scroll » true or false ===
1077
+
1078
+ For: ''flow, stack''.
1079
+
1080
+ Establishes this slot as a scrolling slot. If `:scroll => true` is set, the slot will show a scrollbar if any of its contents go past its height. The scrollbar will appear and disappear as needed. It will also appear inside the width of the slot, meaning the slot's width will never change, regardless of whether there is a scrollbar or not.
1081
+
1082
+ === :secret » true or false ===
1083
+
1084
+ For: ''ask, edit_line''.
1085
+
1086
+ Used for password fields, this setting keeps any characters typed in from becoming visible on the screen. Instead, a replacement character (such as an asterisk) is show for each letter typed.
1087
+
1088
+ === :size » a number ===
1089
+
1090
+ For: ''banner, caption, code, del, em, ins, inscription, link, para, span, strong, sub, sup, subtitle, tagline, title''.
1091
+
1092
+ Sets the pixel size for the font used inside this text block or text fragment.
1093
+
1094
+ Font size may also be augmented, through use of the following strings:
1095
+
1096
+ * "xx-small" - 57% of present size.
1097
+ * "x-small" - 64% of present size.
1098
+ * "small" - 83% of present size.
1099
+ * "medium" - no change in size.
1100
+ * "large" - 120% of present size.
1101
+ * "x-large" - 143% of present size.
1102
+ * "xx-large" - 173% of present size.
1103
+
1104
+ === :state » a string ===
1105
+
1106
+ For: ''button, check, edit_box, edit_line, list_box, radio''.
1107
+
1108
+ The `:state` style is for disabling or locking certain controls, if you don't want them to be edited.
1109
+
1110
+ Here are the possible style settings:
1111
+
1112
+ * nil - the control is active and editable.
1113
+ * "readonly" - the control is active but cannot be edited.
1114
+ * "disabled" - the control is not active (grayed out) and cannot be edited.
1115
+
1116
+ === :stretch » a string ===
1117
+
1118
+ For: ''banner, caption, code, del, em, ins, inscription, link, para, span, strong, sub, sup, subtitle, tagline, title''.
1119
+
1120
+ Sets the font stretching used for a text object.
1121
+
1122
+ Possible settings are:
1123
+
1124
+ * "condensed" - a smaller width of letters.
1125
+ * "normal" - the standard width of letters.
1126
+ * "expanded" - a larger width of letters.
1127
+
1128
+ === :strikecolor » a Shoes::Color ===
1129
+
1130
+ For: ''banner, caption, code, del, em, ins, inscription, link, para, span, strong, sub, sup, subtitle, tagline, title''.
1131
+
1132
+ The color used to paint any lines stricken through this text.
1133
+
1134
+ === :strikethrough » a string ===
1135
+
1136
+ For: ''banner, caption, code, del, em, ins, inscription, link, para, span, strong, sub, sup, subtitle, tagline, title''.
1137
+
1138
+ Is this text stricken through? Two options here:
1139
+
1140
+ * "none" - no strikethrough
1141
+ * "single" - a single-line strikethrough.
1142
+
1143
+ === :stroke » a hex code, a Shoes::Color or a range of either ===
1144
+
1145
+ For: ''arc, arrow, banner, border, caption, code, del, em, flow, image, ins, inscription, line, link, mask, oval, para, rect, shape, span, stack, star, strong, sub, sup, subtitle, tagline, title''.
1146
+
1147
+ The color of the foreground pen. In the case of shapes, this is the color the lines are drawn with. For paragraphs and other text, the letters are printed in this color.
1148
+
1149
+ === :strokewidth » a number ===
1150
+
1151
+ For: ''arc, arrow, border, flow, image, line, mask, oval, rect, shape, star, stack''.
1152
+
1153
+ The thickness of the stroke, in pixels, of the line defining each of these shapes. For example, the number two would set the strokewidth to 2 pixels.
1154
+
1155
+ === :text » a string ===
1156
+
1157
+ For: ''button, edit_box, edit_line''.
1158
+
1159
+ Sets the message displayed on a button control, or the contents of an edit_box or edit_line.
1160
+
1161
+ === :top » a number ===
1162
+
1163
+ For: ''all slots and elements''.
1164
+
1165
+ Sets the top coordinate for an object, relative to its parent slot. If an object is set with `:top => 40`, this means the object's top edge will be placed 40 pixels beneath the top edge of the slot that contains it. If no `:top` style is given, the object is automatically placed in the natural flow of its slot.
1166
+
1167
+ === :undercolor » a Shoes::Color ===
1168
+
1169
+ For: ''banner, caption, code, del, em, ins, inscription, link, para, span, strong, sub, sup, subtitle, tagline, title''.
1170
+
1171
+ The color used to underline text.
1172
+
1173
+ === :underline » a string ===
1174
+
1175
+ For: ''banner, caption, code, del, em, ins, inscription, link, para, span, strong, sub, sup, subtitle, tagline, title''.
1176
+
1177
+ Dictates the style of underline used in the text.
1178
+
1179
+ The choices for this setting are:
1180
+
1181
+ * "none" - no underline at all.
1182
+ * "single" - a continuous underline.
1183
+ * "double" - two continuous parallel underlines.
1184
+ * "low" - a lower underline, beneath the font baseline. (This is generally recommended only for single characters, particularly when showing keyboard accelerators.)
1185
+ * "error" - a wavy underline, usually found indicating a misspelling.
1186
+
1187
+ === :variant » a string ===
1188
+
1189
+ For: ''banner, caption, code, del, em, ins, inscription, link, para, span, strong, sub, sup, subtitle, tagline, title''.
1190
+
1191
+ Vary the font for a group of text. Two choices:
1192
+
1193
+ * "normal" - standard font.
1194
+ * "smallcaps" - font with the lower case characters replaced by smaller variants of the capital characters.
1195
+
1196
+ === :weight » a string ===
1197
+
1198
+ For: ''banner, caption, code, del, em, ins, inscription, link, para, span, strong, sub, sup, subtitle, tagline, title''.
1199
+
1200
+ Set the boldness of the text. Commonly, this style is set to one of the following strings:
1201
+
1202
+ * "ultralight" - the ultralight weight (= 200)
1203
+ * "light" - the light weight (= 300)
1204
+ * "normal" - the default weight (= 400)
1205
+ * "semibold" - a weight intermediate between normal and bold (= 600)
1206
+ * "bold" - the bold weight (= 700)
1207
+ * "ultrabold" - the ultrabold weight (= 800)
1208
+ * "heavy" - the heavy weight (= 900)
1209
+
1210
+ However, you may also pass in the numerical weight directly.
1211
+
1212
+ === :width » a number ===
1213
+
1214
+ For: ''all slots and elements''.
1215
+
1216
+ Sets the pixel width for the element. If the number is a decimal, the width is converted to a percentage (with 0.0 being 0% and 1.0 being 100%.) A width of 100% means the object fills its parent slot.
1217
+
1218
+ === :wrap » a string ===
1219
+
1220
+ For: ''banner, caption, code, del, em, ins, inscription, link, para, span, strong, sub, sup, subtitle, tagline, title''
1221
+
1222
+ How should the text wrap when it fills its width? Possible options are:
1223
+
1224
+ * "word" - Break lines at word breaks.
1225
+ * "char" - Break lines between characters, thus breaking some words.
1226
+ * "trim" - Cut the line off with an ellipsis if it goes too long.
1227
+
1228
+ == Classes List ==
1229
+
1230
+ Here is a complete list of all the classes introduced by Shoes. This chart is laid out according to how classes inherits from each other. Subclasses are indented one level to the right, beneath their parent class.
1231
+
1232
+ {INDEX}
1233
+
1234
+ == Colors List ==
1235
+
1236
+ The following list of colors can be used throughout Shoes. As background colors or border colors. As stroke and fill colors. Most of these colors come from the X11 and HTML palettes.
1237
+
1238
+ All of these colors can be used by name. (So calling the `tomato` method from inside any slot will get you a nice reddish color.) Below each color, also find the exact numbers which can be used with the [[Built-in.rgb]] method.
1239
+
1240
+ {COLORS}
1241
+
1242
+ = Slots =
1243
+
1244
+ Slots are boxes used to lay out images, text and so on. The two most common slots are `stacks` and `flows`. Slots can also be referred to as "boxes" or "canvases" in Shoes terminology.
1245
+
1246
+ Since the mouse wheel and PageUp and PageDown are so pervasive on every platform, vertical scrolling has really become the only overflow that matters. So, in Shoes, just as on the web, width is generally fixed. While height goes on and on.
1247
+
1248
+ Now, you can also just use specific widths and heights for everything, if you want. That'll take some math, but everything could be perfect.
1249
+
1250
+ Generally, I'd suggest using stacks and flows. The idea here is that you want to fill up a certain width with things, then advance down the page, filling up further widths. You can think of these as being analogous to HTML's "block" and "inline" styles.
1251
+
1252
+ ==== Stacks ====
1253
+
1254
+ A stack is simply a vertical stack of elements. Each element in a stack is placed directly under the element preceding it.
1255
+
1256
+ A stack is also shaped like a box. So if a stack is given a width of 250, that stack is itself an element which is 250 pixels wide.
1257
+
1258
+ To create a new stack, use the [[Element.stack]] method, which is available inside any slot. So stacks can contain other stacks and flows.
1259
+
1260
+ ==== Flows ====
1261
+
1262
+ A flow will pack elements in as tightly as it can. A width will be filled, then will wrap beneath those elements. Text elements placed next to each other will appear as a single paragraph. Images and widgets will run together as a series.
1263
+
1264
+ Like the stack, a flow is a box. So stacks and flows can safely be embedded and, without respect to their contents, are identical. They just treat their contents differently.
1265
+
1266
+ Making a flow means calling the [[Element.flow]] method. Flows may contain other flows and stacks.
1267
+
1268
+ Last thing: The Shoes window itself is a flow.
1269
+
1270
+ == Art for Slots ==
1271
+
1272
+ Each slot is like a canvas, a blank surface which can be covered with an assortment of colored shapes or gradients.
1273
+
1274
+ Many common shapes can be drawn with methods like `oval` and `rect`. You'll need to set up the paintbrush colors first, though.
1275
+
1276
+ The `stroke` command sets the line color. And the `fill` command sets the color used to paint inside the lines.
1277
+
1278
+ {{{
1279
+ #!ruby
1280
+ Shoes.app do
1281
+ stroke red
1282
+ fill blue
1283
+ oval :top => 10, :left => 10,
1284
+ :radius => 100
1285
+ end
1286
+ }}}
1287
+
1288
+ That code gives you a blue pie with a red line around it. One-hundred pixels wide, placed just a few pixels
1289
+ southeast of the window's upper left corner.
1290
+
1291
+ The `blue` and `red` methods above are Color objects. See the section on Colors for more on how to mix
1292
+ colors.
1293
+
1294
+ ==== Inspiration from Processing and NodeBox ====
1295
+
1296
+ The artful methods generally come verbatim from NodeBox, a drawing kit for Python. In turn, NodeBox gets much of its ideas from Processing, a Java-like language for graphics and animation. I owe a great debt to the creators of these wonderful programs!
1297
+
1298
+ Shoes does a few things differently from NodeBox and Processing. For example, Shoes has different color methods, including having its own Color objects, though these are very similar to Processing's color methods. And Shoes also allows images and gradients to be used for drawing lines and filling in shapes.
1299
+
1300
+ Shoes also borrows some animation ideas from Processing and will continue to closely consult Processing's methods as it expands.
1301
+
1302
+ === arc(left, top, width, height, angle1, angle2) » Shoes::Shape ===
1303
+
1304
+ Draws an arc shape (a section of an oval) at coordinates (left, top). This method just give you a bit more control than [[oval]], by offering the `:angle1` and `:angle2` styles. (In fact, you can mimick the `oval` method by setting `:angle1` to 0 and `:angle2` to `Shoes::TWO_PI`.)
1305
+
1306
+ === arrow(left, top, width) » Shoes::Shape ===
1307
+
1308
+ Draws an arrow at coordinates (left, top) with a pixel `width`.
1309
+
1310
+ === cap(:curve or :rect or :project) » self ===
1311
+
1312
+ Sets the line cap, which is the shape at the end of every line you draw. If set to `:curve`, the end is rounded. The default is `:rect`, a line which ends abruptly flat. The `:project` cap is also fat, but sticks out a bit longer.
1313
+
1314
+ === fill(pattern) » pattern ===
1315
+
1316
+ Sets the fill bucket to a specific color (or pattern.) Patterns can be colors, gradients or images. So, once the fill bucket is set, you can draw shapes and they will be colored in with the pattern you've chosen.
1317
+
1318
+ To draw a star with an image pattern:
1319
+
1320
+ {{{
1321
+ #!ruby
1322
+ Shoes.app do
1323
+ fill "images/shiny.png"
1324
+ star 200, 200, 5
1325
+ end
1326
+ }}}
1327
+
1328
+ To clear the fill bucket, use `nofill`. And to set the line color (the border of the star,) use the `stroke` method.
1329
+
1330
+ === nofill() » self ===
1331
+
1332
+ Blanks the fill color, so that any shapes drawn will not be filled in. Instead, shapes will have only a
1333
+ lining, leaving the middle transparent.
1334
+
1335
+ === nostroke() » self ===
1336
+
1337
+ Empties the line color. Shapes drawn will have no outer line. If `nofill` is also set, shapes drawn will
1338
+ not be visible.
1339
+
1340
+ === line(left, top, x2, y2) » Shoes::Shape ===
1341
+
1342
+ Draws a line using the current line color (aka "stroke") starting at coordinates (left, top) and ending at coordinates (x2, y2).
1343
+
1344
+ === oval(left, top, radius) » Shoes::Shape ===
1345
+
1346
+ Draws a circular form at pixel coordinates (left, top) with a width and height of `radius` pixels. The line and fill colors are used to draw the shape. By default, the coordinates are for the oval's leftmost, top corner, but this can be changed by calling the [[Art.transform]] method or by using the `:center` style on the next method below.
1347
+
1348
+ {{{
1349
+ #!ruby
1350
+ Shoes.app do
1351
+ stroke blue
1352
+ strokewidth 4
1353
+ fill black
1354
+
1355
+ oval 10, 10, 50
1356
+ end
1357
+ }}}
1358
+
1359
+ To draw an oval of varied proportions, you may also use the syntax: `oval(left, top, width, height)`.
1360
+
1361
+ === oval(styles) » Shoes::Shape ===
1362
+
1363
+ Draw circular form using a style hash. The following styles are supported:
1364
+
1365
+ * `top`: the y-coordinate for the oval pen.
1366
+ * `left`: the x-coordinate for the oval pen.
1367
+ * `radius`: the width and height of the circle.
1368
+ * `width`: a specific pixel width for the oval.
1369
+ * `height`: a specific pixel height for the oval.
1370
+ * `center`: do the coordinates specific the oval's center? (true or false)
1371
+
1372
+ These styles may also be altered using the `style` method on the Shape object.
1373
+
1374
+ === rect(top, left, width, height, corners = 0) » Shoes::Shape ===
1375
+
1376
+ Draws a rectangle starting from coordinates (top, left) with dimensions of width x height. Optionally, you may give the rectangle rounded corners with a fifth argument: the radius of the corners in pixels.
1377
+
1378
+ As with all other shapes, the rectangle is drawn using the stroke and fill colors.
1379
+
1380
+ {{{
1381
+ #!ruby
1382
+ Shoes.app do
1383
+ stroke rgb(0.5, 0.5, 0.7)
1384
+ fill rgb(1.0, 1.0, 0.9)
1385
+ rect 10, 10, self.width - 10, self.height - 10
1386
+ end
1387
+ }}}
1388
+
1389
+ The above sample draws a rectangle which fills the area of its parent box, leaving a margin of 10 pixels around the edge. Also see the `background` method for a rectangle which defaults to filling its parent box.
1390
+
1391
+ === rect(styles) » Shoes::Shape ===
1392
+
1393
+ Draw a rectangle using a style hash. The following styles are supported:
1394
+
1395
+ * `top`: the y-coordinate for the rectangle.
1396
+ * `left`: the x-coordinate for the rectangle.
1397
+ * `curve`: the pixel radius of the rectangle's corners.
1398
+ * `width`: a specific pixel width for the rectangle.
1399
+ * `height`: a specific pixel height for the rectangle.
1400
+ * `center`: do the coordinates specific the rectangle's center? (true or false)
1401
+
1402
+ These styles may also be altered using the `style` method on the Shape object.
1403
+
1404
+ === rotate(degrees: a number) » self ===
1405
+
1406
+ Rotates the pen used for drawing by a certain number of `degrees`, so that any shapes will be drawn at that angle.
1407
+
1408
+ In this example below, the rectangle drawn at (30, 30) will be rotated 45 degrees.
1409
+
1410
+ {{{
1411
+ #!ruby
1412
+ Shoes.app do
1413
+ fill "#333"
1414
+ rotate 45
1415
+ rect 30, 30, 40, 40
1416
+ end
1417
+ }}}
1418
+
1419
+ === shape(left, top) { ... } » Shoes::Shape ===
1420
+
1421
+ Describes an arbitrary shape to draw, beginning at coordinates (left, top) and continued by calls to `line_to`, `move_to`, `curve_to` and `arc_to` inside the block. You can look at it as sketching a shape with a long line that curves and arcs and bends.
1422
+
1423
+ {{{
1424
+ #!ruby
1425
+ Shoes.app do
1426
+ fill red(0.2)
1427
+ shape do
1428
+ move_to(90, 55)
1429
+ arc_to(50, 55, 50, 50, 0, PI/2)
1430
+ arc_to(50, 55, 60, 60, PI/2, PI)
1431
+ arc_to(50, 55, 70, 70, PI, TWO_PI-PI/2)
1432
+ arc_to(50, 55, 80, 80, TWO_PI-PI/2, TWO_PI)
1433
+ end
1434
+ end
1435
+ }}}
1436
+
1437
+ A shape can also contain other shapes. So, you can place an [[Art.oval]], a [[Art.rect]], a [[Art.line]], a [[Art.star]] or an [[Art.arrow]] (and all of the other methods in this [[Art]] section) inside a shape, but they will not be part of the line. They will be more like a group of shapes are all drawn as one.
1438
+
1439
+ === star(left, top, points = 10, outer = 100.0, inner = 50.0) » Shoes::Shape ===
1440
+
1441
+ Draws a star using the stroke and fill colors. The star is positioned with its center point at coordinates (left, top) with a certain number of `points`. The `outer` width defines the full radius of the star; the `inner` width specifies the radius of the star's middle, where points stem from.
1442
+
1443
+ === stroke(pattern) » pattern ===
1444
+
1445
+ Set the active line color for this slot. The `pattern` may be a color, a gradient or an image, all of which are categorized as "patterns." The line color is then used to draw the borders of any subsequent shape.
1446
+
1447
+ So, to draw an arrow with a red line around it:
1448
+
1449
+ {{{
1450
+ #!ruby
1451
+ Shoes.app do
1452
+ stroke red
1453
+ arrow 0, 100, 10
1454
+ end
1455
+ }}}
1456
+
1457
+ To clear the line color, use the `nostroke` method.
1458
+
1459
+ === strokewidth(a number) » self ===
1460
+
1461
+ Sets the line size for all drawing within this slot. Whereas the `stroke` method alters the line color, the `strokewidth` method alters the line size in pixels. Calling `strokewidth(4)` will cause lines to be drawn 4 pixels wide.
1462
+
1463
+ === transform(:center or :corner) » self ===
1464
+
1465
+ Should transformations (such as `skew` and `rotate`) be performed around the center of the shape? Or the corner of the shape? Shoes defaults to `:corner`.
1466
+
1467
+ === translate(left, top) » self ===
1468
+
1469
+ Moves the starting point of the drawing pen for this slot. Normally, the pen starts at (0, 0) in the top-left corner, so that all shapes are drawn from that point. With `translate`, if the starting point is moved to (10, 20) and a shape is drawn at (50, 60), then the shape is actually drawn at (60, 80) on the slot.
1470
+
1471
+ == Element Creation ==
1472
+
1473
+ Shoes has a wide variety of elements, many cherry-picked from HTML. This page describes how to create these elements in a slot. See the Elements section of the manual for more on how to modify and use these elements after they have been placed.
1474
+
1475
+ === animate(fps) { |frame| ... } » Shoes::Animation ===
1476
+
1477
+ Starts an animation timer, which runs parallel to the rest of the app. The `fps` is a number, the frames per seconds. This number dictates how many times per second the attached block will be called.
1478
+
1479
+ The block is given a `frame` number. Starting with zero, the `frame` number tells the block how many frames of the animation have been shown.
1480
+
1481
+ {{{
1482
+ #!ruby
1483
+ Shoes.app do
1484
+ @counter = para "STARTING"
1485
+ animate(24) do |frame|
1486
+ @counter.replace "FRAME #{frame}"
1487
+ end
1488
+ end
1489
+ }}}
1490
+
1491
+ The above animation is shown 24 times per second. If no number is give, the `fps` defaults to 10.
1492
+
1493
+ === background(pattern) » Shoes::Background ===
1494
+
1495
+ Draws a Background element with a specific color (or pattern.) Patterns can be colors, gradients or images. Colors and images will tile across the background. Gradients stretch to fill the background.
1496
+
1497
+ '''PLEASE NOTE:''' Backgrounds are actual elements, not styles. HTML treats backgrounds like styles. Which means every box can only have one background. Shoes layers background elements.
1498
+
1499
+ {{{
1500
+ #!ruby
1501
+ Shoes.app do
1502
+ background black
1503
+ background white, :width => 50
1504
+ end
1505
+ }}}
1506
+
1507
+ The above example paints two backgrounds. First, a black background is painted over the entire app's surface area. Then a 50 pixel white stripe is painted along the left side.
1508
+
1509
+ === banner(text) » Shoes::Banner ===
1510
+
1511
+ Creates a Banner text block. Shoes automatically styles this text to 48 pixels high.
1512
+
1513
+ === border(text, :strokewidth => a number) » Shoes::Border ===
1514
+
1515
+ Draws a Border element using a specific color (or pattern.) Patterns can be colors, gradients or images. Colors and images will tile across the border. Gradients stretch to fill the border.
1516
+
1517
+ '''PLEASE NOTE:''' Like Backgrounds, Borders are actual elements, not styles. HTML treats backgrounds and borders like styles. Which means every box can only have one borders. Shoes layers border and background elements, along with text blocks, images, and everything else.
1518
+
1519
+ === button(text) { ... } » Shoes::Button ===
1520
+
1521
+ Adds a push button with the message `text` written across its surface. An optional block can be attached, which is called if the button is pressed.
1522
+
1523
+ === caption(text) » Shoes::Caption ===
1524
+
1525
+ Creates a Caption text block. Shoes styles this text to 14 pixels high.
1526
+
1527
+ === check() » Shoes::Check ===
1528
+
1529
+ Adds a check box.
1530
+
1531
+ === code(text) » Shoes::Code ===
1532
+
1533
+ Create a Code text fragment. This text defaults to a monospaced font.
1534
+
1535
+ === del(text) » Shoes::Del ===
1536
+
1537
+ Creates a Del text fragment (short for "deleted") which defaults to text with a single strikethrough in its middle.
1538
+
1539
+ === dialog(styles) { ... } » Shoes::App ===
1540
+
1541
+ Opens a new app window (just like the [[Element.window]] method does,) but the window is given a dialog box look.
1542
+
1543
+ === edit_box(text) » Shoes::EditBox ===
1544
+
1545
+ Adds a large, multi-line textarea to this slot. The `text` is optional and should be a string that will start out the box. An optional block can be attached here which is called any type the user changes the text in the box.
1546
+
1547
+ {{{
1548
+ #!ruby
1549
+ Shoes.app do
1550
+ edit_box
1551
+ edit_box "HORRAY EDIT ME"
1552
+ edit_box "small one", :width => 100, :height => 160
1553
+ end
1554
+ }}}
1555
+
1556
+ === edit_line(text) » Shoes::EditLine ===
1557
+
1558
+ Adds a single-line text box to this slot. The `text` is optional and should be a string that will start out the box. An optional block can be attached here which is called any type the user changes the text in the box.
1559
+
1560
+ === em(text) » Shoes::Em ===
1561
+
1562
+ Creates an Em text fragment (short for "emphasized") which, by default, is styled with italics.
1563
+
1564
+ === every(seconds) { |count| ... } » Shoes::Every ===
1565
+
1566
+ A timer similar to the `animation` method, but much slower. This timer fires a given number of seconds, running the block attached. So, for example, if you need to check a web site every five minutes, you'd call `every(300)` with a block containing the code to actually ping the web site.
1567
+
1568
+ === flow(styles) { ... } » Shoes::Flow ===
1569
+
1570
+ A flow is an invisible box (or "slot") in which you place Shoes elements. Both flows and stacks are explained in great detail on the main [[Slots]] page.
1571
+
1572
+ Flows organize elements horizontally. Where one would use a [[Element.stack]] to keep things stacked vertically, a flow places its contents end-to-end across the page. Once the end of the page is reached, the flow starts a new line of elements.
1573
+
1574
+ === image(path) » Shoes::Image ===
1575
+
1576
+ Creates an [[Image]] element for displaying a picture. PNG, JPEG and GIF formats are allowed.
1577
+
1578
+ The `path` can be a file path or a URL. All images loaded are temporarily cached in memory, but remote images are also cached locally in the user's personal Shoes directory. Remote images are loaded in the background; as with browsers, the images will not appear right away, but will we shown when they are loaded.
1579
+
1580
+ === imagesize(path) » [width, height] ===
1581
+
1582
+ Quickly grab the width and height of an image. The image won't be loaded into the cache or displayed.
1583
+
1584
+ URGENT NOTE: This method cannot be used with remote images (loaded from HTTP, rather than the hard drive.)
1585
+
1586
+ === ins(text) » Shoes::Ins ===
1587
+
1588
+ Creates an Ins text fragment (short for "inserted") which Shoes styles with a single underline.
1589
+
1590
+ === inscription(text) » Shoes::Inscription ===
1591
+
1592
+ Creates an Inscription text block. Shoes styles this text at 10 pixels high.
1593
+
1594
+ === link(text, :click => proc or string) » Shoes::Link ===
1595
+
1596
+ Creates a Link text block, which Shoes styles with a single underline and colors with a #06E (blue) colored stroke.
1597
+
1598
+ The default LinkHover style is also single-underlined with a #039 (dark blue) stroke.
1599
+
1600
+ === list_box(:items => [strings, ...]) » Shoes::ListBox ===
1601
+
1602
+ Adds a drop-down list box containing entries for everything in the `items` array. An optional block may be attached, which is called if anything in the box becomes selected by the user.
1603
+
1604
+ {{{
1605
+ #!ruby
1606
+ Shoes.app do
1607
+ stack :margin => 10 do
1608
+ para "Pick a card:"
1609
+ list_box :items => ["Jack", "Ace", "Joker"]
1610
+ end
1611
+ end
1612
+ }}}
1613
+
1614
+ Call `ListBox#text` to get the selected string. See the `ListBox` section under `Native` controls for more help.
1615
+
1616
+ === progress() » Shoes::Progress ===
1617
+
1618
+ Adds a progress bar.
1619
+
1620
+ === para(text) » Shoes::Para ===
1621
+
1622
+ Create a Para text block (short for "paragraph") which Shoes styles at 12 pixels high.
1623
+
1624
+ === radio(group name: a string or symbol) » Shoes::Radio ===
1625
+
1626
+ Adds a radio button. If a `group name` is given, the radio button is considered part of a group. Among radio buttons in the same group, only one may be checked. (If no group name is given, the radio button is grouped with any other radio buttons in the same slot.)
1627
+
1628
+ === span(text) » Shoes::Span ===
1629
+
1630
+ Creates a Span text fragment, unstyled by default.
1631
+
1632
+ === stack(styles) { ... } » Shoes::Stack ===
1633
+
1634
+ Creates a new stack. A stack is a type of slot. (See the main [[Slots]] page for a full explanation of both stacks and flows.)
1635
+
1636
+ In short, stacks are an invisible box (a "slot") for placing stuff. As you add things to the stack, such as buttons or images, those things pile up vertically. Yes, they stack up!
1637
+
1638
+ === strong(text) » Shoes::Strong ===
1639
+
1640
+ Creates a Strong text fragment, styled in bold by default.
1641
+
1642
+ === sub(text) » Shoes::Sub ===
1643
+
1644
+ Creates a Sub text fragment (short for "subscript") which defaults to lowering the text by 10 pixels and styling it in an x-small font.
1645
+
1646
+ === subtitle(text) » Shoes::Subtitle ===
1647
+
1648
+ Creates a Subtitle text block. Shoes styles this text to 26 pixels high.
1649
+
1650
+ === sup(text) » Shoes::Sup ===
1651
+
1652
+ Creates a Sup text fragment (short for "superscript") which defaults to raising the text by 10 pixels and styling it in an x-small font.
1653
+
1654
+ === tagline(text) » Shoes::Tagline ===
1655
+
1656
+ Creates a Tagline text block. Shoes styles this text to 18 pixels high.
1657
+
1658
+ === timer(seconds) { ... } » Shoes::Timer ===
1659
+
1660
+ A one-shot timer. If you want to schedule to run some code in a few seconds (or minutes, hours) you can attach the code as a block here.
1661
+
1662
+ To display an alert box five seconds from now:
1663
+
1664
+ {{{
1665
+ #!ruby
1666
+ Shoes.app do
1667
+ timer(5) do
1668
+ alert("Your five seconds are up.")
1669
+ end
1670
+ end
1671
+ }}}
1672
+
1673
+ === title(text) » Shoes::Title ===
1674
+
1675
+ Creates a Title text block. Shoes styles these elements to 34 pixels high.
1676
+
1677
+ === video(path or url) » Shoes::Video ===
1678
+
1679
+ Embeds a movie in this slot.
1680
+
1681
+ === window(styles) { ... } » Shoes::App ===
1682
+
1683
+ Opens a new app window. This method is almost identical to the [[App.Shoes.app]] method used to start an app in the first place. The difference is that the `window` method sets the new window's [[App.owner]] property. (A normal Shoes.app has its `owner` set to `nil`.)
1684
+
1685
+ So, the new window's `owner` will be set to the Shoes::App which launched the window. This way the child window can call the parent.
1686
+
1687
+ {{{
1688
+ #!ruby
1689
+ Shoes.app :title => "The Owner" do
1690
+ button "Pop up?" do
1691
+ window do
1692
+ para "Okay, popped up from #{owner}"
1693
+ end
1694
+ end
1695
+ end
1696
+ }}}
1697
+
1698
+ == Events ==
1699
+
1700
+ Wondering how to catch stray mouse clicks or keyboard typing? Events are sent to a slot whenever a mouse moves inside the slot. Or whenever a key is pressed. Even when the slot is created or destroyed. You can attach a block to each of these events.
1701
+
1702
+ Mouse events include `motion`, `click`, `hover` and `leave`. Keyboard typing is represented by the `keypress` event. And the `start` and `finish` events indicate when a canvas comes into play or is discarded.
1703
+
1704
+ So, let's say you want to change the background of a slot whenever the mouse floats over it. We can use the `hover` event to change the background when the mouse comes inside the slot. And `leave` to change back when the mouse floats away.
1705
+
1706
+ {{{
1707
+ #!ruby
1708
+ Shoes.app do
1709
+ stack :width => 200, :height => 200 do
1710
+ background red
1711
+ hover do
1712
+ clear { background blue }
1713
+ end
1714
+ leave do
1715
+ clear { background red }
1716
+ end
1717
+ end
1718
+ end
1719
+ }}}
1720
+
1721
+ === click { |button, left, top| ... } » self ===
1722
+
1723
+ The click block is called when a mouse button is clicked. The `button` is the number of the mouse button which has been pressed. The `left` and `top` are the mouse coordinates at which the click happened.
1724
+
1725
+ To catch the moment when the mouse is unclicked, see the [[Events.release]] event.
1726
+
1727
+ === finish { |self| ... } » self ===
1728
+
1729
+ When a slot is removed, it's finish event occurs. The finish block is immediately handed `self`, the slot object which has been removed.
1730
+
1731
+ === hover { |self| ... } » self ===
1732
+
1733
+ The hover event happens when the mouse enters the slot. The block gets `self`, meaning the object which was hovered over.
1734
+
1735
+ To catch the mouse exiting the slot, check out the [[Events.leave]] event.
1736
+
1737
+ === keypress { |key| ... } » self ===
1738
+
1739
+ Whenever a key (or combination of keys) is pressed, the block gets called. The block is sent a `key` which is a string representing the character (such as the letter or number) on the key. For special keys and key combos, a Ruby symbol is sent, rather than a string.
1740
+
1741
+ So, for example, if `Shift-a` is pressed, the block will get the string `"A"`.
1742
+
1743
+ However, if the F1 key is pressed, the `:f1` symbol is received. For `Shift-F1`, the symbol would be `:shift_f1`.
1744
+
1745
+ The modifier keys are `control`, `shift` and `alt`. They appear in that order. If `Shift-Control-Alt-PgUp` is pressed, the symbol will be `:control_shift_alt_page_up`.
1746
+
1747
+ One thing about the shift key. You won't see the shift key on most keys. On US keyboards, `Shift-7` is an ampersand. So you'll get the string `"&"` rather than `:shift_5`. And, if you press `Shift-Alt-7` on such a keyboard, you'll get the symbol: `:alt_&`. You'll only see the shift modifier on the special keys listed a few paragraphs down.
1748
+
1749
+ {{{
1750
+ #!ruby
1751
+ Shoes.app do
1752
+ @info = para "NO KEY is PRESSED."
1753
+ keypress do |k|
1754
+ @info.replace "#{k.inspect} was PRESSED."
1755
+ end
1756
+ end
1757
+ }}}
1758
+
1759
+ Keep in mind that Shoes itself uses a few hotkeys. Alt-Period (`:alt_.`), Alt-Question (`:alt_?`) and Alt-Slash (`:alt_/`) are reserved for Shoes.
1760
+
1761
+ The list of special keys is as follows: `:escape`, `:delete`, `:backspace`, `:tab`, `:page_up`, `:page_down`, `:home`, `:end`, `:left`, `:up`, `:right`, `:down`, `:f1`, `:f2`, `:f3`, `:f4`, `:f5`, `:f6`, `:f7`, `:f8`, `:f9`, `:f10`, `:f11` and `:f12`.
1762
+
1763
+ One caveat to all of those rules: normally the Return key gives you a string `"\n"`. When pressed with modifier keys, however, you end up with `:control_enter`, `:control_alt_enter`, `:shift_alt_enter` and the like.
1764
+
1765
+ === leave { |self| ... } » self ===
1766
+
1767
+ The leave event takes place when the mouse cursor exits a slot. The moment it no longer is inside the slot's edges. When that takes place, the block is called with `self`, the slot object which is being left.
1768
+
1769
+ Also see [[Events.hover]] if you'd like to detect the mouse entering a slot.
1770
+
1771
+ === motion { |left, top| ... } » self ===
1772
+
1773
+ The motion block gets called every time the mouse moves around inside the slot. The block is handed the cursor's `left` and `top` coordinates.
1774
+
1775
+ {{{
1776
+ #!ruby
1777
+ Shoes.app :width => 200, :height => 200 do
1778
+ background black
1779
+ fill white
1780
+ @circ = oval 0, 0, 100, 100
1781
+
1782
+ motion do |top, left|
1783
+ @circ.move top - 50, left - 50
1784
+ end
1785
+ end
1786
+ }}}
1787
+
1788
+ === release { |button, left, top| ... } » self ===
1789
+
1790
+ The release block runs whenever the mouse is unclicked (on mouse up). When the finger is lifted. The `button` is the number of the button that was depressed. The `left` and `top` are the coordinates of the mouse at the time the button was released.
1791
+
1792
+ To catch the actual mouse click, use the [[Events.click]] event.
1793
+
1794
+ === start { |self| ... } » self ===
1795
+
1796
+ The first time the slot is drawn, the start event fires. The block is handed `self`, the slot object which has just been drawn.
1797
+
1798
+ == Manipulation Blocks ==
1799
+
1800
+ The manipulation methods below make quick work of shifting around slots and inserting new elements.
1801
+
1802
+ === append() { ... } » self ===
1803
+
1804
+ Adds elements to the end of a slot.
1805
+
1806
+ {{{
1807
+ #!ruby
1808
+ @slot.append do
1809
+ title "Breaking News"
1810
+ tagline "Astronauts arrested for space shuttle DUI."
1811
+ end
1812
+ }}}
1813
+
1814
+ The `title` and `tagline` elements will be added to the end of the `@slot`.
1815
+
1816
+ === after(element) { ... } » self ===
1817
+
1818
+ Adds elements to a specific place in a slot, just after the `element` which is a child of the slot.
1819
+
1820
+ === before(element) { ... } » self ===
1821
+
1822
+ Adds elements to a specific place in a slot, just before the `element` which is a child of the slot.
1823
+
1824
+ === clear() » self ===
1825
+
1826
+ Empties the slot of any elements, timers and nested slots. This is effectively identical to looping through the contents of the slot and calling each element's `remove` method.
1827
+
1828
+ === clear() { ... } » self ===
1829
+
1830
+ The clear method also takes an optional block. The block will be used to replace the contents of the slot.
1831
+
1832
+ {{{
1833
+ #!ruby
1834
+ @slot = stack { para "Old text" }
1835
+ @slot.clear { para "Brand new text" }
1836
+ }}}
1837
+
1838
+ In this example, the "Old text" paragraph will be cleared out, replaced by the "Brand new text" paragraph.
1839
+
1840
+ === prepend() { ... } » self ===
1841
+
1842
+ Adds elements to the beginning of a slot.
1843
+
1844
+ {{{
1845
+ #!ruby
1846
+ @slot.prepend do
1847
+ para "Your car is ready."
1848
+ end
1849
+ }}}
1850
+
1851
+ The `para` element is added to the beginning of the `@slot`.
1852
+
1853
+ == Position of a Slot ==
1854
+
1855
+ Like any other element, slots can be styled and customized when they are created.
1856
+
1857
+ To set the width of a stack to 150 pixels:
1858
+
1859
+ {{{
1860
+ #!ruby
1861
+ stack(:width => 150) { para "Now that's precision." }
1862
+ }}}
1863
+
1864
+ Each style setting also has a method, which can be used to grab that particular setting. (So,
1865
+ like, the `width` method returns the width of the slot in pixels.)
1866
+
1867
+ === displace(left: a number, top: a number) » self ===
1868
+
1869
+ A shortcut method for setting the :displace_left and :displace_top styles. Displacing is a handy way of moving a slot without altering the layout. In fact, the `top` and `left` methods will not report displacement at all. So, generally, displacement is only for temporary animations. For example, jiggling a button in place.
1870
+
1871
+ The `left` and `top` numbers sent to `displace` are added to the slot's own top-left coordinates. To subtract from the top-left coordinate, use negative numbers.
1872
+
1873
+ === gutter() » a number ===
1874
+
1875
+ The size of the scrollbar area. When Shoes needs to show a scrollbar, the scrollbar may end up covering up some elements that touch the edge of the window. The `gutter` tells you how many pixels to expect the scrollbar to cover.
1876
+
1877
+ This is commonly used to pad elements on the right, like so:
1878
+
1879
+ {{{
1880
+ #!ruby
1881
+ stack :margin_right => 20 + gutter do
1882
+ para "Insert fat and ratified declaration of
1883
+ independence here..."
1884
+ end
1885
+ }}}
1886
+
1887
+ === height() » a number ===
1888
+
1889
+ The vertical size of the viewable slot in pixels. So, if this is a scrolling slot, you'll need to use `scroll_height()` to get the full size of the slot.
1890
+
1891
+ === hide() » self ===
1892
+
1893
+ Hides the slot, so that it can't be seen. See also [[Position.show]] and [[Position.toggle]].
1894
+
1895
+ === left() » a number ===
1896
+
1897
+ The left pixel location of the slot. Also known as the x-axis coordinate.
1898
+
1899
+ === move(left, top) » self ===
1900
+
1901
+ Moves the slot to specific coordinates, the (left, top) being the upper left hand corner of the slot.
1902
+
1903
+ === remove() » self ===
1904
+
1905
+ Removes the slot. It will no longer be displayed and will not be listed in its parent's contents. It's gone.
1906
+
1907
+ === scroll() » true or false ===
1908
+
1909
+ Is this slot allowed to show a scrollbar? True or false. The scrollbar will only appear if
1910
+ the height of the slot is also fixed.
1911
+
1912
+ === scroll_height() » a number ===
1913
+
1914
+ The vertical size of the full slot, including any of it which is hidden by scrolling.
1915
+
1916
+ === scroll_max() » a number ===
1917
+
1918
+ The top coordinate which this slot can be scrolled down to. The top coordinate of a scroll bar is always zero. The bottom coordinate is the full height of the slot minus one page of scrolling. This bottom coordinate is what `scroll_max` returns.
1919
+
1920
+ This is basically a shortcut for writing `slot.scroll_height - slot.height`.
1921
+
1922
+ To scroll to the bottom of a slot, use `slot.scroll_top = slot.scroll_max`.
1923
+
1924
+ === scroll_top() » a number ===
1925
+
1926
+ The top coordinate which this slot is scrolled down to. So, if the slot is scrolled down twenty pixels, this method will return `20`.
1927
+
1928
+ === scroll_top = a number ===
1929
+
1930
+ Scrolls the slot to a certain coordinate. This must be between zero and `scroll_max`.
1931
+
1932
+ === show() » self ===
1933
+
1934
+ Reveals the slot, if it is hidden. See also [[Position.hide]] and [[Position.toggle]].
1935
+
1936
+ === style() » styles ===
1937
+
1938
+ Calling the `style` method with no arguments returns a hash of the styles presently applied to this slot.
1939
+
1940
+ While methods such as `height` and `width` return the true pixel dimensions of the slot, you can use `style[:height]` or `style[:width]` to get the dimensions originally requested.
1941
+
1942
+ {{{
1943
+ #!ruby
1944
+ Shoes.app do
1945
+ @s = stack :width => "100%"
1946
+ para @s.style[:width]
1947
+ end
1948
+ }}}
1949
+
1950
+ In this example, the paragraph under the stack will display the string "100%".
1951
+
1952
+ === style(styles) » styles ===
1953
+
1954
+ Alter the slot using a hash of style settings. Any of the methods on this page (aside from this method, of course) can be used as a style setting. So, for example, there is a `width` method, thus there is also a `width` style.
1955
+
1956
+ {{{
1957
+ #!ruby
1958
+ Shoes.app do
1959
+ @s = stack
1960
+ @s.style(:width => 400)
1961
+ end
1962
+ }}}
1963
+
1964
+ === toggle() » self ===
1965
+
1966
+ Hides the slot, if it is shown. Or shows the slot, if it is hidden.
1967
+
1968
+ === top() » a number ===
1969
+
1970
+ The top pixel location of the slot. Also known as the y-axis coordinate.
1971
+
1972
+ === width() » a number ===
1973
+
1974
+ The horizontal size of the slot in pixels.
1975
+
1976
+ == Traversing the Page ==
1977
+
1978
+ You may find yourself needing to loop through the elements inside a slot. Or maybe you need to
1979
+ climb the page, looking for a stack that is the parent of an element.
1980
+
1981
+ On any element, you may call the `parent` method to get the slot directly above it. And on slots,
1982
+ you can call the `contents` method to get all of the children. (Some elements, such as text blocks,
1983
+ also have a `contents` method for getting their children.)
1984
+
1985
+ === contents() » an array of elements ===
1986
+
1987
+ Lists all elements in a slot.
1988
+
1989
+ === parent() » a Shoes::Stack or Shoes::Flow ===
1990
+
1991
+ Gets the object for this element's container.
1992
+
1993
+ = Elements =
1994
+
1995
+ Ah, here's the stuff of Shoes. An element can be as simple as an oval shape. Or as complex as
1996
+ a video stream. You've encountered all of these elements before in the Slots section of the
1997
+ manual.
1998
+
1999
+ Shoes has seven native controls: the Button, the EditLine, the EditBox, the ListBox, the Progress meter, the Check box and the Radio. By "native" controls, we mean that each of these seven elements is drawn by the operating system. So, a Progress bar will look one way on Windows and another way on OS X.
2000
+
2001
+ Shoes also has seven basic other types of elements: Background, Border, Image, Shape, TextBlock, Timer and Video. These all should look and act the same on every operating system.
2002
+
2003
+ Once an element is created, you will often still want to change it. To move it or hide it or get
2004
+ rid of it. You'll use the commands in this section to do that sort of stuff. (Especially check out the [[Common Common Methods]] section for commands you can use on any element.)
2005
+
2006
+ So, for example, use the `image` method of a Slot to place a PNG on the screen. The `image` method
2007
+ gives you back an Image object. Use the methods of the Image object to change things up.
2008
+
2009
+ == Common Methods ==
2010
+
2011
+ A few methods are shared by every little element in Shoes. Moving, showing, hiding. Removing an element. Basic and very general things. This list encompasses those common commands.
2012
+
2013
+ One of the most general methods of all is the `style` method (which is also covered as the [[Position.style]] method for slots.)
2014
+
2015
+ {{{
2016
+ #!ruby
2017
+ Shoes.app do
2018
+ stack do
2019
+ # Background, text and a button: both are elements!
2020
+ @back = background green
2021
+ @text = banner "A Message for You, Rudy"
2022
+ @press = button "Stop your messin about!"
2023
+
2024
+ # And so, both can be styled.
2025
+ @text.style :size => 12, :stroke => red, :margin => 10
2026
+ @press.style :width => 400
2027
+ @back.style :height => 10
2028
+ end
2029
+ end
2030
+ }}}
2031
+
2032
+ For specific commands, see the other links to the left in the Elements section. Like if you want to pause or play a video file, check the [[Video]] section, since pausing and playing is peculiar to videos. No sense pausing a button.
2033
+
2034
+ === displace(left: a number, top: a number) » self ===
2035
+
2036
+ Displacing an element moves it. But without changing the layout around it. This is great for subtle animations, especially if you want to reserve a place for an element while it is still animating. Like maybe a quick button shake or a slot sliding into view.
2037
+
2038
+ When you displace an element, it moves relative to the upper-left corner where it was placed. So, if an element is at the coordinates (20, 40) and you displace it 2 pixels left and 6 pixels on top, you end up with the coordinates (22, 46).
2039
+
2040
+ {{{
2041
+ #!ruby
2042
+ Shoes.app do
2043
+ flow :margin => 12 do
2044
+ # Set up three buttons
2045
+ button "One"
2046
+ @two = button "Two"
2047
+ button "Three"
2048
+
2049
+ # Bounce the second button
2050
+ animate do |i|
2051
+ @two.displace(0, (Math.sin(i) * 6).to_i)
2052
+ end
2053
+ end
2054
+ end
2055
+ }}}
2056
+
2057
+ Notice that while the second button bounces, the other two buttons stay put. If we used a normal `move` in this situation, the second button would be moved out of the layout and the buttons would act as if the second button wasn't there at all. (See the [[Common.move]] example.)
2058
+
2059
+ '''Of particular note:''' if you use the `left` and `top` methods to get the coordinates of a displaced element, you'll just get back the normal coordinates. As if there was no displacement. Displacing is just intended for quick animations!
2060
+
2061
+ === height() » a number ===
2062
+
2063
+ The vertical screen size of the element in pixels. In the case of images, this is not the
2064
+ full size of the image. This is the height of the element as it is shown right now.
2065
+
2066
+ If you have a 150x150 pixel image and you set the width to 50 pixels, this method will return
2067
+ 50.
2068
+
2069
+ Also see the [[Common.width]] method for an example and some other comments.
2070
+
2071
+ === hide() » self ===
2072
+
2073
+ Hides the element, so that it can't be seen. See also [[Common.show]] and [[Common.toggle]].
2074
+
2075
+ === left() » a number ===
2076
+
2077
+ Gets you the pixel position of the left edge of the element.
2078
+
2079
+ === move(left: a number, top: a number) » self ===
2080
+
2081
+ Moves the element to a specific pixel position within its slot. The element is still inside the slot. But it will no longer be stacked or flowed in with the other stuff in the slot. The element will float freely, now absolutely positioned instead.
2082
+
2083
+ {{{
2084
+ #!ruby
2085
+ Shoes.app do
2086
+ flow :margin => 12 do
2087
+ # Set up three buttons
2088
+ button "One"
2089
+ @two = button "Two"
2090
+ button "Three"
2091
+
2092
+ # Bounce the second button
2093
+ animate do |i|
2094
+ @two.move(40, 40 + (Math.sin(i) * 6).to_i)
2095
+ end
2096
+ end
2097
+ end
2098
+ }}}
2099
+
2100
+ The second button is moved to a specific place, allowing the third button to slide over into its place. If you want to move an element without shifting other pieces, see the [[Common.displace]] method.
2101
+
2102
+ === parent() » a Shoes::Stack or Shoes::Flow ===
2103
+
2104
+ Gets the object for this element's container. Also see the slot's [[Traversing.contents]] to do the opposite: get a container's elements.
2105
+
2106
+ === remove() » self ===
2107
+
2108
+ Removes the element from its slot. (In other words: throws it in the garbage.) The element will no longer be displayed.
2109
+
2110
+ === show() » self ===
2111
+
2112
+ Reveals the element, if it is hidden. See also [[Common.hide]] and [[Common.toggle]].
2113
+
2114
+ === style() » styles ===
2115
+
2116
+ Gives you the full set of styles applied to this element, in the form of a Hash. While methods like `width` and `height` and `top` give you back specific pixel dimensions, using `style[:width]` or `style[:top]`, you can get the original setting (things like "100%" for width or "10px" for top.)
2117
+
2118
+ {{{
2119
+ #!ruby
2120
+ Shoes.app do
2121
+ # A button which take up the whole page
2122
+ @b = button "All of it", :width => 1.0, :height => 1.0
2123
+
2124
+ # When clicked, show the styles
2125
+ @b.click { alert(@b.style.inspect) }
2126
+ end
2127
+ }}}
2128
+
2129
+ === style(styles) » styles ===
2130
+
2131
+ Changes the style of an element. This could include the `:width` and `:height` of an element, the font `:size` of some text, the `:stroke` and `:fill` of a shape. Or any other number of style settings.
2132
+
2133
+ === toggle() » self ===
2134
+
2135
+ Hides an element if it is shown. Or shows the element, if it is hidden.
2136
+
2137
+ === top() » a number ===
2138
+
2139
+ Gets the pixel position of the top edge of the element.
2140
+
2141
+ === width() » a number ===
2142
+
2143
+ Gets the pixel width for the full size of the element. This method always returns an exact pixel size. In the case of images, this is not the full width of the image, just the size it is shown at. See the [[Common.height]] method for more.
2144
+
2145
+ Also, if you create an element with a width of 100% and that element is inside a stack which is 120 pixels wide, you'll get back `120`. However, if you call `style[:width]`, you'll get `"100%"`.
2146
+
2147
+ {{{
2148
+ #!ruby
2149
+ Shoes.app do
2150
+ stack :width => 120 do
2151
+ @b = button "Click me", :width => "100%" do
2152
+ alert "button.width = #{@b.width}\n" +
2153
+ "button.style[:width] = #{@b.style[:width]}"
2154
+ end
2155
+ end
2156
+ end
2157
+ }}}
2158
+
2159
+ In order to set the width, you'll have to go through the [[Common.style]] method again. So, to set the button to 150 pixels wide: `@b.style(:width => 150)`.
2160
+
2161
+ To let Shoes pick the element's width, go with `@b.style(:width => nil)` to empty out the setting.
2162
+
2163
+ == Background ==
2164
+
2165
+ A background is a color, a gradient or an image that is painted across an entire slot. Both backgrounds and borders are a type of Shoes::Pattern. !{:margin_left => 100}man-ele-background.png!
2166
+
2167
+ Even though it's called a ''background'', you may still place this element in front of other elements. If a background comes after something else painted on the slot (like a `rect` or an `oval`,) the background will be painted over that element.
2168
+
2169
+ The simplest background is just a plain color background, created with the [[Element.background]] method, such as this black background:
2170
+
2171
+ {{{
2172
+ #!ruby
2173
+ Shoes.app do
2174
+ background black
2175
+ end
2176
+ }}}
2177
+
2178
+ A simple background like that paints the entire slot that contains it. (In this case, the whole window is painted black.)
2179
+
2180
+ You can use styles to cut down the size or move around the background to your liking.
2181
+
2182
+ To paint a black background across the top fifty pixels of the window:
2183
+
2184
+ {{{
2185
+ #!ruby
2186
+ Shoes.app do
2187
+ background black, :height => 50
2188
+ end
2189
+ }}}
2190
+
2191
+ Or, to paint a fifty pixel column on the right-side of the window:
2192
+
2193
+ {{{
2194
+ #!ruby
2195
+ Shoes.app do
2196
+ background black, :width => 50, :right => 50
2197
+ end
2198
+ }}}
2199
+
2200
+ Since Backgrounds are normal elements as well, see also the start of the [[Elements]] section for all of its other methods.
2201
+
2202
+ === to_pattern() » a Shoes::Pattern ===
2203
+
2204
+ Yanks out the color, gradient or image used to paint this background and places it in a normal Shoes::Pattern object. You can then pass that object to other backgrounds and borders. Reuse it as you like.
2205
+
2206
+ == Border ==
2207
+
2208
+ A border is a color, gradient or image painted in a line around the edge of any slot. Like the Background element in the last section, a Border is a kind of Shoes::Pattern. !{:margin_left => 100}man-ele-border.png!
2209
+
2210
+ The first, crucial thing to know about border is that all borders paint a line around the '''inside''' of a slot, not the outside. So, if you have a slot which is fifty pixels wide and you paint a five pixel border on it, that means there is a fourty pixel wide area inside the slot which is surrounded by the border.
2211
+
2212
+ This also means that if you paint a Border on top of a [[Background]], the edges of the background will be painted over by the border.
2213
+
2214
+ Here is just such a slot:
2215
+
2216
+ {{{
2217
+ #!ruby
2218
+ Shoes.app do
2219
+ stack :width => 50 do
2220
+ border black, :strokewidth => 5
2221
+ para "=^.^=", :stroke => green
2222
+ end
2223
+ end
2224
+ }}}
2225
+
2226
+ If you want to paint a border around the outside of a slot, you'll need to wrap that slot in another slot. Then, place the border in the outside slot.
2227
+
2228
+ {{{
2229
+ #!ruby
2230
+ Shoes.app do
2231
+ stack :width => 60 do
2232
+ border black, :strokewidth => 5
2233
+ stack :width => 50 do
2234
+ para "=^.^=", :stroke => green
2235
+ end
2236
+ end
2237
+ end
2238
+ }}}
2239
+
2240
+ In HTML and many other languages, the border is painted on the outside of the box, thus increasing the overall width of the box. Shoes was designed with consistency in mind, so that if you say that a box is fifty pixels wide, it stays fifty pixels wide regardless of its borders or margins or anything else.
2241
+
2242
+ Please also check out the [[Elements]] section for other methods used on borders.
2243
+
2244
+ === to_pattern() » a Shoes::Pattern ===
2245
+
2246
+ Creates a basic pattern object based on the color, gradient or image used to paint this border. The pattern may then be re-used in new borders and backgrounds.
2247
+
2248
+ == Button ==
2249
+
2250
+ Buttons are, you know, push buttons. You click them and they do something. Buttons are known to say "OK" or "Are you sure?" And, then, if you're sure, you click the button. !{:margin_left => 100}man-ele-button.png!
2251
+
2252
+ {{{
2253
+ #!ruby
2254
+ Shoes.app do
2255
+ button "OK!"
2256
+ button "Are you sure?"
2257
+ end
2258
+ }}}
2259
+
2260
+ The buttons in the example above don't do anything when you click them. In order to get them to work, you've got to hook up a block to each button.
2261
+
2262
+ {{{
2263
+ #!ruby
2264
+ Shoes.app do
2265
+ button "OK!" do
2266
+ append { para "Well okay then." }
2267
+ end
2268
+ button "Are you sure?" do
2269
+ append { para "Your confidence is inspiring." }
2270
+ end
2271
+ end
2272
+ }}}
2273
+
2274
+ So now we've got blocks for the buttons. Each block appends a new paragraph to the page. The more you click, the more paragraphs get added.
2275
+
2276
+ It doesn't go much deeper than that. A button is just a clickable phrase.
2277
+
2278
+ Just to be pedantic, though, here's another way to write that last example.
2279
+
2280
+ {{{
2281
+ #!ruby
2282
+ Shoes.app do
2283
+ @b1 = button "OK!"
2284
+ @b1.click { para "Well okay then." }
2285
+ @b2 = button "Are you sure?"
2286
+ @b2.click { para "Your confidence is inspiring." }
2287
+ end
2288
+ }}}
2289
+
2290
+ This looks dramatically different, but it does the same thing. The first difference: rather than attaching the block directly to the button, the block is attached later, through the `click` method.
2291
+
2292
+ The second change isn't related to buttons at all. The `append` block was dropped since Shoes allows you to add new elements directly to the slot. So we can just call `para` directly. (This isn't the case with the `prepend`, `before` or `after` methods.)
2293
+
2294
+ Beside the methods below, buttons also inherit all of the methods that are [[Common]].
2295
+
2296
+ === click() { |self| ... } » self ===
2297
+
2298
+ When a button is clicked, its `click` block is called. The block is handed `self`. Meaning: the button which was clicked.
2299
+
2300
+ === focus() » self ===
2301
+
2302
+ Moves focus to the button. The button will be highlighted and, if the user hits Enter, the button will be clicked.
2303
+
2304
+ == Check ==
2305
+
2306
+ Check boxes are clickable square boxes than can be either checked or unchecked. A single checkbox usually asks a "yes" or "no" question. Sets of checkboxes are also seen in to-do lists. !{:margin_left => 100}man-ele-check.png!
2307
+
2308
+ Here's a sample checklist.
2309
+
2310
+ {{{
2311
+ #!ruby
2312
+ Shoes.app do
2313
+ stack do
2314
+ flow { check; para "Frances Johnson" }
2315
+ flow { check; para "Ignatius J. Reilly" }
2316
+ flow { check; para "Winston Niles Rumfoord" }
2317
+ end
2318
+ end
2319
+ }}}
2320
+
2321
+ You basically have two ways to use a check. You can attach a block to the check and it'll get called when the check gets clicked. And/or you can just use the `checked?` method to go back and see if a box has been checked or not.
2322
+
2323
+ Okay, let's add to the above example.
2324
+
2325
+ {{{
2326
+ #!ruby
2327
+ Shoes.app do
2328
+ @list = ['Frances Johnson', 'Ignatius J. Reilly',
2329
+ 'Winston Niles Rumfoord']
2330
+
2331
+ stack do
2332
+ @list.map! do |name|
2333
+ flow { @c = check; para name }
2334
+ [@c, name]
2335
+ end
2336
+
2337
+ button "What's been checked?" do
2338
+ selected = @list.map { |c, name| name if c.checked? }.compact
2339
+ alert("You selected: " + selected.join(', '))
2340
+ end
2341
+ end
2342
+ end
2343
+ }}}
2344
+
2345
+ So, when the button gets pressed, each of the checks gets asked for its status, using the `checked?` method.
2346
+
2347
+ Button methods are listed below, but also see the list of [[Common]] methods, which all elements respond to.
2348
+
2349
+ === checked?() » true or false ===
2350
+
2351
+ Returns whether the box is checked or not. So, `true` means "yes, the box is checked!"
2352
+
2353
+ === checked = true or false ===
2354
+
2355
+ Marks or unmarks the check box. Using `checked = false`, for instance, unchecks the box.
2356
+
2357
+ === click() { |self| ... } » self ===
2358
+
2359
+ When the check is clicked, its `click` block is called. The block is handed `self`, which is the check object which was clicked.
2360
+
2361
+ Clicks are sent for both checking and unchecking the box.
2362
+
2363
+ === focus() » self ===
2364
+
2365
+ Moves focus to the check. The check will be highlighted and, if the user hits Enter, the check will be toggled between its checked and unchecked states.
2366
+
2367
+ == EditBox ==
2368
+
2369
+ Edit boxes are wide, rectangular boxes for entering text. On the web, they call these textareas. These are multi-line edit boxes for entering longer descriptions. Essays, even! !{:margin_left => 100}man-ele-editbox.png!
2370
+
2371
+ Without any other styling, edit boxes are sized 200 pixels by 108 pixels. You can also use `:width` and `:height` styles to set specific sizes.
2372
+
2373
+ {{{
2374
+ #!ruby
2375
+ Shoes.app do
2376
+ edit_box
2377
+ edit_box :width => 100, :height => 100
2378
+ end
2379
+ }}}
2380
+
2381
+ Other controls (like [[Button]] and [[Check]]) have only click events, but both [[EditLine]] and EditBox have a `change` event. The `change` block is called every time someone types into or deletes from the box.
2382
+
2383
+ {{{
2384
+ #!ruby
2385
+ Shoes.app do
2386
+ edit_box do |e|
2387
+ @counter.text = e.text.size
2388
+ end
2389
+ @counter = strong("0")
2390
+ para @counter, " characters"
2391
+ end
2392
+ }}}
2393
+
2394
+ Notice that the example also uses the [[EditBox.text]] method inside the block. That method gives you a string of all the characters typed into the box.
2395
+
2396
+ More edit box methods are listed below, but also see the list of [[Common]] methods, which all elements respond to.
2397
+
2398
+ === change() { |self| ... } » self ===
2399
+
2400
+ Each time a character is added to or removed from the edit box, its `change` block is called. The block is given `self`, which is the edit box object which has changed.
2401
+
2402
+ === focus() » self ===
2403
+
2404
+ Moves focus to the edit box. The edit box will be highlighted and the user will be able to type into the edit box.
2405
+
2406
+ === text() » self ===
2407
+
2408
+ Return a string of characters which have been typed into the box.
2409
+
2410
+ === text = a string ===
2411
+
2412
+ Fills the edit box with the characters of `a string`.
2413
+
2414
+ == EditLine ==
2415
+
2416
+ Edit lines are a slender, little box for entering text. While the EditBox is multi-line, an edit line is just one. Line, that is. Horizontal, in fact. !{:margin_left => 100}man-ele-editline.png!
2417
+
2418
+ The unstyled edit line is 200 pixels wide and 28 pixels wide. Roughly. The height may vary on some platforms.
2419
+
2420
+ {{{
2421
+ #!ruby
2422
+ Shoes.app do
2423
+ stack do
2424
+ edit_line
2425
+ edit_line :width => 400
2426
+ end
2427
+ end
2428
+ }}}
2429
+
2430
+ You can change the size by styling both the `:width` and the `:height`. However, you generally only want to style the `:width`, as the height will be sized to fit the font. (And, in current versions of Shoes, the font for edit lines and edit boxes cannot be altered anyway.)
2431
+
2432
+ If a block is given to an edit line, it receives `change` events. Check out the [[EditBox]] page for an example of using a change block. In fact, the edit box has all the same methods as an edit line. Also see the list of [[Common]] methods, which all elements respond to.
2433
+
2434
+ === change() { |self| ... } » self ===
2435
+
2436
+ Each time a character is added to or removed from the edit line, its `change` block is called. The block is given `self`, which is the edit line object which has changed.
2437
+
2438
+ === focus() » self ===
2439
+
2440
+ Moves focus to the edit line. The edit line will be highlighted and the user will be able to type into the edit line.
2441
+
2442
+ === text() » self ===
2443
+
2444
+ Return a string of characters which have been typed into the box.
2445
+
2446
+ === text = a string ===
2447
+
2448
+ Fills the edit line with the characters of `a string`.
2449
+
2450
+ == Image ==
2451
+
2452
+ An image is a picture in PNG, JPEG or GIF format. Shoes can resize images or flow them in with text. Images can be loaded from a file or directly off the web. !{:margin_left => 100}man-ele-image.png!
2453
+
2454
+ To create an image, use the `image` method in a slot:
2455
+
2456
+ {{{
2457
+ #!ruby
2458
+ Shoes.app do
2459
+ para "Nice, nice, very nice. Busy, busy, busy."
2460
+ image "static/disheveled.gif"
2461
+ end
2462
+ }}}
2463
+
2464
+ When you load any image into Shoes, it is cached in memory. This means that if you load up many image elements from the same file, it'll only really load the file once.
2465
+
2466
+ You can use web URLs directly as well.
2467
+
2468
+ {{{
2469
+ #!ruby
2470
+ Shoes.app do
2471
+ image "http://hacketyhack.net/images/design/Hacky-Mouse-Hand.png"
2472
+ end
2473
+ }}}
2474
+
2475
+ When an image is loaded from the web, it's cached on the hard drive as well as in memory. This prevents a repeat download unless the image has changed. (In case you're wondering: Shoes keeps track of modification times and etags just like a browser would.)
2476
+
2477
+ Shoes also loads remote images in the background using system threads. So, using remote images will not block Ruby or any intense graphical displays you may have going on.
2478
+
2479
+ === full_height() » a number ===
2480
+
2481
+ The full pixel height of the image. Normally, you can just use the [[Common.height]] method to figure out how many pixels high the image is. But if you've resized the image or styled it to be larger or something, then `height` will return the scaled size.
2482
+
2483
+ The `full_height` method gives you the height of image (in pixels) as it was stored in the original file.
2484
+
2485
+ === full_width() » a number ===
2486
+
2487
+ The full pixel width of the image. See the [[Image.full_height]] method for an explanation of why you might use this method rather than [[Common.width]].
2488
+
2489
+ === path() » a string ===
2490
+
2491
+ The URL or file name of the image.
2492
+
2493
+ === path = a string ===
2494
+
2495
+ Swaps the image with a different one, loaded from a file or URL.
2496
+
2497
+ == ListBox ==
2498
+
2499
+ List boxes (also called "combo boxes" or "drop-down boxes" or "select boxes" in some places) are a list of options that drop down when you click on the box. !{:margin_left => 100}man-ele-listbox.png!
2500
+
2501
+ A list box gets its options from an array. An array (a list) of strings, passed into the `:items` style.
2502
+
2503
+ {{{
2504
+ #!ruby
2505
+ Shoes.app do
2506
+ para "Choose a fruit:"
2507
+ list_box :items => ["Grapes", "Pears", "Apricots"]
2508
+ end
2509
+ }}}
2510
+
2511
+ So, the basic size of a list box is about 200 pixels wide and 28 pixels high. You can adjust this length using the `:width` style.
2512
+
2513
+ {{{
2514
+ #!ruby
2515
+ Shoes.app do
2516
+ para "Choose a fruit:"
2517
+ list_box :items => ["Grapes", "Pears", "Apricots"],
2518
+ :width => 120, :choose => "Apricots" do |list|
2519
+ @fruit.text = list.text
2520
+ end
2521
+
2522
+ @fruit = para "No fruit selected"
2523
+ end
2524
+ }}}
2525
+
2526
+ Next to the `:width` style, the example uses another useful option. The `:choose` option tells the list box which of the items should be highlighted from the beginning. (There's also a [[ListBox.choose]] method for highlighting an item after the box is created.)
2527
+
2528
+ List boxes also have a [[ListBox.change]] event. In the last example, we've got a block hooked up to the list box. Well, okay, see, that's a `change` block. The block is called each time someone changes the selected item.
2529
+
2530
+ Those are the basics. Might you also be persuaded to look at the [[Common]] methods page, a complete list of the methods that all elements have?
2531
+
2532
+ === change() { |self| ... } » self ===
2533
+
2534
+ Whenever someone highlights a new option in the list box (by clicking on an item, for instance,) its `change` block is called. The block is given `self`, which is the edit line object which has changed.
2535
+
2536
+ === choose(item: a string) » self ===
2537
+
2538
+ Selects the option in the list box that matches the string given by `item`.
2539
+
2540
+ === focus() » self ===
2541
+
2542
+ Moves focus to the list box. The list box will be highlighted and, if the user hits the up and down arrow keys, other options in the list will be selected.
2543
+
2544
+ === items() » an array of strings ===
2545
+
2546
+ Returns the complete list of strings that the list box presently shows as its options.
2547
+
2548
+ === items = an array of strings ===
2549
+
2550
+ Replaces the list box's options with a new list of strings.
2551
+
2552
+ === text() » a string ===
2553
+
2554
+ A string containing whatever text is shown highlighted in the list box right now. If nothing is selected, `nil` will be the reply.
2555
+
2556
+ == Progress ==
2557
+
2558
+ Progress bars show you how far along you are in an activity. Usually, a progress bar represents a percentage (from 0% to 100%.) Shoes thinks of progress in terms of the decimal numbers 0.0 to 1.0. !{:margin_left => 100}man-ele-progress.png!
2559
+
2560
+ A simple progress bar is 200 pixels wide, but you can use the `:width` style (as with all Shoes elements) to lengthen it.
2561
+
2562
+ {{{
2563
+ Shoes.app do
2564
+ stack :margin => 0.1 do
2565
+ title "Progress example"
2566
+ @p = progress :width => 1.0
2567
+
2568
+ animate do |i|
2569
+ @p.fraction = (i % 100) / 100.0
2570
+ end
2571
+ end
2572
+ end
2573
+ }}}
2574
+
2575
+ Take a look at the [[Common]] methods page for a list of methods found an all elements, including progress bars.
2576
+
2577
+ === fraction() » a decimal number ===
2578
+
2579
+ Returns a decimal number from 0.0 to 1.0, indicating how far along the progress bar is.
2580
+
2581
+ === fraction = a decimal number ===
2582
+
2583
+ Sets the progress to a decimal number between 0.0 and 1.0.
2584
+
2585
+ == Radio ==
2586
+
2587
+ Radio buttons are a group of clickable circles. Click a circle and it'll be marked. Only one radio button can be marked at a time. (This is similar to the ListBox, where only one option can be selected at a time.) !{:margin_left => 100}man-ele-radio.png!
2588
+
2589
+ So, how do you decide when to use radio buttons and when to use list boxes? Well, list boxes only show one highlighted item unless you click on the box and the drop-down appears. But radio buttons are all shown, regardless of which is marked.
2590
+
2591
+ {{{
2592
+ #!ruby
2593
+ Shoes.app do
2594
+ para "Among these films, which do you prefer?\n"
2595
+ radio; para strong("The Taste of Tea"), " by Katsuhito Ishii\n"
2596
+ radio; para strong("Kin-Dza-Dza"), " by Georgi Danelia\n"
2597
+ radio; para strong("Children of Heaven"), " by Majid Majidi\n"
2598
+ end
2599
+ }}}
2600
+
2601
+ Only one of these three radios can be checked at a time, since they are grouped together in the same slot (along with a bunch of `para`.)
2602
+
2603
+ If we move them each into their own slot, the example breaks.
2604
+
2605
+ {{{
2606
+ #!ruby
2607
+ Shoes.app do
2608
+ stack do
2609
+ para "Among these films, which do you prefer?"
2610
+ flow { radio; para "The Taste of Tea by Katsuhito Ishii" }
2611
+ flow { radio; para "Kin-Dza-Dza by Georgi Danelia" }
2612
+ flow { radio; para "Children of Heaven by Majid Majidi" }
2613
+ end
2614
+ end
2615
+ }}}
2616
+
2617
+ This can be fixed, though. You can group together radios from different slots, you just have to give them all the same group name.
2618
+
2619
+ Here, let's group all these radios in the `:films` group.
2620
+
2621
+ {{{
2622
+ #!ruby
2623
+ Shoes.app do
2624
+ stack do
2625
+ para "Among these films, which do you prefer?"
2626
+ flow do
2627
+ radio :films
2628
+ para "The Taste of Tea by Katsuhito Ishii"
2629
+ end
2630
+ flow do
2631
+ radio :films
2632
+ para "Kin-Dza-Dza by Georgi Danelia"
2633
+ end
2634
+ flow do
2635
+ radio :films
2636
+ para "Children of Heaven by Majid Majidi"
2637
+ end
2638
+ end
2639
+ end
2640
+ }}}
2641
+
2642
+ For more methods beyond those listed below, also look into the [[Common]] methods page. Because you get those methods on every radio as well.
2643
+
2644
+ === checked?() » true or false ===
2645
+
2646
+ Returns whether the radio button is checked or not. So, `true` means "yes, it is checked!"
2647
+
2648
+ === checked = true or false ===
2649
+
2650
+ Marks or unmarks the radio button. Using `checked = false`, for instance, clears the radio.
2651
+
2652
+ === click() { |self| ... } » self ===
2653
+
2654
+ When the radio button is clicked, its `click` block is called. The block is handed `self`, which is an object representing the radio which was clicked.
2655
+
2656
+ Clicks are sent for both marking and unmarking the radio.
2657
+
2658
+ === focus() » self ===
2659
+
2660
+ Moves focus to the radio. The radio will be highlighted and, if the user hits Enter, the radio will be toggled between its marked and unmarked states.
2661
+
2662
+ == Shape ==
2663
+
2664
+ A shape is a path outline usually created by drawing methods like `oval` and `rect`. !{:margin_left => 100}man-ele-shape.png!
2665
+
2666
+ See the [[Common]] methods page. Shapes respond to all of those methods.
2667
+
2668
+ == TextBlock ==
2669
+
2670
+ The TextBlock object represents a group of text organized as a single element. A paragraph containing bolded text, for example. A caption containing links and bolded text. (So, a `caption` is a TextBlock type. However, `link` and `strong` are TextClass types.) !{:margin_left => 100}man-ele-textblock.png!
2671
+
2672
+ All of the various types of TextBlock are found on the [[Element Element Creation]] page.
2673
+
2674
+ * [[Element.banner]], a 48 pixel font.
2675
+ * [[Element.title]], a 34 pixel font.
2676
+ * [[Element.subtitle]], a 26 pixel font.
2677
+ * [[Element.tagline]], an 18 pixel font.
2678
+ * [[Element.caption]], a 14 pixel font.
2679
+ * [[Element.para]], a 12 pixel font.
2680
+ * [[Element.inscription]], a 10 pixel font.
2681
+
2682
+ === contents() » an array of elements ===
2683
+
2684
+ Lists all of the strings and styled text objects inside this block.
2685
+
2686
+ === replace(a string) ===
2687
+
2688
+ Replaces the text of the entire block with the characters of `a string`.
2689
+
2690
+ === text() » a string ===
2691
+
2692
+ Return a string of all of the characters in this text box. This will strip off any style or text classes and just return the actual characters, as if seen on the screen.
2693
+
2694
+ === text = a string ===
2695
+
2696
+ Replaces the text of the entire block with the characters of `a string`.
2697
+
2698
+ === to_s() » a string ===
2699
+
2700
+ An alias for [[TextBlock.text]]. Returns a flattened string of all of this TextBlock's contents.
2701
+
2702
+ == Timers ==
2703
+
2704
+ Shoes contains three timer classes: the Animation class, the Every class and the Timer class. Both Animations and Everies loop over and over after they start. Timers happen once. A one-shot timer.
2705
+
2706
+ Animations and Everies are basically the same thing. The difference is that Animations usually happen many, many times per second. And Everies happen only once every few seconds or rarely.
2707
+
2708
+ === start() » self ===
2709
+
2710
+ Both types of timers automatically start themselves, so there's no need to use this normally. But if you [[Timers.stop]] a timer and would like to start it up again, then by all means: use this!
2711
+
2712
+ === stop() » self ===
2713
+
2714
+ Pauses the animation or timer. In the case of a one-shot timer that's already happened, it's already stopped and this method will have no effect.
2715
+
2716
+ === toggle() » self ===
2717
+
2718
+ If the animation or timer is stopped, it is started. Otherwise, if it is already running, it is stopped.
2719
+
2720
+ == Video ==
2721
+
2722
+ Shoes supports embedding of QuickTime, Flash video (FLV), DivX, Xvid and various other popular video formats. This is all thanks to VideoLAN and ffmpeg, two sensational open source libraries. Use the `video` method on a slot to setup a Shoes::Video object. !{:margin_left => 100}man-ele-video.png!
2723
+
2724
+ In addition to video formats, some audio formats are also supported, such as MP3, WAV and Ogg Vorbis.
2725
+
2726
+ Video support is optional in Shoes and some builds do not support video. For example, video support is unavailable for PowerPC. When you download Shoes, the build for your platform will be marked `novideo` in the filename if no video support is available.
2727
+
2728
+ === hide() » self ===
2729
+
2730
+ Hides the video. If already playing, the video will continue to play. This just turns off display of the video. One possible use of this method is to collapse the video area when it is playing an audio file, such as an MP3.
2731
+
2732
+ === length() » a number ===
2733
+
2734
+ The full length of the video in milliseconds. Returns nil if the video is not yet loaded.
2735
+
2736
+ === move(left, top) » self ===
2737
+
2738
+ Moves the video to specific coordinates, the (left, top) being the upper left hand corner of the video.
2739
+
2740
+ === pause() » self ===
2741
+
2742
+ Pauses the video, if it is playing.
2743
+
2744
+ === playing?() » true of false ===
2745
+
2746
+ Returns true if the video is currently playing. Or, false if the video is paused or stopped.
2747
+
2748
+ === play() » self ===
2749
+
2750
+ Starts playing the video, if it isn't already playing. If already playing, the video is restarted from the beginning.
2751
+
2752
+ === position() » a decimal ===
2753
+
2754
+ The position of the video as a decimanl number (a Float) between the beginning (0.0) and the end (1.0). For instance, a Float value of 0.5 indicates the halfway point of the video.
2755
+
2756
+ === position = a decimal ===
2757
+
2758
+ Sets the position of the video using a Float value. To move the video to its 25% position: `@video.position = 0.25`.
2759
+
2760
+ === remove() » self ===
2761
+
2762
+ Removes the video from its slot. This will stop the video as well.
2763
+
2764
+ === show() » self ===
2765
+
2766
+ Reveals the video, if it has been hidden by the `hide()` method.
2767
+
2768
+ === stop() » self ===
2769
+
2770
+ Stops the video, if it is playing.
2771
+
2772
+ === time() » a number ===
2773
+
2774
+ The time position of the video in milliseconds. So, if the video is 10 seconds into play, this method would return the number 10000.
2775
+
2776
+ === time = a number ===
2777
+
2778
+ Set the position of the video to a time in milliseconds.
2779
+
2780
+ === toggle() » self ===
2781
+
2782
+ Toggles the visibility of the video. If the video can be seen, then `hide` is called. Otherwise, `show` is called.
2783
+