tk_as_gem 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (345) hide show
  1. data/README +22 -0
  2. data/Rakefile +11 -0
  3. data/VERSION +1 -0
  4. data/ext/ChangeLog.tkextlib +935 -0
  5. data/ext/MANUAL_tcltklib.eng +469 -0
  6. data/ext/MANUAL_tcltklib.eucj +579 -0
  7. data/ext/README.1st +19 -0
  8. data/ext/README.ActiveTcl +49 -0
  9. data/ext/README.fork +34 -0
  10. data/ext/README.macosx-aqua +67 -0
  11. data/ext/README.tcltklib +85 -0
  12. data/ext/depend +2 -0
  13. data/ext/extconf.rb +451 -0
  14. data/ext/lib/README +30 -0
  15. data/ext/lib/multi-tk.rb +3491 -0
  16. data/ext/lib/remote-tk.rb +530 -0
  17. data/ext/lib/tcltk.rb +367 -0
  18. data/ext/lib/tk.rb +5584 -0
  19. data/ext/lib/tk/after.rb +6 -0
  20. data/ext/lib/tk/autoload.rb +414 -0
  21. data/ext/lib/tk/bgerror.rb +29 -0
  22. data/ext/lib/tk/bindtag.rb +138 -0
  23. data/ext/lib/tk/button.rb +30 -0
  24. data/ext/lib/tk/canvas.rb +789 -0
  25. data/ext/lib/tk/canvastag.rb +434 -0
  26. data/ext/lib/tk/checkbutton.rb +30 -0
  27. data/ext/lib/tk/clipboard.rb +75 -0
  28. data/ext/lib/tk/clock.rb +71 -0
  29. data/ext/lib/tk/composite.rb +458 -0
  30. data/ext/lib/tk/console.rb +52 -0
  31. data/ext/lib/tk/dialog.rb +326 -0
  32. data/ext/lib/tk/encodedstr.rb +187 -0
  33. data/ext/lib/tk/entry.rb +119 -0
  34. data/ext/lib/tk/event.rb +542 -0
  35. data/ext/lib/tk/font.rb +2344 -0
  36. data/ext/lib/tk/frame.rb +131 -0
  37. data/ext/lib/tk/grid.rb +279 -0
  38. data/ext/lib/tk/image.rb +275 -0
  39. data/ext/lib/tk/itemconfig.rb +1215 -0
  40. data/ext/lib/tk/itemfont.rb +327 -0
  41. data/ext/lib/tk/kinput.rb +71 -0
  42. data/ext/lib/tk/label.rb +21 -0
  43. data/ext/lib/tk/labelframe.rb +29 -0
  44. data/ext/lib/tk/listbox.rb +282 -0
  45. data/ext/lib/tk/macpkg.rb +78 -0
  46. data/ext/lib/tk/menu.rb +681 -0
  47. data/ext/lib/tk/menubar.rb +131 -0
  48. data/ext/lib/tk/menuspec.rb +275 -0
  49. data/ext/lib/tk/message.rb +22 -0
  50. data/ext/lib/tk/mngfocus.rb +33 -0
  51. data/ext/lib/tk/msgcat.rb +296 -0
  52. data/ext/lib/tk/namespace.rb +551 -0
  53. data/ext/lib/tk/optiondb.rb +377 -0
  54. data/ext/lib/tk/optionobj.rb +212 -0
  55. data/ext/lib/tk/pack.rb +107 -0
  56. data/ext/lib/tk/package.rb +143 -0
  57. data/ext/lib/tk/palette.rb +55 -0
  58. data/ext/lib/tk/panedwindow.rb +258 -0
  59. data/ext/lib/tk/place.rb +128 -0
  60. data/ext/lib/tk/radiobutton.rb +71 -0
  61. data/ext/lib/tk/root.rb +95 -0
  62. data/ext/lib/tk/scale.rb +111 -0
  63. data/ext/lib/tk/scrollable.rb +82 -0
  64. data/ext/lib/tk/scrollbar.rb +177 -0
  65. data/ext/lib/tk/scrollbox.rb +39 -0
  66. data/ext/lib/tk/selection.rb +86 -0
  67. data/ext/lib/tk/spinbox.rb +119 -0
  68. data/ext/lib/tk/tagfont.rb +43 -0
  69. data/ext/lib/tk/text.rb +1596 -0
  70. data/ext/lib/tk/textimage.rb +88 -0
  71. data/ext/lib/tk/textmark.rb +204 -0
  72. data/ext/lib/tk/texttag.rb +318 -0
  73. data/ext/lib/tk/textwindow.rb +154 -0
  74. data/ext/lib/tk/timer.rb +669 -0
  75. data/ext/lib/tk/toplevel.rb +262 -0
  76. data/ext/lib/tk/ttk_selector.rb +76 -0
  77. data/ext/lib/tk/txtwin_abst.rb +39 -0
  78. data/ext/lib/tk/validation.rb +397 -0
  79. data/ext/lib/tk/variable.rb +1765 -0
  80. data/ext/lib/tk/virtevent.rb +139 -0
  81. data/ext/lib/tk/winfo.rb +392 -0
  82. data/ext/lib/tk/winpkg.rb +153 -0
  83. data/ext/lib/tk/wm.rb +552 -0
  84. data/ext/lib/tk/xim.rb +122 -0
  85. data/ext/lib/tkafter.rb +4 -0
  86. data/ext/lib/tkbgerror.rb +4 -0
  87. data/ext/lib/tkcanvas.rb +4 -0
  88. data/ext/lib/tkclass.rb +47 -0
  89. data/ext/lib/tkconsole.rb +4 -0
  90. data/ext/lib/tkdialog.rb +4 -0
  91. data/ext/lib/tkentry.rb +4 -0
  92. data/ext/lib/tkextlib/ICONS.rb +13 -0
  93. data/ext/lib/tkextlib/ICONS/icons.rb +129 -0
  94. data/ext/lib/tkextlib/ICONS/setup.rb +8 -0
  95. data/ext/lib/tkextlib/SUPPORT_STATUS +196 -0
  96. data/ext/lib/tkextlib/blt.rb +187 -0
  97. data/ext/lib/tkextlib/blt/barchart.rb +79 -0
  98. data/ext/lib/tkextlib/blt/bitmap.rb +112 -0
  99. data/ext/lib/tkextlib/blt/busy.rb +82 -0
  100. data/ext/lib/tkextlib/blt/component.rb +2145 -0
  101. data/ext/lib/tkextlib/blt/container.rb +28 -0
  102. data/ext/lib/tkextlib/blt/cutbuffer.rb +23 -0
  103. data/ext/lib/tkextlib/blt/dragdrop.rb +268 -0
  104. data/ext/lib/tkextlib/blt/eps.rb +32 -0
  105. data/ext/lib/tkextlib/blt/graph.rb +67 -0
  106. data/ext/lib/tkextlib/blt/htext.rb +111 -0
  107. data/ext/lib/tkextlib/blt/setup.rb +8 -0
  108. data/ext/lib/tkextlib/blt/spline.rb +23 -0
  109. data/ext/lib/tkextlib/blt/stripchart.rb +74 -0
  110. data/ext/lib/tkextlib/blt/table.rb +399 -0
  111. data/ext/lib/tkextlib/blt/tabnotebook.rb +110 -0
  112. data/ext/lib/tkextlib/blt/tabset.rb +500 -0
  113. data/ext/lib/tkextlib/blt/ted.rb +65 -0
  114. data/ext/lib/tkextlib/blt/tile.rb +21 -0
  115. data/ext/lib/tkextlib/blt/tile/button.rb +16 -0
  116. data/ext/lib/tkextlib/blt/tile/checkbutton.rb +17 -0
  117. data/ext/lib/tkextlib/blt/tile/frame.rb +16 -0
  118. data/ext/lib/tkextlib/blt/tile/label.rb +16 -0
  119. data/ext/lib/tkextlib/blt/tile/radiobutton.rb +17 -0
  120. data/ext/lib/tkextlib/blt/tile/scrollbar.rb +16 -0
  121. data/ext/lib/tkextlib/blt/tile/toplevel.rb +16 -0
  122. data/ext/lib/tkextlib/blt/tree.rb +1058 -0
  123. data/ext/lib/tkextlib/blt/treeview.rb +1272 -0
  124. data/ext/lib/tkextlib/blt/unix_dnd.rb +135 -0
  125. data/ext/lib/tkextlib/blt/vector.rb +256 -0
  126. data/ext/lib/tkextlib/blt/watch.rb +175 -0
  127. data/ext/lib/tkextlib/blt/win_printer.rb +61 -0
  128. data/ext/lib/tkextlib/blt/winop.rb +107 -0
  129. data/ext/lib/tkextlib/bwidget.rb +151 -0
  130. data/ext/lib/tkextlib/bwidget/arrowbutton.rb +21 -0
  131. data/ext/lib/tkextlib/bwidget/bitmap.rb +21 -0
  132. data/ext/lib/tkextlib/bwidget/button.rb +31 -0
  133. data/ext/lib/tkextlib/bwidget/buttonbox.rb +90 -0
  134. data/ext/lib/tkextlib/bwidget/combobox.rb +51 -0
  135. data/ext/lib/tkextlib/bwidget/dialog.rb +182 -0
  136. data/ext/lib/tkextlib/bwidget/dragsite.rb +31 -0
  137. data/ext/lib/tkextlib/bwidget/dropsite.rb +39 -0
  138. data/ext/lib/tkextlib/bwidget/dynamichelp.rb +63 -0
  139. data/ext/lib/tkextlib/bwidget/entry.rb +43 -0
  140. data/ext/lib/tkextlib/bwidget/label.rb +41 -0
  141. data/ext/lib/tkextlib/bwidget/labelentry.rb +80 -0
  142. data/ext/lib/tkextlib/bwidget/labelframe.rb +52 -0
  143. data/ext/lib/tkextlib/bwidget/listbox.rb +358 -0
  144. data/ext/lib/tkextlib/bwidget/mainframe.rb +128 -0
  145. data/ext/lib/tkextlib/bwidget/messagedlg.rb +192 -0
  146. data/ext/lib/tkextlib/bwidget/notebook.rb +166 -0
  147. data/ext/lib/tkextlib/bwidget/pagesmanager.rb +73 -0
  148. data/ext/lib/tkextlib/bwidget/panedwindow.rb +37 -0
  149. data/ext/lib/tkextlib/bwidget/panelframe.rb +57 -0
  150. data/ext/lib/tkextlib/bwidget/passwddlg.rb +44 -0
  151. data/ext/lib/tkextlib/bwidget/progressbar.rb +20 -0
  152. data/ext/lib/tkextlib/bwidget/progressdlg.rb +58 -0
  153. data/ext/lib/tkextlib/bwidget/scrollableframe.rb +40 -0
  154. data/ext/lib/tkextlib/bwidget/scrolledwindow.rb +38 -0
  155. data/ext/lib/tkextlib/bwidget/scrollview.rb +25 -0
  156. data/ext/lib/tkextlib/bwidget/selectcolor.rb +73 -0
  157. data/ext/lib/tkextlib/bwidget/selectfont.rb +86 -0
  158. data/ext/lib/tkextlib/bwidget/separator.rb +20 -0
  159. data/ext/lib/tkextlib/bwidget/setup.rb +8 -0
  160. data/ext/lib/tkextlib/bwidget/spinbox.rb +98 -0
  161. data/ext/lib/tkextlib/bwidget/statusbar.rb +52 -0
  162. data/ext/lib/tkextlib/bwidget/titleframe.rb +33 -0
  163. data/ext/lib/tkextlib/bwidget/tree.rb +453 -0
  164. data/ext/lib/tkextlib/bwidget/widget.rb +129 -0
  165. data/ext/lib/tkextlib/itcl.rb +13 -0
  166. data/ext/lib/tkextlib/itcl/incr_tcl.rb +178 -0
  167. data/ext/lib/tkextlib/itcl/setup.rb +13 -0
  168. data/ext/lib/tkextlib/itk.rb +13 -0
  169. data/ext/lib/tkextlib/itk/incr_tk.rb +446 -0
  170. data/ext/lib/tkextlib/itk/setup.rb +13 -0
  171. data/ext/lib/tkextlib/iwidgets.rb +94 -0
  172. data/ext/lib/tkextlib/iwidgets/buttonbox.rb +120 -0
  173. data/ext/lib/tkextlib/iwidgets/calendar.rb +125 -0
  174. data/ext/lib/tkextlib/iwidgets/canvasprintbox.rb +53 -0
  175. data/ext/lib/tkextlib/iwidgets/canvasprintdialog.rb +38 -0
  176. data/ext/lib/tkextlib/iwidgets/checkbox.rb +129 -0
  177. data/ext/lib/tkextlib/iwidgets/combobox.rb +104 -0
  178. data/ext/lib/tkextlib/iwidgets/dateentry.rb +20 -0
  179. data/ext/lib/tkextlib/iwidgets/datefield.rb +58 -0
  180. data/ext/lib/tkextlib/iwidgets/dialog.rb +20 -0
  181. data/ext/lib/tkextlib/iwidgets/dialogshell.rb +120 -0
  182. data/ext/lib/tkextlib/iwidgets/disjointlistbox.rb +50 -0
  183. data/ext/lib/tkextlib/iwidgets/entryfield.rb +185 -0
  184. data/ext/lib/tkextlib/iwidgets/extbutton.rb +40 -0
  185. data/ext/lib/tkextlib/iwidgets/extfileselectionbox.rb +46 -0
  186. data/ext/lib/tkextlib/iwidgets/extfileselectiondialog.rb +33 -0
  187. data/ext/lib/tkextlib/iwidgets/feedback.rb +35 -0
  188. data/ext/lib/tkextlib/iwidgets/fileselectionbox.rb +46 -0
  189. data/ext/lib/tkextlib/iwidgets/fileselectiondialog.rb +33 -0
  190. data/ext/lib/tkextlib/iwidgets/finddialog.rb +42 -0
  191. data/ext/lib/tkextlib/iwidgets/hierarchy.rb +365 -0
  192. data/ext/lib/tkextlib/iwidgets/hyperhelp.rb +50 -0
  193. data/ext/lib/tkextlib/iwidgets/labeledframe.rb +39 -0
  194. data/ext/lib/tkextlib/iwidgets/labeledwidget.rb +45 -0
  195. data/ext/lib/tkextlib/iwidgets/mainwindow.rb +67 -0
  196. data/ext/lib/tkextlib/iwidgets/menubar.rb +211 -0
  197. data/ext/lib/tkextlib/iwidgets/messagebox.rb +92 -0
  198. data/ext/lib/tkextlib/iwidgets/messagedialog.rb +20 -0
  199. data/ext/lib/tkextlib/iwidgets/notebook.rb +174 -0
  200. data/ext/lib/tkextlib/iwidgets/optionmenu.rb +92 -0
  201. data/ext/lib/tkextlib/iwidgets/panedwindow.rb +133 -0
  202. data/ext/lib/tkextlib/iwidgets/promptdialog.rb +131 -0
  203. data/ext/lib/tkextlib/iwidgets/pushbutton.rb +35 -0
  204. data/ext/lib/tkextlib/iwidgets/radiobox.rb +120 -0
  205. data/ext/lib/tkextlib/iwidgets/scopedobject.rb +24 -0
  206. data/ext/lib/tkextlib/iwidgets/scrolledcanvas.rb +353 -0
  207. data/ext/lib/tkextlib/iwidgets/scrolledframe.rb +59 -0
  208. data/ext/lib/tkextlib/iwidgets/scrolledhtml.rb +58 -0
  209. data/ext/lib/tkextlib/iwidgets/scrolledlistbox.rb +207 -0
  210. data/ext/lib/tkextlib/iwidgets/scrolledtext.rb +564 -0
  211. data/ext/lib/tkextlib/iwidgets/scrolledwidget.rb +20 -0
  212. data/ext/lib/tkextlib/iwidgets/selectionbox.rb +102 -0
  213. data/ext/lib/tkextlib/iwidgets/selectiondialog.rb +92 -0
  214. data/ext/lib/tkextlib/iwidgets/setup.rb +8 -0
  215. data/ext/lib/tkextlib/iwidgets/shell.rb +38 -0
  216. data/ext/lib/tkextlib/iwidgets/spindate.rb +48 -0
  217. data/ext/lib/tkextlib/iwidgets/spinint.rb +30 -0
  218. data/ext/lib/tkextlib/iwidgets/spinner.rb +169 -0
  219. data/ext/lib/tkextlib/iwidgets/spintime.rb +48 -0
  220. data/ext/lib/tkextlib/iwidgets/tabnotebook.rb +180 -0
  221. data/ext/lib/tkextlib/iwidgets/tabset.rb +144 -0
  222. data/ext/lib/tkextlib/iwidgets/timeentry.rb +25 -0
  223. data/ext/lib/tkextlib/iwidgets/timefield.rb +58 -0
  224. data/ext/lib/tkextlib/iwidgets/toolbar.rb +112 -0
  225. data/ext/lib/tkextlib/iwidgets/watch.rb +56 -0
  226. data/ext/lib/tkextlib/pkg_checker.rb +184 -0
  227. data/ext/lib/tkextlib/setup.rb +8 -0
  228. data/ext/lib/tkextlib/tcllib.rb +90 -0
  229. data/ext/lib/tkextlib/tcllib/README +135 -0
  230. data/ext/lib/tkextlib/tcllib/autoscroll.rb +158 -0
  231. data/ext/lib/tkextlib/tcllib/ctext.rb +160 -0
  232. data/ext/lib/tkextlib/tcllib/cursor.rb +97 -0
  233. data/ext/lib/tkextlib/tcllib/datefield.rb +57 -0
  234. data/ext/lib/tkextlib/tcllib/dialog.rb +84 -0
  235. data/ext/lib/tkextlib/tcllib/getstring.rb +134 -0
  236. data/ext/lib/tkextlib/tcllib/history.rb +73 -0
  237. data/ext/lib/tkextlib/tcllib/ico.rb +116 -0
  238. data/ext/lib/tkextlib/tcllib/ip_entry.rb +66 -0
  239. data/ext/lib/tkextlib/tcllib/panelframe.rb +72 -0
  240. data/ext/lib/tkextlib/tcllib/plotchart.rb +886 -0
  241. data/ext/lib/tkextlib/tcllib/ruler.rb +65 -0
  242. data/ext/lib/tkextlib/tcllib/screenruler.rb +68 -0
  243. data/ext/lib/tkextlib/tcllib/scrollwin.rb +61 -0
  244. data/ext/lib/tkextlib/tcllib/setup.rb +8 -0
  245. data/ext/lib/tkextlib/tcllib/style.rb +61 -0
  246. data/ext/lib/tkextlib/tcllib/superframe.rb +51 -0
  247. data/ext/lib/tkextlib/tcllib/swaplist.rb +150 -0
  248. data/ext/lib/tkextlib/tcllib/tablelist.rb +27 -0
  249. data/ext/lib/tkextlib/tcllib/tablelist_core.rb +782 -0
  250. data/ext/lib/tkextlib/tcllib/tablelist_tile.rb +25 -0
  251. data/ext/lib/tkextlib/tcllib/tkpiechart.rb +314 -0
  252. data/ext/lib/tkextlib/tcllib/tooltip.rb +95 -0
  253. data/ext/lib/tkextlib/tcllib/widget.rb +48 -0
  254. data/ext/lib/tkextlib/tclx.rb +13 -0
  255. data/ext/lib/tkextlib/tclx/setup.rb +8 -0
  256. data/ext/lib/tkextlib/tclx/tclx.rb +74 -0
  257. data/ext/lib/tkextlib/tile.rb +419 -0
  258. data/ext/lib/tkextlib/tile/dialog.rb +96 -0
  259. data/ext/lib/tkextlib/tile/setup.rb +8 -0
  260. data/ext/lib/tkextlib/tile/sizegrip.rb +29 -0
  261. data/ext/lib/tkextlib/tile/style.rb +316 -0
  262. data/ext/lib/tkextlib/tile/tbutton.rb +33 -0
  263. data/ext/lib/tkextlib/tile/tcheckbutton.rb +36 -0
  264. data/ext/lib/tkextlib/tile/tcombobox.rb +54 -0
  265. data/ext/lib/tkextlib/tile/tentry.rb +48 -0
  266. data/ext/lib/tkextlib/tile/tframe.rb +33 -0
  267. data/ext/lib/tkextlib/tile/tlabel.rb +33 -0
  268. data/ext/lib/tkextlib/tile/tlabelframe.rb +36 -0
  269. data/ext/lib/tkextlib/tile/tmenubutton.rb +36 -0
  270. data/ext/lib/tkextlib/tile/tnotebook.rb +139 -0
  271. data/ext/lib/tkextlib/tile/tpaned.rb +231 -0
  272. data/ext/lib/tkextlib/tile/tprogressbar.rb +56 -0
  273. data/ext/lib/tkextlib/tile/tradiobutton.rb +36 -0
  274. data/ext/lib/tkextlib/tile/treeview.rb +1239 -0
  275. data/ext/lib/tkextlib/tile/tscale.rb +53 -0
  276. data/ext/lib/tkextlib/tile/tscrollbar.rb +54 -0
  277. data/ext/lib/tkextlib/tile/tseparator.rb +33 -0
  278. data/ext/lib/tkextlib/tile/tsquare.rb +30 -0
  279. data/ext/lib/tkextlib/tkDND.rb +18 -0
  280. data/ext/lib/tkextlib/tkDND/setup.rb +8 -0
  281. data/ext/lib/tkextlib/tkDND/shape.rb +125 -0
  282. data/ext/lib/tkextlib/tkDND/tkdnd.rb +182 -0
  283. data/ext/lib/tkextlib/tkHTML.rb +13 -0
  284. data/ext/lib/tkextlib/tkHTML/htmlwidget.rb +453 -0
  285. data/ext/lib/tkextlib/tkHTML/setup.rb +8 -0
  286. data/ext/lib/tkextlib/tkimg.rb +36 -0
  287. data/ext/lib/tkextlib/tkimg/README +26 -0
  288. data/ext/lib/tkextlib/tkimg/bmp.rb +33 -0
  289. data/ext/lib/tkextlib/tkimg/gif.rb +33 -0
  290. data/ext/lib/tkextlib/tkimg/ico.rb +33 -0
  291. data/ext/lib/tkextlib/tkimg/jpeg.rb +33 -0
  292. data/ext/lib/tkextlib/tkimg/pcx.rb +33 -0
  293. data/ext/lib/tkextlib/tkimg/pixmap.rb +44 -0
  294. data/ext/lib/tkextlib/tkimg/png.rb +33 -0
  295. data/ext/lib/tkextlib/tkimg/ppm.rb +33 -0
  296. data/ext/lib/tkextlib/tkimg/ps.rb +33 -0
  297. data/ext/lib/tkextlib/tkimg/setup.rb +8 -0
  298. data/ext/lib/tkextlib/tkimg/sgi.rb +33 -0
  299. data/ext/lib/tkextlib/tkimg/sun.rb +33 -0
  300. data/ext/lib/tkextlib/tkimg/tga.rb +33 -0
  301. data/ext/lib/tkextlib/tkimg/tiff.rb +33 -0
  302. data/ext/lib/tkextlib/tkimg/window.rb +33 -0
  303. data/ext/lib/tkextlib/tkimg/xbm.rb +33 -0
  304. data/ext/lib/tkextlib/tkimg/xpm.rb +33 -0
  305. data/ext/lib/tkextlib/tktable.rb +14 -0
  306. data/ext/lib/tkextlib/tktable/setup.rb +8 -0
  307. data/ext/lib/tkextlib/tktable/tktable.rb +957 -0
  308. data/ext/lib/tkextlib/tktrans.rb +14 -0
  309. data/ext/lib/tkextlib/tktrans/setup.rb +8 -0
  310. data/ext/lib/tkextlib/tktrans/tktrans.rb +64 -0
  311. data/ext/lib/tkextlib/treectrl.rb +13 -0
  312. data/ext/lib/tkextlib/treectrl/setup.rb +8 -0
  313. data/ext/lib/tkextlib/treectrl/tktreectrl.rb +2461 -0
  314. data/ext/lib/tkextlib/trofs.rb +13 -0
  315. data/ext/lib/tkextlib/trofs/setup.rb +8 -0
  316. data/ext/lib/tkextlib/trofs/trofs.rb +51 -0
  317. data/ext/lib/tkextlib/version.rb +6 -0
  318. data/ext/lib/tkextlib/vu.rb +48 -0
  319. data/ext/lib/tkextlib/vu/bargraph.rb +61 -0
  320. data/ext/lib/tkextlib/vu/charts.rb +53 -0
  321. data/ext/lib/tkextlib/vu/dial.rb +102 -0
  322. data/ext/lib/tkextlib/vu/pie.rb +282 -0
  323. data/ext/lib/tkextlib/vu/setup.rb +8 -0
  324. data/ext/lib/tkextlib/vu/spinbox.rb +22 -0
  325. data/ext/lib/tkextlib/winico.rb +14 -0
  326. data/ext/lib/tkextlib/winico/setup.rb +8 -0
  327. data/ext/lib/tkextlib/winico/winico.rb +224 -0
  328. data/ext/lib/tkfont.rb +4 -0
  329. data/ext/lib/tkmacpkg.rb +4 -0
  330. data/ext/lib/tkmenubar.rb +4 -0
  331. data/ext/lib/tkmngfocus.rb +4 -0
  332. data/ext/lib/tkpalette.rb +4 -0
  333. data/ext/lib/tkscrollbox.rb +4 -0
  334. data/ext/lib/tktext.rb +4 -0
  335. data/ext/lib/tkvirtevent.rb +4 -0
  336. data/ext/lib/tkwinpkg.rb +4 -0
  337. data/ext/old-README.tcltklib.eucj +159 -0
  338. data/ext/stubs.c +531 -0
  339. data/ext/stubs.h +33 -0
  340. data/ext/tcltklib.c +10155 -0
  341. data/ext/tkutil/.cvsignore +3 -0
  342. data/ext/tkutil/depend +1 -0
  343. data/ext/tkutil/extconf.rb +14 -0
  344. data/ext/tkutil/tkutil.c +1789 -0
  345. metadata +418 -0
