tk 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1060) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.travis.yml +6 -0
  4. data/BSDL +22 -0
  5. data/ChangeLog.tkextlib +949 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +56 -0
  8. data/MANUAL_tcltklib.eng +467 -0
  9. data/MANUAL_tcltklib.ja +578 -0
  10. data/README.1st +19 -0
  11. data/README.ActiveTcl +62 -0
  12. data/README.fork +34 -0
  13. data/README.macosx-aqua +67 -0
  14. data/README.md +33 -0
  15. data/README.tcltklib +152 -0
  16. data/Rakefile +16 -0
  17. data/bin/console +14 -0
  18. data/bin/setup +8 -0
  19. data/ext/tk/config_list.in +41 -0
  20. data/ext/tk/extconf.rb +2098 -0
  21. data/ext/tk/old-extconf.rb +441 -0
  22. data/ext/tk/stubs.c +592 -0
  23. data/ext/tk/stubs.h +33 -0
  24. data/ext/tk/tcltklib.c +11066 -0
  25. data/ext/tk/tkutil/extconf.rb +14 -0
  26. data/ext/tk/tkutil/tkutil.c +1900 -0
  27. data/lib/README +30 -0
  28. data/lib/multi-tk.rb +3743 -0
  29. data/lib/remote-tk.rb +527 -0
  30. data/lib/tcltk.rb +369 -0
  31. data/lib/tk.rb +5758 -0
  32. data/lib/tk/after.rb +7 -0
  33. data/lib/tk/autoload.rb +763 -0
  34. data/lib/tk/bgerror.rb +30 -0
  35. data/lib/tk/bindtag.rb +139 -0
  36. data/lib/tk/busy.rb +119 -0
  37. data/lib/tk/button.rb +32 -0
  38. data/lib/tk/canvas.rb +847 -0
  39. data/lib/tk/canvastag.rb +460 -0
  40. data/lib/tk/checkbutton.rb +33 -0
  41. data/lib/tk/clipboard.rb +76 -0
  42. data/lib/tk/clock.rb +72 -0
  43. data/lib/tk/composite.rb +485 -0
  44. data/lib/tk/console.rb +53 -0
  45. data/lib/tk/dialog.rb +327 -0
  46. data/lib/tk/encodedstr.rb +188 -0
  47. data/lib/tk/entry.rb +121 -0
  48. data/lib/tk/event.rb +563 -0
  49. data/lib/tk/font.rb +2352 -0
  50. data/lib/tk/fontchooser.rb +181 -0
  51. data/lib/tk/frame.rb +133 -0
  52. data/lib/tk/grid.rb +280 -0
  53. data/lib/tk/image.rb +396 -0
  54. data/lib/tk/itemconfig.rb +1222 -0
  55. data/lib/tk/itemfont.rb +328 -0
  56. data/lib/tk/kinput.rb +72 -0
  57. data/lib/tk/label.rb +23 -0
  58. data/lib/tk/labelframe.rb +32 -0
  59. data/lib/tk/listbox.rb +285 -0
  60. data/lib/tk/macpkg.rb +81 -0
  61. data/lib/tk/menu.rb +719 -0
  62. data/lib/tk/menubar.rb +138 -0
  63. data/lib/tk/menuspec.rb +457 -0
  64. data/lib/tk/message.rb +25 -0
  65. data/lib/tk/mngfocus.rb +34 -0
  66. data/lib/tk/msgcat.rb +300 -0
  67. data/lib/tk/namespace.rb +547 -0
  68. data/lib/tk/optiondb.rb +372 -0
  69. data/lib/tk/optionobj.rb +213 -0
  70. data/lib/tk/pack.rb +108 -0
  71. data/lib/tk/package.rb +144 -0
  72. data/lib/tk/palette.rb +56 -0
  73. data/lib/tk/panedwindow.rb +261 -0
  74. data/lib/tk/place.rb +129 -0
  75. data/lib/tk/radiobutton.rb +74 -0
  76. data/lib/tk/root.rb +96 -0
  77. data/lib/tk/scale.rb +113 -0
  78. data/lib/tk/scrollable.rb +83 -0
  79. data/lib/tk/scrollbar.rb +184 -0
  80. data/lib/tk/scrollbox.rb +40 -0
  81. data/lib/tk/selection.rb +87 -0
  82. data/lib/tk/spinbox.rb +145 -0
  83. data/lib/tk/tagfont.rb +44 -0
  84. data/lib/tk/text.rb +1605 -0
  85. data/lib/tk/textimage.rb +89 -0
  86. data/lib/tk/textmark.rb +205 -0
  87. data/lib/tk/texttag.rb +322 -0
  88. data/lib/tk/textwindow.rb +155 -0
  89. data/lib/tk/timer.rb +666 -0
  90. data/lib/tk/tk_mac.rb +159 -0
  91. data/lib/tk/toplevel.rb +265 -0
  92. data/lib/tk/ttk_selector.rb +99 -0
  93. data/lib/tk/txtwin_abst.rb +40 -0
  94. data/lib/tk/validation.rb +398 -0
  95. data/lib/tk/variable.rb +1797 -0
  96. data/lib/tk/virtevent.rb +140 -0
  97. data/lib/tk/winfo.rb +393 -0
  98. data/lib/tk/winpkg.rb +157 -0
  99. data/lib/tk/wm.rb +553 -0
  100. data/lib/tk/xim.rb +123 -0
  101. data/lib/tkafter.rb +5 -0
  102. data/lib/tkbgerror.rb +5 -0
  103. data/lib/tkcanvas.rb +5 -0
  104. data/lib/tkclass.rb +48 -0
  105. data/lib/tkconsole.rb +5 -0
  106. data/lib/tkdialog.rb +5 -0
  107. data/lib/tkentry.rb +5 -0
  108. data/lib/tkextlib/ICONS.rb +14 -0
  109. data/lib/tkextlib/ICONS/icons.rb +130 -0
  110. data/lib/tkextlib/ICONS/setup.rb +9 -0
  111. data/lib/tkextlib/SUPPORT_STATUS +193 -0
  112. data/lib/tkextlib/blt.rb +190 -0
  113. data/lib/tkextlib/blt/barchart.rb +80 -0
  114. data/lib/tkextlib/blt/bitmap.rb +113 -0
  115. data/lib/tkextlib/blt/busy.rb +84 -0
  116. data/lib/tkextlib/blt/component.rb +2219 -0
  117. data/lib/tkextlib/blt/container.rb +29 -0
  118. data/lib/tkextlib/blt/cutbuffer.rb +24 -0
  119. data/lib/tkextlib/blt/dragdrop.rb +270 -0
  120. data/lib/tkextlib/blt/eps.rb +33 -0
  121. data/lib/tkextlib/blt/graph.rb +68 -0
  122. data/lib/tkextlib/blt/htext.rb +113 -0
  123. data/lib/tkextlib/blt/setup.rb +9 -0
  124. data/lib/tkextlib/blt/spline.rb +24 -0
  125. data/lib/tkextlib/blt/stripchart.rb +75 -0
  126. data/lib/tkextlib/blt/table.rb +413 -0
  127. data/lib/tkextlib/blt/tabnotebook.rb +111 -0
  128. data/lib/tkextlib/blt/tabset.rb +505 -0
  129. data/lib/tkextlib/blt/ted.rb +69 -0
  130. data/lib/tkextlib/blt/tile.rb +26 -0
  131. data/lib/tkextlib/blt/tile/button.rb +17 -0
  132. data/lib/tkextlib/blt/tile/checkbutton.rb +18 -0
  133. data/lib/tkextlib/blt/tile/frame.rb +17 -0
  134. data/lib/tkextlib/blt/tile/label.rb +17 -0
  135. data/lib/tkextlib/blt/tile/radiobutton.rb +18 -0
  136. data/lib/tkextlib/blt/tile/scrollbar.rb +17 -0
  137. data/lib/tkextlib/blt/tile/toplevel.rb +17 -0
  138. data/lib/tkextlib/blt/tree.rb +1059 -0
  139. data/lib/tkextlib/blt/treeview.rb +1288 -0
  140. data/lib/tkextlib/blt/unix_dnd.rb +142 -0
  141. data/lib/tkextlib/blt/vector.rb +257 -0
  142. data/lib/tkextlib/blt/watch.rb +176 -0
  143. data/lib/tkextlib/blt/win_printer.rb +62 -0
  144. data/lib/tkextlib/blt/winop.rb +108 -0
  145. data/lib/tkextlib/bwidget.rb +154 -0
  146. data/lib/tkextlib/bwidget/arrowbutton.rb +22 -0
  147. data/lib/tkextlib/bwidget/bitmap.rb +22 -0
  148. data/lib/tkextlib/bwidget/button.rb +32 -0
  149. data/lib/tkextlib/bwidget/buttonbox.rb +91 -0
  150. data/lib/tkextlib/bwidget/combobox.rb +63 -0
  151. data/lib/tkextlib/bwidget/dialog.rb +195 -0
  152. data/lib/tkextlib/bwidget/dragsite.rb +32 -0
  153. data/lib/tkextlib/bwidget/dropsite.rb +40 -0
  154. data/lib/tkextlib/bwidget/dynamichelp.rb +64 -0
  155. data/lib/tkextlib/bwidget/entry.rb +44 -0
  156. data/lib/tkextlib/bwidget/label.rb +42 -0
  157. data/lib/tkextlib/bwidget/labelentry.rb +81 -0
  158. data/lib/tkextlib/bwidget/labelframe.rb +53 -0
  159. data/lib/tkextlib/bwidget/listbox.rb +362 -0
  160. data/lib/tkextlib/bwidget/mainframe.rb +133 -0
  161. data/lib/tkextlib/bwidget/messagedlg.rb +193 -0
  162. data/lib/tkextlib/bwidget/notebook.rb +167 -0
  163. data/lib/tkextlib/bwidget/pagesmanager.rb +74 -0
  164. data/lib/tkextlib/bwidget/panedwindow.rb +43 -0
  165. data/lib/tkextlib/bwidget/panelframe.rb +68 -0
  166. data/lib/tkextlib/bwidget/passwddlg.rb +45 -0
  167. data/lib/tkextlib/bwidget/progressbar.rb +21 -0
  168. data/lib/tkextlib/bwidget/progressdlg.rb +59 -0
  169. data/lib/tkextlib/bwidget/scrollableframe.rb +41 -0
  170. data/lib/tkextlib/bwidget/scrolledwindow.rb +49 -0
  171. data/lib/tkextlib/bwidget/scrollview.rb +26 -0
  172. data/lib/tkextlib/bwidget/selectcolor.rb +74 -0
  173. data/lib/tkextlib/bwidget/selectfont.rb +92 -0
  174. data/lib/tkextlib/bwidget/separator.rb +21 -0
  175. data/lib/tkextlib/bwidget/setup.rb +9 -0
  176. data/lib/tkextlib/bwidget/spinbox.rb +99 -0
  177. data/lib/tkextlib/bwidget/statusbar.rb +63 -0
  178. data/lib/tkextlib/bwidget/titleframe.rb +34 -0
  179. data/lib/tkextlib/bwidget/tree.rb +501 -0
  180. data/lib/tkextlib/bwidget/widget.rb +130 -0
  181. data/lib/tkextlib/itcl.rb +14 -0
  182. data/lib/tkextlib/itcl/incr_tcl.rb +179 -0
  183. data/lib/tkextlib/itcl/setup.rb +14 -0
  184. data/lib/tkextlib/itk.rb +14 -0
  185. data/lib/tkextlib/itk/incr_tk.rb +447 -0
  186. data/lib/tkextlib/itk/setup.rb +14 -0
  187. data/lib/tkextlib/iwidgets.rb +95 -0
  188. data/lib/tkextlib/iwidgets/buttonbox.rb +122 -0
  189. data/lib/tkextlib/iwidgets/calendar.rb +126 -0
  190. data/lib/tkextlib/iwidgets/canvasprintbox.rb +54 -0
  191. data/lib/tkextlib/iwidgets/canvasprintdialog.rb +39 -0
  192. data/lib/tkextlib/iwidgets/checkbox.rb +131 -0
  193. data/lib/tkextlib/iwidgets/combobox.rb +105 -0
  194. data/lib/tkextlib/iwidgets/dateentry.rb +21 -0
  195. data/lib/tkextlib/iwidgets/datefield.rb +59 -0
  196. data/lib/tkextlib/iwidgets/dialog.rb +21 -0
  197. data/lib/tkextlib/iwidgets/dialogshell.rb +122 -0
  198. data/lib/tkextlib/iwidgets/disjointlistbox.rb +51 -0
  199. data/lib/tkextlib/iwidgets/entryfield.rb +186 -0
  200. data/lib/tkextlib/iwidgets/extbutton.rb +41 -0
  201. data/lib/tkextlib/iwidgets/extfileselectionbox.rb +47 -0
  202. data/lib/tkextlib/iwidgets/extfileselectiondialog.rb +34 -0
  203. data/lib/tkextlib/iwidgets/feedback.rb +36 -0
  204. data/lib/tkextlib/iwidgets/fileselectionbox.rb +47 -0
  205. data/lib/tkextlib/iwidgets/fileselectiondialog.rb +34 -0
  206. data/lib/tkextlib/iwidgets/finddialog.rb +43 -0
  207. data/lib/tkextlib/iwidgets/hierarchy.rb +366 -0
  208. data/lib/tkextlib/iwidgets/hyperhelp.rb +51 -0
  209. data/lib/tkextlib/iwidgets/labeledframe.rb +40 -0
  210. data/lib/tkextlib/iwidgets/labeledwidget.rb +46 -0
  211. data/lib/tkextlib/iwidgets/mainwindow.rb +68 -0
  212. data/lib/tkextlib/iwidgets/menubar.rb +213 -0
  213. data/lib/tkextlib/iwidgets/messagebox.rb +94 -0
  214. data/lib/tkextlib/iwidgets/messagedialog.rb +21 -0
  215. data/lib/tkextlib/iwidgets/notebook.rb +176 -0
  216. data/lib/tkextlib/iwidgets/optionmenu.rb +93 -0
  217. data/lib/tkextlib/iwidgets/panedwindow.rb +135 -0
  218. data/lib/tkextlib/iwidgets/promptdialog.rb +132 -0
  219. data/lib/tkextlib/iwidgets/pushbutton.rb +36 -0
  220. data/lib/tkextlib/iwidgets/radiobox.rb +122 -0
  221. data/lib/tkextlib/iwidgets/scopedobject.rb +25 -0
  222. data/lib/tkextlib/iwidgets/scrolledcanvas.rb +354 -0
  223. data/lib/tkextlib/iwidgets/scrolledframe.rb +60 -0
  224. data/lib/tkextlib/iwidgets/scrolledhtml.rb +59 -0
  225. data/lib/tkextlib/iwidgets/scrolledlistbox.rb +208 -0
  226. data/lib/tkextlib/iwidgets/scrolledtext.rb +569 -0
  227. data/lib/tkextlib/iwidgets/scrolledwidget.rb +21 -0
  228. data/lib/tkextlib/iwidgets/selectionbox.rb +103 -0
  229. data/lib/tkextlib/iwidgets/selectiondialog.rb +93 -0
  230. data/lib/tkextlib/iwidgets/setup.rb +9 -0
  231. data/lib/tkextlib/iwidgets/shell.rb +39 -0
  232. data/lib/tkextlib/iwidgets/spindate.rb +49 -0
  233. data/lib/tkextlib/iwidgets/spinint.rb +31 -0
  234. data/lib/tkextlib/iwidgets/spinner.rb +170 -0
  235. data/lib/tkextlib/iwidgets/spintime.rb +49 -0
  236. data/lib/tkextlib/iwidgets/tabnotebook.rb +182 -0
  237. data/lib/tkextlib/iwidgets/tabset.rb +146 -0
  238. data/lib/tkextlib/iwidgets/timeentry.rb +26 -0
  239. data/lib/tkextlib/iwidgets/timefield.rb +59 -0
  240. data/lib/tkextlib/iwidgets/toolbar.rb +113 -0
  241. data/lib/tkextlib/iwidgets/watch.rb +57 -0
  242. data/lib/tkextlib/pkg_checker.rb +185 -0
  243. data/lib/tkextlib/setup.rb +9 -0
  244. data/lib/tkextlib/tcllib.rb +106 -0
  245. data/lib/tkextlib/tcllib/README +135 -0
  246. data/lib/tkextlib/tcllib/autoscroll.rb +159 -0
  247. data/lib/tkextlib/tcllib/calendar.rb +56 -0
  248. data/lib/tkextlib/tcllib/canvas_sqmap.rb +37 -0
  249. data/lib/tkextlib/tcllib/canvas_zoom.rb +22 -0
  250. data/lib/tkextlib/tcllib/chatwidget.rb +152 -0
  251. data/lib/tkextlib/tcllib/crosshair.rb +118 -0
  252. data/lib/tkextlib/tcllib/ctext.rb +161 -0
  253. data/lib/tkextlib/tcllib/cursor.rb +98 -0
  254. data/lib/tkextlib/tcllib/dateentry.rb +63 -0
  255. data/lib/tkextlib/tcllib/datefield.rb +58 -0
  256. data/lib/tkextlib/tcllib/diagrams.rb +225 -0
  257. data/lib/tkextlib/tcllib/dialog.rb +85 -0
  258. data/lib/tkextlib/tcllib/getstring.rb +135 -0
  259. data/lib/tkextlib/tcllib/history.rb +74 -0
  260. data/lib/tkextlib/tcllib/ico.rb +147 -0
  261. data/lib/tkextlib/tcllib/ip_entry.rb +76 -0
  262. data/lib/tkextlib/tcllib/khim.rb +69 -0
  263. data/lib/tkextlib/tcllib/menuentry.rb +48 -0
  264. data/lib/tkextlib/tcllib/ntext.rb +147 -0
  265. data/lib/tkextlib/tcllib/panelframe.rb +79 -0
  266. data/lib/tkextlib/tcllib/plotchart.rb +1405 -0
  267. data/lib/tkextlib/tcllib/ruler.rb +66 -0
  268. data/lib/tkextlib/tcllib/screenruler.rb +69 -0
  269. data/lib/tkextlib/tcllib/scrolledwindow.rb +58 -0
  270. data/lib/tkextlib/tcllib/scrollwin.rb +62 -0
  271. data/lib/tkextlib/tcllib/setup.rb +9 -0
  272. data/lib/tkextlib/tcllib/statusbar.rb +80 -0
  273. data/lib/tkextlib/tcllib/style.rb +62 -0
  274. data/lib/tkextlib/tcllib/superframe.rb +52 -0
  275. data/lib/tkextlib/tcllib/swaplist.rb +151 -0
  276. data/lib/tkextlib/tcllib/tablelist.rb +29 -0
  277. data/lib/tkextlib/tcllib/tablelist_core.rb +1073 -0
  278. data/lib/tkextlib/tcllib/tablelist_tile.rb +44 -0
  279. data/lib/tkextlib/tcllib/tkpiechart.rb +315 -0
  280. data/lib/tkextlib/tcllib/toolbar.rb +176 -0
  281. data/lib/tkextlib/tcllib/tooltip.rb +105 -0
  282. data/lib/tkextlib/tcllib/validator.rb +66 -0
  283. data/lib/tkextlib/tcllib/widget.rb +83 -0
  284. data/lib/tkextlib/tclx.rb +14 -0
  285. data/lib/tkextlib/tclx/setup.rb +9 -0
  286. data/lib/tkextlib/tclx/tclx.rb +75 -0
  287. data/lib/tkextlib/tile.rb +450 -0
  288. data/lib/tkextlib/tile/dialog.rb +103 -0
  289. data/lib/tkextlib/tile/setup.rb +9 -0
  290. data/lib/tkextlib/tile/sizegrip.rb +33 -0
  291. data/lib/tkextlib/tile/style.rb +337 -0
  292. data/lib/tkextlib/tile/tbutton.rb +35 -0
  293. data/lib/tkextlib/tile/tcheckbutton.rb +39 -0
  294. data/lib/tkextlib/tile/tcombobox.rb +56 -0
  295. data/lib/tkextlib/tile/tentry.rb +50 -0
  296. data/lib/tkextlib/tile/tframe.rb +35 -0
  297. data/lib/tkextlib/tile/tlabel.rb +35 -0
  298. data/lib/tkextlib/tile/tlabelframe.rb +39 -0
  299. data/lib/tkextlib/tile/tmenubutton.rb +39 -0
  300. data/lib/tkextlib/tile/tnotebook.rb +148 -0
  301. data/lib/tkextlib/tile/tpaned.rb +246 -0
  302. data/lib/tkextlib/tile/tprogressbar.rb +58 -0
  303. data/lib/tkextlib/tile/tradiobutton.rb +39 -0
  304. data/lib/tkextlib/tile/treeview.rb +1337 -0
  305. data/lib/tkextlib/tile/tscale.rb +57 -0
  306. data/lib/tkextlib/tile/tscrollbar.rb +64 -0
  307. data/lib/tkextlib/tile/tseparator.rb +35 -0
  308. data/lib/tkextlib/tile/tspinbox.rb +108 -0
  309. data/lib/tkextlib/tile/tsquare.rb +31 -0
  310. data/lib/tkextlib/tkDND.rb +19 -0
  311. data/lib/tkextlib/tkDND/setup.rb +9 -0
  312. data/lib/tkextlib/tkDND/shape.rb +126 -0
  313. data/lib/tkextlib/tkDND/tkdnd.rb +183 -0
  314. data/lib/tkextlib/tkHTML.rb +14 -0
  315. data/lib/tkextlib/tkHTML/htmlwidget.rb +454 -0
  316. data/lib/tkextlib/tkHTML/setup.rb +9 -0
  317. data/lib/tkextlib/tkimg.rb +37 -0
  318. data/lib/tkextlib/tkimg/README +26 -0
  319. data/lib/tkextlib/tkimg/bmp.rb +34 -0
  320. data/lib/tkextlib/tkimg/dted.rb +34 -0
  321. data/lib/tkextlib/tkimg/gif.rb +34 -0
  322. data/lib/tkextlib/tkimg/ico.rb +34 -0
  323. data/lib/tkextlib/tkimg/jpeg.rb +34 -0
  324. data/lib/tkextlib/tkimg/pcx.rb +34 -0
  325. data/lib/tkextlib/tkimg/pixmap.rb +45 -0
  326. data/lib/tkextlib/tkimg/png.rb +34 -0
  327. data/lib/tkextlib/tkimg/ppm.rb +34 -0
  328. data/lib/tkextlib/tkimg/ps.rb +34 -0
  329. data/lib/tkextlib/tkimg/raw.rb +34 -0
  330. data/lib/tkextlib/tkimg/setup.rb +9 -0
  331. data/lib/tkextlib/tkimg/sgi.rb +34 -0
  332. data/lib/tkextlib/tkimg/sun.rb +34 -0
  333. data/lib/tkextlib/tkimg/tga.rb +34 -0
  334. data/lib/tkextlib/tkimg/tiff.rb +34 -0
  335. data/lib/tkextlib/tkimg/window.rb +34 -0
  336. data/lib/tkextlib/tkimg/xbm.rb +34 -0
  337. data/lib/tkextlib/tkimg/xpm.rb +34 -0
  338. data/lib/tkextlib/tktable.rb +15 -0
  339. data/lib/tkextlib/tktable/setup.rb +9 -0
  340. data/lib/tkextlib/tktable/tktable.rb +967 -0
  341. data/lib/tkextlib/tktrans.rb +15 -0
  342. data/lib/tkextlib/tktrans/setup.rb +9 -0
  343. data/lib/tkextlib/tktrans/tktrans.rb +65 -0
  344. data/lib/tkextlib/treectrl.rb +14 -0
  345. data/lib/tkextlib/treectrl/setup.rb +9 -0
  346. data/lib/tkextlib/treectrl/tktreectrl.rb +2523 -0
  347. data/lib/tkextlib/trofs.rb +14 -0
  348. data/lib/tkextlib/trofs/setup.rb +9 -0
  349. data/lib/tkextlib/trofs/trofs.rb +52 -0
  350. data/lib/tkextlib/version.rb +7 -0
  351. data/lib/tkextlib/vu.rb +49 -0
  352. data/lib/tkextlib/vu/bargraph.rb +62 -0
  353. data/lib/tkextlib/vu/charts.rb +54 -0
  354. data/lib/tkextlib/vu/dial.rb +103 -0
  355. data/lib/tkextlib/vu/pie.rb +287 -0
  356. data/lib/tkextlib/vu/setup.rb +9 -0
  357. data/lib/tkextlib/vu/spinbox.rb +23 -0
  358. data/lib/tkextlib/winico.rb +15 -0
  359. data/lib/tkextlib/winico/setup.rb +9 -0
  360. data/lib/tkextlib/winico/winico.rb +225 -0
  361. data/lib/tkfont.rb +5 -0
  362. data/lib/tkmacpkg.rb +5 -0
  363. data/lib/tkmenubar.rb +5 -0
  364. data/lib/tkmngfocus.rb +5 -0
  365. data/lib/tkpalette.rb +5 -0
  366. data/lib/tkscrollbox.rb +5 -0
  367. data/lib/tktext.rb +5 -0
  368. data/lib/tkvirtevent.rb +5 -0
  369. data/lib/tkwinpkg.rb +5 -0
  370. data/old-README.tcltklib.ja +159 -0
  371. data/sample/24hr_clock.rb +287 -0
  372. data/sample/binding_sample.rb +88 -0
  373. data/sample/bindtag_sample.rb +128 -0
  374. data/sample/binstr_usage.rb +46 -0
  375. data/sample/btn_with_frame.rb +21 -0
  376. data/sample/cd_timer.rb +82 -0
  377. data/sample/cmd_res_test.rb +18 -0
  378. data/sample/cmd_resource +5 -0
  379. data/sample/demos-en/ChangeLog +64 -0
  380. data/sample/demos-en/ChangeLog.prev +9 -0
  381. data/sample/demos-en/README +138 -0
  382. data/sample/demos-en/README.1st +18 -0
  383. data/sample/demos-en/README.tkencoding +29 -0
  384. data/sample/demos-en/anilabel.rb +175 -0
  385. data/sample/demos-en/aniwave.rb +119 -0
  386. data/sample/demos-en/arrow.rb +250 -0
  387. data/sample/demos-en/bind.rb +128 -0
  388. data/sample/demos-en/bitmap.rb +76 -0
  389. data/sample/demos-en/browse1 +63 -0
  390. data/sample/demos-en/browse2 +82 -0
  391. data/sample/demos-en/button.rb +85 -0
  392. data/sample/demos-en/check.rb +73 -0
  393. data/sample/demos-en/check2.rb +110 -0
  394. data/sample/demos-en/clrpick.rb +88 -0
  395. data/sample/demos-en/colors.rb +159 -0
  396. data/sample/demos-en/combo.rb +97 -0
  397. data/sample/demos-en/cscroll.rb +137 -0
  398. data/sample/demos-en/ctext.rb +208 -0
  399. data/sample/demos-en/dialog1.rb +39 -0
  400. data/sample/demos-en/dialog2.rb +42 -0
  401. data/sample/demos-en/doc.org/README +7 -0
  402. data/sample/demos-en/doc.org/README.JP +14 -0
  403. data/sample/demos-en/doc.org/README.tk80 +46 -0
  404. data/sample/demos-en/doc.org/license.terms +39 -0
  405. data/sample/demos-en/doc.org/license.terms.tk80 +39 -0
  406. data/sample/demos-en/entry1.rb +59 -0
  407. data/sample/demos-en/entry2.rb +94 -0
  408. data/sample/demos-en/entry3.rb +221 -0
  409. data/sample/demos-en/filebox.rb +103 -0
  410. data/sample/demos-en/floor.rb +1724 -0
  411. data/sample/demos-en/floor2.rb +1723 -0
  412. data/sample/demos-en/form.rb +65 -0
  413. data/sample/demos-en/goldberg.rb +2007 -0
  414. data/sample/demos-en/hello +14 -0
  415. data/sample/demos-en/hscale.rb +76 -0
  416. data/sample/demos-en/icon.rb +106 -0
  417. data/sample/demos-en/image1.rb +66 -0
  418. data/sample/demos-en/image2.rb +108 -0
  419. data/sample/demos-en/image3.rb +126 -0
  420. data/sample/demos-en/items.rb +382 -0
  421. data/sample/demos-en/ixset +333 -0
  422. data/sample/demos-en/ixset2 +367 -0
  423. data/sample/demos-en/knightstour.rb +272 -0
  424. data/sample/demos-en/label.rb +73 -0
  425. data/sample/demos-en/labelframe.rb +96 -0
  426. data/sample/demos-en/mclist.rb +118 -0
  427. data/sample/demos-en/menu.rb +197 -0
  428. data/sample/demos-en/menu84.rb +216 -0
  429. data/sample/demos-en/menubu.rb +238 -0
  430. data/sample/demos-en/msgbox.rb +91 -0
  431. data/sample/demos-en/msgbox2.rb +92 -0
  432. data/sample/demos-en/paned1.rb +48 -0
  433. data/sample/demos-en/paned2.rb +95 -0
  434. data/sample/demos-en/pendulum.rb +241 -0
  435. data/sample/demos-en/plot.rb +125 -0
  436. data/sample/demos-en/puzzle.rb +135 -0
  437. data/sample/demos-en/radio.rb +87 -0
  438. data/sample/demos-en/radio2.rb +110 -0
  439. data/sample/demos-en/radio3.rb +118 -0
  440. data/sample/demos-en/rmt +268 -0
  441. data/sample/demos-en/rolodex +320 -0
  442. data/sample/demos-en/ruler.rb +206 -0
  443. data/sample/demos-en/sayings.rb +107 -0
  444. data/sample/demos-en/search.rb +188 -0
  445. data/sample/demos-en/spin.rb +66 -0
  446. data/sample/demos-en/square +81 -0
  447. data/sample/demos-en/states.rb +81 -0
  448. data/sample/demos-en/style.rb +232 -0
  449. data/sample/demos-en/tcolor +526 -0
  450. data/sample/demos-en/text.rb +129 -0
  451. data/sample/demos-en/textpeer.rb +77 -0
  452. data/sample/demos-en/timer +136 -0
  453. data/sample/demos-en/tkencoding.rb +43 -0
  454. data/sample/demos-en/toolbar.rb +131 -0
  455. data/sample/demos-en/tree.rb +120 -0
  456. data/sample/demos-en/ttkbut.rb +140 -0
  457. data/sample/demos-en/ttkmenu.rb +86 -0
  458. data/sample/demos-en/ttknote.rb +90 -0
  459. data/sample/demos-en/ttkpane.rb +214 -0
  460. data/sample/demos-en/ttkprogress.rb +67 -0
  461. data/sample/demos-en/twind.rb +292 -0
  462. data/sample/demos-en/twind2.rb +385 -0
  463. data/sample/demos-en/unicodeout.rb +115 -0
  464. data/sample/demos-en/vscale.rb +80 -0
  465. data/sample/demos-en/widget +1087 -0
  466. data/sample/demos-jp/README +54 -0
  467. data/sample/demos-jp/README.1st +20 -0
  468. data/sample/demos-jp/anilabel.rb +178 -0
  469. data/sample/demos-jp/aniwave.rb +121 -0
  470. data/sample/demos-jp/arrow.rb +248 -0
  471. data/sample/demos-jp/bind.rb +126 -0
  472. data/sample/demos-jp/bitmap.rb +75 -0
  473. data/sample/demos-jp/browse1 +63 -0
  474. data/sample/demos-jp/browse2 +82 -0
  475. data/sample/demos-jp/button.rb +84 -0
  476. data/sample/demos-jp/check.rb +71 -0
  477. data/sample/demos-jp/check2.rb +111 -0
  478. data/sample/demos-jp/clrpick.rb +85 -0
  479. data/sample/demos-jp/colors.rb +156 -0
  480. data/sample/demos-jp/combo.rb +99 -0
  481. data/sample/demos-jp/cscroll.rb +135 -0
  482. data/sample/demos-jp/ctext.rb +205 -0
  483. data/sample/demos-jp/dialog1.rb +40 -0
  484. data/sample/demos-jp/dialog2.rb +44 -0
  485. data/sample/demos-jp/doc.org/README +7 -0
  486. data/sample/demos-jp/doc.org/README.JP +14 -0
  487. data/sample/demos-jp/doc.org/README.tk80 +46 -0
  488. data/sample/demos-jp/doc.org/license.terms +39 -0
  489. data/sample/demos-jp/doc.org/license.terms.tk80 +39 -0
  490. data/sample/demos-jp/entry1.rb +61 -0
  491. data/sample/demos-jp/entry2.rb +92 -0
  492. data/sample/demos-jp/entry3.rb +226 -0
  493. data/sample/demos-jp/filebox.rb +103 -0
  494. data/sample/demos-jp/floor.rb +1722 -0
  495. data/sample/demos-jp/floor2.rb +1720 -0
  496. data/sample/demos-jp/form.rb +67 -0
  497. data/sample/demos-jp/goldberg.rb +2012 -0
  498. data/sample/demos-jp/hello +10 -0
  499. data/sample/demos-jp/hscale.rb +79 -0
  500. data/sample/demos-jp/icon.rb +104 -0
  501. data/sample/demos-jp/image1.rb +65 -0
  502. data/sample/demos-jp/image2.rb +107 -0
  503. data/sample/demos-jp/image3.rb +128 -0
  504. data/sample/demos-jp/items.rb +380 -0
  505. data/sample/demos-jp/ixset +333 -0
  506. data/sample/demos-jp/ixset2 +369 -0
  507. data/sample/demos-jp/knightstour.rb +274 -0
  508. data/sample/demos-jp/label.rb +70 -0
  509. data/sample/demos-jp/labelframe.rb +103 -0
  510. data/sample/demos-jp/mclist.rb +122 -0
  511. data/sample/demos-jp/menu.rb +202 -0
  512. data/sample/demos-jp/menu84.rb +214 -0
  513. data/sample/demos-jp/menu8x.rb +234 -0
  514. data/sample/demos-jp/menubu.rb +239 -0
  515. data/sample/demos-jp/msgbox.rb +90 -0
  516. data/sample/demos-jp/msgbox2.rb +91 -0
  517. data/sample/demos-jp/paned1.rb +53 -0
  518. data/sample/demos-jp/paned2.rb +101 -0
  519. data/sample/demos-jp/pendulum.rb +243 -0
  520. data/sample/demos-jp/plot.rb +127 -0
  521. data/sample/demos-jp/puzzle.rb +132 -0
  522. data/sample/demos-jp/radio.rb +85 -0
  523. data/sample/demos-jp/radio2.rb +113 -0
  524. data/sample/demos-jp/radio3.rb +120 -0
  525. data/sample/demos-jp/rmt +268 -0
  526. data/sample/demos-jp/rolodex +320 -0
  527. data/sample/demos-jp/rolodex-j +300 -0
  528. data/sample/demos-jp/ruler.rb +204 -0
  529. data/sample/demos-jp/sayings.rb +104 -0
  530. data/sample/demos-jp/search.rb +185 -0
  531. data/sample/demos-jp/spin.rb +72 -0
  532. data/sample/demos-jp/square +81 -0
  533. data/sample/demos-jp/states.rb +75 -0
  534. data/sample/demos-jp/style.rb +271 -0
  535. data/sample/demos-jp/tcolor +534 -0
  536. data/sample/demos-jp/text.rb +121 -0
  537. data/sample/demos-jp/textpeer.rb +83 -0
  538. data/sample/demos-jp/timer +136 -0
  539. data/sample/demos-jp/toolbar.rb +137 -0
  540. data/sample/demos-jp/tree.rb +121 -0
  541. data/sample/demos-jp/ttkbut.rb +146 -0
  542. data/sample/demos-jp/ttkmenu.rb +92 -0
  543. data/sample/demos-jp/ttknote.rb +98 -0
  544. data/sample/demos-jp/ttkpane.rb +217 -0
  545. data/sample/demos-jp/ttkprogress.rb +72 -0
  546. data/sample/demos-jp/twind.rb +293 -0
  547. data/sample/demos-jp/twind2.rb +385 -0
  548. data/sample/demos-jp/unicodeout.rb +120 -0
  549. data/sample/demos-jp/vscale.rb +81 -0
  550. data/sample/demos-jp/widget +1122 -0
  551. data/sample/editable_listbox.rb +149 -0
  552. data/sample/encstr_usage.rb +31 -0
  553. data/sample/figmemo_sample.rb +457 -0
  554. data/sample/images/earth.gif +0 -0
  555. data/sample/images/earthris.gif +0 -0
  556. data/sample/images/face.xbm +173 -0
  557. data/sample/images/flagdown.xbm +27 -0
  558. data/sample/images/flagup.xbm +27 -0
  559. data/sample/images/gray25.xbm +6 -0
  560. data/sample/images/grey.25 +6 -0
  561. data/sample/images/grey.5 +6 -0
  562. data/sample/images/letters.xbm +27 -0
  563. data/sample/images/noletter.xbm +27 -0
  564. data/sample/images/pattern.xbm +6 -0
  565. data/sample/images/tcllogo.gif +0 -0
  566. data/sample/images/teapot.ppm +31 -0
  567. data/sample/irbtk.rb +31 -0
  568. data/sample/irbtkw.rbw +156 -0
  569. data/sample/iso2022-kr.txt +2 -0
  570. data/sample/menubar1.rb +52 -0
  571. data/sample/menubar2.rb +57 -0
  572. data/sample/menubar3.rb +73 -0
  573. data/sample/msgs_rb/README +3 -0
  574. data/sample/msgs_rb/cs.msg +84 -0
  575. data/sample/msgs_rb/de.msg +88 -0
  576. data/sample/msgs_rb/el.msg +98 -0
  577. data/sample/msgs_rb/en.msg +83 -0
  578. data/sample/msgs_rb/en_gb.msg +7 -0
  579. data/sample/msgs_rb/eo.msg +87 -0
  580. data/sample/msgs_rb/es.msg +84 -0
  581. data/sample/msgs_rb/fr.msg +84 -0
  582. data/sample/msgs_rb/it.msg +84 -0
  583. data/sample/msgs_rb/ja.msg +13 -0
  584. data/sample/msgs_rb/nl.msg +123 -0
  585. data/sample/msgs_rb/pl.msg +87 -0
  586. data/sample/msgs_rb/ru.msg +87 -0
  587. data/sample/msgs_rb2/README +5 -0
  588. data/sample/msgs_rb2/de.msg +88 -0
  589. data/sample/msgs_rb2/ja.msg +85 -0
  590. data/sample/msgs_tk/README +4 -0
  591. data/sample/msgs_tk/cs.msg +84 -0
  592. data/sample/msgs_tk/de.msg +88 -0
  593. data/sample/msgs_tk/el.msg +103 -0
  594. data/sample/msgs_tk/en.msg +83 -0
  595. data/sample/msgs_tk/en_gb.msg +7 -0
  596. data/sample/msgs_tk/eo.msg +87 -0
  597. data/sample/msgs_tk/es.msg +84 -0
  598. data/sample/msgs_tk/fr.msg +84 -0
  599. data/sample/msgs_tk/it.msg +84 -0
  600. data/sample/msgs_tk/ja.msg +13 -0
  601. data/sample/msgs_tk/license.terms +39 -0
  602. data/sample/msgs_tk/nl.msg +123 -0
  603. data/sample/msgs_tk/pl.msg +87 -0
  604. data/sample/msgs_tk/ru.msg +87 -0
  605. data/sample/multi-ip_sample.rb +104 -0
  606. data/sample/multi-ip_sample2.rb +30 -0
  607. data/sample/optobj_sample.rb +68 -0
  608. data/sample/propagate.rb +31 -0
  609. data/sample/remote-ip_sample.rb +34 -0
  610. data/sample/remote-ip_sample2.rb +57 -0
  611. data/sample/resource.en +13 -0
  612. data/sample/resource.ja +13 -0
  613. data/sample/safe-tk.rb +132 -0
  614. data/sample/scrollframe.rb +250 -0
  615. data/sample/tcltklib/batsu.gif +0 -0
  616. data/sample/tcltklib/lines0.tcl +42 -0
  617. data/sample/tcltklib/lines1.rb +51 -0
  618. data/sample/tcltklib/lines2.rb +55 -0
  619. data/sample/tcltklib/lines3.rb +55 -0
  620. data/sample/tcltklib/lines4.rb +55 -0
  621. data/sample/tcltklib/maru.gif +0 -0
  622. data/sample/tcltklib/safeTk.rb +23 -0
  623. data/sample/tcltklib/sample0.rb +40 -0
  624. data/sample/tcltklib/sample1.rb +635 -0
  625. data/sample/tcltklib/sample2.rb +452 -0
  626. data/sample/tkalignbox.rb +236 -0
  627. data/sample/tkballoonhelp.rb +221 -0
  628. data/sample/tkbiff.rb +156 -0
  629. data/sample/tkbrowse.rb +80 -0
  630. data/sample/tkcombobox.rb +498 -0
  631. data/sample/tkdialog.rb +62 -0
  632. data/sample/tkextlib/ICONS/Orig_LICENSE.txt +61 -0
  633. data/sample/tkextlib/ICONS/tkIcons +195 -0
  634. data/sample/tkextlib/ICONS/tkIcons-sample.kde +658 -0
  635. data/sample/tkextlib/ICONS/tkIcons.kde +195 -0
  636. data/sample/tkextlib/ICONS/viewIcons.rb +330 -0
  637. data/sample/tkextlib/blt/barchart5.rb +102 -0
  638. data/sample/tkextlib/blt/calendar.rb +118 -0
  639. data/sample/tkextlib/blt/graph6.rb +2223 -0
  640. data/sample/tkextlib/blt/graph7.rb +41 -0
  641. data/sample/tkextlib/blt/graph7a.rb +64 -0
  642. data/sample/tkextlib/blt/graph7b.rb +42 -0
  643. data/sample/tkextlib/blt/graph7c.rb +46 -0
  644. data/sample/tkextlib/blt/images/buckskin.gif +0 -0
  645. data/sample/tkextlib/blt/images/chalk.gif +0 -0
  646. data/sample/tkextlib/blt/images/qv100.t.gif +0 -0
  647. data/sample/tkextlib/blt/images/rain.gif +0 -0
  648. data/sample/tkextlib/blt/images/sample.gif +0 -0
  649. data/sample/tkextlib/blt/pareto.rb +91 -0
  650. data/sample/tkextlib/blt/plot1.rb +10 -0
  651. data/sample/tkextlib/blt/plot1b.rb +11 -0
  652. data/sample/tkextlib/blt/readme.txt +2 -0
  653. data/sample/tkextlib/blt/scripts/stipples.rb +157 -0
  654. data/sample/tkextlib/blt/winop1.rb +41 -0
  655. data/sample/tkextlib/blt/winop2.rb +29 -0
  656. data/sample/tkextlib/bwidget/Orig_LICENSE.txt +53 -0
  657. data/sample/tkextlib/bwidget/basic.rb +199 -0
  658. data/sample/tkextlib/bwidget/bwidget.xbm +46 -0
  659. data/sample/tkextlib/bwidget/demo.rb +244 -0
  660. data/sample/tkextlib/bwidget/dnd.rb +47 -0
  661. data/sample/tkextlib/bwidget/manager.rb +151 -0
  662. data/sample/tkextlib/bwidget/select.rb +83 -0
  663. data/sample/tkextlib/bwidget/tmpldlg.rb +222 -0
  664. data/sample/tkextlib/bwidget/tree.rb +290 -0
  665. data/sample/tkextlib/bwidget/x1.xbm +2258 -0
  666. data/sample/tkextlib/iwidgets/catalog_demo/Orig_LICENSE.txt +42 -0
  667. data/sample/tkextlib/iwidgets/catalog_demo/images/box.xbm +14 -0
  668. data/sample/tkextlib/iwidgets/catalog_demo/images/clear.gif +0 -0
  669. data/sample/tkextlib/iwidgets/catalog_demo/images/close.gif +0 -0
  670. data/sample/tkextlib/iwidgets/catalog_demo/images/copy.gif +0 -0
  671. data/sample/tkextlib/iwidgets/catalog_demo/images/cut.gif +0 -0
  672. data/sample/tkextlib/iwidgets/catalog_demo/images/exit.gif +0 -0
  673. data/sample/tkextlib/iwidgets/catalog_demo/images/find.gif +0 -0
  674. data/sample/tkextlib/iwidgets/catalog_demo/images/help.gif +0 -0
  675. data/sample/tkextlib/iwidgets/catalog_demo/images/line.xbm +14 -0
  676. data/sample/tkextlib/iwidgets/catalog_demo/images/mag.gif +0 -0
  677. data/sample/tkextlib/iwidgets/catalog_demo/images/new.gif +0 -0
  678. data/sample/tkextlib/iwidgets/catalog_demo/images/open.gif +0 -0
  679. data/sample/tkextlib/iwidgets/catalog_demo/images/oval.xbm +14 -0
  680. data/sample/tkextlib/iwidgets/catalog_demo/images/paste.gif +0 -0
  681. data/sample/tkextlib/iwidgets/catalog_demo/images/points.xbm +14 -0
  682. data/sample/tkextlib/iwidgets/catalog_demo/images/poly.gif +0 -0
  683. data/sample/tkextlib/iwidgets/catalog_demo/images/print.gif +0 -0
  684. data/sample/tkextlib/iwidgets/catalog_demo/images/ruler.gif +0 -0
  685. data/sample/tkextlib/iwidgets/catalog_demo/images/save.gif +0 -0
  686. data/sample/tkextlib/iwidgets/catalog_demo/images/select.gif +0 -0
  687. data/sample/tkextlib/iwidgets/catalog_demo/images/text.xbm +14 -0
  688. data/sample/tkextlib/iwidgets/sample/buttonbox.rb +23 -0
  689. data/sample/tkextlib/iwidgets/sample/calendar.rb +11 -0
  690. data/sample/tkextlib/iwidgets/sample/canvasprintbox.rb +9 -0
  691. data/sample/tkextlib/iwidgets/sample/canvasprintdialog.rb +9 -0
  692. data/sample/tkextlib/iwidgets/sample/checkbox.rb +13 -0
  693. data/sample/tkextlib/iwidgets/sample/combobox.rb +33 -0
  694. data/sample/tkextlib/iwidgets/sample/dateentry.rb +8 -0
  695. data/sample/tkextlib/iwidgets/sample/datefield.rb +9 -0
  696. data/sample/tkextlib/iwidgets/sample/dialog.rb +21 -0
  697. data/sample/tkextlib/iwidgets/sample/dialogshell.rb +15 -0
  698. data/sample/tkextlib/iwidgets/sample/disjointlistbox.rb +17 -0
  699. data/sample/tkextlib/iwidgets/sample/entryfield-1.rb +40 -0
  700. data/sample/tkextlib/iwidgets/sample/entryfield-2.rb +45 -0
  701. data/sample/tkextlib/iwidgets/sample/entryfield-3.rb +41 -0
  702. data/sample/tkextlib/iwidgets/sample/extbutton.rb +21 -0
  703. data/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb +9 -0
  704. data/sample/tkextlib/iwidgets/sample/extfileselectiondialog.rb +30 -0
  705. data/sample/tkextlib/iwidgets/sample/feedback.rb +11 -0
  706. data/sample/tkextlib/iwidgets/sample/fileselectionbox.rb +9 -0
  707. data/sample/tkextlib/iwidgets/sample/fileselectiondialog.rb +29 -0
  708. data/sample/tkextlib/iwidgets/sample/finddialog.rb +16 -0
  709. data/sample/tkextlib/iwidgets/sample/hierarchy.rb +26 -0
  710. data/sample/tkextlib/iwidgets/sample/hyperhelp.rb +15 -0
  711. data/sample/tkextlib/iwidgets/sample/labeledframe.rb +15 -0
  712. data/sample/tkextlib/iwidgets/sample/labeledwidget.rb +14 -0
  713. data/sample/tkextlib/iwidgets/sample/mainwindow.rb +65 -0
  714. data/sample/tkextlib/iwidgets/sample/menubar.rb +125 -0
  715. data/sample/tkextlib/iwidgets/sample/menubar2.rb +45 -0
  716. data/sample/tkextlib/iwidgets/sample/messagebox1.rb +20 -0
  717. data/sample/tkextlib/iwidgets/sample/messagebox2.rb +20 -0
  718. data/sample/tkextlib/iwidgets/sample/messagedialog.rb +45 -0
  719. data/sample/tkextlib/iwidgets/sample/notebook.rb +31 -0
  720. data/sample/tkextlib/iwidgets/sample/notebook2.rb +31 -0
  721. data/sample/tkextlib/iwidgets/sample/optionmenu.rb +15 -0
  722. data/sample/tkextlib/iwidgets/sample/panedwindow.rb +23 -0
  723. data/sample/tkextlib/iwidgets/sample/panedwindow2.rb +23 -0
  724. data/sample/tkextlib/iwidgets/sample/promptdialog.rb +18 -0
  725. data/sample/tkextlib/iwidgets/sample/pushbutton.rb +10 -0
  726. data/sample/tkextlib/iwidgets/sample/radiobox.rb +14 -0
  727. data/sample/tkextlib/iwidgets/sample/scrolledcanvas.rb +14 -0
  728. data/sample/tkextlib/iwidgets/sample/scrolledframe.rb +19 -0
  729. data/sample/tkextlib/iwidgets/sample/scrolledhtml.rb +16 -0
  730. data/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb +23 -0
  731. data/sample/tkextlib/iwidgets/sample/scrolledtext.rb +12 -0
  732. data/sample/tkextlib/iwidgets/sample/selectionbox.rb +20 -0
  733. data/sample/tkextlib/iwidgets/sample/selectiondialog.rb +13 -0
  734. data/sample/tkextlib/iwidgets/sample/shell.rb +18 -0
  735. data/sample/tkextlib/iwidgets/sample/spindate.rb +8 -0
  736. data/sample/tkextlib/iwidgets/sample/spinint.rb +11 -0
  737. data/sample/tkextlib/iwidgets/sample/spinner.rb +34 -0
  738. data/sample/tkextlib/iwidgets/sample/spintime.rb +8 -0
  739. data/sample/tkextlib/iwidgets/sample/tabnotebook.rb +27 -0
  740. data/sample/tkextlib/iwidgets/sample/tabnotebook2.rb +31 -0
  741. data/sample/tkextlib/iwidgets/sample/tabset.rb +35 -0
  742. data/sample/tkextlib/iwidgets/sample/timeentry.rb +8 -0
  743. data/sample/tkextlib/iwidgets/sample/timefield.rb +9 -0
  744. data/sample/tkextlib/iwidgets/sample/toolbar.rb +153 -0
  745. data/sample/tkextlib/iwidgets/sample/watch.rb +19 -0
  746. data/sample/tkextlib/tcllib/Orig_LICENSE.txt +46 -0
  747. data/sample/tkextlib/tcllib/datefield.rb +30 -0
  748. data/sample/tkextlib/tcllib/plotdemos1.rb +159 -0
  749. data/sample/tkextlib/tcllib/plotdemos2.rb +72 -0
  750. data/sample/tkextlib/tcllib/plotdemos3.rb +84 -0
  751. data/sample/tkextlib/tcllib/xyplot.rb +18 -0
  752. data/sample/tkextlib/tile/Orig_LICENSE.txt +30 -0
  753. data/sample/tkextlib/tile/demo.rb +984 -0
  754. data/sample/tkextlib/tile/iconlib.tcl +110 -0
  755. data/sample/tkextlib/tile/readme.txt +2 -0
  756. data/sample/tkextlib/tile/repeater.tcl +117 -0
  757. data/sample/tkextlib/tile/themes/blue/blue.tcl +149 -0
  758. data/sample/tkextlib/tile/themes/blue/blue/arrowdown-h.gif +0 -0
  759. data/sample/tkextlib/tile/themes/blue/blue/arrowdown-p.gif +0 -0
  760. data/sample/tkextlib/tile/themes/blue/blue/arrowdown.gif +0 -0
  761. data/sample/tkextlib/tile/themes/blue/blue/arrowleft-h.gif +0 -0
  762. data/sample/tkextlib/tile/themes/blue/blue/arrowleft-p.gif +0 -0
  763. data/sample/tkextlib/tile/themes/blue/blue/arrowleft.gif +0 -0
  764. data/sample/tkextlib/tile/themes/blue/blue/arrowright-h.gif +0 -0
  765. data/sample/tkextlib/tile/themes/blue/blue/arrowright-p.gif +0 -0
  766. data/sample/tkextlib/tile/themes/blue/blue/arrowright.gif +0 -0
  767. data/sample/tkextlib/tile/themes/blue/blue/arrowup-h.gif +0 -0
  768. data/sample/tkextlib/tile/themes/blue/blue/arrowup-p.gif +0 -0
  769. data/sample/tkextlib/tile/themes/blue/blue/arrowup.gif +0 -0
  770. data/sample/tkextlib/tile/themes/blue/blue/button-h.gif +0 -0
  771. data/sample/tkextlib/tile/themes/blue/blue/button-n.gif +0 -0
  772. data/sample/tkextlib/tile/themes/blue/blue/button-n.xcf +0 -0
  773. data/sample/tkextlib/tile/themes/blue/blue/button-p.gif +0 -0
  774. data/sample/tkextlib/tile/themes/blue/blue/check-hc.gif +0 -0
  775. data/sample/tkextlib/tile/themes/blue/blue/check-hu.gif +0 -0
  776. data/sample/tkextlib/tile/themes/blue/blue/check-nc.gif +0 -0
  777. data/sample/tkextlib/tile/themes/blue/blue/check-nu.gif +0 -0
  778. data/sample/tkextlib/tile/themes/blue/blue/radio-hc.gif +0 -0
  779. data/sample/tkextlib/tile/themes/blue/blue/radio-hu.gif +0 -0
  780. data/sample/tkextlib/tile/themes/blue/blue/radio-nc.gif +0 -0
  781. data/sample/tkextlib/tile/themes/blue/blue/radio-nu.gif +0 -0
  782. data/sample/tkextlib/tile/themes/blue/blue/sb-thumb-p.gif +0 -0
  783. data/sample/tkextlib/tile/themes/blue/blue/sb-thumb.gif +0 -0
  784. data/sample/tkextlib/tile/themes/blue/blue/sb-vthumb-p.gif +0 -0
  785. data/sample/tkextlib/tile/themes/blue/blue/sb-vthumb.gif +0 -0
  786. data/sample/tkextlib/tile/themes/blue/blue/slider-p.gif +0 -0
  787. data/sample/tkextlib/tile/themes/blue/blue/slider.gif +0 -0
  788. data/sample/tkextlib/tile/themes/blue/blue/vslider-p.gif +0 -0
  789. data/sample/tkextlib/tile/themes/blue/blue/vslider.gif +0 -0
  790. data/sample/tkextlib/tile/themes/blue/pkgIndex.tcl +6 -0
  791. data/sample/tkextlib/tile/themes/keramik/keramik.tcl +194 -0
  792. data/sample/tkextlib/tile/themes/keramik/keramik/arrowdown-n.gif +0 -0
  793. data/sample/tkextlib/tile/themes/keramik/keramik/arrowdown-p.gif +0 -0
  794. data/sample/tkextlib/tile/themes/keramik/keramik/arrowleft-n.gif +0 -0
  795. data/sample/tkextlib/tile/themes/keramik/keramik/arrowleft-p.gif +0 -0
  796. data/sample/tkextlib/tile/themes/keramik/keramik/arrowright-n.gif +0 -0
  797. data/sample/tkextlib/tile/themes/keramik/keramik/arrowright-p.gif +0 -0
  798. data/sample/tkextlib/tile/themes/keramik/keramik/arrowup-n.gif +0 -0
  799. data/sample/tkextlib/tile/themes/keramik/keramik/arrowup-p.gif +0 -0
  800. data/sample/tkextlib/tile/themes/keramik/keramik/button-d.gif +0 -0
  801. data/sample/tkextlib/tile/themes/keramik/keramik/button-h.gif +0 -0
  802. data/sample/tkextlib/tile/themes/keramik/keramik/button-n.gif +0 -0
  803. data/sample/tkextlib/tile/themes/keramik/keramik/button-p.gif +0 -0
  804. data/sample/tkextlib/tile/themes/keramik/keramik/button-s.gif +0 -0
  805. data/sample/tkextlib/tile/themes/keramik/keramik/check-c.gif +0 -0
  806. data/sample/tkextlib/tile/themes/keramik/keramik/check-u.gif +0 -0
  807. data/sample/tkextlib/tile/themes/keramik/keramik/hsb-n.gif +0 -0
  808. data/sample/tkextlib/tile/themes/keramik/keramik/hsb-p.gif +0 -0
  809. data/sample/tkextlib/tile/themes/keramik/keramik/hslider-n.gif +0 -0
  810. data/sample/tkextlib/tile/themes/keramik/keramik/mbut-a.gif +0 -0
  811. data/sample/tkextlib/tile/themes/keramik/keramik/mbut-arrow-n.gif +0 -0
  812. data/sample/tkextlib/tile/themes/keramik/keramik/mbut-d.gif +0 -0
  813. data/sample/tkextlib/tile/themes/keramik/keramik/mbut-n.gif +0 -0
  814. data/sample/tkextlib/tile/themes/keramik/keramik/radio-c.gif +0 -0
  815. data/sample/tkextlib/tile/themes/keramik/keramik/radio-u.gif +0 -0
  816. data/sample/tkextlib/tile/themes/keramik/keramik/tab-n.gif +0 -0
  817. data/sample/tkextlib/tile/themes/keramik/keramik/tab-p.gif +0 -0
  818. data/sample/tkextlib/tile/themes/keramik/keramik/tbar-a.gif +0 -0
  819. data/sample/tkextlib/tile/themes/keramik/keramik/tbar-n.gif +0 -0
  820. data/sample/tkextlib/tile/themes/keramik/keramik/tbar-p.gif +0 -0
  821. data/sample/tkextlib/tile/themes/keramik/keramik/vsb-n.gif +0 -0
  822. data/sample/tkextlib/tile/themes/keramik/keramik/vsb-p.gif +0 -0
  823. data/sample/tkextlib/tile/themes/keramik/keramik/vslider-n.gif +0 -0
  824. data/sample/tkextlib/tile/themes/keramik/pkgIndex.tcl +15 -0
  825. data/sample/tkextlib/tile/themes/kroc.rb +227 -0
  826. data/sample/tkextlib/tile/themes/kroc/kroc.tcl +163 -0
  827. data/sample/tkextlib/tile/themes/kroc/kroc/button-h.gif +0 -0
  828. data/sample/tkextlib/tile/themes/kroc/kroc/button-n.gif +0 -0
  829. data/sample/tkextlib/tile/themes/kroc/kroc/button-p.gif +0 -0
  830. data/sample/tkextlib/tile/themes/kroc/kroc/check-hc.gif +0 -0
  831. data/sample/tkextlib/tile/themes/kroc/kroc/check-hu.gif +0 -0
  832. data/sample/tkextlib/tile/themes/kroc/kroc/check-nc.gif +0 -0
  833. data/sample/tkextlib/tile/themes/kroc/kroc/check-nu.gif +0 -0
  834. data/sample/tkextlib/tile/themes/kroc/kroc/radio-hc.gif +0 -0
  835. data/sample/tkextlib/tile/themes/kroc/kroc/radio-hu.gif +0 -0
  836. data/sample/tkextlib/tile/themes/kroc/kroc/radio-nc.gif +0 -0
  837. data/sample/tkextlib/tile/themes/kroc/kroc/radio-nu.gif +0 -0
  838. data/sample/tkextlib/tile/themes/kroc/pkgIndex.tcl +15 -0
  839. data/sample/tkextlib/tile/themes/plastik/pkgIndex.tcl +16 -0
  840. data/sample/tkextlib/tile/themes/plastik/plastik.tcl +125 -0
  841. data/sample/tkextlib/tile/themes/plastik/plastik/arrowdown-n.gif +0 -0
  842. data/sample/tkextlib/tile/themes/plastik/plastik/arrowdown-p.gif +0 -0
  843. data/sample/tkextlib/tile/themes/plastik/plastik/arrowleft-n.gif +0 -0
  844. data/sample/tkextlib/tile/themes/plastik/plastik/arrowleft-p.gif +0 -0
  845. data/sample/tkextlib/tile/themes/plastik/plastik/arrowright-n.gif +0 -0
  846. data/sample/tkextlib/tile/themes/plastik/plastik/arrowright-p.gif +0 -0
  847. data/sample/tkextlib/tile/themes/plastik/plastik/arrowup-n.gif +0 -0
  848. data/sample/tkextlib/tile/themes/plastik/plastik/arrowup-p.gif +0 -0
  849. data/sample/tkextlib/tile/themes/plastik/plastik/button-h.gif +0 -0
  850. data/sample/tkextlib/tile/themes/plastik/plastik/button-n.gif +0 -0
  851. data/sample/tkextlib/tile/themes/plastik/plastik/button-p.gif +0 -0
  852. data/sample/tkextlib/tile/themes/plastik/plastik/check-hc.gif +0 -0
  853. data/sample/tkextlib/tile/themes/plastik/plastik/check-hu.gif +0 -0
  854. data/sample/tkextlib/tile/themes/plastik/plastik/check-nc.gif +0 -0
  855. data/sample/tkextlib/tile/themes/plastik/plastik/check-nu.gif +0 -0
  856. data/sample/tkextlib/tile/themes/plastik/plastik/check-pc.gif +0 -0
  857. data/sample/tkextlib/tile/themes/plastik/plastik/hsb-n.gif +0 -0
  858. data/sample/tkextlib/tile/themes/plastik/plastik/hslider-n.gif +0 -0
  859. data/sample/tkextlib/tile/themes/plastik/plastik/radio-hc.gif +0 -0
  860. data/sample/tkextlib/tile/themes/plastik/plastik/radio-hu.gif +0 -0
  861. data/sample/tkextlib/tile/themes/plastik/plastik/radio-nc.gif +0 -0
  862. data/sample/tkextlib/tile/themes/plastik/plastik/radio-nu.gif +0 -0
  863. data/sample/tkextlib/tile/themes/plastik/plastik/radio-pc.gif +0 -0
  864. data/sample/tkextlib/tile/themes/plastik/plastik/vsb-n.gif +0 -0
  865. data/sample/tkextlib/tile/themes/plastik/plastik/vslider-n.gif +0 -0
  866. data/sample/tkextlib/tile/toolbutton.tcl +152 -0
  867. data/sample/tkextlib/tkHTML/Orig_COPYRIGHT.txt +12 -0
  868. data/sample/tkextlib/tkHTML/README +12 -0
  869. data/sample/tkextlib/tkHTML/hv.rb +314 -0
  870. data/sample/tkextlib/tkHTML/page1/image1 +0 -0
  871. data/sample/tkextlib/tkHTML/page1/image10 +0 -0
  872. data/sample/tkextlib/tkHTML/page1/image11 +0 -0
  873. data/sample/tkextlib/tkHTML/page1/image12 +0 -0
  874. data/sample/tkextlib/tkHTML/page1/image13 +0 -0
  875. data/sample/tkextlib/tkHTML/page1/image14 +0 -0
  876. data/sample/tkextlib/tkHTML/page1/image2 +0 -0
  877. data/sample/tkextlib/tkHTML/page1/image3 +0 -0
  878. data/sample/tkextlib/tkHTML/page1/image4 +0 -0
  879. data/sample/tkextlib/tkHTML/page1/image5 +0 -0
  880. data/sample/tkextlib/tkHTML/page1/image6 +0 -0
  881. data/sample/tkextlib/tkHTML/page1/image7 +0 -0
  882. data/sample/tkextlib/tkHTML/page1/image8 +0 -0
  883. data/sample/tkextlib/tkHTML/page1/image9 +0 -0
  884. data/sample/tkextlib/tkHTML/page1/index.html +115 -0
  885. data/sample/tkextlib/tkHTML/page2/image1 +0 -0
  886. data/sample/tkextlib/tkHTML/page2/image10 +0 -0
  887. data/sample/tkextlib/tkHTML/page2/image11 +0 -0
  888. data/sample/tkextlib/tkHTML/page2/image12 +0 -0
  889. data/sample/tkextlib/tkHTML/page2/image13 +0 -0
  890. data/sample/tkextlib/tkHTML/page2/image14 +0 -0
  891. data/sample/tkextlib/tkHTML/page2/image15 +0 -0
  892. data/sample/tkextlib/tkHTML/page2/image16 +0 -0
  893. data/sample/tkextlib/tkHTML/page2/image17 +0 -0
  894. data/sample/tkextlib/tkHTML/page2/image18 +0 -0
  895. data/sample/tkextlib/tkHTML/page2/image19 +0 -0
  896. data/sample/tkextlib/tkHTML/page2/image2 +0 -0
  897. data/sample/tkextlib/tkHTML/page2/image20 +0 -0
  898. data/sample/tkextlib/tkHTML/page2/image21 +0 -0
  899. data/sample/tkextlib/tkHTML/page2/image22 +0 -0
  900. data/sample/tkextlib/tkHTML/page2/image23 +0 -0
  901. data/sample/tkextlib/tkHTML/page2/image24 +0 -0
  902. data/sample/tkextlib/tkHTML/page2/image25 +0 -0
  903. data/sample/tkextlib/tkHTML/page2/image26 +0 -0
  904. data/sample/tkextlib/tkHTML/page2/image27 +0 -0
  905. data/sample/tkextlib/tkHTML/page2/image28 +0 -0
  906. data/sample/tkextlib/tkHTML/page2/image29 +0 -0
  907. data/sample/tkextlib/tkHTML/page2/image3 +0 -0
  908. data/sample/tkextlib/tkHTML/page2/image30 +0 -0
  909. data/sample/tkextlib/tkHTML/page2/image31 +0 -0
  910. data/sample/tkextlib/tkHTML/page2/image32 +0 -0
  911. data/sample/tkextlib/tkHTML/page2/image33 +0 -0
  912. data/sample/tkextlib/tkHTML/page2/image34 +0 -0
  913. data/sample/tkextlib/tkHTML/page2/image35 +0 -0
  914. data/sample/tkextlib/tkHTML/page2/image36 +0 -0
  915. data/sample/tkextlib/tkHTML/page2/image37 +0 -0
  916. data/sample/tkextlib/tkHTML/page2/image38 +0 -0
  917. data/sample/tkextlib/tkHTML/page2/image39 +0 -0
  918. data/sample/tkextlib/tkHTML/page2/image4 +0 -0
  919. data/sample/tkextlib/tkHTML/page2/image5 +0 -0
  920. data/sample/tkextlib/tkHTML/page2/image6 +0 -0
  921. data/sample/tkextlib/tkHTML/page2/image7 +0 -0
  922. data/sample/tkextlib/tkHTML/page2/image8 +0 -0
  923. data/sample/tkextlib/tkHTML/page2/image9 +0 -0
  924. data/sample/tkextlib/tkHTML/page2/index.html +433 -0
  925. data/sample/tkextlib/tkHTML/page3/image1 +0 -0
  926. data/sample/tkextlib/tkHTML/page3/image10 +0 -0
  927. data/sample/tkextlib/tkHTML/page3/image11 +0 -0
  928. data/sample/tkextlib/tkHTML/page3/image12 +0 -0
  929. data/sample/tkextlib/tkHTML/page3/image13 +0 -0
  930. data/sample/tkextlib/tkHTML/page3/image14 +0 -0
  931. data/sample/tkextlib/tkHTML/page3/image2 +0 -0
  932. data/sample/tkextlib/tkHTML/page3/image3 +0 -0
  933. data/sample/tkextlib/tkHTML/page3/image4 +0 -0
  934. data/sample/tkextlib/tkHTML/page3/image5 +0 -0
  935. data/sample/tkextlib/tkHTML/page3/image6 +0 -0
  936. data/sample/tkextlib/tkHTML/page3/image7 +0 -0
  937. data/sample/tkextlib/tkHTML/page3/image8 +0 -0
  938. data/sample/tkextlib/tkHTML/page3/image9 +0 -0
  939. data/sample/tkextlib/tkHTML/page3/index.html +2787 -0
  940. data/sample/tkextlib/tkHTML/page4/image1 +0 -0
  941. data/sample/tkextlib/tkHTML/page4/image2 +0 -0
  942. data/sample/tkextlib/tkHTML/page4/image3 +0 -0
  943. data/sample/tkextlib/tkHTML/page4/image4 +0 -0
  944. data/sample/tkextlib/tkHTML/page4/image5 +0 -0
  945. data/sample/tkextlib/tkHTML/page4/image6 +0 -0
  946. data/sample/tkextlib/tkHTML/page4/image7 +0 -0
  947. data/sample/tkextlib/tkHTML/page4/image8 +0 -0
  948. data/sample/tkextlib/tkHTML/page4/image9 +0 -0
  949. data/sample/tkextlib/tkHTML/page4/index.html +768 -0
  950. data/sample/tkextlib/tkHTML/ss.rb +437 -0
  951. data/sample/tkextlib/tkimg/demo.rb +1479 -0
  952. data/sample/tkextlib/tkimg/license_terms_of_Img_extension +41 -0
  953. data/sample/tkextlib/tkimg/readme.txt +3 -0
  954. data/sample/tkextlib/tktable/Orig_LICENSE.txt +52 -0
  955. data/sample/tkextlib/tktable/basic.rb +61 -0
  956. data/sample/tkextlib/tktable/buttons.rb +77 -0
  957. data/sample/tkextlib/tktable/command.rb +90 -0
  958. data/sample/tkextlib/tktable/debug.rb +102 -0
  959. data/sample/tkextlib/tktable/dynarows.rb +100 -0
  960. data/sample/tkextlib/tktable/maxsize.rb +68 -0
  961. data/sample/tkextlib/tktable/spreadsheet.rb +138 -0
  962. data/sample/tkextlib/tktable/tcllogo.gif +0 -0
  963. data/sample/tkextlib/tktable/valid.rb +89 -0
  964. data/sample/tkextlib/treectrl/bitmaps.rb +77 -0
  965. data/sample/tkextlib/treectrl/demo.rb +1306 -0
  966. data/sample/tkextlib/treectrl/explorer.rb +431 -0
  967. data/sample/tkextlib/treectrl/help.rb +405 -0
  968. data/sample/tkextlib/treectrl/imovie.rb +131 -0
  969. data/sample/tkextlib/treectrl/layout.rb +160 -0
  970. data/sample/tkextlib/treectrl/mailwasher.rb +270 -0
  971. data/sample/tkextlib/treectrl/outlook-folders.rb +125 -0
  972. data/sample/tkextlib/treectrl/outlook-newgroup.rb +449 -0
  973. data/sample/tkextlib/treectrl/pics/big-dll.gif +0 -0
  974. data/sample/tkextlib/treectrl/pics/big-exe.gif +0 -0
  975. data/sample/tkextlib/treectrl/pics/big-file.gif +0 -0
  976. data/sample/tkextlib/treectrl/pics/big-folder.gif +0 -0
  977. data/sample/tkextlib/treectrl/pics/big-txt.gif +0 -0
  978. data/sample/tkextlib/treectrl/pics/checked.gif +0 -0
  979. data/sample/tkextlib/treectrl/pics/file.gif +0 -0
  980. data/sample/tkextlib/treectrl/pics/folder-closed.gif +0 -0
  981. data/sample/tkextlib/treectrl/pics/folder-open.gif +0 -0
  982. data/sample/tkextlib/treectrl/pics/help-book-closed.gif +0 -0
  983. data/sample/tkextlib/treectrl/pics/help-book-open.gif +0 -0
  984. data/sample/tkextlib/treectrl/pics/help-page.gif +0 -0
  985. data/sample/tkextlib/treectrl/pics/imovie-01.gif +0 -0
  986. data/sample/tkextlib/treectrl/pics/imovie-02.gif +0 -0
  987. data/sample/tkextlib/treectrl/pics/imovie-03.gif +0 -0
  988. data/sample/tkextlib/treectrl/pics/imovie-04.gif +0 -0
  989. data/sample/tkextlib/treectrl/pics/imovie-05.gif +0 -0
  990. data/sample/tkextlib/treectrl/pics/imovie-06.gif +0 -0
  991. data/sample/tkextlib/treectrl/pics/imovie-07.gif +0 -0
  992. data/sample/tkextlib/treectrl/pics/internet-check-off.gif +0 -0
  993. data/sample/tkextlib/treectrl/pics/internet-check-on.gif +0 -0
  994. data/sample/tkextlib/treectrl/pics/internet-print.gif +0 -0
  995. data/sample/tkextlib/treectrl/pics/internet-radio-off.gif +0 -0
  996. data/sample/tkextlib/treectrl/pics/internet-radio-on.gif +0 -0
  997. data/sample/tkextlib/treectrl/pics/internet-search.gif +0 -0
  998. data/sample/tkextlib/treectrl/pics/internet-security.gif +0 -0
  999. data/sample/tkextlib/treectrl/pics/mac-collapse.gif +0 -0
  1000. data/sample/tkextlib/treectrl/pics/mac-expand.gif +0 -0
  1001. data/sample/tkextlib/treectrl/pics/outlook-arrow.gif +0 -0
  1002. data/sample/tkextlib/treectrl/pics/outlook-clip.gif +0 -0
  1003. data/sample/tkextlib/treectrl/pics/outlook-deleted.gif +0 -0
  1004. data/sample/tkextlib/treectrl/pics/outlook-draft.gif +0 -0
  1005. data/sample/tkextlib/treectrl/pics/outlook-folder.gif +0 -0
  1006. data/sample/tkextlib/treectrl/pics/outlook-group.gif +0 -0
  1007. data/sample/tkextlib/treectrl/pics/outlook-inbox.gif +0 -0
  1008. data/sample/tkextlib/treectrl/pics/outlook-local.gif +0 -0
  1009. data/sample/tkextlib/treectrl/pics/outlook-main.gif +0 -0
  1010. data/sample/tkextlib/treectrl/pics/outlook-outbox.gif +0 -0
  1011. data/sample/tkextlib/treectrl/pics/outlook-read-2.gif +0 -0
  1012. data/sample/tkextlib/treectrl/pics/outlook-read.gif +0 -0
  1013. data/sample/tkextlib/treectrl/pics/outlook-sent.gif +0 -0
  1014. data/sample/tkextlib/treectrl/pics/outlook-server.gif +0 -0
  1015. data/sample/tkextlib/treectrl/pics/outlook-unread.gif +0 -0
  1016. data/sample/tkextlib/treectrl/pics/outlook-watch.gif +0 -0
  1017. data/sample/tkextlib/treectrl/pics/sky.gif +0 -0
  1018. data/sample/tkextlib/treectrl/pics/small-dll.gif +0 -0
  1019. data/sample/tkextlib/treectrl/pics/small-exe.gif +0 -0
  1020. data/sample/tkextlib/treectrl/pics/small-file.gif +0 -0
  1021. data/sample/tkextlib/treectrl/pics/small-folder.gif +0 -0
  1022. data/sample/tkextlib/treectrl/pics/small-txt.gif +0 -0
  1023. data/sample/tkextlib/treectrl/pics/unchecked.gif +0 -0
  1024. data/sample/tkextlib/treectrl/random.rb +509 -0
  1025. data/sample/tkextlib/treectrl/readme.txt +2 -0
  1026. data/sample/tkextlib/treectrl/www-options.rb +304 -0
  1027. data/sample/tkextlib/vu/Orig_LICENSE.txt +51 -0
  1028. data/sample/tkextlib/vu/README.txt +50 -0
  1029. data/sample/tkextlib/vu/canvItems.rb +91 -0
  1030. data/sample/tkextlib/vu/canvSticker.rb +83 -0
  1031. data/sample/tkextlib/vu/canvSticker2.rb +102 -0
  1032. data/sample/tkextlib/vu/dial_demo.rb +114 -0
  1033. data/sample/tkextlib/vu/m128_000.xbm +174 -0
  1034. data/sample/tkextlib/vu/oscilloscope.rb +69 -0
  1035. data/sample/tkextlib/vu/pie.rb +57 -0
  1036. data/sample/tkextlib/vu/vu_demo.rb +68 -0
  1037. data/sample/tkfrom.rb +133 -0
  1038. data/sample/tkhello.rb +11 -0
  1039. data/sample/tkline.rb +48 -0
  1040. data/sample/tkmenubutton.rb +136 -0
  1041. data/sample/tkmsgcat-load_rb.rb +103 -0
  1042. data/sample/tkmsgcat-load_rb2.rb +103 -0
  1043. data/sample/tkmsgcat-load_tk.rb +119 -0
  1044. data/sample/tkmulticolumnlist.rb +744 -0
  1045. data/sample/tkmultilistbox.rb +655 -0
  1046. data/sample/tkmultilistframe.rb +941 -0
  1047. data/sample/tkoptdb-safeTk.rb +74 -0
  1048. data/sample/tkoptdb.rb +107 -0
  1049. data/sample/tkrttimer.rb +78 -0
  1050. data/sample/tksleep_sample.rb +30 -0
  1051. data/sample/tktextframe.rb +282 -0
  1052. data/sample/tktextio.rb +1061 -0
  1053. data/sample/tktimer.rb +51 -0
  1054. data/sample/tktimer2.rb +48 -0
  1055. data/sample/tktimer3.rb +60 -0
  1056. data/sample/tktree.rb +104 -0
  1057. data/sample/tktree.tcl +305 -0
  1058. data/sample/ttk_wrapper.rb +155 -0
  1059. data/tk.gemspec +24 -0
  1060. metadata +1144 -0
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: false
2
+ #
3
+ # tk/txtwin_abst.rb : TkTextWin abstract class
4
+ #
5
+ require 'tk'
6
+
7
+ class TkTextWin<TkWindow
8
+ TkCommandNames = [].freeze
9
+ #def create_self
10
+ # fail RuntimeError, "TkTextWin is an abstract class"
11
+ #end
12
+ #private :create_self
13
+
14
+ def bbox(index)
15
+ list(tk_send_without_enc('bbox', index))
16
+ end
17
+ def delete(first, last=None)
18
+ tk_send_without_enc('delete', first, last)
19
+ self
20
+ end
21
+ def get(*index)
22
+ _fromUTF8(tk_send_without_enc('get', *index))
23
+ end
24
+ def insert(index, *args)
25
+ tk_send('insert', index, *args)
26
+ self
27
+ end
28
+ def scan_mark(x, y)
29
+ tk_send_without_enc('scan', 'mark', x, y)
30
+ self
31
+ end
32
+ def scan_dragto(x, y)
33
+ tk_send_without_enc('scan', 'dragto', x, y)
34
+ self
35
+ end
36
+ def see(index)
37
+ tk_send_without_enc('see', index)
38
+ self
39
+ end
40
+ end
@@ -0,0 +1,398 @@
1
+ # frozen_string_literal: false
2
+ #
3
+ # tk/validation.rb - validation support module for entry, spinbox, and so on
4
+ #
5
+ require 'tk'
6
+
7
+ module Tk
8
+ module ValidateConfigure
9
+ def self.__def_validcmd(scope, klass, keys=nil)
10
+ keys = klass._config_keys unless keys
11
+ keys.each{|key|
12
+ eval("def #{key}(*args, &b)
13
+ __validcmd_call(#{klass.name}, '#{key}', *args, &b)
14
+ end", scope)
15
+ }
16
+ end
17
+
18
+ def __validcmd_call(klass, key, *args, &b)
19
+ return cget(key) if args.empty? && !b
20
+
21
+ cmd = (b)? proc(&b) : args.shift
22
+
23
+ if cmd.kind_of?(klass)
24
+ configure(key, cmd)
25
+ elsif !args.empty?
26
+ configure(key, [cmd, args])
27
+ else
28
+ configure(key, cmd)
29
+ end
30
+ end
31
+
32
+ def __validation_class_list
33
+ # maybe need to override
34
+ []
35
+ end
36
+
37
+ def __get_validate_key2class
38
+ k2c = {}
39
+ __validation_class_list.each{|klass|
40
+ klass._config_keys.each{|key|
41
+ k2c[key.to_s] = klass
42
+ }
43
+ }
44
+ k2c
45
+ end
46
+
47
+ def __conv_vcmd_on_hash_kv(keys)
48
+ key2class = __get_validate_key2class
49
+
50
+ keys = _symbolkey2str(keys)
51
+ key2class.each{|key, klass|
52
+ if keys[key].kind_of?(Array)
53
+ cmd, *args = keys[key]
54
+ #keys[key] = klass.new(cmd, args.join(' '))
55
+ keys[key] = klass.new(cmd, *args)
56
+ # elsif keys[key].kind_of?(Proc) || keys[key].kind_of?(Method)
57
+ elsif TkComm._callback_entry?(keys[key])
58
+ keys[key] = klass.new(keys[key])
59
+ end
60
+ }
61
+ keys
62
+ end
63
+
64
+ def create_self(keys)
65
+ super(__conv_vcmd_on_hash_kv(keys))
66
+ end
67
+ private :create_self
68
+
69
+ def configure(slot, value=TkComm::None)
70
+ if slot.kind_of?(Hash)
71
+ super(__conv_vcmd_on_hash_kv(slot))
72
+ else
73
+ super(__conv_vcmd_on_hash_kv(slot=>value))
74
+ end
75
+ self
76
+ end
77
+ =begin
78
+ def configure(slot, value=TkComm::None)
79
+ key2class = __get_validate_key2class
80
+
81
+ if slot.kind_of?(Hash)
82
+ slot = _symbolkey2str(slot)
83
+ key2class.each{|key, klass|
84
+ if slot[key].kind_of?(Array)
85
+ cmd, *args = slot[key]
86
+ slot[key] = klass.new(cmd, args.join(' '))
87
+ elsif slot[key].kind_of?(Proc) || slot[key].kind_of?(Method)
88
+ slot[key] = klass.new(slot[key])
89
+ end
90
+ }
91
+ super(slot)
92
+
93
+ else
94
+ slot = slot.to_s
95
+ if (klass = key2class[slot])
96
+ if value.kind_of?(Array)
97
+ cmd, *args = value
98
+ value = klass.new(cmd, args.join(' '))
99
+ elsif value.kind_of?(Proc) || value.kind_of?(Method)
100
+ value = klass.new(value)
101
+ end
102
+ end
103
+ super(slot, value)
104
+ end
105
+
106
+ self
107
+ end
108
+ =end
109
+ end
110
+
111
+ module ItemValidateConfigure
112
+ def self.__def_validcmd(scope, klass, keys=nil)
113
+ keys = klass._config_keys unless keys
114
+ keys.each{|key|
115
+ eval("def item_#{key}(id, *args, &b)
116
+ __item_validcmd_call(#{klass.name}, '#{key}', id, *args, &b)
117
+ end", scope)
118
+ }
119
+ end
120
+
121
+ def __item_validcmd_call(tagOrId, klass, key, *args, &b)
122
+ return itemcget(tagid(tagOrId), key) if args.empty? && !b
123
+
124
+ cmd = (b)? proc(&b) : args.shift
125
+
126
+ if cmd.kind_of?(klass)
127
+ itemconfigure(tagid(tagOrId), key, cmd)
128
+ elsif !args.empty?
129
+ itemconfigure(tagid(tagOrId), key, [cmd, args])
130
+ else
131
+ itemconfigure(tagid(tagOrId), key, cmd)
132
+ end
133
+ end
134
+
135
+ def __item_validation_class_list(id)
136
+ # maybe need to override
137
+ []
138
+ end
139
+
140
+ def __get_item_validate_key2class(id)
141
+ k2c = {}
142
+ __item_validation_class_list(id).each{|klass|
143
+ klass._config_keys.each{|key|
144
+ k2c[key.to_s] = klass
145
+ }
146
+ }
147
+ end
148
+
149
+ def __conv_item_vcmd_on_hash_kv(keys)
150
+ key2class = __get_item_validate_key2class(tagid(tagOrId))
151
+
152
+ keys = _symbolkey2str(keys)
153
+ key2class.each{|key, klass|
154
+ if keys[key].kind_of?(Array)
155
+ cmd, *args = keys[key]
156
+ #keys[key] = klass.new(cmd, args.join(' '))
157
+ keys[key] = klass.new(cmd, *args)
158
+ # elsif keys[key].kind_of?(Proc) || keys[key].kind_of?(Method)
159
+ elsif TkComm._callback_entry?(keys[key])
160
+ keys[key] = klass.new(keys[key])
161
+ end
162
+ }
163
+ keys
164
+ end
165
+
166
+ def itemconfigure(tagOrId, slot, value=TkComm::None)
167
+ if slot.kind_of?(Hash)
168
+ super(__conv_item_vcmd_on_hash_kv(slot))
169
+ else
170
+ super(__conv_item_vcmd_on_hash_kv(slot=>value))
171
+ end
172
+ self
173
+ end
174
+ =begin
175
+ def itemconfigure(tagOrId, slot, value=TkComm::None)
176
+ key2class = __get_item_validate_key2class(tagid(tagOrId))
177
+
178
+ if slot.kind_of?(Hash)
179
+ slot = _symbolkey2str(slot)
180
+ key2class.each{|key, klass|
181
+ if slot[key].kind_of?(Array)
182
+ cmd, *args = slot[key]
183
+ slot[key] = klass.new(cmd, args.join(' '))
184
+ elsif slot[key].kind_of?(Proc) || slot[key].kind_of?(Method)
185
+ slot[key] = klass.new(slot[key])
186
+ end
187
+ }
188
+ super(slot)
189
+
190
+ else
191
+ slot = slot.to_s
192
+ if (klass = key2class[slot])
193
+ if value.kind_of?(Array)
194
+ cmd, *args = value
195
+ value = klass.new(cmd, args.join(' '))
196
+ elsif value.kind_of?(Proc) || value.kind_of?(Method)
197
+ value = klass.new(value)
198
+ end
199
+ end
200
+ super(slot, value)
201
+ end
202
+
203
+ self
204
+ end
205
+ =end
206
+ end
207
+ end
208
+
209
+ class TkValidateCommand
210
+ include TkComm
211
+ extend TkComm
212
+
213
+ class ValidateArgs < TkUtil::CallbackSubst
214
+ KEY_TBL = [
215
+ [ ?d, ?n, :action ],
216
+ [ ?i, ?x, :index ],
217
+ [ ?s, ?e, :current ],
218
+ [ ?v, ?s, :type ],
219
+ [ ?P, ?e, :value ],
220
+ [ ?S, ?e, :string ],
221
+ [ ?V, ?s, :triggered ],
222
+ [ ?W, ?w, :widget ],
223
+ nil
224
+ ]
225
+
226
+ PROC_TBL = [
227
+ [ ?n, TkComm.method(:number) ],
228
+ [ ?s, TkComm.method(:string) ],
229
+ [ ?w, TkComm.method(:window) ],
230
+
231
+ [ ?e, proc{|val|
232
+ #enc = Tk.encoding
233
+ enc = ((Tk.encoding)? Tk.encoding : Tk.encoding_system)
234
+ if enc
235
+ Tk.fromUTF8(TkComm::string(val), enc)
236
+ else
237
+ TkComm::string(val)
238
+ end
239
+ }
240
+ ],
241
+
242
+ [ ?x, proc{|val|
243
+ idx = TkComm::number(val)
244
+ if idx < 0
245
+ nil
246
+ else
247
+ idx
248
+ end
249
+ }
250
+ ],
251
+
252
+ nil
253
+ ]
254
+
255
+ =begin
256
+ # for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
257
+ KEY_TBL.map!{|inf|
258
+ if inf.kind_of?(Array)
259
+ inf[0] = inf[0].getbyte(0) if inf[0].kind_of?(String)
260
+ inf[1] = inf[1].getbyte(0) if inf[1].kind_of?(String)
261
+ end
262
+ inf
263
+ }
264
+
265
+ PROC_TBL.map!{|inf|
266
+ if inf.kind_of?(Array)
267
+ inf[0] = inf[0].getbyte(0) if inf[0].kind_of?(String)
268
+ end
269
+ inf
270
+ }
271
+ =end
272
+
273
+ _setup_subst_table(KEY_TBL, PROC_TBL);
274
+
275
+ #
276
+ # NOTE: The order of parameters which passed to callback procedure is
277
+ # <extra_arg>, <extra_arg>, ... , <subst_arg>, <subst_arg>, ...
278
+ #
279
+
280
+ #def self._get_extra_args_tbl
281
+ # # return an array of convert procs
282
+ # []
283
+ #end
284
+
285
+ def self.ret_val(val)
286
+ (val)? '1': '0'
287
+ end
288
+ end
289
+
290
+ ###############################################
291
+
292
+ def self._config_keys
293
+ # array of config-option key (string or symbol)
294
+ ['vcmd', 'validatecommand', 'invcmd', 'invalidcommand']
295
+ end
296
+
297
+ def _initialize_for_cb_class(klass, cmd = Proc.new, *args)
298
+ extra_args_tbl = klass._get_extra_args_tbl
299
+
300
+ if args.compact.size > 0
301
+ args.map!{|arg| klass._sym2subst(arg)}
302
+ args = args.join(' ')
303
+ keys = klass._get_subst_key(args)
304
+ if cmd.kind_of?(String)
305
+ id = cmd
306
+ elsif cmd.kind_of?(TkCallbackEntry)
307
+ @id = install_cmd(cmd)
308
+ else
309
+ @id = install_cmd(proc{|*arg|
310
+ ex_args = []
311
+ extra_args_tbl.reverse_each{|conv| ex_args << conv.call(arg.pop)}
312
+ klass.ret_val(cmd.call(
313
+ *(ex_args.concat(klass.scan_args(keys, arg)))
314
+ ))
315
+ }) + ' ' + args
316
+ end
317
+ else
318
+ keys, args = klass._get_all_subst_keys
319
+ if cmd.kind_of?(String)
320
+ id = cmd
321
+ elsif cmd.kind_of?(TkCallbackEntry)
322
+ @id = install_cmd(cmd)
323
+ else
324
+ @id = install_cmd(proc{|*arg|
325
+ ex_args = []
326
+ extra_args_tbl.reverse_each{|conv| ex_args << conv.call(arg.pop)}
327
+ klass.ret_val(cmd.call(
328
+ *(ex_args << klass.new(*klass.scan_args(keys, arg)))
329
+ ))
330
+ }) + ' ' + args
331
+ end
332
+ end
333
+ end
334
+
335
+ def initialize(cmd = Proc.new, *args)
336
+ _initialize_for_cb_class(self.class::ValidateArgs, cmd, *args)
337
+ end
338
+
339
+ def to_eval
340
+ @id
341
+ end
342
+ end
343
+
344
+ module TkValidation
345
+ include Tk::ValidateConfigure
346
+
347
+ class ValidateCmd < TkValidateCommand
348
+ module Action
349
+ Insert = 1
350
+ Delete = 0
351
+ Others = -1
352
+ Focus = -1
353
+ Forced = -1
354
+ Textvariable = -1
355
+ TextVariable = -1
356
+ end
357
+ end
358
+
359
+ #####################################
360
+
361
+ def __validation_class_list
362
+ super() << ValidateCmd
363
+ end
364
+
365
+ Tk::ValidateConfigure.__def_validcmd(binding, ValidateCmd)
366
+
367
+ =begin
368
+ def validatecommand(cmd = Proc.new, args = nil)
369
+ if cmd.kind_of?(ValidateCmd)
370
+ configure('validatecommand', cmd)
371
+ elsif args
372
+ configure('validatecommand', [cmd, args])
373
+ else
374
+ configure('validatecommand', cmd)
375
+ end
376
+ end
377
+ =end
378
+ # def validatecommand(*args, &b)
379
+ # __validcmd_call(ValidateCmd, 'validatecommand', *args, &b)
380
+ # end
381
+ # alias vcmd validatecommand
382
+
383
+ =begin
384
+ def invalidcommand(cmd = Proc.new, args = nil)
385
+ if cmd.kind_of?(ValidateCmd)
386
+ configure('invalidcommand', cmd)
387
+ elsif args
388
+ configure('invalidcommand', [cmd, args])
389
+ else
390
+ configure('invalidcommand', cmd)
391
+ end
392
+ end
393
+ =end
394
+ # def invalidcommand(*args, &b)
395
+ # __validcmd_call(ValidateCmd, 'invalidcommand', *args, &b)
396
+ # end
397
+ # alias invcmd invalidcommand
398
+ end
@@ -0,0 +1,1797 @@
1
+ # frozen_string_literal: false
2
+ #
3
+ # tk/variable.rb : treat Tk variable object
4
+ #
5
+ require 'tk'
6
+
7
+ class TkVariable
8
+ include Tk
9
+ extend TkCore
10
+
11
+ include Comparable
12
+
13
+ #TkCommandNames = ['tkwait'.freeze].freeze
14
+ TkCommandNames = ['vwait'.freeze].freeze
15
+
16
+ #TkVar_CB_TBL = {}
17
+ #TkVar_ID_TBL = {}
18
+ TkVar_CB_TBL = TkCore::INTERP.create_table
19
+ TkVar_ID_TBL = TkCore::INTERP.create_table
20
+ (Tk_VARIABLE_ID = ["v".freeze, TkUtil.untrust("00000")]).instance_eval{
21
+ @mutex = Mutex.new
22
+ def mutex; @mutex; end
23
+ freeze
24
+ }
25
+ TkCore::INTERP.init_ip_env{
26
+ TkVar_CB_TBL.mutex.synchronize{ TkVar_CB_TBL.clear }
27
+ TkVar_ID_TBL.mutex.synchronize{ TkVar_ID_TBL.clear }
28
+ }
29
+
30
+ major, minor, type, patchlevel = TclTkLib.get_version
31
+ USE_OLD_TRACE_OPTION_STYLE = (major < 8) || (major == 8 && minor < 4)
32
+
33
+ #TkCore::INTERP.add_tk_procs('rb_var', 'args',
34
+ # "ruby [format \"TkVariable.callback %%Q!%s!\" $args]")
35
+ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
36
+ if {[set st [catch {eval {ruby_cmd TkVariable callback} $args} ret]] != 0} {
37
+ set idx [string first "\n\n" $ret]
38
+ if {$idx > 0} {
39
+ global errorInfo
40
+ set tcl_backtrace $errorInfo
41
+ set errorInfo [string range $ret [expr $idx + 2] \
42
+ [string length $ret]]
43
+ append errorInfo "\n" $tcl_backtrace
44
+ bgerror [string range $ret 0 [expr $idx - 1]]
45
+ } else {
46
+ bgerror $ret
47
+ }
48
+ return ""
49
+ #return -code $st $ret
50
+ } else {
51
+ return $ret
52
+ }
53
+ EOL
54
+
55
+ #def TkVariable.callback(args)
56
+ def TkVariable.callback(id, name1, name2, op)
57
+ #name1,name2,op = tk_split_list(args)
58
+ #name1,name2,op = tk_split_simplelist(args)
59
+ if cb_obj = TkVar_CB_TBL[id]
60
+ #_get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2,op))
61
+ begin
62
+ _get_eval_string(cb_obj.trace_callback(name2, op))
63
+ rescue SystemExit
64
+ exit(0)
65
+ rescue Interrupt
66
+ exit!(1)
67
+ rescue Exception => e
68
+ begin
69
+ msg = _toUTF8(e.class.inspect) + ': ' +
70
+ _toUTF8(e.message) + "\n" +
71
+ "\n---< backtrace of Ruby side >-----\n" +
72
+ _toUTF8(e.backtrace.join("\n")) +
73
+ "\n---< backtrace of Tk side >-------"
74
+ if TkCore::WITH_ENCODING
75
+ msg.force_encoding('utf-8')
76
+ else
77
+ msg.instance_variable_set(:@encoding, 'utf-8')
78
+ end
79
+ rescue Exception
80
+ msg = e.class.inspect + ': ' + e.message + "\n" +
81
+ "\n---< backtrace of Ruby side >-----\n" +
82
+ e.backtrace.join("\n") +
83
+ "\n---< backtrace of Tk side >-------"
84
+ end
85
+ fail(e, msg)
86
+ end
87
+ =begin
88
+ begin
89
+ raise 'check backtrace'
90
+ rescue
91
+ # ignore backtrace before 'callback'
92
+ pos = -($!.backtrace.size)
93
+ end
94
+ begin
95
+ _get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2,op))
96
+ rescue
97
+ trace = $!.backtrace
98
+ raise $!, "\n#{trace[0]}: #{$!.message} (#{$!.class})\n" +
99
+ "\tfrom #{trace[1..pos].join("\n\tfrom ")}"
100
+ end
101
+ =end
102
+ else
103
+ ''
104
+ end
105
+ end
106
+
107
+ def self.new_hash(val = {})
108
+ if val.kind_of?(Hash)
109
+ self.new(val)
110
+ else
111
+ fail ArgumentError, 'Hash is expected'
112
+ end
113
+ end
114
+
115
+ #
116
+ # default_value is available only when the variable is an assoc array.
117
+ #
118
+ def default_value(val=nil, &b)
119
+ if b
120
+ @def_default = :proc
121
+ @default_val = proc(&b)
122
+ else
123
+ @def_default = :val
124
+ @default_val = val
125
+ end
126
+ self
127
+ end
128
+ def set_default_value(val)
129
+ @def_default = :val
130
+ @default_val = val
131
+ self
132
+ end
133
+ alias default_value= set_default_value
134
+ def default_proc(cmd = Proc.new)
135
+ @def_default = :proc
136
+ @default_val = cmd
137
+ self
138
+ end
139
+
140
+ def undef_default
141
+ @default_val = nil
142
+ @def_default = false
143
+ self
144
+ end
145
+
146
+ def default_value_type
147
+ @type
148
+ end
149
+ def default_element_value_type(idxs)
150
+ if idxs.kind_of?(Array)
151
+ index = idxs.collect{|idx| _get_eval_string(idx, true)}.join(',')
152
+ else
153
+ index = _get_eval_string(idxs, true)
154
+ end
155
+ @element_type[index]
156
+ end
157
+
158
+ def _set_default_value_type_core(type, idxs)
159
+ if type.kind_of?(Class)
160
+ if type == NilClass
161
+ type = nil
162
+ elsif type == Numeric
163
+ type = :numeric
164
+ elsif type == TrueClass || type == FalseClass
165
+ type = :bool
166
+ elsif type == String
167
+ type = :string
168
+ elsif type == Symbol
169
+ type = :symbol
170
+ elsif type == Array
171
+ type = :list
172
+ elsif type <= TkVariable
173
+ type = :variable
174
+ elsif type <= TkWindow
175
+ type = :window
176
+ elsif TkComm._callback_entry_class?(type)
177
+ type = :procedure
178
+ else
179
+ type = nil
180
+ end
181
+ else
182
+ case(type)
183
+ when nil
184
+ type = nil
185
+ when :numeric, 'numeric'
186
+ type = :numeric
187
+ when true, false, :bool, 'bool'
188
+ type = :bool
189
+ when :string, 'string'
190
+ type = :string
191
+ when :symbol, 'symbol'
192
+ type = :symbol
193
+ when :list, 'list'
194
+ type = :list
195
+ when :numlist, 'numlist'
196
+ type = :numlist
197
+ when :variable, 'variable'
198
+ type = :variable
199
+ when :window, 'window'
200
+ type = :window
201
+ when :procedure, 'procedure'
202
+ type = :procedure
203
+ else
204
+ return _set_default_value_type_core(type.class, idxs)
205
+ end
206
+ end
207
+ if idxs
208
+ if idxs.kind_of?(Array)
209
+ index = idxs.collect{|idx| _get_eval_string(idx, true)}.join(',')
210
+ else
211
+ index = _get_eval_string(idxs, true)
212
+ end
213
+ @element_type[index] = type
214
+ else
215
+ @type = type
216
+ end
217
+ type
218
+ end
219
+ private :_set_default_value_type_core
220
+
221
+ def set_default_value_type(type)
222
+ _set_default_value_type_core(type, nil)
223
+ self
224
+ end
225
+ alias default_value_type= set_default_value_type
226
+
227
+ def set_default_element_value_type(idxs, type)
228
+ _set_default_value_type_core(type, idxs)
229
+ self
230
+ end
231
+
232
+ def _to_default_type(val, idxs = nil)
233
+ if idxs
234
+ if idxs.kind_of?(Array)
235
+ index = idxs.collect{|idx| _get_eval_string(idx, true)}.join(',')
236
+ else
237
+ index = _get_eval_string(idxs, true)
238
+ end
239
+ type = @element_type[index]
240
+ else
241
+ type = @type
242
+ end
243
+ return val unless type
244
+ if val.kind_of?(Hash)
245
+ val.keys.each{|k| val[k] = _to_default_type(val[k], idxs) }
246
+ val
247
+ else
248
+ begin
249
+ case(type)
250
+ when :numeric
251
+ number(val)
252
+ when :bool
253
+ TkComm.bool(val)
254
+ when :string
255
+ val
256
+ when :symbol
257
+ val.intern
258
+ when :list
259
+ tk_split_simplelist(val)
260
+ when :numlist
261
+ tk_split_simplelist(val).collect!{|v| number(v)}
262
+ when :variable
263
+ TkVarAccess.new(val)
264
+ when :window
265
+ TkComm.window(val)
266
+ when :procedure
267
+ TkComm.procedure(val)
268
+ else
269
+ val
270
+ end
271
+ rescue
272
+ val
273
+ end
274
+ end
275
+ end
276
+ private :_to_default_type
277
+
278
+ def _to_default_element_type(idxs, val)
279
+ _to_default_type(val, idxs)
280
+ end
281
+ private :_to_default_element_type
282
+
283
+ def initialize(val="", type=nil)
284
+ # @id = Tk_VARIABLE_ID.join('')
285
+ begin
286
+ Tk_VARIABLE_ID.mutex.synchronize{
287
+ @id = Tk_VARIABLE_ID.join(TkCore::INTERP._ip_id_)
288
+ Tk_VARIABLE_ID[1].succ!
289
+ }
290
+ end until INTERP._invoke_without_enc('info', 'globals', @id).empty?
291
+
292
+ TkVar_ID_TBL.mutex.synchronize{
293
+ TkVar_ID_TBL[@id] = self
294
+ }
295
+
296
+ @var = @id
297
+ @elem = nil
298
+
299
+ @def_default = false
300
+ @default_val = nil
301
+
302
+ @trace_var = nil
303
+ @trace_elem = nil
304
+ @trace_opts = nil
305
+
306
+ @type = nil
307
+ var = self
308
+ @element_type = Hash.new{|k,v| var.default_value_type }
309
+
310
+ self.default_value_type = type
311
+
312
+ # teach Tk-ip that @id is global var
313
+ INTERP._invoke_without_enc('global', @id)
314
+ #INTERP._invoke('global', @id)
315
+
316
+ # create and init
317
+ if val.kind_of?(Hash)
318
+ # assoc-array variable
319
+ self[''] = 0
320
+ self.clear
321
+ end
322
+ self.value = val
323
+
324
+ =begin
325
+ if val == []
326
+ # INTERP._eval(format('global %s; set %s(0) 0; unset %s(0)',
327
+ # @id, @id, @id))
328
+ elsif val.kind_of?(Array)
329
+ a = []
330
+ # val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e))}
331
+ # s = '"' + a.join(" ").gsub(/[\[\]$"]/, '\\\\\&') + '"'
332
+ val.each_with_index{|e,i| a.push(i); a.push(e)}
333
+ #s = '"' + array2tk_list(a).gsub(/[\[\]$"]/, '\\\\\&') + '"'
334
+ s = '"' + array2tk_list(a).gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
335
+ INTERP._eval(format('global %s; array set %s %s', @id, @id, s))
336
+ elsif val.kind_of?(Hash)
337
+ #s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
338
+ # .gsub(/[\[\]$"]/, '\\\\\&') + '"'
339
+ s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
340
+ .gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
341
+ INTERP._eval(format('global %s; array set %s %s', @id, @id, s))
342
+ else
343
+ #s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"'
344
+ s = '"' + _get_eval_string(val).gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
345
+ INTERP._eval(format('global %s; set %s %s', @id, @id, s))
346
+ end
347
+ =end
348
+ =begin
349
+ if val.kind_of?(Hash)
350
+ #s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
351
+ # .gsub(/[\[\]$"]/, '\\\\\&') + '"'
352
+ s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
353
+ .gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
354
+ INTERP._eval(Kernel.format('global %s; array set %s %s', @id, @id, s))
355
+ else
356
+ #s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"'
357
+ s = '"' + _get_eval_string(val).gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
358
+ INTERP._eval(Kernel.format('global %s; set %s %s', @id, @id, s))
359
+ end
360
+ =end
361
+ end
362
+
363
+ def wait(on_thread = false, check_root = false)
364
+ on_thread &= (Thread.list.size != 1)
365
+ if on_thread
366
+ if check_root
367
+ INTERP._thread_tkwait('variable', @id)
368
+ else
369
+ INTERP._thread_vwait(@id)
370
+ end
371
+ else
372
+ if check_root
373
+ INTERP._invoke_without_enc('tkwait', 'variable', @id)
374
+ else
375
+ INTERP._invoke_without_enc('vwait', @id)
376
+ end
377
+ end
378
+ end
379
+ def eventloop_wait(check_root = false)
380
+ wait(false, check_root)
381
+ end
382
+ def thread_wait(check_root = false)
383
+ wait(true, check_root)
384
+ end
385
+ def tkwait(on_thread = true)
386
+ wait(on_thread, true)
387
+ end
388
+ def eventloop_tkwait
389
+ wait(false, true)
390
+ end
391
+ def thread_tkwait
392
+ wait(true, true)
393
+ end
394
+
395
+ def id
396
+ @id
397
+ end
398
+
399
+ def ref(*idxs)
400
+ # "#{@id}(#{idxs.collect{|idx| _get_eval_string(idx)}.join(',')})"
401
+ TkVarAccess.new("#{@id}(#{idxs.collect{|idx| _get_eval_string(idx)}.join(',')})")
402
+ end
403
+
404
+ def is_hash?
405
+ #ITNERP._eval("global #{@id}; array exist #{@id}") == '1'
406
+ INTERP._invoke_without_enc('global', @id)
407
+ # INTERP._invoke_without_enc('array', 'exist', @id) == '1'
408
+ TkComm.bool(INTERP._invoke_without_enc('array', 'exist', @id))
409
+ end
410
+
411
+ def is_scalar?
412
+ ! is_hash?
413
+ end
414
+
415
+ def exist?(*elems)
416
+ INTERP._invoke_without_enc('global', @id)
417
+ if elems.empty?
418
+ TkComm.bool(tk_call('info', 'exist', @id))
419
+ else
420
+ # array
421
+ index = elems.collect{|idx| _get_eval_string(idx, true)}.join(',')
422
+ TkComm.bool(tk_call('info', 'exist', "#{@id}")) &&
423
+ TkComm.bool(tk_call('info', 'exist', "#{@id}(#{index})"))
424
+ end
425
+ end
426
+
427
+ def keys
428
+ if (is_scalar?)
429
+ fail RuntimeError, 'cannot get keys from a scalar variable'
430
+ end
431
+ #tk_split_simplelist(INTERP._eval("global #{@id}; array get #{@id}"))
432
+ INTERP._invoke_without_enc('global', @id)
433
+ #tk_split_simplelist(INTERP._fromUTF8(INTERP._invoke_without_enc('array', 'names', @id)))
434
+ tk_split_simplelist(INTERP._invoke_without_enc('array', 'names', @id),
435
+ false, true)
436
+ end
437
+
438
+ def size
439
+ INTERP._invoke_without_enc('global', @id)
440
+ TkComm.number(INTERP._invoke_without_enc('array', 'size', @id))
441
+ end
442
+
443
+ def clear
444
+ if (is_scalar?)
445
+ fail RuntimeError, 'cannot clear a scalar variable'
446
+ end
447
+ keys.each{|k| unset(k)}
448
+ self
449
+ end
450
+
451
+ def update(hash)
452
+ if (is_scalar?)
453
+ fail RuntimeError, 'cannot update a scalar variable'
454
+ end
455
+ hash.each{|k,v| self[k] = v}
456
+ self
457
+ end
458
+
459
+ unless const_defined?(:USE_TCLs_SET_VARIABLE_FUNCTIONS)
460
+ USE_TCLs_SET_VARIABLE_FUNCTIONS = true
461
+ end
462
+
463
+ if USE_TCLs_SET_VARIABLE_FUNCTIONS
464
+ ###########################################################################
465
+ # use Tcl function version of set tkvariable
466
+ ###########################################################################
467
+
468
+ def _value
469
+ #if INTERP._eval("global #{@id}; array exist #{@id}") == '1'
470
+ INTERP._invoke_without_enc('global', @id)
471
+ # if INTERP._invoke('array', 'exist', @id) == '1'
472
+ if TkComm.bool(INTERP._invoke('array', 'exist', @id))
473
+ #Hash[*tk_split_simplelist(INTERP._eval("global #{@id}; array get #{@id}"))]
474
+ Hash[*tk_split_simplelist(INTERP._invoke('array', 'get', @id))]
475
+ else
476
+ _fromUTF8(INTERP._get_global_var(@id))
477
+ end
478
+ end
479
+
480
+ def value=(val)
481
+ val = val._value if !@type && @type != :variable && val.kind_of?(TkVariable)
482
+ if val.kind_of?(Hash)
483
+ self.clear
484
+ val.each{|k, v|
485
+ #INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(k)),
486
+ # _toUTF8(_get_eval_string(v)))
487
+ INTERP._set_global_var2(@id, _get_eval_string(k, true),
488
+ _get_eval_string(v, true))
489
+ }
490
+ self.value
491
+ # elsif val.kind_of?(Array)
492
+ =begin
493
+ INTERP._set_global_var(@id, '')
494
+ val.each{|v|
495
+ #INTERP._set_variable(@id, _toUTF8(_get_eval_string(v)),
496
+ INTERP._set_variable(@id, _get_eval_string(v, true),
497
+ TclTkLib::VarAccessFlag::GLOBAL_ONLY |
498
+ TclTkLib::VarAccessFlag::LEAVE_ERR_MSG |
499
+ TclTkLib::VarAccessFlag::APPEND_VALUE |
500
+ TclTkLib::VarAccessFlag::LIST_ELEMENT)
501
+ }
502
+ self.value
503
+ =end
504
+ # _fromUTF8(INTERP._set_global_var(@id, array2tk_list(val, true)))
505
+ else
506
+ #_fromUTF8(INTERP._set_global_var(@id, _toUTF8(_get_eval_string(val))))
507
+ _fromUTF8(INTERP._set_global_var(@id, _get_eval_string(val, true)))
508
+ end
509
+ end
510
+
511
+ def _element_value(*idxs)
512
+ index = idxs.collect{|idx| _get_eval_string(idx, true)}.join(',')
513
+ begin
514
+ _fromUTF8(INTERP._get_global_var2(@id, index))
515
+ rescue => e
516
+ case @def_default
517
+ when :proc
518
+ @default_val.call(self, *idxs)
519
+ when :val
520
+ @default_val
521
+ else
522
+ fail e
523
+ end
524
+ end
525
+ #_fromUTF8(INTERP._get_global_var2(@id, index))
526
+ #_fromUTF8(INTERP._get_global_var2(@id, _toUTF8(_get_eval_string(index))))
527
+ #_fromUTF8(INTERP._get_global_var2(@id, _get_eval_string(index, true)))
528
+ end
529
+
530
+ def []=(*args)
531
+ val = args.pop
532
+ type = default_element_value_type(args)
533
+ val = val._value if !type && type != :variable && val.kind_of?(TkVariable)
534
+ index = args.collect{|idx| _get_eval_string(idx, true)}.join(',')
535
+ _fromUTF8(INTERP._set_global_var2(@id, index, _get_eval_string(val, true)))
536
+ #_fromUTF8(INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(index)),
537
+ # _toUTF8(_get_eval_string(val))))
538
+ #_fromUTF8(INTERP._set_global_var2(@id, _get_eval_string(index, true),
539
+ # _get_eval_string(val, true)))
540
+ end
541
+
542
+ def unset(*elems)
543
+ if elems.empty?
544
+ INTERP._unset_global_var(@id)
545
+ else
546
+ index = elems.collect{|idx| _get_eval_string(idx, true)}.join(',')
547
+ INTERP._unset_global_var2(@id, index)
548
+ end
549
+ end
550
+ alias remove unset
551
+
552
+ else
553
+ ###########################################################################
554
+ # use Ruby script version of set tkvariable (traditional methods)
555
+ ###########################################################################
556
+
557
+ def _value
558
+ begin
559
+ INTERP._eval(Kernel.format('global %s; set %s', @id, @id))
560
+ #INTERP._eval(Kernel.format('set %s', @id))
561
+ #INTERP._invoke_without_enc('set', @id)
562
+ rescue
563
+ if INTERP._eval(Kernel.format('global %s; array exists %s',
564
+ @id, @id)) != "1"
565
+ #if INTERP._eval(Kernel.format('array exists %s', @id)) != "1"
566
+ #if INTERP._invoke_without_enc('array', 'exists', @id) != "1"
567
+ fail
568
+ else
569
+ Hash[*tk_split_simplelist(INTERP._eval(Kernel.format('global %s; array get %s', @id, @id)))]
570
+ #Hash[*tk_split_simplelist(_fromUTF8(INTERP._invoke_without_enc('array', 'get', @id)))]
571
+ end
572
+ end
573
+ end
574
+
575
+ def value=(val)
576
+ val = val._value if !@type && @type != :variable && val.kind_of?(TkVariable)
577
+ begin
578
+ #s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"'
579
+ s = '"' + _get_eval_string(val).gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
580
+ INTERP._eval(Kernel.format('global %s; set %s %s', @id, @id, s))
581
+ #INTERP._eval(Kernel.format('set %s %s', @id, s))
582
+ #_fromUTF8(INTERP._invoke_without_enc('set', @id, _toUTF8(s)))
583
+ rescue
584
+ if INTERP._eval(Kernel.format('global %s; array exists %s',
585
+ @id, @id)) != "1"
586
+ #if INTERP._eval(Kernel.format('array exists %s', @id)) != "1"
587
+ #if INTERP._invoke_without_enc('array', 'exists', @id) != "1"
588
+ fail
589
+ else
590
+ if val == []
591
+ INTERP._eval(Kernel.format('global %s; unset %s; set %s(0) 0; unset %s(0)', @id, @id, @id, @id))
592
+ #INTERP._eval(Kernel.format('unset %s; set %s(0) 0; unset %s(0)',
593
+ # @id, @id, @id))
594
+ #INTERP._invoke_without_enc('unset', @id)
595
+ #INTERP._invoke_without_enc('set', @id+'(0)', 0)
596
+ #INTERP._invoke_without_enc('unset', @id+'(0)')
597
+ elsif val.kind_of?(Array)
598
+ a = []
599
+ val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e, true))}
600
+ #s = '"' + a.join(" ").gsub(/[\[\]$"]/, '\\\\\&') + '"'
601
+ s = '"' + a.join(" ").gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
602
+ INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s',
603
+ @id, @id, @id, s))
604
+ #INTERP._eval(Kernel.format('unset %s; array set %s %s',
605
+ # @id, @id, s))
606
+ #INTERP._invoke_without_enc('unset', @id)
607
+ #_fromUTF8(INTERP._invoke_without_enc('array','set', @id, _toUTF8(s)))
608
+ elsif val.kind_of?(Hash)
609
+ #s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
610
+ # .gsub(/[\[\]$"]/, '\\\\\&') + '"'
611
+ s = '"' + val.to_a.collect{|e| array2tk_list(e, true)}.join(" ")\
612
+ .gsub(/[\[\]$\\"]/, '\\\\\&') + '"'
613
+ INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s',
614
+ @id, @id, @id, s))
615
+ #INTERP._eval(Kernel.format('unset %s; array set %s %s',
616
+ # @id, @id, s))
617
+ #INTERP._invoke_without_enc('unset', @id)
618
+ #_fromUTF8(INTERP._invoke_without_enc('array','set', @id, _toUTF8(s)))
619
+ else
620
+ fail
621
+ end
622
+ end
623
+ end
624
+ end
625
+
626
+ def _element_value(*idxs)
627
+ index = idxs.collect{|idx| _get_eval_string(idx)}.join(',')
628
+ begin
629
+ INTERP._eval(Kernel.format('global %s; set %s(%s)', @id, @id, index))
630
+ rescue => e
631
+ case @def_default
632
+ when :proc
633
+ @default_val.call(self, *idxs)
634
+ when :val
635
+ @default_val
636
+ else
637
+ fail e
638
+ end
639
+ end
640
+ #INTERP._eval(Kernel.format('global %s; set %s(%s)', @id, @id, index))
641
+ #INTERP._eval(Kernel.format('global %s; set %s(%s)',
642
+ # @id, @id, _get_eval_string(index)))
643
+ #INTERP._eval(Kernel.format('set %s(%s)', @id, _get_eval_string(index)))
644
+ #INTERP._eval('set ' + @id + '(' + _get_eval_string(index) + ')')
645
+ end
646
+
647
+ def []=(*args)
648
+ val = args.pop
649
+ type = default_element_value_type(args)
650
+ val = val._value if !type && type != :variable && val.kind_of?(TkVariable)
651
+ index = args.collect{|idx| _get_eval_string(idx)}.join(',')
652
+ INTERP._eval(Kernel.format('global %s; set %s(%s) %s', @id, @id,
653
+ index, _get_eval_string(val)))
654
+ #INTERP._eval(Kernel.format('global %s; set %s(%s) %s', @id, @id,
655
+ # _get_eval_string(index), _get_eval_string(val)))
656
+ #INTERP._eval(Kernel.format('set %s(%s) %s', @id,
657
+ # _get_eval_string(index), _get_eval_string(val)))
658
+ #INTERP._eval('set ' + @id + '(' + _get_eval_string(index) + ') ' +
659
+ # _get_eval_string(val))
660
+ end
661
+
662
+ def unset(*elems)
663
+ if elems.empty?
664
+ INTERP._eval(Kernel.format('global %s; unset %s', @id, @id))
665
+ #INTERP._eval(Kernel.format('unset %s', @id))
666
+ #INTERP._eval('unset ' + @id)
667
+ else
668
+ index = elems.collect{|idx| _get_eval_string(idx, true)}.join(',')
669
+ INTERP._eval(Kernel.format('global %s; unset %s(%s)', @id, @id, index))
670
+ #INTERP._eval(Kernel.format('global %s; unset %s(%s)',
671
+ # @id, @id, _get_eval_string(elem)))
672
+ #INTERP._eval(Kernel.format('unset %s(%s)', @id, tk_tcl2ruby(elem)))
673
+ #INTERP._eval('unset ' + @id + '(' + _get_eval_string(elem) + ')')
674
+ end
675
+ end
676
+ alias remove unset
677
+
678
+ end
679
+
680
+ protected :_value, :_element_value
681
+
682
+ def value
683
+ _to_default_type(_value)
684
+ end
685
+
686
+ def [](*idxs)
687
+ _to_default_element_type(idxs, _element_value(*idxs))
688
+ end
689
+
690
+ def set_value(val)
691
+ self.value = val
692
+ self
693
+ end
694
+
695
+ def to_hash
696
+ hash = {}
697
+ self.keys.each{|k|
698
+ hash[k] = self[k]
699
+ }
700
+ hash
701
+ end
702
+
703
+ def set_element_value(idxs, val)
704
+ if idxs.kind_of?(Array)
705
+ self[*idxs]=val
706
+ else
707
+ self[idxs]=val
708
+ end
709
+ self
710
+ end
711
+
712
+ def set_value_type(val)
713
+ self.default_value_type = val.class
714
+ self.value = val
715
+ self
716
+ end
717
+
718
+ alias value_type= set_value_type
719
+
720
+ def set_element_value_type(idxs, val)
721
+ self.set_default_element_value_type(idxs, val.class)
722
+ if idxs.kind_of?(Array)
723
+ self[*idxs]=val
724
+ else
725
+ self[idxs]=val
726
+ end
727
+ self
728
+ end
729
+
730
+ def numeric
731
+ number(_value)
732
+ end
733
+ def numeric_element(*idxs)
734
+ number(_element_value(*idxs))
735
+ end
736
+ def set_numeric(val)
737
+ case val
738
+ when Numeric
739
+ self.value=(val)
740
+ when TkVariable
741
+ self.value=(val.numeric)
742
+ else
743
+ raise ArgumentError, "Numeric is expected"
744
+ end
745
+ self
746
+ end
747
+ alias numeric= set_numeric
748
+ def set_numeric_element(idxs, val)
749
+ case val
750
+ when Numeric
751
+ val
752
+ when TkVariable
753
+ val = val.numeric
754
+ else
755
+ raise ArgumentError, "Numeric is expected"
756
+ end
757
+ if idxs.kind_of?(Array)
758
+ self[*idxs]=val
759
+ else
760
+ self[idxs]=val
761
+ end
762
+ self
763
+ end
764
+ def set_numeric_type(val)
765
+ @type = :numeric
766
+ self.numeric=(val)
767
+ self
768
+ end
769
+ alias numeric_type= set_numeric_type
770
+ def set_numeric_element_type(idxs, val)
771
+ self.set_default_element_value_type(idxs, :numeric)
772
+ self.set_numeric_element(idxs, val)
773
+ end
774
+
775
+ def bool
776
+ TkComm.bool(_value)
777
+ =begin
778
+ # see Tcl_GetBoolean man-page
779
+ case _value.downcase
780
+ when '0', 'false', 'no', 'off'
781
+ false
782
+ else
783
+ true
784
+ end
785
+ =end
786
+ end
787
+ def bool_element(*idxs)
788
+ TkComm.bool(_element_value(*idxs))
789
+ end
790
+ def set_bool(val)
791
+ if ! val
792
+ self.value = '0'
793
+ else
794
+ case val.to_s.downcase
795
+ when 'false', '0', 'no', 'off'
796
+ self.value = '0'
797
+ else
798
+ self.value = '1'
799
+ end
800
+ end
801
+ self
802
+ end
803
+ alias bool= set_bool
804
+ def set_bool_element(idxs, val)
805
+ if ! val
806
+ val = '0'
807
+ else
808
+ case val.to_s.downcase
809
+ when 'false', '0', 'no', 'off'
810
+ val = '0'
811
+ else
812
+ val = '1'
813
+ end
814
+ end
815
+ if idxs.kind_of?(Array)
816
+ self[*idxs]=val
817
+ else
818
+ self[idxs]=val
819
+ end
820
+ self
821
+ end
822
+ def set_bool_type(val)
823
+ @type = :bool
824
+ self.bool=(val)
825
+ self
826
+ end
827
+ alias bool_type= set_bool_type
828
+ def set_bool_element_type(idxs, val)
829
+ self.set_default_element_value_type(idxs, :bool)
830
+ self.set_bool_element(idxs, val)
831
+ end
832
+
833
+ def variable
834
+ # keeps a Tcl's variable name
835
+ TkVarAccess.new(self._value)
836
+ end
837
+ def variable_element(*idxs)
838
+ TkVarAccess.new(_element_value(*idxs))
839
+ end
840
+ def set_variable(var)
841
+ var = var.id if var.kind_of?(TkVariable)
842
+ self.value = var
843
+ self
844
+ end
845
+ alias variable= set_variable
846
+ def set_variable_element(idxs, var)
847
+ var = var.id if var.kind_of?(TkVariable)
848
+ if idxs.kind_of?(Array)
849
+ self[*idxs]=var
850
+ else
851
+ self[idxs]=var
852
+ end
853
+ self
854
+ end
855
+ def set_variable_type(var)
856
+ @type = :variable
857
+ var = var.id if var.kind_of?(TkVariable)
858
+ self.value = var
859
+ self
860
+ end
861
+ alias variable_type= set_variable_type
862
+ def set_variable_element_type(idxs, var)
863
+ self.set_default_element_value_type(idxs, :variable)
864
+ self.set_variable_element(idxs, var)
865
+ end
866
+
867
+ def window
868
+ TkComm.window(self._value)
869
+ end
870
+ def window_element(*idxs)
871
+ TkComm.window(_element_value(*idxs))
872
+ end
873
+ def set_window(win)
874
+ win = win._value if win.kind_of?(TkVariable)
875
+ self.value = win
876
+ self
877
+ end
878
+ alias window= set_window
879
+ def set_window_element(idxs, win)
880
+ win = win._value if win.kind_of?(TkVariable)
881
+ if idxs.kind_of?(Array)
882
+ self[*idxs]=win
883
+ else
884
+ self[idxs]=win
885
+ end
886
+ self
887
+ end
888
+ def set_window_type(win)
889
+ @type = :window
890
+ self.window=(win)
891
+ self
892
+ end
893
+ alias window_type= set_window_type
894
+ def set_window_element_type(idxs, win)
895
+ self.set_default_element_value_type(idxs, :window)
896
+ self.set_window_element(idxs, win)
897
+ end
898
+
899
+ def procedure
900
+ TkComm.procedure(self._value)
901
+ end
902
+ def procedure_element(*idxs)
903
+ TkComm.procedure(_element_value(*idxs))
904
+ end
905
+ def set_procedure(cmd)
906
+ self.value = cmd
907
+ self
908
+ end
909
+ alias procedure= set_procedure
910
+ def set_procedure_element(idxs, cmd)
911
+ cmd = cmd._value if cmd.kind_of?(TkVariable)
912
+ if idxs.kind_of?(Array)
913
+ self[*idxs]=cmd
914
+ else
915
+ self[idxs]=cmd
916
+ end
917
+ self
918
+ end
919
+ def set_procedure_type(cmd)
920
+ @type = :procedure
921
+ self.procedure=(cmd)
922
+ self
923
+ end
924
+ alias procedure_type= set_procedure_type
925
+ def set_procedure_element_type(idxs, cmd)
926
+ self.set_default_element_value_type(idxs, :procedure)
927
+ self.set_proceure_element(idxs, cmd)
928
+ end
929
+
930
+ def to_proc
931
+ cmd = self.procedure
932
+ if cmd.respond_to?(:call)
933
+ cmd
934
+ else
935
+ # cmd is a String
936
+ cmd.to_sym.to_proc
937
+ end
938
+ end
939
+
940
+ def to_i
941
+ number(_value).to_i
942
+ end
943
+ alias to_int to_i
944
+ def element_to_i(*idxs)
945
+ number(_element_value(*idxs)).to_i
946
+ end
947
+
948
+ def to_f
949
+ number(_value).to_f
950
+ end
951
+ def element_to_f(*idxs)
952
+ number(_element_value(*idxs)).to_f
953
+ end
954
+
955
+ def to_s
956
+ #string(value).to_s
957
+ _value
958
+ end
959
+ alias string to_s
960
+ alias to_str to_s
961
+ def element_to_s(*idxs)
962
+ _element_value(*idxs)
963
+ end
964
+ def string_element(*idxs)
965
+ _element_value(*idxs)
966
+ end
967
+ def set_string(val)
968
+ val = val._value if val.kind_of?(TkVariable)
969
+ self.value=val
970
+ self
971
+ end
972
+ alias string= set_string
973
+ def set_string_element(idxs, val)
974
+ val = val._value if val.kind_of?(TkVariable)
975
+ if idxs.kind_of?(Array)
976
+ self[*idxs]=val
977
+ else
978
+ self[idxs]=val
979
+ end
980
+ self
981
+ end
982
+ def set_string_type(val)
983
+ @type = :string
984
+ self.string=(val)
985
+ self
986
+ end
987
+ alias string_type= set_string_type
988
+ def set_string_element_type(idxs, val)
989
+ self.set_default_element_value_type(idxs, :string)
990
+ self.set_string_element(idxs, val)
991
+ end
992
+
993
+ def to_sym
994
+ _value.intern
995
+ end
996
+ alias symbol to_sym
997
+ def element_to_sym(*idxs)
998
+ _element_value(*idxs).intern
999
+ end
1000
+ alias symbol_element element_to_sym
1001
+ def set_symbol(val)
1002
+ val = val._value if val.kind_of?(TkVariable)
1003
+ self.value=val
1004
+ self
1005
+ end
1006
+ alias symbol= set_symbol
1007
+ def set_symbol_element(idxs, val)
1008
+ val = val._value if val.kind_of?(TkVariable)
1009
+ if idxs.kind_of?(Array)
1010
+ self[*idxs]=val
1011
+ else
1012
+ self[idxs]=val
1013
+ end
1014
+ self
1015
+ end
1016
+ def set_symbol_type(val)
1017
+ @type = :symbol
1018
+ self.value=(val)
1019
+ self
1020
+ end
1021
+ alias symbol_type= set_symbol_type
1022
+ def set_symbol_element_type(idxs, val)
1023
+ self.set_default_element_value_type(idxs, :symbol)
1024
+ self.set_symbol_element(idxs, val)
1025
+ end
1026
+
1027
+ def list
1028
+ #tk_split_list(value)
1029
+ tk_split_simplelist(_value)
1030
+ end
1031
+ alias to_a list
1032
+ alias to_ary list
1033
+ def list_element(*idxs)
1034
+ tk_split_simplelist(_element_value(*idxs))
1035
+ end
1036
+ alias element_to_a list_element
1037
+
1038
+ def numlist
1039
+ list.collect!{|val| number(val)}
1040
+ end
1041
+ def numlist_element(*idxs)
1042
+ list_element(*idxs).collect!{|val| number(val)}
1043
+ end
1044
+
1045
+ def set_list(val)
1046
+ case val
1047
+ when Array
1048
+ self.value=(val)
1049
+ when TkVariable
1050
+ self.value=(val.list)
1051
+ else
1052
+ raise ArgumentError, "Array is expected"
1053
+ end
1054
+ self
1055
+ end
1056
+ alias list= set_list
1057
+
1058
+ alias set_numlist set_list
1059
+ alias numlist= set_numlist
1060
+
1061
+ def set_list_element(idxs, val)
1062
+ case val
1063
+ when Array
1064
+ val
1065
+ when TkVariable
1066
+ val = val.list
1067
+ else
1068
+ raise ArgumentError, "Array is expected"
1069
+ end
1070
+ if idxs.kind_of?(Array)
1071
+ self[*idxs]=val
1072
+ else
1073
+ self[idxs]=val
1074
+ end
1075
+ self
1076
+ end
1077
+ alias set_numlist_element set_list_element
1078
+
1079
+ def set_list_type(val)
1080
+ @type = :list
1081
+ self.list=(val)
1082
+ self
1083
+ end
1084
+ alias list_type= set_list_type
1085
+ def set_list_element_type(idxs, val)
1086
+ self.set_default_element_value_type(idxs, :list)
1087
+ self.set_list_element(idxs, val)
1088
+ end
1089
+ def set_numlist_type(val)
1090
+ @type = :numlist
1091
+ self.numlist=(val)
1092
+ self
1093
+ end
1094
+ alias numlist_type= set_numlist_type
1095
+ def set_numlist_element_type(idxs, val)
1096
+ self.set_default_element_value_type(idxs, :numlist)
1097
+ self.set_numlist_element(idxs, val)
1098
+ end
1099
+
1100
+ def lappend(*elems)
1101
+ tk_call('lappend', @id, *elems)
1102
+ self
1103
+ end
1104
+ def element_lappend(idxs, *elems)
1105
+ if idxs.kind_of?(Array)
1106
+ idxs = idxs.collect{|idx| _get_eval_string(idx, true)}.join(',')
1107
+ end
1108
+ tk_call('lappend', "#{@id}(#{idxs})", *elems)
1109
+ self
1110
+ end
1111
+
1112
+ def lindex(idx)
1113
+ tk_call('lindex', self._value, idx)
1114
+ end
1115
+ alias lget lindex
1116
+ def element_lindex(elem_idxs, idx)
1117
+ if elem_idxs.kind_of?(Array)
1118
+ val = _element_value(*elem_idxs)
1119
+ else
1120
+ val = _element_value(elem_idxs)
1121
+ end
1122
+ tk_call('lindex', val, idx)
1123
+ end
1124
+ alias element_lget element_lindex
1125
+
1126
+ def lget_i(idx)
1127
+ number(lget(idx)).to_i
1128
+ end
1129
+ def element_lget_i(elem_idxs, idx)
1130
+ number(element_lget(elem_idxs, idx)).to_i
1131
+ end
1132
+
1133
+ def lget_f(idx)
1134
+ number(lget(idx)).to_f
1135
+ end
1136
+ def element_lget_f(elem_idxs, idx)
1137
+ number(element_lget(elem_idxs, idx)).to_f
1138
+ end
1139
+
1140
+ def lset(idx, val)
1141
+ tk_call('lset', @id, idx, val)
1142
+ self
1143
+ end
1144
+ def element_lset(elem_idxs, idx, val)
1145
+ if elem_idxs.kind_of?(Array)
1146
+ idxs = elem_idxs.collect{|i| _get_eval_string(i, true)}.join(',')
1147
+ end
1148
+ tk_call('lset', "#{@id}(#{idxs})", idx, val)
1149
+ self
1150
+ end
1151
+
1152
+ def inspect
1153
+ #Kernel.format "#<TkVariable: %s>", @id
1154
+ '#<TkVariable: ' + @id + '>'
1155
+ end
1156
+
1157
+ def coerce(other)
1158
+ case other
1159
+ when TkVariable
1160
+ [other._value, self._value]
1161
+ when String
1162
+ [other, self.to_s]
1163
+ when Symbol
1164
+ [other, self.to_sym]
1165
+ when Numeric
1166
+ [other, self.numeric]
1167
+ when Array
1168
+ [other, self.to_a]
1169
+ else
1170
+ [other, self._value]
1171
+ end
1172
+ end
1173
+
1174
+ def +@
1175
+ self.numeric
1176
+ end
1177
+ def -@
1178
+ -(self.numeric)
1179
+ end
1180
+
1181
+ def &(other)
1182
+ if other.kind_of?(Array)
1183
+ self.to_a & other.to_a
1184
+ else
1185
+ self.to_i & other.to_i
1186
+ end
1187
+ end
1188
+ def |(other)
1189
+ if other.kind_of?(Array)
1190
+ self.to_a | other.to_a
1191
+ else
1192
+ self.to_i | other.to_i
1193
+ end
1194
+ end
1195
+ def +(other)
1196
+ case other
1197
+ when Array
1198
+ self.to_a + other
1199
+ when String
1200
+ self._value + other
1201
+ else
1202
+ begin
1203
+ number(self._value) + other
1204
+ rescue
1205
+ self._value + other.to_s
1206
+ end
1207
+ end
1208
+ end
1209
+ def -(other)
1210
+ if other.kind_of?(Array)
1211
+ self.to_a - other
1212
+ else
1213
+ number(self._value) - other
1214
+ end
1215
+ end
1216
+ def *(other)
1217
+ num_or_str(self._value) * other
1218
+ #begin
1219
+ # number(self._value) * other
1220
+ #rescue
1221
+ # self._value * other
1222
+ #end
1223
+ end
1224
+ def /(other)
1225
+ number(self._value) / other
1226
+ end
1227
+ def %(other)
1228
+ num_or_str(self._value) % other
1229
+ #begin
1230
+ # number(self._value) % other
1231
+ #rescue
1232
+ # self._value % other
1233
+ #end
1234
+ end
1235
+ def **(other)
1236
+ number(self._value) ** other
1237
+ end
1238
+ def =~(other)
1239
+ self._value =~ other
1240
+ end
1241
+
1242
+ def ==(other)
1243
+ case other
1244
+ when TkVariable
1245
+ #self.equal?(other)
1246
+ self._value == other._value
1247
+ when String
1248
+ self.to_s == other
1249
+ when Symbol
1250
+ self.to_sym == other
1251
+ when Integer
1252
+ self.to_i == other
1253
+ when Float
1254
+ self.to_f == other
1255
+ when Array
1256
+ self.to_a == other
1257
+ when Hash
1258
+ # false if self is not an assoc array
1259
+ self._value == other
1260
+ else
1261
+ # false
1262
+ self._value == _get_eval_string(other)
1263
+ end
1264
+ end
1265
+
1266
+ def ===(other)
1267
+ if other.kind_of?(TkVariable)
1268
+ self.id == other.id
1269
+ else
1270
+ super
1271
+ end
1272
+ end
1273
+
1274
+ def zero?
1275
+ numeric.zero?
1276
+ end
1277
+ def nonzero?
1278
+ !(numeric.zero?)
1279
+ end
1280
+
1281
+ def <=>(other)
1282
+ if other.kind_of?(TkVariable)
1283
+ begin
1284
+ val = other.numeric
1285
+ other = val
1286
+ rescue
1287
+ other = other._value
1288
+ end
1289
+ elsif other.kind_of?(Numeric)
1290
+ begin
1291
+ return self.numeric <=> other
1292
+ rescue
1293
+ return self._value <=> other.to_s
1294
+ end
1295
+ elsif other.kind_of?(Array)
1296
+ return self.list <=> other
1297
+ else
1298
+ return self._value <=> other
1299
+ end
1300
+ end
1301
+
1302
+ def to_eval
1303
+ @id
1304
+ end
1305
+
1306
+ def trace_callback(elem, op)
1307
+ if @trace_var.kind_of? Array
1308
+ @trace_var.each{|m,e| e.call(self,elem,op) if m.index(op)}
1309
+ end
1310
+ if elem.kind_of?(String) && elem != ''
1311
+ if @trace_elem.kind_of?(Hash) && @trace_elem[elem].kind_of?(Array)
1312
+ @trace_elem[elem].each{|m,e| e.call(self,elem,op) if m.index(op)}
1313
+ end
1314
+ end
1315
+ end
1316
+
1317
+ def _check_trace_opt(opts)
1318
+ if opts.kind_of?(Array)
1319
+ opt_str = opts.map{|s| s.to_s}.join(' ')
1320
+ else
1321
+ opt_str = opts.to_s
1322
+ end
1323
+
1324
+ fail ArgumentError, 'null trace option' if opt_str.empty?
1325
+
1326
+ if opt_str =~ /[^arwu\s]/
1327
+ # new format (Tcl/Tk8.4+?)
1328
+ if opts.kind_of?(Array)
1329
+ opt_ary = opts.map{|opt| opt.to_s.strip}
1330
+ else
1331
+ opt_ary = opt_str.split(/\s+|\|/)
1332
+ opt_ary.delete('')
1333
+ end
1334
+ if USE_OLD_TRACE_OPTION_STYLE
1335
+ opt_ary.uniq.map{|opt|
1336
+ case opt
1337
+ when 'array'
1338
+ 'a'
1339
+ when 'read'
1340
+ 'r'
1341
+ when 'write'
1342
+ 'w'
1343
+ when 'unset'
1344
+ 'u'
1345
+ else
1346
+ fail ArgumentError, "unsupported trace option '#{opt}' on Tcl/Tk#{Tk::TCL_PATCHLEVEL}"
1347
+ end
1348
+ }.join
1349
+ else
1350
+ opt_ary
1351
+ end
1352
+ else
1353
+ # old format
1354
+ opt_ary = opt_str.delete('^arwu').split(//).uniq
1355
+ if USE_OLD_TRACE_OPTION_STYLE
1356
+ opt_ary.join
1357
+ else
1358
+ opt_ary.map{|c|
1359
+ case c
1360
+ when 'a'
1361
+ 'array'
1362
+ when 'r'
1363
+ 'read'
1364
+ when 'w'
1365
+ 'write'
1366
+ when 'u'
1367
+ 'unset'
1368
+ end
1369
+ }
1370
+ end
1371
+ end
1372
+ end
1373
+ private :_check_trace_opt
1374
+
1375
+ def trace(opts, cmd = Proc.new)
1376
+ opts = _check_trace_opt(opts)
1377
+ (@trace_var ||= []).unshift([opts,cmd])
1378
+
1379
+ if @trace_opts == nil
1380
+ TkVar_CB_TBL[@id] = self
1381
+ @trace_opts = opts.dup
1382
+ if USE_OLD_TRACE_OPTION_STYLE
1383
+ Tk.tk_call_without_enc('trace', 'variable',
1384
+ @id, @trace_opts, 'rb_var ' << @id)
1385
+ else
1386
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
1387
+ @id, @trace_opts, 'rb_var ' << @id)
1388
+ end
1389
+ else
1390
+ newopts = @trace_opts.dup
1391
+ if USE_OLD_TRACE_OPTION_STYLE
1392
+ opts.each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)}
1393
+ if newopts != @trace_opts
1394
+ Tk.tk_call_without_enc('trace', 'vdelete',
1395
+ @id, @trace_opts, 'rb_var ' << @id)
1396
+ @trace_opts.replace(newopts)
1397
+ Tk.tk_call_without_enc('trace', 'variable',
1398
+ @id, @trace_opts, 'rb_var ' << @id)
1399
+ end
1400
+ else
1401
+ newopts |= opts
1402
+ unless (newopts - @trace_opts).empty?
1403
+ Tk.tk_call_without_enc('trace', 'remove', 'variable',
1404
+ @id, @trace_opts, 'rb_var ' << @id)
1405
+ @trace_opts.replace(newopts)
1406
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
1407
+ @id, @trace_opts, 'rb_var ' << @id)
1408
+ end
1409
+ end
1410
+ end
1411
+
1412
+ self
1413
+ end
1414
+
1415
+ def trace_element(elem, opts, cmd = Proc.new)
1416
+ if @elem
1417
+ fail(RuntimeError,
1418
+ "invalid for a TkVariable which denotes an element of Tcl's array")
1419
+ end
1420
+
1421
+ opts = _check_trace_opt(opts)
1422
+
1423
+ ((@trace_elem ||= {})[elem] ||= []).unshift([opts,cmd])
1424
+
1425
+ if @trace_opts == nil
1426
+ TkVar_CB_TBL[@id] = self
1427
+ @trace_opts = opts.dup
1428
+ if USE_OLD_TRACE_OPTION_STYLE
1429
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
1430
+ @id, @trace_opts, 'rb_var ' << @id)
1431
+ else
1432
+ Tk.tk_call_without_enc('trace', 'variable',
1433
+ @id, @trace_opts, 'rb_var ' << @id)
1434
+ end
1435
+ else
1436
+ newopts = @trace_opts.dup
1437
+ if USE_OLD_TRACE_OPTION_STYLE
1438
+ opts.each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)}
1439
+ if newopts != @trace_opts
1440
+ Tk.tk_call_without_enc('trace', 'vdelete',
1441
+ @id, @trace_opts, 'rb_var ' << @id)
1442
+ @trace_opts.replace(newopts)
1443
+ Tk.tk_call_without_enc('trace', 'variable',
1444
+ @id, @trace_opts, 'rb_var ' << @id)
1445
+ end
1446
+ else
1447
+ newopts |= opts
1448
+ unless (newopts - @trace_opts).empty?
1449
+ Tk.tk_call_without_enc('trace', 'remove', 'variable',
1450
+ @id, @trace_opts, 'rb_var ' << @id)
1451
+ @trace_opts.replace(newopts)
1452
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
1453
+ @id, @trace_opts, 'rb_var ' << @id)
1454
+ end
1455
+ end
1456
+ end
1457
+
1458
+ self
1459
+ end
1460
+
1461
+ def trace_info
1462
+ return [] unless @trace_var
1463
+ @trace_var.dup
1464
+ end
1465
+ alias trace_vinfo trace_info
1466
+
1467
+ def trace_info_for_element(elem)
1468
+ if @elem
1469
+ fail(RuntimeError,
1470
+ "invalid for a TkVariable which denotes an element of Tcl's array")
1471
+ end
1472
+ return [] unless @trace_elem
1473
+ return [] unless @trace_elem[elem]
1474
+ @trace_elem[elem].dup
1475
+ end
1476
+ alias trace_vinfo_for_element trace_info_for_element
1477
+
1478
+ def trace_remove(opts,cmd)
1479
+ return self unless @trace_var.kind_of? Array
1480
+
1481
+ opts = _check_trace_opt(opts)
1482
+
1483
+ idx = -1
1484
+ if USE_OLD_TRACE_OPTION_STYLE
1485
+ newopts = ''
1486
+ @trace_var.each_with_index{|e, i|
1487
+ if idx < 0 && e[1] == cmd
1488
+ diff = false
1489
+ ['a', 'r', 'w', 'u'].each{|c|
1490
+ break if (diff = e[0].index(c) ^ opts.index(c))
1491
+ }
1492
+ unless diff
1493
+ #find
1494
+ idx = i
1495
+ next
1496
+ end
1497
+ end
1498
+ e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)}
1499
+ }
1500
+ else
1501
+ newopts = []
1502
+ @trace_var.each_with_index{|e, i|
1503
+ if idx < 0 && e[1] == cmd &&
1504
+ e[0].size == opts.size && (e[0] - opts).empty?
1505
+ # find
1506
+ idx = i
1507
+ next
1508
+ end
1509
+ newopts |= e[0]
1510
+ }
1511
+ end
1512
+
1513
+ if idx >= 0
1514
+ @trace_var.delete_at(idx)
1515
+ else
1516
+ return self
1517
+ end
1518
+
1519
+ (@trace_elem ||= {}).each{|elem|
1520
+ @trace_elem[elem].each{|e|
1521
+ if USE_OLD_TRACE_OPTION_STYLE
1522
+ e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)}
1523
+ else
1524
+ newopts |= e[0]
1525
+ end
1526
+ }
1527
+ }
1528
+
1529
+ if USE_OLD_TRACE_OPTION_STYLE
1530
+ diff = false
1531
+ @trace_opts.each_byte{|c| break if (diff = ! newopts.index(c))}
1532
+ if diff
1533
+ Tk.tk_call_without_enc('trace', 'vdelete',
1534
+ @id, @trace_opts, 'rb_var ' << @id)
1535
+ @trace_opts.replace(newopts)
1536
+ unless @trace_opts.empty?
1537
+ Tk.tk_call_without_enc('trace', 'variable',
1538
+ @id, @trace_opts, 'rb_var ' << @id)
1539
+ end
1540
+ end
1541
+ else
1542
+ unless (@trace_opts - newopts).empty?
1543
+ Tk.tk_call_without_enc('trace', 'remove', 'variable',
1544
+ @id, @trace_opts, 'rb_var ' << @id)
1545
+ @trace_opts.replace(newopts)
1546
+ unless @trace_opts.empty?
1547
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
1548
+ @id, @trace_opts, 'rb_var ' << @id)
1549
+ end
1550
+ end
1551
+ end
1552
+
1553
+ self
1554
+ end
1555
+ alias trace_delete trace_remove
1556
+ alias trace_vdelete trace_remove
1557
+
1558
+ def trace_remove_for_element(elem,opts,cmd)
1559
+ if @elem
1560
+ fail(RuntimeError,
1561
+ "invalid for a TkVariable which denotes an element of Tcl's array")
1562
+ end
1563
+ return self unless @trace_elem.kind_of? Hash
1564
+ return self unless @trace_elem[elem].kind_of? Array
1565
+
1566
+ opts = _check_trace_opt(opts)
1567
+
1568
+ idx = -1
1569
+ if USE_OLD_TRACE_OPTION_STYLE
1570
+ @trace_elem[elem].each_with_index{|e, i|
1571
+ if idx < 0 && e[1] == cmd
1572
+ diff = false
1573
+ ['a', 'r', 'w', 'u'].each{|c|
1574
+ break if (diff = e[0].index(c) ^ opts.index(c))
1575
+ }
1576
+ unless diff
1577
+ #find
1578
+ idx = i
1579
+ next
1580
+ end
1581
+ end
1582
+ }
1583
+ else
1584
+ @trace_elem[elem].each_with_index{|e, i|
1585
+ if idx < 0 && e[1] == cmd &&
1586
+ e[0].size == opts.size && (e[0] - opts).empty?
1587
+ # find
1588
+ idx = i
1589
+ next
1590
+ end
1591
+ }
1592
+ end
1593
+
1594
+ if idx >= 0
1595
+ @trace_elem[elem].delete_at(idx)
1596
+ else
1597
+ return self
1598
+ end
1599
+
1600
+ if USE_OLD_TRACE_OPTION_STYLE
1601
+ newopts = ''
1602
+ @trace_var.each{|e|
1603
+ e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)}
1604
+ }
1605
+ @trace_elem.each{|elem|
1606
+ @trace_elem[elem].each{|e|
1607
+ e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)}
1608
+ }
1609
+ }
1610
+ else
1611
+ newopts = []
1612
+ @trace_var.each{|e|
1613
+ newopts |= e[0]
1614
+ }
1615
+ @trace_elem.each{|elem|
1616
+ @trace_elem[elem].each{|e|
1617
+ e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)}
1618
+ }
1619
+ }
1620
+ end
1621
+
1622
+ if USE_OLD_TRACE_OPTION_STYLE
1623
+ diff = false
1624
+ @trace_opts.each_byte{|c| break if (diff = ! newopts.index(c))}
1625
+ if diff
1626
+ Tk.tk_call_without_enc('trace', 'vdelete',
1627
+ @id, @trace_opts, 'rb_var ' << @id)
1628
+ @trace_opts.replace(newopts)
1629
+ unless @trace_opts.empty?
1630
+ Tk.tk_call_without_enc('trace', 'variable',
1631
+ @id, @trace_opts, 'rb_var ' << @id)
1632
+ end
1633
+ end
1634
+ else
1635
+ unless (@trace_opts - newopts).empty?
1636
+ Tk.tk_call_without_enc('trace', 'remove', 'variable',
1637
+ @id, @trace_opts, 'rb_var ' << @id)
1638
+ @trace_opts.replace(newopts)
1639
+ unless @trace_opts.empty?
1640
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
1641
+ @id, @trace_opts, 'rb_var ' << @id)
1642
+ end
1643
+ end
1644
+ end
1645
+
1646
+ self
1647
+ end
1648
+ alias trace_delete_for_element trace_remove_for_element
1649
+ alias trace_vdelete_for_element trace_remove_for_element
1650
+ end
1651
+
1652
+ class TkVarAccess<TkVariable
1653
+ def self.new(name, *args)
1654
+ if name.kind_of?(TkVariable)
1655
+ name.value = args[0] unless args.empty?
1656
+ return name
1657
+ end
1658
+
1659
+ name = name.to_s
1660
+ v = nil
1661
+ TkVar_ID_TBL.mutex.synchronize{
1662
+ if v = TkVar_ID_TBL[name]
1663
+ v.value = args[0] unless args.empty?
1664
+ return v
1665
+ else
1666
+ (v = self.allocate).instance_eval{
1667
+ @id = name
1668
+ TkVar_ID_TBL[@id] = self
1669
+ @var = @id
1670
+ }
1671
+ end
1672
+ }
1673
+
1674
+ v.instance_eval{ initialize(name, *args) }
1675
+ v
1676
+ end
1677
+
1678
+ def self.new_hash(name, *args)
1679
+ if name.kind_of?(TkVariable)
1680
+ unless name.is_hash?
1681
+ fail ArgumentError, "already exist as a scalar variable"
1682
+ end
1683
+ name.value = args[0] unless args.empty?
1684
+ return name
1685
+ end
1686
+
1687
+ name = name.to_s
1688
+ v = nil
1689
+ TkVar_ID_TBL.mutex.synchronize{
1690
+ if v = TkVar_ID_TBL[name]
1691
+ unless v.is_hash?
1692
+ fail ArgumentError, "already exist as a scalar variable"
1693
+ end
1694
+ v.value = args[0] unless args.empty?
1695
+ return v
1696
+ else
1697
+ (v = self.allocate).instance_eval{
1698
+ @id = name
1699
+ TkVar_ID_TBL[@id] = self
1700
+ @var = @id
1701
+ }
1702
+ end
1703
+ }
1704
+
1705
+ INTERP._invoke_without_enc('global', name)
1706
+ if args.empty? && INTERP._invoke_without_enc('array', 'exist', name) == '0'
1707
+ v.instance_eval{ initialize(name, {}) } # force creating
1708
+ else
1709
+ v.instance_eval{ initialize(name, *args) }
1710
+ end
1711
+ v
1712
+ end
1713
+
1714
+ def initialize(varname, val=nil)
1715
+ # @id = varname
1716
+ # TkVar_ID_TBL[@id] = self
1717
+
1718
+ # @var = @id
1719
+ @elem = nil
1720
+
1721
+ @def_default = false
1722
+ @default_val = nil
1723
+
1724
+ @trace_var = nil
1725
+ @trace_elem = nil
1726
+ @trace_opts = nil
1727
+
1728
+ @type = nil
1729
+ var = self
1730
+ @element_type = Hash.new{|k,v| var.default_value_type }
1731
+
1732
+ # is an element?
1733
+ if @id =~ /^([^(]+)\((.+)\)$/
1734
+ # is an element --> var == $1, elem == $2
1735
+ @var = $1
1736
+ @elem = $2
1737
+ end
1738
+
1739
+ # teach Tk-ip that @id is global var
1740
+ INTERP._invoke_without_enc('global', @var)
1741
+ =begin
1742
+ begin
1743
+ INTERP._invoke_without_enc('global', @id)
1744
+ rescue => e
1745
+ if @id =~ /^(.+)\([^()]+\)$/
1746
+ # is an element --> varname == $1
1747
+ INTERP._invoke_without_enc('global', $1)
1748
+ else
1749
+ fail e
1750
+ end
1751
+ end
1752
+ =end
1753
+
1754
+ if val
1755
+ if val.kind_of?(Hash)
1756
+ # assoc-array variable
1757
+ self[''] = 0
1758
+ self.clear
1759
+ end
1760
+ #s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"' #"
1761
+ #s = '"' + _get_eval_string(val).gsub(/[\[\]$"\\]/, '\\\\\&') + '"' #"
1762
+ #INTERP._eval(Kernel.format('global %s; set %s %s', @id, @id, s))
1763
+ #INTERP._set_global_var(@id, _toUTF8(_get_eval_string(val)))
1764
+ self.value = val
1765
+ end
1766
+ end
1767
+ end
1768
+
1769
+ module Tk
1770
+ begin
1771
+ INTERP._invoke_without_enc('global', 'auto_path')
1772
+ auto_path = INTERP._invoke('set', 'auto_path')
1773
+ rescue => e
1774
+ begin
1775
+ INTERP._invoke_without_enc('global', 'env')
1776
+ auto_path = INTERP._invoke('set', 'env(TCLLIBPATH)')
1777
+ rescue => e
1778
+ auto_path = Tk::LIBRARY
1779
+ end
1780
+ end
1781
+
1782
+ AUTO_PATH = TkVarAccess.new('auto_path', auto_path)
1783
+
1784
+ =begin
1785
+ AUTO_OLDPATH = tk_split_simplelist(INTERP._invoke('set', 'auto_oldpath'))
1786
+ AUTO_OLDPATH.each{|s| s.freeze}
1787
+ AUTO_OLDPATH.freeze
1788
+ =end
1789
+
1790
+ TCL_PACKAGE_PATH = TkVarAccess.new('tcl_pkgPath')
1791
+ PACKAGE_PATH = TCL_PACKAGE_PATH
1792
+
1793
+ TCL_LIBRARY_PATH = TkVarAccess.new('tcl_libPath')
1794
+ LIBRARY_PATH = TCL_LIBRARY_PATH
1795
+
1796
+ TCL_PRECISION = TkVarAccess.new('tcl_precision')
1797
+ end