@@ -0,0 +1,1272 @@
1
+ #
2
+ # tkextlib/blt/treeview.rb
3
+ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
4
+ #
5
+
6
+ require 'tk'
7
+ require 'tkextlib/blt.rb'
8
+ require 'tk/validation.rb'
9
+
10
+ module Tk::BLT
11
+ class Treeview < TkWindow
12
+ module ConfigMethod
13
+ end
14
+
15
+ module TagOrID_Methods
16
+ end
17
+
18
+ class Node < TkObject
19
+ end
20
+
21
+ class Tag < TkObject
22
+ end
23
+ end
24
+
25
+ class Hiertable < Treeview
26
+ end
27
+ end
28
+
29
+ ######################################
30
+
31
+ module Tk::BLT::Treeview::ConfigMethod
32
+ include TkItemConfigMethod
33
+
34
+ def __item_boolval_optkeys(id)
35
+ case id
36
+ when Array
37
+ # id := [ 'column', name ]
38
+ ['edit', 'hide']
39
+ when 'sort'
40
+ ['decreasing']
41
+ else
42
+ []
43
+ end
44
+ end
45
+ private :__item_boolval_optkeys
46
+
47
+ def __item_strval_optkeys(id)
48
+ case id
49
+ when Array
50
+ # id := [ 'column', name ]
51
+ super() << 'titleforeground' << 'titleshadow'
52
+ when 'sort'
53
+ ['decreasing']
54
+ else
55
+ []
56
+ end
57
+ end
58
+ private :__item_strval_optkeys
59
+
60
+ def __item_listval_optkeys(id)
61
+ case id
62
+ when 'entry'
63
+ ['bindtags']
64
+ else
65
+ []
66
+ end
67
+ end
68
+ private :__item_listval_optkeys
69
+
70
+ def __item_cget_cmd(id)
71
+ if id.kind_of?(Array)
72
+ # id := [ type, name ]
73
+ [self.path, id[0], 'cget', id[1]]
74
+ else
75
+ [self.path, id, 'cget']
76
+ end
77
+ end
78
+ private :__item_cget_cmd
79
+
80
+ def __item_config_cmd(id)
81
+ if id.kind_of?(Array)
82
+ # id := [ type, name ]
83
+ [self.path, id[0], 'configure', id[1]]
84
+ else
85
+ [self.path, id, 'configure']
86
+ end
87
+ end
88
+ private :__item_config_cmd
89
+
90
+ def __item_pathname(id)
91
+ if id.kind_of?(Array)
92
+ id = tagid(id[1])
93
+ end
94
+ [self.path, id].join(';')
95
+ end
96
+ private :__item_pathname
97
+
98
+ def column_cget(name, option)
99
+ itemcget(['column', name], option)
100
+ end
101
+ def column_cget_strict(name, option)
102
+ itemcget_strict(['column', name], option)
103
+ end
104
+ def column_configure(name, slot, value=None)
105
+ itemconfigure(['column', name], slot, value)
106
+ end
107
+ def column_configinfo(name, slot=nil)
108
+ itemconfiginfo(['column', name], slot)
109
+ end
110
+ def current_column_configinfo(name, slot=nil)
111
+ current_itemconfiginfo(['column', name], slot)
112
+ end
113
+
114
+ def button_cget(option)
115
+ itemcget('button', option)
116
+ end
117
+ def button_cget_strict(option)
118
+ itemcget_strict('button', option)
119
+ end
120
+ def button_configure(slot, value=None)
121
+ itemconfigure('button', slot, value)
122
+ end
123
+ def button_configinfo(slot=nil)
124
+ itemconfiginfo('button', slot)
125
+ end
126
+ def current_button_configinfo(slot=nil)
127
+ current_itemconfiginfo('button', slot)
128
+ end
129
+
130
+ def entry_cget(option)
131
+ ret = itemcget('entry', option)
132
+ if option == 'bindtags' || option == :bindtags
133
+ ret.collect{|tag| TkBindTag.id2obj(tag)}
134
+ else
135
+ ret
136
+ end
137
+ end
138
+ def entry_cget_strict(option)
139
+ ret = itemcget_strict('entry', option)
140
+ if option == 'bindtags' || option == :bindtags
141
+ ret.collect{|tag| TkBindTag.id2obj(tag)}
142
+ else
143
+ ret
144
+ end
145
+ end
146
+ def entry_configure(slot, value=None)
147
+ itemconfigure('entry', slot, value)
148
+ end
149
+ def entry_configinfo(slot=nil)
150
+ ret = itemconfiginfo('entry', slot)
151
+
152
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
153
+ if slot
154
+ if slot == 'bindtags' || slot == :bindtags
155
+ ret[-2] = ret[-2].collect{|tag| TkBindTag.id2obj(tag)}
156
+ ret[-1] = ret[-1].collect{|tag| TkBindTag.id2obj(tag)}
157
+ end
158
+ else
159
+ inf = ret.assoc('bindtags')
160
+ inf[-2] = inf[-2].collect{|tag| TkBindTag.id2obj(tag)}
161
+ inf[-1] = inf[-1].collect{|tag| TkBindTag.id2obj(tag)}
162
+ end
163
+
164
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
165
+ if (inf = ret['bindtags'])
166
+ inf[-2] = inf[-2].collect{|tag| TkBindTag.id2obj(tag)}
167
+ inf[-1] = inf[-1].collect{|tag| TkBindTag.id2obj(tag)}
168
+ ret['bindtags'] = inf
169
+ end
170
+ end
171
+
172
+ ret
173
+ end
174
+ def current_entry_configinfo(slot=nil)
175
+ ret = current_itemconfiginfo('entry', slot)
176
+
177
+ if (val = ret['bindtags'])
178
+ ret['bindtags'] = val.collect{|tag| TkBindTag.id2obj(tag)}
179
+ end
180
+
181
+ ret
182
+ end
183
+
184
+ def sort_cget(option)
185
+ itemcget('sort', option)
186
+ end
187
+ def sort_cget_strict(option)
188
+ itemcget_strict('sort', option)
189
+ end
190
+ def sort_configure(slot, value=None)
191
+ itemconfigure('sort', slot, value)
192
+ end
193
+ def sort_configinfo(slot=nil)
194
+ itemconfiginfo('sort', slot)
195
+ end
196
+ def current_sort_configinfo(slot=nil)
197
+ current_itemconfiginfo('sort', slot)
198
+ end
199
+
200
+ def text_cget(option)
201
+ itemcget('text', option)
202
+ end
203
+ def text_cget_strict(option)
204
+ itemcget_strict('text', option)
205
+ end
206
+ def text_configure(slot, value=None)
207
+ itemconfigure('text', slot, value)
208
+ end
209
+ def text_configinfo(slot=nil)
210
+ itemconfiginfo('text', slot)
211
+ end
212
+ def current_text_configinfo(slot=nil)
213
+ current_itemconfiginfo('text', slot)
214
+ end
215
+
216
+ private :itemcget, :itemcget_strict
217
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
218
+ end
219
+
220
+ class Tk::BLT::Treeview
221
+ TkCommandNames = ['::blt::treeview'.freeze].freeze
222
+ WidgetClassName = 'TreeView'.freeze
223
+ WidgetClassNames[WidgetClassName] = self
224
+
225
+ include Scrollable
226
+ include ValidateConfigure
227
+ include ItemValidateConfigure
228
+ include Tk::BLT::Treeview::ConfigMethod
229
+
230
+ ########################
231
+
232
+ def __boolval_optkeys
233
+ ['autocreate', 'allowduplicates', 'exportselection', 'flat', 'hideroot',
234
+ 'newtags', 'showtitles', 'sortselection']
235
+ end
236
+ private :__boolval_optkeys
237
+
238
+ def __strval_optkeys
239
+ super() + ['focusforeground', 'linecolor', 'separator', 'trim']
240
+ end
241
+ private :__strval_optkeys
242
+
243
+ ########################
244
+
245
+ class OpenCloseCommand < TkValidateCommand
246
+ class ValidateArgs < TkUtil::CallbackSubst
247
+ KEY_TBL = [
248
+ [ ?W, ?w, :widget ],
249
+ [ ?p, ?s, :name ],
250
+ [ ?P, ?s, :fullpath ],
251
+ [ ?#, ?x, :node_id ],
252
+ nil
253
+ ]
254
+
255
+ PROC_TBL = [
256
+ [ ?x, TkComm.method(:num_or_str) ],
257
+ [ ?s, TkComm.method(:string) ],
258
+ [ ?w, TkComm.method(:window) ],
259
+ nil
260
+ ]
261
+
262
+ =begin
263
+ # for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
264
+ KEY_TBL.map!{|inf|
265
+ if inf.kind_of?(Array)
266
+ inf[0] = inf[0].getbyte(0) if inf[0].kind_of?(String)
267
+ inf[1] = inf[1].getbyte(0) if inf[1].kind_of?(String)
268
+ end
269
+ inf
270
+ }
271
+
272
+ PROC_TBL.map!{|inf|
273
+ if inf.kind_of?(Array)
274
+ inf[0] = inf[0].getbyte(0) if inf[0].kind_of?(String)
275
+ end
276
+ inf
277
+ }
278
+ =end
279
+
280
+ _setup_subst_table(KEY_TBL, PROC_TBL);
281
+
282
+ def self.ret_val(val)
283
+ val
284
+ end
285
+ end
286
+
287
+ def self._config_keys
288
+ ['opencommand', 'closecomand']
289
+ end
290
+ end
291
+
292
+ def __validation_class_list
293
+ super() << OpenCloseCommand
294
+ end
295
+
296
+ Tk::ValidateConfigure.__def_validcmd(binding, OpenCloseCommand)
297
+
298
+ ########################
299
+
300
+ def __item_validation_class_list(id)
301
+ case id
302
+ when 'entry'
303
+ super(id) << OpenCloseCommand
304
+ else
305
+ super(id)
306
+ end
307
+ end
308
+
309
+ Tk::ItemValidateConfigure.__def_validcmd(binding, OpenCloseCommand)
310
+
311
+ ########################
312
+
313
+ def __destroy_hook__
314
+ Tk::BLT::Treeview::Node::TreeNodeID_TBL.mutex.synchronize{
315
+ Tk::BLT::Treeview::Node::TreeNodeID_TBL.delete(@path)
316
+ }
317
+ Tk::BLT::Treeview::Tag::TreeTagID_TBL.mutex.synchronize{
318
+ Tk::BLT::Treeview::Tag::TreeTagID_TBL.delete(@path)
319
+ }
320
+ end
321
+
322
+ def tagid(tag)
323
+ if tag.kind_of?(Tk::BLT::Treeview::Node) \
324
+ || tag.kind_of?(Tk::BLT::Treeview::Tag)
325
+ tag.id
326
+ else
327
+ tag # maybe an Array of configure paramters
328
+ end
329
+ end
330
+ private :tagid
331
+
332
+ def tagid2obj(tagid)
333
+ if tagid.kind_of?(Integer)
334
+ Tk::BLT::Treeview::Node.id2obj(self, tagid.to_s)
335
+ elsif tagid.kind_of?(String)
336
+ if tagid =~ /^\d+$/
337
+ Tk::BLT::Treeview::Node.id2obj(self, tagid)
338
+ else
339
+ Tk::BLT::Treeview::Tag.id2obj(self, tagid)
340
+ end
341
+ else
342
+ tagid
343
+ end
344
+ end
345
+
346
+ def bbox(*tags)
347
+ list(tk_send('bbox', *(tags.collect{|tag| tagid(tag)})))
348
+ end
349
+
350
+ def screen_bbox(*tags)
351
+ list(tk_send('bbox', '-screen', *(tags.collect{|tag| tagid(tag)})))
352
+ end
353
+
354
+ def tag_bind(tag, seq, *args)
355
+ if TkComm._callback_entry?(args[0]) || !block_given?
356
+ cmd = args.shift
357
+ else
358
+ cmd = Proc.new
359
+ end
360
+ _bind([@path, 'bind', tagid(tag)], seq, cmd, *args)
361
+ self
362
+ end
363
+ def tag_bind_append(tag, seq, *args)
364
+ if TkComm._callback_entry?(args[0]) || !block_given?
365
+ cmd = args.shift
366
+ else
367
+ cmd = Proc.new
368
+ end
369
+ _bind_append([@path, 'bind', tagid(tag)], seq, cmd, *args)
370
+ self
371
+ end
372
+ def tag_bind_remove(tag, seq)
373
+ _bind_remove([@path, 'bind', tagid(tag)], seq)
374
+ self
375
+ end
376
+ def tag_bindinfo(tag, seq=nil)
377
+ _bindinfo([@path, 'bind', tagid(tag)], seq)
378
+ end
379
+
380
+ def button_activate(tag)
381
+ tk_send('button', 'activate', tagid(tag))
382
+ self
383
+ end
384
+
385
+ def button_bind(tag, seq, *args)
386
+ if TkComm._callback_entry?(args[0]) || !block_given?
387
+ cmd = args.shift
388
+ else
389
+ cmd = Proc.new
390
+ end
391
+ _bind([@path, 'button', 'bind', tagid(tag)], seq, cmd, *args)
392
+ self
393
+ end
394
+ def button_bind_append(tag, seq, *args)
395
+ if TkComm._callback_entry?(args[0]) || !block_given?
396
+ cmd = args.shift
397
+ else
398
+ cmd = Proc.new
399
+ end
400
+ _bind_append([@path, 'button', 'bind', tagid(tag)], seq, cmd, *args)
401
+ self
402
+ end
403
+ def button_bind_remove(tag, seq)
404
+ _bind_remove([@path, 'button', 'bind', tagid(tag)], seq)
405
+ self
406
+ end
407
+ def button_bindinfo(tag, seq=nil)
408
+ _bindinfo([@path, 'button', 'bind', tagid(tag)], seq)
409
+ end
410
+
411
+ def close(*tags)
412
+ tk_send('close', *(tags.collect{|tag| tagid(tag)}))
413
+ self
414
+ end
415
+ def close_recurse(*tags)
416
+ tk_send('close', '-recurse', *(tags.collect{|tag| tagid(tag)}))
417
+ self
418
+ end
419
+
420
+ def column_activate(column=None)
421
+ if column == None
422
+ tk_send('column', 'activate')
423
+ else
424
+ tk_send('column', 'activate', column)
425
+ self
426
+ end
427
+ end
428
+
429
+ def column_delete(*fields)
430
+ tk_send('column', 'delete', *fields)
431
+ self
432
+ end
433
+ def column_insert(pos, field, *opts)
434
+ tk_send('column', 'insert', pos, field, *opts)
435
+ self
436
+ end
437
+ def column_invoke(field)
438
+ tk_send('column', 'invoke', field)
439
+ self
440
+ end
441
+ def column_move(name, dest)
442
+ tk_send('column', 'move', name, dest)
443
+ self
444
+ end
445
+ def column_names()
446
+ simplelist(tk_send('column', 'names'))
447
+ end
448
+ def column_nearest(x, y=None)
449
+ tk_send('column', 'nearest', x, y)
450
+ end
451
+
452
+ def curselection
453
+ simplelist(tk_send('curselection')).collect{|id| tagid2obj(id)}
454
+ end
455
+
456
+ def delete(*tags)
457
+ tk_send('delete', *(tags.collect{|tag| tagid(tag)}))
458
+ self
459
+ end
460
+
461
+ def entry_activate(tag)
462
+ tk_send('entry', 'activate', tagid(tag))
463
+ self
464
+ end
465
+ def entry_children(tag, first=None, last=None)
466
+ simplelist(tk_send('entry', 'children', tagid(tag),
467
+ first, last)).collect{|id| tagid2obj(id)}
468
+ end
469
+ def entry_delete(tag, first=None, last=None)
470
+ tk_send('entry', 'delete', tagid(tag), first, last)
471
+ end
472
+ def entry_before?(tag1, tag2)
473
+ bool(tk_send('entry', 'isbefore', tagid(tag1), tagid(tag2)))
474
+ end
475
+ def entry_hidden?(tag)
476
+ bool(tk_send('entry', 'ishidden', tagid(tag)))
477
+ end
478
+ def entry_open?(tag)
479
+ bool(tk_send('entry', 'isopen', tagid(tag)))
480
+ end
481
+
482
+ def entry_size(tag)
483
+ number(tk_send('entry', 'size', tagid(tag)))
484
+ end
485
+ def entry_size_recurse(tag)
486
+ number(tk_send('entry', 'size', '-recurse', tagid(tag)))
487
+ end
488
+
489
+ def _search_flags(keys)
490
+ keys = _symbolkey2str(keys)
491
+ keys['exact'] = None if keys.delete('exact')
492
+ keys['glob'] = None if keys.delete('glob')
493
+ keys['regexp'] = None if keys.delete('regexp')
494
+ keys['nonmatching'] = None if keys.delete('nonmatching')
495
+ end
496
+ private :_search_flags
497
+
498
+ ################################
499
+
500
+ class FindExecFlagValue < TkValidateCommand
501
+ class ValidateArgs < TkUtil::CallbackSubst
502
+ KEY_TBL = [
503
+ [ ?W, ?w, :widget ],
504
+ [ ?p, ?s, :name ],
505
+ [ ?P, ?s, :fullpath ],
506
+ [ ?#, ?x, :node_id ],
507
+ nil
508
+ ]
509
+
510
+ PROC_TBL = [
511
+ [ ?x, TkComm.method(:num_or_str) ],
512
+ [ ?s, TkComm.method(:string) ],
513
+ [ ?w, TkComm.method(:window) ],
514
+ nil
515
+ ]
516
+
517
+ =begin
518
+ # for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
519
+ KEY_TBL.map!{|inf|
520
+ if inf.kind_of?(Array)
521
+ inf[0] = inf[0].getbyte(0) if inf[0].kind_of?(String)
522
+ inf[1] = inf[1].getbyte(0) if inf[1].kind_of?(String)
523
+ end
524
+ inf
525
+ }
526
+
527
+ PROC_TBL.map!{|inf|
528
+ if inf.kind_of?(Array)
529
+ inf[0] = inf[0].getbyte(0) if inf[0].kind_of?(String)
530
+ end
531
+ inf
532
+ }
533
+ =end
534
+
535
+ _setup_subst_table(KEY_TBL, PROC_TBL);
536
+
537
+ def self.ret_val(val)
538
+ val
539
+ end
540
+ end
541
+
542
+ def self._config_keys
543
+ []
544
+ end
545
+ end
546
+
547
+ def _find_exec_flag_value(val)
548
+ if val.kind_of?(Array)
549
+ cmd, *args = val
550
+ #FindExecFlagValue.new(cmd, args.join(' '))
551
+ FindExecFlagValue.new(cmd, *args)
552
+ elsif TkComm._callback_entry?(val)
553
+ FindExecFlagValue.new(val)
554
+ else
555
+ val
556
+ end
557
+ end
558
+
559
+ ################################
560
+
561
+ def find(first, last, keys={})
562
+ keys = _search_flags(keys)
563
+ keys['exec'] = _find_exec_flag_value(keys['exec']) if keys.key?('exec')
564
+ args = hash_kv(keys) << '--' << tagid(first) << tagid(last)
565
+ simplelist(tk_send('find', *args)).collect{|id| tagid2obj(id)}
566
+ end
567
+
568
+ def tag_focus(tag)
569
+ tk_send('focus', tagid(tag))
570
+ self
571
+ end
572
+ def get(*tags)
573
+ simplelist(tk_send('get', *(tags.collect{|tag| tagid(tag)})))
574
+ end
575
+ def get_full(*tags)
576
+ simplelist(tk_send('get', '-full', *(tags.collect{|tag| tagid(tag)})))
577
+ end
578
+
579
+ def hide(*tags)
580
+ if tags[-1].kind_of?(Hash)
581
+ keys = tags.pop
582
+ else
583
+ keys = {}
584
+ end
585
+ keys = _search_flags(keys)
586
+ args = hash_kv(keys) << '--'
587
+ args.concat(tags.collect{|t| tagid(t)})
588
+ tk_send('hide', *args)
589
+ self
590
+ end
591
+
592
+ def index(str)
593
+ tagid2obj(tk_send('index', str))
594
+ end
595
+ def index_at(tag, str)
596
+ tagid2obj(tk_send('index', '-at', tagid(tag), str))
597
+ end
598
+ def index_at_path(tag, str)
599
+ tagid2obj(tk_send('index', '-at', tagid(tag), '-path', str))
600
+ end
601
+
602
+ def insert(pos, parent=nil, keys={})
603
+ Tk::BLT::Treeview::Node.new(pos, parent, keys)
604
+ end
605
+ def insert_at(tag, pos, parent=nil, keys={})
606
+ if parent.kind_of?(Hash)
607
+ keys = parent
608
+ parent = nil
609
+ end
610
+
611
+ keys = _symbolkey2str(keys)
612
+ keys['at'] = tagid(tag)
613
+
614
+ Tk::BLT::Treeview::Node.new(pos, parent, keys)
615
+ end
616
+
617
+ def move_before(tag, dest)
618
+ tk_send('move', tagid(tag), 'before', tagid(dest))
619
+ self
620
+ end
621
+ def move_after(tag, dest)
622
+ tk_send('move', tagid(tag), 'after', tagid(dest))
623
+ self
624
+ end
625
+ def move_into(tag, dest)
626
+ tk_send('move', tagid(tag), 'into', tagid(dest))
627
+ self
628
+ end
629
+
630
+ def nearest(x, y, var=None)
631
+ tagid2obj(tk_send('nearest', x, y, var))
632
+ end
633
+
634
+ def open(*tags)
635
+ tk_send('open', *(tags.collect{|tag| tagid(tag)}))
636
+ self
637
+ end
638
+ def open_recurse(*tags)
639
+ tk_send('open', '-recurse', *(tags.collect{|tag| tagid(tag)}))
640
+ self
641
+ end
642
+
643
+ def range(first, last)
644
+ simplelist(tk_send('range', tagid(first), tagid(last))).collect{|id|
645
+ tagid2obj(id)
646
+ }
647
+ end
648
+ def range_open(first, last)
649
+ simplelist(tk_send('range', '-open',
650
+ tagid(first), tagid(last))).collect{|id|
651
+ tagid2obj(id)
652
+ }
653
+ end
654
+
655
+ def scan_mark(x, y)
656
+ tk_send_without_enc('scan', 'mark', x, y)
657
+ self
658
+ end
659
+ def scan_dragto(x, y)
660
+ tk_send_without_enc('scan', 'dragto', x, y)
661
+ self
662
+ end
663
+
664
+ def see(tag)
665
+ tk_send_without_enc('see', tagid(tag))
666
+ self
667
+ end
668
+ def see_anchor(anchor, tag)
669
+ tk_send_without_enc('see', '-anchor', anchor, tagid(tag))
670
+ self
671
+ end
672
+
673
+ def selection_anchor(tag)
674
+ tk_send_without_enc('selection', 'anchor', tagid(tag))
675
+ self
676
+ end
677
+ def selection_cancel()
678
+ tk_send_without_enc('selection', 'cancel')
679
+ self
680
+ end
681
+ def selection_clear(first, last=None)
682
+ tk_send_without_enc('selection', 'clear', tagid(first), tagid(last))
683
+ self
684
+ end
685
+ def selection_clear_all()
686
+ tk_send_without_enc('selection', 'clearall')
687
+ self
688
+ end
689
+ def selection_mark(tag)
690
+ tk_send_without_enc('selection', 'mark', tagid(tag))
691
+ self
692
+ end
693
+ def selection_include?(tag)
694
+ bool(tk_send('selection', 'include', tagid(tag)))
695
+ end
696
+ def selection_present?()
697
+ bool(tk_send('selection', 'present'))
698
+ end
699
+ def selection_set(first, last=None)
700
+ tk_send_without_enc('selection', 'set', tagid(first), tagid(last))
701
+ self
702
+ end
703
+ def selection_toggle(first, last=None)
704
+ tk_send_without_enc('selection', 'toggle', tagid(first), tagid(last))
705
+ self
706
+ end
707
+
708
+ def show(*tags)
709
+ if tags[-1].kind_of?(Hash)
710
+ keys = tags.pop
711
+ else
712
+ keys = {}
713
+ end
714
+ keys = _search_flags(keys)
715
+ args = hash_kv(keys) << '--'
716
+ args.concat(tags.collect{|t| tagid(t)})
717
+ tk_send('show', *args)
718
+ self
719
+ end
720
+
721
+ def sort_auto(mode)
722
+ tk_send('sort', 'auto', mode)
723
+ self
724
+ end
725
+ def sort_auto=(mode)
726
+ tk_send('sort', 'auto', mode)
727
+ mode
728
+ end
729
+ def sort_auto?
730
+ bool(tk_send('sort', 'auto'))
731
+ end
732
+ def sort_once(*tags)
733
+ tk_send('sort', 'once', *(tags.collect{|tag| tagid(tag)}))
734
+ self
735
+ end
736
+ def sort_once_recurse(*tags)
737
+ tk_send('sort', 'once', '-recurse', *(tags.collect{|tag| tagid(tag)}))
738
+ self
739
+ end
740
+
741
+ def tag_add(tag, *ids)
742
+ tk_send('tag', 'add', tagid(tag), *ids)
743
+ self
744
+ end
745
+ def tag_delete(tag, *ids)
746
+ tk_send('tag', 'delete', tagid(tag), *ids)
747
+ self
748
+ end
749
+ def tag_forget(tag)
750
+ tk_send('tag', 'forget', tagid(tag))
751
+ self
752
+ end
753
+ def tag_names(id=nil)
754
+ id = (id)? tagid(id): None
755
+
756
+ simplelist(tk_send('tag', 'nodes', id)).collect{|tag|
757
+ Tk::BLT::Treeview::Tag.id2obj(self, tag)
758
+ }
759
+ end
760
+ def tag_nodes(tag)
761
+ simplelist(tk_send('tag', 'nodes', tagid(tag))).collect{|id|
762
+ Tk::BLT::Treeview::Node.id2obj(self, id)
763
+ }
764
+ end
765
+
766
+ def text_apply
767
+ tk_send('text', 'apply')
768
+ self
769
+ end
770
+ def text_cancel
771
+ tk_send('text', 'cancel')
772
+ self
773
+ end
774
+
775
+ def text_delete(first, last)
776
+ tk_send('text', 'delete', first, last)
777
+ self
778
+ end
779
+ def text_get(x, y)
780
+ tk_send('text', 'get', x, y)
781
+ end
782
+ def text_get_root(x, y)
783
+ tk_send('text', 'get', '-root', x, y)
784
+ end
785
+ def text_icursor(idx)
786
+ tk_send('text', 'icursor', idx)
787
+ self
788
+ end
789
+ def text_index(idx)
790
+ num_or_str(tk_send('text', 'index', idx))
791
+ end
792
+ def text_insert(idx, str)
793
+ tk_send('text', 'insert', idx, str)
794
+ self
795
+ end
796
+
797
+ def text_selection_adjust(idx)
798
+ tk_send('text', 'selection', 'adjust', idx)
799
+ self
800
+ end
801
+ def text_selection_clear
802
+ tk_send('text', 'selection', 'clear')
803
+ self
804
+ end
805
+ def text_selection_from(idx)
806
+ tk_send('text', 'selection', 'from', idx)
807
+ self
808
+ end
809
+ def text_selection_present
810
+ num_or_str(tk_send('text', 'selection', 'present'))
811
+ end
812
+ def text_selection_range(start, last)
813
+ tk_send('text', 'selection', 'range', start, last)
814
+ self
815
+ end
816
+ def text_selection_to(idx)
817
+ tk_send('text', 'selection', 'to', idx)
818
+ self
819
+ end
820
+
821
+ def toggle(tag)
822
+ tk_send('toggle', tagid(tag))
823
+ self
824
+ end
825
+ end
826
+
827
+ ######################################
828
+
829
+ module Tk::BLT::Treeview::TagOrID_Methods
830
+ def bbox
831
+ @tree.bbox(self)
832
+ end
833
+ def screen_bbox
834
+ @tree.screen_bbox(self)
835
+ end
836
+
837
+ def bind(seq, *args)
838
+ @tree.tag_bind(self, seq, *args)
839
+ self
840
+ end
841
+ def bind_append(seq, *args)
842
+ @tree.tag_bind_append(self, seq, *args)
843
+ self
844
+ end
845
+ def bind_remove(seq)
846
+ @tree.tag_bind_remove(self, seq)
847
+ self
848
+ end
849
+ def bindinfo(seq=nil)
850
+ @tree.tag_bindinfo(self, seq)
851
+ end
852
+
853
+ def button_activate
854
+ @tree.button_activate(self)
855
+ self
856
+ end
857
+
858
+ def button_bind(seq, *args)
859
+ @tree.button_bind(self, seq, *args)
860
+ self
861
+ end
862
+ def button_bind_append(seq, *args)
863
+ @tree.button_bind_append(self, seq, *args)
864
+ self
865
+ end
866
+ def button_bind_remove(seq)
867
+ @tree.button_bind_remove(self, seq)
868
+ self
869
+ end
870
+ def button_bindinfo(seq=nil)
871
+ @tree.button_bindinfo(self, seq)
872
+ end
873
+
874
+ def close
875
+ @tree.close(self)
876
+ self
877
+ end
878
+ def close_recurse
879
+ @tree.close_recurse(self)
880
+ self
881
+ end
882
+
883
+ def delete
884
+ @tree.delete(self)
885
+ self
886
+ end
887
+
888
+ def entry_activate
889
+ @tree.entry_activate(self)
890
+ self
891
+ end
892
+ def entry_children(first=None, last=None)
893
+ @tree.entry_children(self, first, last)
894
+ end
895
+ def entry_delete(first=None, last=None)
896
+ @tree.entry_delete(self, first, last)
897
+ end
898
+ def entry_before?(tag)
899
+ @tree.entry_before?(self, tag)
900
+ end
901
+ def entry_hidden?
902
+ @tree.entry_before?(self)
903
+ end
904
+ def entry_open?
905
+ @tree.entry_open?(self)
906
+ end
907
+
908
+ def entry_size
909
+ @tree.entry_size(self)
910
+ end
911
+ def entry_size_recurse
912
+ @tree.entry_size_recurse(self)
913
+ end
914
+
915
+ def focus
916
+ @tree.tag_focus(self)
917
+ self
918
+ end
919
+
920
+ def get
921
+ @tree.get(self)
922
+ end
923
+ def get_full
924
+ @tree.get_full(self)
925
+ end
926
+
927
+ def hide
928
+ @tree.hide(self)
929
+ self
930
+ end
931
+
932
+ def index(str)
933
+ @tree.index_at(self, str)
934
+ end
935
+ def index_path(str)
936
+ @tree.index_at_path(self, str)
937
+ end
938
+
939
+ def insert(pos, parent=nil, keys={})
940
+ @tree.insert_at(self, pos, parent, keys)
941
+ end
942
+
943
+ def move_before(dest)
944
+ @tree.move_before(self, dest)
945
+ self
946
+ end
947
+ def move_after(dest)
948
+ @tree.move_after(self, dest)
949
+ self
950
+ end
951
+ def move_into(dest)
952
+ @tree.move_into(self, dest)
953
+ self
954
+ end
955
+
956
+ def open
957
+ @tree.open(self)
958
+ self
959
+ end
960
+ def open_recurse
961
+ @tree.open_recurse(self)
962
+ self
963
+ end
964
+
965
+ def range_to(tag)
966
+ @tree.range(self, tag)
967
+ end
968
+ def range_open_to(tag)
969
+ @tree.range(self, tag)
970
+ end
971
+
972
+ def see
973
+ @tree.see(self)
974
+ self
975
+ end
976
+ def see_anchor(anchor)
977
+ @tree.see_anchor(anchor, self)
978
+ self
979
+ end
980
+
981
+ def selection_anchor
982
+ @tree.selection_anchor(self)
983
+ self
984
+ end
985
+ def selection_clear
986
+ @tree.selection_clear(self)
987
+ self
988
+ end
989
+ def selection_mark
990
+ @tree.selection_mark(self)
991
+ self
992
+ end
993
+ def selection_include?
994
+ @tree.selection_include?(self)
995
+ end
996
+ def selection_set
997
+ @tree.selection_set(self)
998
+ self
999
+ end
1000
+ def selection_toggle
1001
+ @tree.selection_toggle(self)
1002
+ self
1003
+ end
1004
+
1005
+ def show
1006
+ @tree.show(self)
1007
+ self
1008
+ end
1009
+
1010
+ def sort_once
1011
+ @tree.sort_once(self)
1012
+ self
1013
+ end
1014
+ def sort_once_recurse
1015
+ @tree.sort_once_recurse(self)
1016
+ self
1017
+ end
1018
+
1019
+ def toggle
1020
+ @tree.toggle(self)
1021
+ self
1022
+ end
1023
+ end
1024
+
1025
+ ######################################
1026
+
1027
+ class Tk::BLT::Treeview::Node < TkObject
1028
+ include Tk::BLT::Treeview::TagOrID_Methods
1029
+
1030
+ TreeNodeID_TBL = TkCore::INTERP.create_table
1031
+
1032
+ (TreeNode_ID = ['blt_treeview_node'.freeze, '00000'.taint]).instance_eval{
1033
+ @mutex = Mutex.new
1034
+ def mutex; @mutex; end
1035
+ freeze
1036
+ }
1037
+
1038
+ TkCore::INTERP.init_ip_env{
1039
+ TreeNodeID_TBL.mutex.synchronize{ TreeNodeID_TBL.clear }
1040
+ }
1041
+
1042
+ def self.id2obj(tree, id)
1043
+ tpath = tree.path
1044
+ TreeNodeID_TBL.mutex.synchronize{
1045
+ if TreeNodeID_TBL[tpath]
1046
+ if TreeNodeID_TBL[tpath][id]
1047
+ TreeNodeID_TBL[tpath][id]
1048
+ else
1049
+ begin
1050
+ # self.new(tree, nil, nil, 'node'=>Integer(id))
1051
+ unless (tk_call(@tpath, 'get', id)).empty?
1052
+ id = Integer(id)
1053
+ (obj = self.allocate).instance_eval{
1054
+ @parent = @tree = tree
1055
+ @tpath = @parent.path
1056
+ @path = @id = id
1057
+ TreeNodeID_TBL[@tpath] ||= {}
1058
+ TreeNodeID_TBL[@tpath][@id] = self
1059
+ }
1060
+ obj
1061
+ else
1062
+ id
1063
+ end
1064
+ rescue
1065
+ id
1066
+ end
1067
+ end
1068
+ else
1069
+ id
1070
+ end
1071
+ }
1072
+ end
1073
+
1074
+ def self.new(tree, pos, parent=nil, keys={})
1075
+ if parent.kind_of?(Hash)
1076
+ keys = parent
1077
+ parent = nil
1078
+ end
1079
+
1080
+ keys = _symbolkey2str(keys)
1081
+ tpath = tree.path
1082
+
1083
+ TreeNodeID_TBL.mutex.synchronize{
1084
+ TreeNodeID_TBL[tpath] ||= {}
1085
+ if (id = keys['node']) && (obj = TreeNodeID_TBL[tpath][id])
1086
+ keys.delete('node')
1087
+ tk_call(tree.path, 'move', id, pos, parent) if parent
1088
+ return obj
1089
+ end
1090
+
1091
+ #super(tree, pos, parent, keys)
1092
+ (obj = self.allocate).instance_eval{
1093
+ initialize(tree, pos, parent, keys)
1094
+ TreeNodeID_TBL[tpath][@id] = self
1095
+ }
1096
+ obj
1097
+ }
1098
+ end
1099
+
1100
+ def initialize(tree, pos, parent, keys)
1101
+ @parent = @tree = tree
1102
+ @tpath = @parent.path
1103
+
1104
+ if (id = keys['node'])
1105
+ # if tk_call(@tpath, 'get', id).empty?
1106
+ # fail RuntimeError, "not exist the node '#{id}'"
1107
+ # end
1108
+ @path = @id = id
1109
+ tk_call(@tpath, 'move', @id, pos, tagid(parent)) if parent
1110
+ configure(keys) if keys && ! keys.empty?
1111
+ else
1112
+ name = nil
1113
+ TreeNode_ID.mutex.synchronize{
1114
+ name = TreeNode_ID.join(TkCore::INTERP._ip_id_).freeze
1115
+ TreeNode_ID[1].succ!
1116
+ }
1117
+
1118
+ at = keys.delete['at']
1119
+
1120
+ if parent
1121
+ if parent.kind_of?(Tk::BLT::Treeview::Node) ||
1122
+ parent.kind_of?(Tk::BLT::Treeview::Tag)
1123
+ path = [get_full(parent.id)[0], name]
1124
+ at = nil # ignore 'at' option
1125
+ else
1126
+ path = [parent.to_s, name]
1127
+ end
1128
+ else
1129
+ path = name
1130
+ end
1131
+
1132
+ if at
1133
+ @id = tk_call(@tpath, 'insert', '-at', tagid(at), pos, path, keys)
1134
+ else
1135
+ @id = tk_call(@tpath, 'insert', pos, path, keys)
1136
+ end
1137
+ @path = @id
1138
+ end
1139
+ end
1140
+
1141
+ def id
1142
+ @id
1143
+ end
1144
+ end
1145
+
1146
+ ######################################
1147
+
1148
+ class Tk::BLT::Treeview::Tag < TkObject
1149
+ include Tk::BLT::Treeview::TagOrID_Methods
1150
+
1151
+ TreeTagID_TBL = TkCore::INTERP.create_table
1152
+
1153
+ (TreeTag_ID = ['blt_treeview_tag'.freeze, '00000'.taint]).instance_eval{
1154
+ @mutex = Mutex.new
1155
+ def mutex; @mutex; end
1156
+ freeze
1157
+ }
1158
+
1159
+ TkCore::INTERP.init_ip_env{
1160
+ TreeTagID_TBL.mutex.synchronize{ TreeTagID_TBL.clear }
1161
+ }
1162
+
1163
+ def self.id2obj(tree, name)
1164
+ tpath = tree.path
1165
+ TreeTagID_TBL.mutex.synchronize{
1166
+ if TreeTagID_TBL[tpath]
1167
+ if TreeTagID_TBL[tpath][name]
1168
+ TreeTagID_TBL[tpath][name]
1169
+ else
1170
+ #self.new(tree, name)
1171
+ (obj = self.allocate).instance_eval{
1172
+ @parent = @tree = tree
1173
+ @tpath = @parent.path
1174
+ @path = @id = name
1175
+ TreeTagID_TBL[@tpath] = {} unless TreeTagID_TBL[@tpath]
1176
+ TreeTagID_TBL[@tpath][@id] = self
1177
+ }
1178
+ obj
1179
+ end
1180
+ else
1181
+ id
1182
+ end
1183
+ }
1184
+ end
1185
+
1186
+ def self.new_by_name(tree, name, *ids)
1187
+ TreeTagID_TBL.mutex.synchronize{
1188
+ unless (obj = TreeTagID_TBL[tree.path][name])
1189
+ (obj = self.allocate).instance_eval{
1190
+ initialize(tree, name, ids)
1191
+ TreeTagID_TBL[@tpath] = {} unless TreeTagID_TBL[@tpath]
1192
+ TreeTagID_TBL[@tpath][@id] = self
1193
+ }
1194
+ end
1195
+ obj
1196
+ }
1197
+ end
1198
+
1199
+ def self.new(tree, *ids)
1200
+ TreeTagID_TBL.mutex.synchronize{
1201
+ (obj = self.allocate).instance_eval{
1202
+ if tree.kind_of?(Array)
1203
+ initialize(tree[0], tree[1], ids)
1204
+ else
1205
+ initialize(tree, nil, ids)
1206
+ end
1207
+ TreeTagID_TBL[@tpath] = {} unless TreeTagID_TBL[@tpath]
1208
+ TreeTagID_TBL[@tpath][@id] = self
1209
+ }
1210
+ obj
1211
+ }
1212
+ end
1213
+
1214
+ def initialize(tree, name, ids)
1215
+ @parent = @tree = tree
1216
+ @tpath = @parent.path
1217
+
1218
+ if name
1219
+ @path = @id = name
1220
+ else
1221
+ TreeTag_ID.mutex.synchronize{
1222
+ @path = @id = TreeTag_ID.join(TkCore::INTERP._ip_id_).freeze
1223
+ TreeTag_ID[1].succ!
1224
+ }
1225
+ end
1226
+
1227
+ unless ids.empty?
1228
+ tk_call(@tpath, 'tag', 'add', @id, *(ids.collect{|id| tagid(id)}))
1229
+ end
1230
+ end
1231
+
1232
+ def tagid(tag)
1233
+ if tag.kind_of?(Tk::BLT::Treeview::Node) \
1234
+ || tag.kind_of?(Tk::BLT::Treeview::Tag)
1235
+ tag.id
1236
+ else
1237
+ tag
1238
+ end
1239
+ end
1240
+ private :tagid
1241
+
1242
+ def id
1243
+ @id
1244
+ end
1245
+
1246
+ def add(*ids)
1247
+ tk_call(@tpath, 'tag', 'add', @id, *(ids{|id| tagid(id)}))
1248
+ self
1249
+ end
1250
+
1251
+ def remove(*ids)
1252
+ tk_call(@tpath, 'tag', 'delete', @id, *(ids{|id| tagid(id)}))
1253
+ self
1254
+ end
1255
+
1256
+ def forget
1257
+ tk_call(@tpath, 'tag', 'forget', @id)
1258
+ self
1259
+ end
1260
+
1261
+ def nodes
1262
+ simplelist(tk_call(@tpath, 'tag', 'nodes', @id)).collect{|id|
1263
+ Tk::BLT::Treeview::Node.id2obj(@tree, id)
1264
+ }
1265
+ end
1266
+ end
1267
+
1268
+ class Tk::BLT::Hiertable
1269
+ TkCommandNames = ['::blt::hiertable'.freeze].freeze
1270
+ WidgetClassName = 'Hiertable'.freeze
1271
+ WidgetClassNames[WidgetClassName] = self
1272
+ end