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,14 @@
1
+ #
2
+ # TkTrans support (win32 only)
3
+ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
4
+ #
5
+ require 'tk'
6
+
7
+ # call setup script for general 'tkextlib' libraries
8
+ require 'tkextlib/setup.rb'
9
+
10
+ # call setup script
11
+ require 'tkextlib/tktrans/setup.rb'
12
+
13
+ # load library
14
+ require 'tkextlib/tktrans/tktrans'
@@ -0,0 +1,8 @@
1
+ #
2
+ # setup.rb -- setup script before calling TkPackage.require()
3
+ #
4
+ # If you need some setup operations (for example, add a library path
5
+ # to the library search path) before using Tcl/Tk library packages
6
+ # wrapped by Ruby scripts in this directory, please write the setup
7
+ # operations in this file.
8
+ #
@@ -0,0 +1,64 @@
1
+ #
2
+ # TkTrans support (win32 only)
3
+ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
4
+ #
5
+ require 'tk'
6
+
7
+ # call setup script for general 'tkextlib' libraries
8
+ require 'tkextlib/setup.rb'
9
+
10
+ # call setup script
11
+ require 'tkextlib/tktrans/setup.rb'
12
+
13
+ TkPackage.require('tktrans') rescue Tk.load_tcllibrary('tktrans')
14
+
15
+ module Tk
16
+ module TkTrans
17
+ PACKAGE_NAME = 'tktrans'.freeze
18
+ def self.package_name
19
+ PACKAGE_NAME
20
+ end
21
+
22
+ def self.package_version
23
+ begin
24
+ TkPackage.require('tktrans')
25
+ rescue
26
+ ''
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ class TkWindow
33
+ def tktrans_set_image(img)
34
+ tk_send('tktrans::setwidget', @path, img)
35
+ self
36
+ end
37
+ def tktrans_get_image()
38
+ tk_send('tktrans::setwidget', @path)
39
+ end
40
+ end
41
+
42
+ class Tk::Root
43
+ undef tktrans_set_image, tktrans_get_image
44
+
45
+ def tktrans_set_image(img)
46
+ tk_send('tktrans::settoplevel', @path, img)
47
+ self
48
+ end
49
+ def tktrans_get_image()
50
+ tk_send('tktrans::settoplevel', @path)
51
+ end
52
+ end
53
+
54
+ class Tk::Toplevel
55
+ undef tktrans_set_image, tktrans_get_image
56
+
57
+ def tktrans_set_image(img)
58
+ tk_send('tktrans::settoplevel', @path, img)
59
+ self
60
+ end
61
+ def tktrans_get_image()
62
+ tk_send('tktrans::settoplevel', @path)
63
+ end
64
+ end
@@ -0,0 +1,13 @@
1
+ #
2
+ # TkTreeCtrl support
3
+ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
4
+ #
5
+
6
+ # call setup script for general 'tkextlib' libraries
7
+ require 'tkextlib/setup.rb'
8
+
9
+ # call setup script
10
+ require 'tkextlib/treectrl/setup.rb'
11
+
12
+ # load library
13
+ require 'tkextlib/treectrl/tktreectrl'
@@ -0,0 +1,8 @@
1
+ #
2
+ # setup.rb -- setup script before calling TkPackage.require()
3
+ #
4
+ # If you need some setup operations (for example, add a library path
5
+ # to the library search path) before using Tcl/Tk library packages
6
+ # wrapped by Ruby scripts in this directory, please write the setup
7
+ # operations in this file.
8
+ #
@@ -0,0 +1,2461 @@
1
+ #
2
+ # tkextlib/treectrl/tktreectrl.rb
3
+ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
4
+ #
5
+
6
+ require 'tk'
7
+
8
+ # call setup script for general 'tkextlib' libraries
9
+ require 'tkextlib/setup.rb'
10
+
11
+ # call setup script
12
+ require 'tkextlib/treectrl/setup.rb'
13
+
14
+ # TkPackage.require('treectrl', '1.0')
15
+ # TkPackage.require('treectrl', '1.1')
16
+ TkPackage.require('treectrl')
17
+
18
+ module Tk
19
+ class TreeCtrl < TkWindow
20
+ BindTag_FileList = TkBindTag.new_by_name('TreeCtrlFileList')
21
+
22
+ PACKAGE_NAME = 'treectrl'.freeze
23
+ def self.package_name
24
+ PACKAGE_NAME
25
+ end
26
+
27
+ def self.package_version
28
+ begin
29
+ TkPackage.require('treectrl')
30
+ rescue
31
+ ''
32
+ end
33
+ end
34
+
35
+ HasColumnCreateCommand =
36
+ (TkPackage.vcompare(self.package_version, '1.1') >= 0)
37
+
38
+ # dummy ::
39
+ # pkgIndex.tcl of TreeCtrl-1.0 doesn't support auto_load for
40
+ # 'loupe' command (probably it is bug, I think).
41
+ # So, calling a 'treectrl' command for loading the dll with
42
+ # the auto_load facility.
43
+ begin
44
+ tk_call('treectrl')
45
+ rescue
46
+ end
47
+ def self.loupe(img, x, y, w, h, zoom)
48
+ # NOTE: platform == 'unix' only
49
+
50
+ # img => TkPhotoImage
51
+ # x, y => screen coords
52
+ # w, h => magnifier width and height
53
+ # zoom => zooming rate
54
+ Tk.tk_call_without_enc('loupe', img, x, y, w, h, zoom)
55
+ end
56
+
57
+ def self.text_layout(font, text, keys={})
58
+ TkComm.list(Tk.tk_call_without_enc('textlayout', font, text, keys))
59
+ end
60
+
61
+ def self.image_tint(img, color, alpha)
62
+ Tk.tk_call_without_enc('imagetint', img, color, alpha)
63
+ end
64
+
65
+ class NotifyEvent < TkUtil::CallbackSubst
66
+ end
67
+
68
+ module ConfigMethod
69
+ end
70
+ end
71
+ TreeCtrl_Widget = TreeCtrl
72
+ end
73
+
74
+ ##############################################
75
+
76
+ class Tk::TreeCtrl::NotifyEvent
77
+ # [ <'%' subst-key char>, <proc type char>, <instance var (accessor) name>]
78
+ KEY_TBL = [
79
+ [ ?c, ?n, :item_num ],
80
+ [ ?d, ?s, :detail ],
81
+ [ ?D, ?l, :items ],
82
+ [ ?e, ?e, :event ],
83
+ [ ?I, ?n, :id ],
84
+ [ ?l, ?n, :lower_bound ],
85
+ [ ?p, ?n, :active_id ],
86
+ [ ?P, ?e, :pattern ],
87
+ [ ?S, ?l, :sel_items ],
88
+ [ ?T, ?w, :widget ],
89
+ [ ?u, ?n, :upper_bound ],
90
+ [ ?W, ?o, :object ],
91
+ [ ??, ?x, :parm_info ],
92
+ nil
93
+ ]
94
+
95
+ # [ <proc type char>, <proc/method to convert tcl-str to ruby-obj>]
96
+ PROC_TBL = [
97
+ [ ?n, TkComm.method(:num_or_str) ],
98
+ [ ?s, TkComm.method(:string) ],
99
+ [ ?l, TkComm.method(:list) ],
100
+ [ ?w, TkComm.method(:window) ],
101
+
102
+ [ ?e, proc{|val|
103
+ case val
104
+ when /^<<[^<>]+>>$/
105
+ TkVirtualEvent.getobj(val[1..-2])
106
+ when /^<[^<>]+>$/
107
+ val[1..-2]
108
+ else
109
+ val
110
+ end
111
+ }
112
+ ],
113
+
114
+ [ ?o, proc{|val| TkComm.tk_tcl2ruby(val)} ],
115
+
116
+ [ ?x, proc{|val|
117
+ begin
118
+ inf = {}
119
+ Hash[*(TkComm.list(val))].each{|k, v|
120
+ if keyinfo = KEY_TBL.assoc(k[0])
121
+ if cmd = PROC_TBL.assoc(keyinfo[1])
122
+ begin
123
+ new_v = cmd.call(v)
124
+ v = new_v
125
+ rescue
126
+ end
127
+ end
128
+ end
129
+ inf[k] = v
130
+ }
131
+ inf
132
+ rescue
133
+ val
134
+ end
135
+ } ],
136
+
137
+ nil
138
+ ]
139
+
140
+ =begin
141
+ # for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
142
+ KEY_TBL.map!{|inf|
143
+ if inf.kind_of?(Array)
144
+ inf[0] = inf[0].getbyte(0) if inf[0].kind_of?(String)
145
+ inf[1] = inf[1].getbyte(0) if inf[1].kind_of?(String)
146
+ end
147
+ inf
148
+ }
149
+
150
+ PROC_TBL.map!{|inf|
151
+ if inf.kind_of?(Array)
152
+ inf[0] = inf[0].getbyte(0) if inf[0].kind_of?(String)
153
+ end
154
+ inf
155
+ }
156
+ =end
157
+
158
+ # setup tables to be used by scan_args, _get_subst_key, _get_all_subst_keys
159
+ #
160
+ # _get_subst_key() and _get_all_subst_keys() generates key-string
161
+ # which describe how to convert callback arguments to ruby objects.
162
+ # When binding parameters are given, use _get_subst_key().
163
+ # But when no parameters are given, use _get_all_subst_keys() to
164
+ # create a Event class object as a callback parameter.
165
+ #
166
+ # scan_args() is used when doing callback. It convert arguments
167
+ # ( which are Tcl strings ) to ruby objects based on the key string
168
+ # that is generated by _get_subst_key() or _get_all_subst_keys().
169
+ #
170
+ _setup_subst_table(KEY_TBL, PROC_TBL);
171
+ end
172
+
173
+ ##############################################
174
+
175
+ module Tk::TreeCtrl::ConfigMethod
176
+ include TkItemConfigMethod
177
+
178
+ def treectrl_tagid(key, obj)
179
+ if key.kind_of?(Array)
180
+ key = key.join(' ')
181
+ else
182
+ key = key.to_s
183
+ end
184
+
185
+ if (obj.kind_of?(Tk::TreeCtrl::Column) ||
186
+ obj.kind_of?(Tk::TreeCtrl::Element) ||
187
+ obj.kind_of?(Tk::TreeCtrl::Item) ||
188
+ obj.kind_of?(Tk::TreeCtrl::Style))
189
+ obj = obj.id
190
+ end
191
+
192
+ case key
193
+ when 'column'
194
+ obj
195
+
196
+ when 'debug'
197
+ None
198
+
199
+ when 'dragimage'
200
+ None
201
+
202
+ when 'element'
203
+ obj
204
+
205
+ when 'item element'
206
+ obj
207
+
208
+ when 'marquee'
209
+ None
210
+
211
+ when 'notify'
212
+ obj
213
+
214
+ when 'style'
215
+ obj
216
+
217
+ else
218
+ obj
219
+ end
220
+ end
221
+
222
+ def tagid(mixed_id)
223
+ if mixed_id == 'debug'
224
+ ['debug', None]
225
+ elsif mixed_id == 'dragimage'
226
+ ['dragimage', None]
227
+ elsif mixed_id == 'marquee'
228
+ ['marquee', None]
229
+ elsif mixed_id.kind_of?(Array)
230
+ [mixed_id[0], treectrl_tagid(*mixed_id)]
231
+ else
232
+ tagid(mixed_id.split(':'))
233
+ end
234
+ end
235
+
236
+ def __item_cget_cmd(mixed_id)
237
+ if mixed_id[0] == 'column' && mixed_id[1] == 'drag'
238
+ return [self.path, 'column', 'dragcget']
239
+ end
240
+
241
+ if mixed_id[1].kind_of?(Array)
242
+ id = mixed_id[1]
243
+ else
244
+ id = [mixed_id[1]]
245
+ end
246
+
247
+ if mixed_id[0].kind_of?(Array)
248
+ ([self.path].concat(mixed_id[0]) << 'cget').concat(id)
249
+ else
250
+ [self.path, mixed_id[0], 'cget'].concat(id)
251
+ end
252
+ end
253
+ private :__item_cget_cmd
254
+
255
+ def __item_config_cmd(mixed_id)
256
+ if mixed_id[0] == 'column' && mixed_id[1] == 'drag'
257
+ return [self.path, 'column', 'dragconfigure']
258
+ end
259
+
260
+ if mixed_id[1].kind_of?(Array)
261
+ id = mixed_id[1]
262
+ else
263
+ id = [mixed_id[1]]
264
+ end
265
+
266
+ if mixed_id[0].kind_of?(Array)
267
+ ([self.path].concat(mixed_id[0]) << 'configure').concat(id)
268
+ else
269
+ [self.path, mixed_id[0], 'configure'].concat(id)
270
+ end
271
+ end
272
+ private :__item_config_cmd
273
+
274
+ def __item_pathname(id)
275
+ if id.kind_of?(Array)
276
+ key = id[0]
277
+ if key.kind_of?(Array)
278
+ key = key.join(' ')
279
+ end
280
+
281
+ tag = id[1]
282
+ if tag.kind_of?(Array)
283
+ tag = tag.join(' ')
284
+ end
285
+
286
+ id = [key, tag].join(':')
287
+ end
288
+ [self.path, id].join(';')
289
+ end
290
+ private :__item_pathname
291
+
292
+ def __item_configinfo_struct(id)
293
+ if id.kind_of?(Array) && id[0].to_s == 'notify'
294
+ {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil,
295
+ :default_value=>nil, :current_value=>1}
296
+ else
297
+ {:key=>0, :alias=>1, :db_name=>1, :db_class=>2,
298
+ :default_value=>3, :current_value=>4}
299
+ end
300
+ end
301
+ private :__item_configinfo_struct
302
+
303
+
304
+ def __item_font_optkeys(id)
305
+ if id.kind_of?(Array) && (id[0] == 'element' ||
306
+ (id[0].kind_of?(Array) && id[0][1] == 'element'))
307
+ []
308
+ else
309
+ ['font']
310
+ end
311
+ end
312
+ private :__item_font_optkeys
313
+
314
+ def __item_numstrval_optkeys(id)
315
+ if id == 'debug'
316
+ ['displaydelay']
317
+ else
318
+ super(id)
319
+ end
320
+ end
321
+ private :__item_numstrval_optkeys
322
+
323
+ def __item_boolval_optkeys(id)
324
+ if id == 'debug'
325
+ ['data', 'display', 'enable']
326
+ elsif id == 'dragimage'
327
+ ['visible']
328
+ elsif id == 'marquee'
329
+ ['visible']
330
+ elsif id.kind_of?(Array)
331
+ case id[0]
332
+ when 'item'
333
+ ['button', 'visible']
334
+ when 'column'
335
+ if id[1] == 'drag'
336
+ ['enable']
337
+ else
338
+ ['button', 'expand', 'resize', 'squeeze', 'sunken',
339
+ 'visible', 'widthhack']
340
+ end
341
+ when 'element'
342
+ ['draw', 'filled', 'showfocus', 'destroy']
343
+ when 'notify'
344
+ ['active']
345
+ when 'style'
346
+ ['detach']
347
+ else
348
+ if id[0].kind_of?(Array) && id[0][1] == 'element'
349
+ ['filled', 'showfocus']
350
+ else
351
+ super(id)
352
+ end
353
+ end
354
+ else
355
+ super(id)
356
+ end
357
+ end
358
+ private :__item_boolval_optkeys
359
+
360
+ def __item_strval_optkeys(id)
361
+ if id == 'debug'
362
+ ['erasecolor']
363
+ elsif id.kind_of?(Array)
364
+ case id[0]
365
+ when 'column'
366
+ if id[1] == 'drag'
367
+ ['indicatorcolor']
368
+ else
369
+ super(id) << 'textcolor'
370
+ end
371
+ when 'element'
372
+ super(id) << 'fill' << 'outline' << 'format'
373
+ else
374
+ super(id)
375
+ end
376
+ else
377
+ super(id)
378
+ end
379
+ end
380
+ private :__item_strval_optkeys
381
+
382
+ def __item_listval_optkeys(id)
383
+ if id.kind_of?(Array)
384
+ case id[0]
385
+ when 'column'
386
+ ['itembackground']
387
+ when 'element'
388
+ ['relief']
389
+ when 'style'
390
+ ['union']
391
+ else
392
+ if id[0].kind_of?(Array) && id[0][1] == 'element'
393
+ ['relief']
394
+ else
395
+ []
396
+ end
397
+ end
398
+ else
399
+ []
400
+ end
401
+ end
402
+ private :__item_listval_optkeys
403
+
404
+ def __item_keyonly_optkeys(id) # { def_key=>(undef_key|nil), ... }
405
+ {
406
+ 'notreally'=>nil,
407
+ 'increasing'=>'decreasing',
408
+ 'decreasing'=>'increasing',
409
+ 'ascii'=>nil,
410
+ 'dictionary'=>nil,
411
+ 'integer'=>nil,
412
+ 'real'=>nil
413
+ }
414
+ end
415
+ private :__item_keyonly_optkeys
416
+
417
+ def column_cget(tagOrId, option)
418
+ itemcget(['column', tagOrId], option)
419
+ end
420
+ def column_cget_strict(tagOrId, option)
421
+ itemcget_strict(['column', tagOrId], option)
422
+ end
423
+ def column_configure(tagOrId, slot, value=None)
424
+ itemconfigure(['column', tagOrId], slot, value)
425
+ end
426
+ def column_configinfo(tagOrId, slot=nil)
427
+ itemconfiginfo(['column', tagOrId], slot)
428
+ end
429
+ def current_column_configinfo(tagOrId, slot=nil)
430
+ current_itemconfiginfo(['column', tagOrId], slot)
431
+ end
432
+
433
+ def column_dragcget(option)
434
+ itemcget(['column', 'drag'], option)
435
+ end
436
+ def column_dragcget_strict(option)
437
+ itemcget_strict(['column', 'drag'], option)
438
+ end
439
+ def column_dragconfigure(slot, value=None)
440
+ itemconfigure(['column', 'drag'], slot, value)
441
+ end
442
+ def column_dragconfiginfo(slot=nil)
443
+ itemconfiginfo(['column', 'drag'], slot)
444
+ end
445
+ def current_column_dragconfiginfo(slot=nil)
446
+ current_itemconfiginfo(['column', 'drag'], slot)
447
+ end
448
+
449
+ def debug_cget(option)
450
+ itemcget('debug', option)
451
+ end
452
+ def debug_cget_strict(option)
453
+ itemcget_strict('debug', option)
454
+ end
455
+ def debug_configure(slot, value=None)
456
+ itemconfigure('debug', slot, value)
457
+ end
458
+ def debug_configinfo(slot=nil)
459
+ itemconfiginfo('debug', slot)
460
+ end
461
+ def current_debug_configinfo(slot=nil)
462
+ current_itemconfiginfo('debug', slot)
463
+ end
464
+
465
+ def dragimage_cget(option)
466
+ itemcget('dragimage', option)
467
+ end
468
+ def dragimage_cget_strict(option)
469
+ itemcget_strict('dragimage', option)
470
+ end
471
+ def dragimage_configure(slot, value=None)
472
+ itemconfigure('dragimage', slot, value)
473
+ end
474
+ def dragimage_configinfo(slot=nil)
475
+ itemconfiginfo('dragimage', slot)
476
+ end
477
+ def current_dragimage_configinfo(slot=nil)
478
+ current_itemconfiginfo('dragimage', slot)
479
+ end
480
+
481
+ def element_cget(tagOrId, option)
482
+ itemcget(['element', tagOrId], option)
483
+ end
484
+ def element_cget_strict(tagOrId, option)
485
+ itemcget_strict(['element', tagOrId], option)
486
+ end
487
+ def element_configure(tagOrId, slot, value=None)
488
+ itemconfigure(['element', tagOrId], slot, value)
489
+ end
490
+ def element_configinfo(tagOrId, slot=nil)
491
+ itemconfiginfo(['element', tagOrId], slot)
492
+ end
493
+ def current_element_configinfo(tagOrId, slot=nil)
494
+ current_itemconfiginfo(['element', tagOrId], slot)
495
+ end
496
+
497
+ def item_cget(tagOrId, option)
498
+ itemcget(['item', tagOrId], option)
499
+ end
500
+ def item_cget_strict(tagOrId, option)
501
+ itemcget_strict(['item', tagOrId], option)
502
+ end
503
+ def item_configure(tagOrId, slot, value=None)
504
+ itemconfigure(['item', tagOrId], slot, value)
505
+ end
506
+ def item_configinfo(tagOrId, slot=nil)
507
+ itemconfiginfo(['item', tagOrId], slot)
508
+ end
509
+ def current_item_configinfo(tagOrId, slot=nil)
510
+ current_itemconfiginfo(['item', tagOrId], slot)
511
+ end
512
+
513
+ def item_element_cget(item, column, elem, option)
514
+ itemcget([['item', 'element'], [item, column, elem]], option)
515
+ end
516
+ def item_element_cget_strict(item, column, elem, option)
517
+ itemcget_strict([['item', 'element'], [item, column, elem]], option)
518
+ end
519
+ def item_element_configure(item, column, elem, slot, value=None)
520
+ itemconfigure([['item', 'element'], [item, column, elem]], slot, value)
521
+ end
522
+ def item_element_configinfo(item, column, elem, slot=nil)
523
+ itemconfiginfo([['item', 'element'], [item, column, elem]], slot)
524
+ end
525
+ def current_item_element_configinfo(item, column, elem, slot=nil)
526
+ current_itemconfiginfo([['item', 'element'], [item, column, elem]], slot)
527
+ end
528
+
529
+ def marquee_cget(option)
530
+ itemcget('marquee', option)
531
+ end
532
+ def marquee_cget_strict(option)
533
+ itemcget_strict('marquee', option)
534
+ end
535
+ def marquee_configure(slot, value=None)
536
+ itemconfigure('marquee', slot, value)
537
+ end
538
+ def marquee_configinfo(slot=nil)
539
+ itemconfiginfo('marquee', slot)
540
+ end
541
+ def current_marquee_configinfo(slot=nil)
542
+ current_itemconfiginfo('marquee', slot)
543
+ end
544
+
545
+ def notify_cget(win, pattern, option)
546
+ pattern = "<#{pattern}>"
547
+ # "notify" doesn't have cget subcommand.
548
+ current_itemconfiginfo(['notify', [win, pattern]])[option.to_s]
549
+ end
550
+ def notify_cget_strict(win, pattern, option)
551
+ pattern = "<#{pattern}>"
552
+ # "notify" doesn't have cget subcommand.
553
+ info = current_itemconfiginfo(['notify', [win, pattern]])
554
+ option = option.to_s
555
+ unless info.has_key?(option)
556
+ fail RuntimeError, "unknown option \"#{option}\""
557
+ else
558
+ info[option]
559
+ end
560
+ end
561
+ def notify_configure(win, pattern, slot, value=None)
562
+ pattern = "<#{pattern}>"
563
+ itemconfigure(['notify', [win, pattern]], slot, value)
564
+ end
565
+ def notify_configinfo(win, pattern, slot=nil)
566
+ pattern = "<#{pattern}>"
567
+ itemconfiginfo(['notify', [win, pattern]], slot)
568
+ end
569
+ def current_notify_configinfo(tagOrId, slot=nil)
570
+ pattern = "<#{pattern}>"
571
+ current_itemconfiginfo(['notify', [win, pattern]], slot)
572
+ end
573
+
574
+ def style_cget(tagOrId, option)
575
+ itemcget(['style', tagOrId], option)
576
+ end
577
+ def style_cget_strict(tagOrId, option)
578
+ itemcget_strict(['style', tagOrId], option)
579
+ end
580
+ def style_configure(tagOrId, slot, value=None)
581
+ itemconfigure(['style', tagOrId], slot, value)
582
+ end
583
+ def style_configinfo(tagOrId, slot=nil)
584
+ itemconfiginfo(['style', tagOrId], slot)
585
+ end
586
+ def current_style_configinfo(tagOrId, slot=nil)
587
+ current_itemconfiginfo(['style', tagOrId], slot)
588
+ end
589
+
590
+ private :itemcget, :itemcget_strict
591
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
592
+ end
593
+
594
+ ##############################################
595
+
596
+ class Tk::TreeCtrl
597
+ include Tk::TreeCtrl::ConfigMethod
598
+ include Scrollable
599
+
600
+ TkCommandNames = ['treectrl'.freeze].freeze
601
+ WidgetClassName = 'TreeCtrl'.freeze
602
+ WidgetClassNames[WidgetClassName] = self
603
+
604
+ #########################
605
+
606
+ def __destroy_hook__
607
+ Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL.mutex.synchronize{
608
+ Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL.delete(@path)
609
+ }
610
+ Tk::TreeCtrl::Element::TreeCtrlElementID_TBL.mutex.synchronize{
611
+ Tk::TreeCtrl::Element::TreeCtrlElementID_TBL.delete(@path)
612
+ }
613
+ Tk::TreeCtrl::Item::TreeCtrlItemID_TBL.mutex.synchronize{
614
+ Tk::TreeCtrl::Item::TreeCtrlItemID_TBL.delete(@path)
615
+ }
616
+ Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL.mutex.synchronize{
617
+ Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL.delete(@path)
618
+ }
619
+ end
620
+
621
+ #########################
622
+
623
+ def __strval_optkeys
624
+ super() + [
625
+ 'buttoncolor', 'columnprefix', 'itemprefix', 'linecolor'
626
+ ]
627
+ end
628
+ private :__strval_optkeys
629
+
630
+ def __boolval_optkeys
631
+ [
632
+ 'itemwidthequal', 'usetheme',
633
+ 'showbuttons', 'showheader', 'showlines', 'showroot',
634
+ 'showrootbutton', 'showrootlines',
635
+ ]
636
+ end
637
+ private :__boolval_optkeys
638
+
639
+ def __listval_optkeys
640
+ [ 'defaultstyle' ]
641
+ end
642
+ private :__listval_optkeys
643
+
644
+ #########################
645
+
646
+ def install_bind(cmd, *args)
647
+ install_bind_for_event_class(Tk::TreeCtrl::NotifyEvent, cmd, *args)
648
+ end
649
+
650
+ #########################
651
+
652
+ def create_self(keys)
653
+ if keys and keys != None
654
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
655
+ *hash_kv(keys, true))
656
+ else
657
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
658
+ end
659
+ end
660
+ private :create_self
661
+
662
+ #########################
663
+
664
+ def activate(desc)
665
+ tk_send('activate', desc)
666
+ self
667
+ end
668
+
669
+ def canvasx(x)
670
+ number(tk_send('canvasx', x))
671
+ end
672
+
673
+ def canvasy(y)
674
+ number(tk_send('canvasy', y))
675
+ end
676
+
677
+ def collapse(*dsc)
678
+ tk_send_without_enc('collapse', *(dsc.map!{|d| _get_eval_string(d, true)}))
679
+ self
680
+ end
681
+
682
+ def collapse_recurse(*dsc)
683
+ tk_send_without_enc('collapse', '-recurse',
684
+ *(dsc.map!{|d| _get_eval_string(d, true)}))
685
+ self
686
+ end
687
+
688
+ def column_bbox(idx)
689
+ list(tk_send('column', 'bbox', idx))
690
+ end
691
+
692
+ def column_compare(column1, op, column2)
693
+ bool(tk_send('column', 'compare', column1, op, column2))
694
+ end
695
+
696
+ def column_count
697
+ num_or_str(tk_send('column', 'count'))
698
+ end
699
+
700
+ def column_create(keys=nil)
701
+ if keys && keys.kind_of?(Hash)
702
+ num_or_str(tk_send('column', 'create', *hash_kv(keys)))
703
+ else
704
+ num_or_str(tk_send('column', 'create'))
705
+ end
706
+ end
707
+
708
+ def column_delete(idx)
709
+ Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL.mutex.synchronize{
710
+ if Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[self.path]
711
+ Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[self.path].delete(idx)
712
+ end
713
+ }
714
+ tk_send('column', 'delete', idx)
715
+ self
716
+ end
717
+
718
+ def column_index(idx)
719
+ num_or_str(tk_send('column', 'index', idx))
720
+ end
721
+
722
+ def column_id(idx)
723
+ tk_send('column', 'id', idx)
724
+ end
725
+
726
+ def column_list(visible=false)
727
+ if visible
728
+ simplelist(tk_send('column', 'list', '-visible'))
729
+ else
730
+ simplelist(tk_send('column', 'list'))
731
+ end
732
+ end
733
+ def column_visible_list
734
+ column_list(true)
735
+ end
736
+
737
+ def column_move(idx, before)
738
+ tk_send('column', 'move', idx, before)
739
+ self
740
+ end
741
+
742
+ def column_needed_width(idx)
743
+ num_or_str(tk_send('column', 'neededwidth', idx))
744
+ end
745
+ alias column_neededwidth column_needed_width
746
+
747
+ def column_order(column, visible=false)
748
+ if visible
749
+ num_or_str(tk_send('column', 'order', column, '-visible'))
750
+ else
751
+ num_or_str(tk_send('column', 'order', column))
752
+ end
753
+ end
754
+ def column_visible_order(column)
755
+ column_order(column, true)
756
+ end
757
+
758
+ def column_width(idx)
759
+ num_or_str(tk_send('column', 'width', idx))
760
+ end
761
+
762
+ def compare(item1, op, item2)
763
+ bool(tk_send('compare', item1, op, item2))
764
+ end
765
+
766
+ def contentbox()
767
+ list(tk_send('contentbox'))
768
+ end
769
+
770
+ def depth(item=None)
771
+ num_or_str(tk_send_without_enc('depth', _get_eval_string(item, true)))
772
+ end
773
+
774
+ def dragimage_add(item, *args)
775
+ tk_send('dragimage', 'add', item, *args)
776
+ self
777
+ end
778
+
779
+ def dragimage_clear()
780
+ tk_send('dragimage', 'clear')
781
+ self
782
+ end
783
+
784
+ def dragimage_offset(*args) # x, y
785
+ if args.empty?
786
+ list(tk_send('dragimage', 'offset'))
787
+ else
788
+ tk_send('dragimage', 'offset', *args)
789
+ self
790
+ end
791
+ end
792
+
793
+ def dragimage_visible(*args) # mode
794
+ if args..empty?
795
+ bool(tk_send('dragimage', 'visible'))
796
+ else
797
+ tk_send('dragimage', 'visible', *args)
798
+ self
799
+ end
800
+ end
801
+ def dragimage_visible?
802
+ dragimage_visible()
803
+ end
804
+
805
+ def debug_dinfo
806
+ tk_send('debug', 'dinfo')
807
+ self
808
+ end
809
+
810
+ def debug_scroll
811
+ tk_send('debug', 'scroll')
812
+ end
813
+
814
+ def element_create(elem, type, keys=nil)
815
+ if keys && keys.kind_of?(Hash)
816
+ tk_send('element', 'create', elem, type, *hash_kv(keys))
817
+ else
818
+ tk_send('element', 'create', elem, type)
819
+ end
820
+ end
821
+
822
+ def element_delete(*elems)
823
+ Tk::TreeCtrl::Element::TreeCtrlElementID_TBL.mutex.synchronize{
824
+ if Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[self.path]
825
+ elems.each{|elem|
826
+ Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[self.path].delete(elem)
827
+ }
828
+ end
829
+ }
830
+ tk_send('element', 'delete', *elems)
831
+ self
832
+ end
833
+
834
+ def element_names()
835
+ list(tk_send('element', 'names')).collect!{|elem|
836
+ Tk::TreeCtrl::Element.id2obj(self, elem)
837
+ }
838
+ end
839
+
840
+ def _conv_element_perstate_val(opt, val)
841
+ case opt
842
+ when 'background', 'foreground', 'fill', 'outline', 'format'
843
+ val
844
+ when 'draw', 'filled', 'showfocus', 'destroy'
845
+ bool(val)
846
+ else
847
+ tk_tcl2ruby(val)
848
+ end
849
+ end
850
+ private :_conv_element_perstate_val
851
+
852
+ def element_perstate(elem, opt, st_list)
853
+ tk_send('element', 'perstate', elem, "-{opt}", st_list)
854
+ end
855
+
856
+ def element_type(elem)
857
+ tk_send('element', 'type', elem)
858
+ end
859
+
860
+ def element_class(elem)
861
+ Tk::TreeCtrl::Element.type2class(element_type(elem))
862
+ end
863
+
864
+ def expand(*dsc)
865
+ tk_send('expand', *dsc)
866
+ self
867
+ end
868
+
869
+ def expand_recurse(*dsc)
870
+ tk_send('expand', '-recurse', *dsc)
871
+ self
872
+ end
873
+
874
+ def identify(x, y)
875
+ lst = list(tk_send('identify', x, y))
876
+
877
+ if lst[0] == 'item'
878
+ lst[1] = Tk::TreeCtrl::Item.id2obj(self, lst[1])
879
+ size = lst.size
880
+ i = 2
881
+ while i < size
882
+ case lst[i]
883
+ when 'line'
884
+ i += 1
885
+ lst[i] = Tk::TreeCtrl::Item.id2obj(self, lst[i])
886
+ i += 1
887
+
888
+ when 'button'
889
+ i += 1
890
+
891
+ when 'column'
892
+ i += 2
893
+
894
+ when 'elem'
895
+ i += 1
896
+ lst[i] = Tk::TreeCtrl::Element.id2obj(self, lst[i])
897
+ i += 1
898
+
899
+ else
900
+ i += 1
901
+ end
902
+ end
903
+ end
904
+
905
+ lst
906
+ end
907
+
908
+ def index(idx)
909
+ num_or_str(tk_send('index', idx))
910
+ end
911
+
912
+ def item_ancestors(item)
913
+ list(tk_send('item', 'ancestors', item)).collect!{|id|
914
+ Tk::TreeCtrl::Item.id2obj(self, id)
915
+ }
916
+ end
917
+
918
+ def item_bbox(item, *args)
919
+ list(tk_send('item', 'bbox', item, *args))
920
+ end
921
+
922
+ def item_children(item)
923
+ list(tk_send('item', 'children', item)).collect!{|id|
924
+ Tk::TreeCtrl::Item.id2obj(self, id)
925
+ }
926
+ end
927
+
928
+ def item_collapse(item)
929
+ tk_send_without_enc('item', 'collapse', _get_eval_string(item, true))
930
+ self
931
+ end
932
+
933
+ def item_collapse_recurse(item)
934
+ tk_send_without_enc('item', 'collapse',
935
+ _get_eval_string(item, true), '-recurse')
936
+ self
937
+ end
938
+
939
+ def item_compare(item1, op, item2)
940
+ bool(tk_send('item', 'compare', item1, op, item2))
941
+ end
942
+
943
+ def item_complex(item, *args)
944
+ tk_send_without_enc('item', 'complex',
945
+ _get_eval_string(item, true),
946
+ *(args.map!{|arg| _get_eval_string(arg, true)}))
947
+ self
948
+ end
949
+
950
+ def item_count
951
+ num_or_str(tk_send('item', 'count'))
952
+ end
953
+
954
+ def item_create(keys={})
955
+ num_or_str(tk_send_without_enc('item', 'create', *hash_kv(keys, true)))
956
+ end
957
+
958
+ def _erase_children(item)
959
+ item_children(item).each{|i| _erase_children(i)}
960
+ # table is already locked
961
+ Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[self.path].delete(item)
962
+ end
963
+ private :_erase_children
964
+
965
+ def item_delete(first, last=None)
966
+ Tk::TreeCtrl::Item::TreeCtrlItemID_TBL.mutex.synchronize{
967
+ if Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[self.path]
968
+ if first == 'all' || first == :all || last == 'all' || last == :all
969
+ Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[self.path].clear
970
+ elsif last == None
971
+ _erase_children(first)
972
+ else
973
+ self.range(first, last).each{|id|
974
+ _erase_children(id)
975
+ }
976
+ end
977
+ end
978
+ }
979
+ tk_send('item', 'delete', first, last)
980
+ self
981
+ end
982
+
983
+ def item_dump(item)
984
+ list(tk_send('item', 'dump', item))
985
+ end
986
+
987
+ def item_dump_hash(item)
988
+ Hash[*list(tk_send('item', 'dump', item))]
989
+ end
990
+
991
+ def item_element_actual(item, column, elem, key)
992
+ tk_send('item', 'element', 'actual', item, column, elem, "-#{key}")
993
+ end
994
+
995
+ def item_element_perstate(elem, opt, st_list)
996
+ tk_send('item', 'element', 'perstate', elem, "-{opt}", st_list)
997
+ end
998
+
999
+ def item_expand(item)
1000
+ tk_send('item', 'expand', item)
1001
+ self
1002
+ end
1003
+
1004
+ def item_expand_recurse(item)
1005
+ tk_send('item', 'expand', item, '-recurse')
1006
+ self
1007
+ end
1008
+
1009
+ def item_firstchild(parent, child=nil)
1010
+ if child
1011
+ tk_send_without_enc('item', 'firstchild',
1012
+ _get_eval_string(parent, true),
1013
+ _get_eval_string(child, true))
1014
+ self
1015
+ else
1016
+ id = num_or_str(tk_send_without_enc('item', 'firstchild',
1017
+ _get_eval_string(parent, true)))
1018
+ Tk::TreeCtrl::Item.id2obj(self, id)
1019
+ end
1020
+ end
1021
+ alias item_first_child item_firstchild
1022
+
1023
+ def item_hasbutton(item, st=None)
1024
+ if st == None
1025
+ bool(tk_send_without_enc('item', 'hasbutton',
1026
+ _get_eval_string(item, true)))
1027
+ else
1028
+ tk_send_without_enc('item', 'hasbutton',
1029
+ _get_eval_string(item, true),
1030
+ _get_eval_string(st))
1031
+ self
1032
+ end
1033
+ end
1034
+ alias item_has_button item_hasbutton
1035
+
1036
+ def item_hasbutton?(item)
1037
+ item_hasbutton(item)
1038
+ end
1039
+ alias item_has_button? item_hasbutton?
1040
+
1041
+ def item_id(item)
1042
+ tk_send('item', 'id', item)
1043
+ end
1044
+
1045
+ def item_image(item, column=nil, *args)
1046
+ if args.empty?
1047
+ if column
1048
+ img = tk_send('item', 'image', item, column)
1049
+ TkImage::Tk_IMGTBL[img]? TkImage::Tk_IMGTBL[img] : img
1050
+ else
1051
+ simplelist(tk_send('item', 'image', item)).collect!{|img|
1052
+ TkImage::Tk_IMGTBL[img]? TkImage::Tk_IMGTBL[img] : img
1053
+ }
1054
+ end
1055
+ else
1056
+ tk_send('item', 'image', item, column, *args)
1057
+ self
1058
+ end
1059
+ end
1060
+ def get_item_image(item, column=nil)
1061
+ item_image(item, column)
1062
+ end
1063
+ def set_item_image(item, col, img, *args)
1064
+ item_image(item, col, img, *args)
1065
+ end
1066
+
1067
+ def item_index(item)
1068
+ list(tk_send('item', 'index', item))
1069
+ end
1070
+
1071
+ def item_isancestor(item, des)
1072
+ bool(tk_send('item', 'isancestor', item, des))
1073
+ end
1074
+ alias item_is_ancestor item_isancestor
1075
+ alias item_isancestor? item_isancestor
1076
+ alias item_is_ancestor? item_isancestor
1077
+
1078
+ def item_isopen(item)
1079
+ bool(tk_send('item', 'isopen', item))
1080
+ end
1081
+ alias item_is_open item_isopen
1082
+ alias item_isopen? item_isopen
1083
+ alias item_is_open? item_isopen
1084
+ alias item_isopened? item_isopen
1085
+ alias item_is_opened? item_isopen
1086
+
1087
+ def item_lastchild(parent, child=nil)
1088
+ if child
1089
+ tk_send_without_enc('item', 'lastchild',
1090
+ _get_eval_string(parent, true),
1091
+ _get_eval_string(child, true))
1092
+ self
1093
+ else
1094
+ id = num_or_str(tk_send_without_enc('item', 'lastchild',
1095
+ _get_eval_string(parent, true)))
1096
+ Tk::TreeCtrl::Item.id2obj(self, id)
1097
+ end
1098
+ end
1099
+ alias item_last_child item_lastchild
1100
+
1101
+ def item_nextsibling(sibling, nxt=nil)
1102
+ if nxt
1103
+ tk_send('item', 'nextsibling', sibling, nxt)
1104
+ self
1105
+ else
1106
+ id = num_or_str(tk_send('item', 'nextsibling', sibling))
1107
+ Tk::TreeCtrl::Item.id2obj(self, id)
1108
+ end
1109
+ end
1110
+ alias item_next_sibling item_nextsibling
1111
+
1112
+ def item_numchildren(item)
1113
+ number(tk_send_without_enc('item', 'numchildren',
1114
+ _get_eval_string(item, true)))
1115
+ end
1116
+ alias item_num_children item_numchildren
1117
+ alias item_children_size item_numchildren
1118
+
1119
+ def item_order(item, visible=false)
1120
+ if visible
1121
+ ret = num_or_str(tk_send('item', 'order', item, '-visible'))
1122
+ else
1123
+ ret = num_or_str(tk_send('item', 'order', item))
1124
+ end
1125
+
1126
+ (ret.kind_of?(Fixnum) && ret < 0)? nil: ret
1127
+ end
1128
+ def item_visible_order(item)
1129
+ item_order(item, true)
1130
+ end
1131
+
1132
+ def item_parent(item)
1133
+ id = num_or_str(tk_send('item', 'parent', item))
1134
+ Tk::TreeCtrl::Item.id2obj(self, id)
1135
+ end
1136
+
1137
+ def item_prevsibling(sibling, prev=nil)
1138
+ if prev
1139
+ tk_send('item', 'prevsibling', sibling, prev)
1140
+ self
1141
+ else
1142
+ id = num_or_str(tk_send('item', 'prevsibling', sibling))
1143
+ Tk::TreeCtrl::Item.id2obj(self, id)
1144
+ end
1145
+ end
1146
+ alias item_prev_sibling item_prevsibling
1147
+
1148
+ def item_range(first, last)
1149
+ simplelist(tk_send('item', 'range', first, last))
1150
+ end
1151
+
1152
+ def item_remove(item)
1153
+ tk_send('item', 'remove', item)
1154
+ self
1155
+ end
1156
+
1157
+ def item_rnc(item)
1158
+ list(tk_send('item', 'rnc', item))
1159
+ end
1160
+
1161
+ def _item_sort_core(real_sort, item, *opts)
1162
+ # opts ::= sort_param [, sort_param, ... ]
1163
+ # sort_param ::= {key=>val, ...}
1164
+ # [type, desc, {key=>val, ...}]
1165
+ # param
1166
+ opts = opts.collect{|param|
1167
+ if param.kind_of?(Hash)
1168
+ param = _symbolkey2str(param)
1169
+ if param.key?('column')
1170
+ key = '-column'
1171
+ desc = param.delete('column')
1172
+ elsif param.key?('element')
1173
+ key = '-element'
1174
+ desc = param.delete('element')
1175
+ else
1176
+ key = nil
1177
+ end
1178
+
1179
+ if param.empty?
1180
+ param = None
1181
+ else
1182
+ param = hash_kv(__conv_item_keyonly_opts(item, param))
1183
+ end
1184
+
1185
+ if key
1186
+ [key, desc].concat(param)
1187
+ else
1188
+ param
1189
+ end
1190
+
1191
+ elsif param.kind_of?(Array)
1192
+ if param[2].kind_of?(Hash)
1193
+ param[2] = hash_kv(__conv_item_keyonly_opts(item, param[2]))
1194
+ end
1195
+ param
1196
+
1197
+ elsif param.kind_of?(String) && param =~ /\A[a-z]+\Z/
1198
+ '-' << param
1199
+
1200
+ elsif param.kind_of?(Symbol)
1201
+ '-' << param.to_s
1202
+
1203
+ else
1204
+ param
1205
+ end
1206
+ }.flatten
1207
+
1208
+ if real_sort
1209
+ tk_send('item', 'sort', item, *opts)
1210
+ self
1211
+ else
1212
+ list(tk_send('item', 'sort', item, '-notreally', *opts))
1213
+ end
1214
+ end
1215
+ private :_item_sort_core
1216
+
1217
+ def item_sort(item, *opts)
1218
+ _item_sort_core(true, item, *opts)
1219
+ end
1220
+ def item_sort_not_really(item, *opts)
1221
+ _item_sort_core(false, item, *opts)
1222
+ end
1223
+
1224
+ def item_span(item, column=nil, *args)
1225
+ if args.empty?
1226
+ if column
1227
+ list(tk_send('item', 'span', item, column))
1228
+ else
1229
+ simplelist(tk_send('item', 'span', item)).collect!{|elem| list(elem)}
1230
+ end
1231
+ else
1232
+ tk_send('item', 'span', item, column, *args)
1233
+ self
1234
+ end
1235
+ end
1236
+ def get_item_span(item, column=nil)
1237
+ item_span(item, column)
1238
+ end
1239
+ def set_item_span(item, col, num, *args)
1240
+ item_span(item, col, num, *args)
1241
+ end
1242
+
1243
+ def item_state_forcolumn(item, column, *args)
1244
+ tk_send('item', 'state', 'forcolumn', item, column, *args)
1245
+ end
1246
+ alias item_state_for_column item_state_forcolumn
1247
+
1248
+ def item_state_get(item, *args)
1249
+ if args.empty?
1250
+ list(tk_send('item', 'state', 'get', item *args))
1251
+ else
1252
+ bool(tk_send('item', 'state', 'get', item))
1253
+ end
1254
+ end
1255
+
1256
+ def item_state_set(item, *args)
1257
+ tk_send('item', 'state', 'set', item, *args)
1258
+ end
1259
+
1260
+ def item_style_elements(item, column)
1261
+ list(tk_send('item', 'style', 'elements', item, column)).collect!{|id|
1262
+ Tk::TreeCtrl::Style.id2obj(self, id)
1263
+ }
1264
+ end
1265
+
1266
+ def item_style_map(item, column, style, map)
1267
+ tk_send('item', 'style', 'map', item, column, style, map)
1268
+ self
1269
+ end
1270
+
1271
+ def item_style_set(item, column=nil, *args)
1272
+ if args.empty?
1273
+ if column
1274
+ id = tk_send_without_enc('item', 'style', 'set',
1275
+ _get_eval_string(item, true),
1276
+ _get_eval_string(column, true))
1277
+ Tk::TreeCtrl::Style.id2obj(self, id)
1278
+ else
1279
+ list(tk_send_without_enc('item', 'style', 'set',
1280
+ _get_eval_string(item, true))).collect!{|id|
1281
+ Tk::TreeCtrl::Style.id2obj(self, id)
1282
+ }
1283
+ end
1284
+ else
1285
+ tk_send_without_enc('item', 'style', 'set',
1286
+ _get_eval_string(item, true),
1287
+ _get_eval_string(column, true),
1288
+ *(args.flatten.map!{|arg|
1289
+ _get_eval_string(arg, true)
1290
+ }))
1291
+ self
1292
+ end
1293
+ end
1294
+
1295
+ def item_text(item, column, txt=nil, *args)
1296
+ if args.empty?
1297
+ if txt
1298
+ tk_send('item', 'text', item, column, txt)
1299
+ self
1300
+ else
1301
+ tk_send('item', 'text', item, column)
1302
+ end
1303
+ else
1304
+ tk_send('item', 'text', item, column, txt, *args)
1305
+ self
1306
+ end
1307
+ end
1308
+
1309
+ def item_toggle(item)
1310
+ tk_send('item', 'toggle', item)
1311
+ self
1312
+ end
1313
+
1314
+ def item_toggle_recurse(item)
1315
+ tk_send('item', 'toggle', item, '-recurse')
1316
+ self
1317
+ end
1318
+
1319
+ def item_visible(item, st=None)
1320
+ if st == None
1321
+ bool(tk_send('item', 'visible', item))
1322
+ else
1323
+ tk_send('item', 'visible', item, st)
1324
+ self
1325
+ end
1326
+ end
1327
+ def item_visible?(item)
1328
+ item_visible(item)
1329
+ end
1330
+
1331
+ def marquee_anchor(*args)
1332
+ if args.empty?
1333
+ list(tk_send('marquee', 'anchor'))
1334
+ else
1335
+ tk_send('marquee', 'anchor', *args)
1336
+ self
1337
+ end
1338
+ end
1339
+
1340
+ def marquee_coords(*args)
1341
+ if args.empty?
1342
+ list(tk_send('marquee', 'coords'))
1343
+ else
1344
+ tk_send('marquee', 'coords', *args)
1345
+ self
1346
+ end
1347
+ end
1348
+
1349
+ def marquee_corner(*args)
1350
+ if args.empty?
1351
+ tk_send('marquee', 'corner')
1352
+ else
1353
+ tk_send('marquee', 'corner', *args)
1354
+ self
1355
+ end
1356
+ end
1357
+
1358
+ def marquee_identify()
1359
+ list(tk_send('marquee', 'identify')).collect!{|id|
1360
+ Tk::TreeCtrl::Item.id2obj(self, id)
1361
+ }
1362
+ end
1363
+
1364
+ def marquee_visible(st=None)
1365
+ if st == None
1366
+ bool(tk_send('marquee', 'visible'))
1367
+ else
1368
+ tk_send('marquee', 'visible', st)
1369
+ self
1370
+ end
1371
+ end
1372
+ def marquee_visible?()
1373
+ marquee_visible()
1374
+ end
1375
+
1376
+ #def notify_bind(obj, event, cmd=Proc.new, *args)
1377
+ # _bind([@path, 'notify', 'bind', obj], event, cmd, *args)
1378
+ # self
1379
+ #end
1380
+ def notify_bind(obj, event, *args)
1381
+ # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
1382
+ if TkComm._callback_entry?(args[0]) || !block_given?
1383
+ cmd = args.shift
1384
+ else
1385
+ cmd = Proc.new
1386
+ end
1387
+ _bind([@path, 'notify', 'bind', obj], event, cmd, *args)
1388
+ self
1389
+ end
1390
+
1391
+ #def notify_bind_append(obj, event, cmd=Proc.new, *args)
1392
+ # _bind_append([@path, 'notify', 'bind', obj], event, cmd, *args)
1393
+ # self
1394
+ #end
1395
+ def notify_bind_append(obj, event, *args)
1396
+ # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
1397
+ if TkComm._callback_entry?(args[0]) || !block_given?
1398
+ cmd = args.shift
1399
+ else
1400
+ cmd = Proc.new
1401
+ end
1402
+ _bind_append([@path, 'notify', 'bind', obj], event, cmd, *args)
1403
+ self
1404
+ end
1405
+
1406
+ def notify_bind_remove(obj, event)
1407
+ _bind_remove([@path, 'notify', 'bind', obj], event)
1408
+ self
1409
+ end
1410
+
1411
+ def notify_bindinfo(obj, event=nil)
1412
+ _bindinfo([@path, 'notify', 'bind', obj], event)
1413
+ end
1414
+
1415
+ def notify_detailnames(event)
1416
+ list(tk_send('notify', 'detailnames', event))
1417
+ end
1418
+
1419
+ def notify_eventnames()
1420
+ list(tk_send('notify', 'eventnames'))
1421
+ end
1422
+
1423
+ def notify_generate(pattern, char_map=None, percents_cmd=None)
1424
+ pattern = "<#{pattern}>"
1425
+ tk_send('notify', 'generate', pattern, char_map, percents_cmd)
1426
+ self
1427
+ end
1428
+
1429
+ def notify_install(pattern, percents_cmd=nil, &b)
1430
+ pattern = "<#{pattern}>"
1431
+ percents_cmd = Proc.new(&b) if !percents_cmd && b
1432
+ if percents_cmd
1433
+ procedure(tk_send('notify', 'install', pattern, percents_cmd))
1434
+ else
1435
+ procedure(tk_send('notify', 'install', pattern))
1436
+ end
1437
+ end
1438
+
1439
+ def notify_install_detail(event, detail, percents_cmd=nil, &b)
1440
+ percents_cmd = Proc.new(&b) if !percents_cmd && b
1441
+ if percents_cmd
1442
+ tk_send('notify', 'install', 'detail', event, detail, percents_cmd)
1443
+ else
1444
+ tk_send('notify', 'install', 'detail', event, detail)
1445
+ end
1446
+ end
1447
+
1448
+ def notify_install_event(event, percents_cmd=nil, &b)
1449
+ percents_cmd = Proc.new(&b) if !percents_cmd && b
1450
+ if percents_cmd
1451
+ tk_send('notify', 'install', 'event', event, percents_cmd)
1452
+ else
1453
+ tk_send('notify', 'install', 'event', event)
1454
+ end
1455
+ end
1456
+
1457
+ def notify_linkage(pattern, detail=None)
1458
+ if detail != None
1459
+ tk_send('notify', 'linkage', pattern, detail)
1460
+ else
1461
+ begin
1462
+ if pattern.to_s.index(?-)
1463
+ # TreeCtrl 1.1 format?
1464
+ begin
1465
+ tk_send('notify', 'linkage', "<#{pattern}>")
1466
+ rescue
1467
+ # TreeCtrl 1.0?
1468
+ tk_send('notify', 'linkage', pattern)
1469
+ end
1470
+ else
1471
+ # TreeCtrl 1.0 format?
1472
+ begin
1473
+ tk_send('notify', 'linkage', pattern)
1474
+ rescue
1475
+ # TreeCtrl 1.1?
1476
+ tk_send('notify', 'linkage', "<#{pattern}>")
1477
+ end
1478
+ end
1479
+ end
1480
+ end
1481
+ end
1482
+
1483
+ def notify_unbind(pattern=nil)
1484
+ if pattern
1485
+ tk_send('notify', 'unbind', "<#{pattern}>")
1486
+ else
1487
+ tk_send('notify', 'unbind')
1488
+ end
1489
+ self
1490
+ end
1491
+
1492
+ def notify_uninstall(pattern)
1493
+ pattern = "<#{pattern}>"
1494
+ tk_send('notify', 'uninstall', pattern)
1495
+ self
1496
+ end
1497
+
1498
+ def notify_uninstall_detail(event, detail)
1499
+ tk_send('notify', 'uninstall', 'detail', event, detail)
1500
+ self
1501
+ end
1502
+
1503
+ def notify_uninstall_event(event)
1504
+ tk_send('notify', 'uninstall', 'event', event)
1505
+ self
1506
+ end
1507
+
1508
+ def numcolumns()
1509
+ num_or_str(tk_send('numcolumns'))
1510
+ end
1511
+ alias num_columns numcolumns
1512
+ alias columns_size numcolumns
1513
+
1514
+ def numitems()
1515
+ num_or_str(tk_send('numitems'))
1516
+ end
1517
+ alias num_items numitems
1518
+ alias items_size numitems
1519
+
1520
+ def orphans()
1521
+ list(tk_send('orphans')).collect!{|id|
1522
+ Tk::TreeCtrl::Item.id2obj(self, id)
1523
+ }
1524
+ end
1525
+
1526
+ def range(first, last)
1527
+ list(tk_send('range', first, last)).collect!{|id|
1528
+ Tk::TreeCtrl::Item.id2obj(self, id)
1529
+ }
1530
+ end
1531
+
1532
+ def state_define(name)
1533
+ tk_send('state', 'define', name)
1534
+ self
1535
+ end
1536
+
1537
+ def state_linkage(name)
1538
+ tk_send('state', 'linkage', name)
1539
+ end
1540
+
1541
+ def state_names()
1542
+ list(tk_send('state', 'names'))
1543
+ end
1544
+
1545
+ def state_undefine(*names)
1546
+ tk_send('state', 'undefine', *names)
1547
+ self
1548
+ end
1549
+
1550
+ def see(item)
1551
+ tk_send('see', item)
1552
+ self
1553
+ end
1554
+
1555
+ def selection_add(first, last=None)
1556
+ tk_send('selection', 'add', first, last)
1557
+ self
1558
+ end
1559
+
1560
+ def selection_anchor(item=None)
1561
+ id = num_or_str(tk_send('selection', 'anchor', item))
1562
+ Tk::TreeCtrl::Item.id2obj(self, id)
1563
+ end
1564
+
1565
+ def selection_clear(*args) # first, last
1566
+ tk_send('selection', 'clear', *args)
1567
+ self
1568
+ end
1569
+
1570
+ def selection_count()
1571
+ number(tk_send('selection', 'count'))
1572
+ end
1573
+
1574
+ def selection_get()
1575
+ list(tk_send('selection', 'get')).collect!{|id|
1576
+ Tk::TreeCtrl::Item.id2obj(self, id)
1577
+ }
1578
+ end
1579
+
1580
+ def selection_includes(item)
1581
+ bool(tk_send('selection', 'includes', item))
1582
+ end
1583
+
1584
+ def selection_modify(sel, desel)
1585
+ tk_send('selection', 'modify', sel, desel)
1586
+ self
1587
+ end
1588
+
1589
+ def style_create(style, keys=None)
1590
+ if keys && keys != None
1591
+ tk_send('style', 'create', style, *hash_kv(keys))
1592
+ else
1593
+ tk_send('style', 'create', style)
1594
+ end
1595
+ end
1596
+
1597
+ def style_delete(*args)
1598
+ Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL.mutex.synchronize{
1599
+ if Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[self.path]
1600
+ args.each{|sty|
1601
+ Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[self.path].delete(sty)
1602
+ }
1603
+ end
1604
+ }
1605
+ tk_send('style', 'delete', *args)
1606
+ self
1607
+ end
1608
+
1609
+ def style_elements(style, *elems)
1610
+ if elems.empty?
1611
+ list(tk_send('style', 'elements', style)).collect!{|id|
1612
+ Tk::TreeCtrl::Element.id2obj(self, id)
1613
+ }
1614
+ else
1615
+ tk_send('style', 'elements', style, elems.flatten)
1616
+ self
1617
+ end
1618
+ end
1619
+
1620
+ def _conv_style_layout_val(sty, val)
1621
+ case sty.to_s
1622
+ when 'padx', 'pady', 'ipadx', 'ipady'
1623
+ lst = list(val)
1624
+ (lst.size == 1)? lst[0]: lst
1625
+ when 'detach', 'indent'
1626
+ bool(val)
1627
+ when 'union'
1628
+ simplelist(val).collect!{|elem|
1629
+ Tk::TreeCtrl::Element.id2obj(self, elem)
1630
+ }
1631
+ else
1632
+ val
1633
+ end
1634
+ end
1635
+ private :_conv_style_layout_val
1636
+
1637
+ def style_layout(style, elem, keys=None)
1638
+ if keys && keys != None
1639
+ if keys.kind_of?(Hash)
1640
+ tk_send('style', 'layout', style, elem, *hash_kv(keys))
1641
+ self
1642
+ else
1643
+ _conv_style_layout_val(keys,
1644
+ tk_send('style', 'layout',
1645
+ style, elem, "-#{keys}"))
1646
+ end
1647
+ else
1648
+ ret = Hash.new
1649
+ Hash[*simplelist(tk_send('style', 'layout', style, elem))].each{|k, v|
1650
+ k = k[1..-1]
1651
+ ret[k] = _conv_style_layout_val(k, v)
1652
+ }
1653
+ ret
1654
+ end
1655
+ end
1656
+ def get_style_layout(style, elem, opt=None)
1657
+ style_layout(style, elem, opt)
1658
+ end
1659
+ def set_style_layout(style, elem, slot, value=None)
1660
+ if slot.kind_of?(Hash)
1661
+ style_layout(style, elem, slot)
1662
+ else
1663
+ style_layout(style, elem, {slot=>value})
1664
+ end
1665
+ end
1666
+
1667
+ def style_names()
1668
+ list(tk_send('style', 'names')).collect!{|id|
1669
+ Tk::TreeCtrl::Style.id2obj(self, id)
1670
+ }
1671
+ end
1672
+
1673
+ def toggle(*items)
1674
+ tk_send('toggle', *items)
1675
+ self
1676
+ end
1677
+
1678
+ def toggle_recurse()
1679
+ tk_send('toggle', '-recurse', *items)
1680
+ self
1681
+ end
1682
+ end
1683
+
1684
+ #####################
1685
+
1686
+ class Tk::TreeCtrl::Column < TkObject
1687
+ TreeCtrlColumnID_TBL = TkCore::INTERP.create_table
1688
+
1689
+ (TreeCtrlColumnID = ['treectrl_column'.freeze, '00000'.taint]).instance_eval{
1690
+ @mutex = Mutex.new
1691
+ def mutex; @mutex; end
1692
+ freeze
1693
+ }
1694
+
1695
+ TkCore::INTERP.init_ip_env{
1696
+ Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL.mutex.synchronize{
1697
+ Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL.clear
1698
+ }
1699
+ }
1700
+
1701
+ def self.id2obj(tree, id)
1702
+ tpath = tree.path
1703
+ Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL.mutex.synchronize{
1704
+ if Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[tpath]
1705
+ Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[tpath][id]? \
1706
+ Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[tpath][id] : id
1707
+ else
1708
+ id
1709
+ end
1710
+ }
1711
+ end
1712
+
1713
+ def initialize(parent, keys={})
1714
+ @tree = parent
1715
+ @tpath = parent.path
1716
+
1717
+ keys = _symbolkey2str(keys)
1718
+
1719
+ Tk::TreeCtrl::Column::TreeCtrlColumnID.mutex.synchronize{
1720
+ @path = @id =
1721
+ keys.delete('tag') ||
1722
+ Tk::TreeCtrl::Column::TreeCtrlColumnID.join(TkCore::INTERP._ip_id_)
1723
+ Tk::TreeCtrl::Column::TreeCtrlColumnID[1].succ!
1724
+ }
1725
+
1726
+ keys['tag'] = @id
1727
+
1728
+ Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL.mutex.synchronize{
1729
+ Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[@tpath] ||= {}
1730
+ Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[@tpath][@id] = self
1731
+ }
1732
+
1733
+ @tree.column_create(keys)
1734
+ end
1735
+
1736
+ def id
1737
+ @id
1738
+ end
1739
+
1740
+ def to_s
1741
+ @id.to_s.dup
1742
+ end
1743
+
1744
+ def cget(opt)
1745
+ @tree.column_cget(@tree.column_index(@id), opt)
1746
+ end
1747
+ def cget_strict(opt)
1748
+ @tree.column_cget_strict(@tree.column_index(@id), opt)
1749
+ end
1750
+
1751
+ def configure(*args)
1752
+ @tree.column_configure(@tree.column_index(@id), *args)
1753
+ end
1754
+
1755
+ def configinfo(*args)
1756
+ @tree.column_configinfo(@tree.column_index(@id), *args)
1757
+ end
1758
+
1759
+ def current_configinfo(*args)
1760
+ @tree.current_column_configinfo(@tree.column_index(@id), *args)
1761
+ end
1762
+
1763
+ def delete
1764
+ @tree.column_delete(@tree.column_index(@id))
1765
+ self
1766
+ end
1767
+
1768
+ def index
1769
+ @tree.column_index(@id)
1770
+ end
1771
+
1772
+ def move(before)
1773
+ @tree.column_move(@tree.column_index(@id), before)
1774
+ self
1775
+ end
1776
+
1777
+ def needed_width
1778
+ @tree.column_needed_width(@tree.column_index(@id))
1779
+ end
1780
+ alias neededwidth needed_width
1781
+
1782
+ def current_width
1783
+ @tree.column_width(@tree.column_index(@id))
1784
+ end
1785
+ end
1786
+
1787
+ #####################
1788
+
1789
+ class Tk::TreeCtrl::Element < TkObject
1790
+ TreeCtrlElementID_TBL = TkCore::INTERP.create_table
1791
+
1792
+ (TreeCtrlElementID = ['treectrl_element'.freeze, '00000'.taint]).instance_eval{
1793
+ @mutex = Mutex.new
1794
+ def mutex; @mutex; end
1795
+ freeze
1796
+ }
1797
+ TreeCtrlElemTypeToClass = {}
1798
+
1799
+ TkCore::INTERP.init_ip_env{
1800
+ Tk::TreeCtrl::Element::TreeCtrlElementID_TBL.mutex.synchronize{
1801
+ Tk::TreeCtrl::Element::TreeCtrlElementID_TBL.clear
1802
+ }
1803
+ }
1804
+
1805
+ def self.type2class(type)
1806
+ TreeCtrlElemTypeToClass[type] || type
1807
+ end
1808
+
1809
+ def self.id2obj(tree, id)
1810
+ tpath = tree.path
1811
+ Tk::TreeCtrl::Element::TreeCtrlElementID_TBL.mutex.synchronize{
1812
+ if Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[tpath]
1813
+ Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[tpath][id]? \
1814
+ Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[tpath][id] : id
1815
+ else
1816
+ id
1817
+ end
1818
+ }
1819
+ end
1820
+
1821
+ def initialize(parent, type, keys=nil)
1822
+ @tree = parent
1823
+ @tpath = parent.path
1824
+ @type = type.to_s
1825
+ Tk::TreeCtrl::Element::TreeCtrlElementID.mutex.synchronize{
1826
+ @path = @id =
1827
+ Tk::TreeCtrl::Element::TreeCtrlElementID.join(TkCore::INTERP._ip_id_)
1828
+ Tk::TreeCtrl::Element::TreeCtrlElementID[1].succ!
1829
+ }
1830
+
1831
+ Tk::TreeCtrl::Element::TreeCtrlElementID_TBL.mutex.synchronize{
1832
+ Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[@tpath] ||= {}
1833
+ Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[@tpath][@id] = self
1834
+ }
1835
+
1836
+ @tree.element_create(@id, @type, keys)
1837
+ end
1838
+
1839
+ def id
1840
+ @id
1841
+ end
1842
+
1843
+ def to_s
1844
+ @id.dup
1845
+ end
1846
+
1847
+ def cget(opt)
1848
+ @tree.element_cget(@id, opt)
1849
+ end
1850
+ def cget_strict(opt)
1851
+ @tree.element_cget_strict(@id, opt)
1852
+ end
1853
+
1854
+ def configure(*args)
1855
+ @tree.element_configure(@id, *args)
1856
+ end
1857
+
1858
+ def configinfo(*args)
1859
+ @tree.element_configinfo(@id, *args)
1860
+ end
1861
+
1862
+ def current_configinfo(*args)
1863
+ @tree.current_element_configinfo(@id, *args)
1864
+ end
1865
+
1866
+ def delete
1867
+ @tree.element_delete(@id)
1868
+ self
1869
+ end
1870
+
1871
+ def element_type
1872
+ @tree.element_type(@id)
1873
+ end
1874
+
1875
+ def element_class
1876
+ @tree.element_class(@id)
1877
+ end
1878
+ end
1879
+
1880
+ class Tk::TreeCtrl::BitmapElement < Tk::TreeCtrl::Element
1881
+ TreeCtrlElemTypeToClass['bitmap'] = self
1882
+
1883
+ def initialize(parent, keys=nil)
1884
+ super(parent, 'bitmap', keys)
1885
+ end
1886
+ end
1887
+
1888
+ class Tk::TreeCtrl::BorderElement < Tk::TreeCtrl::Element
1889
+ TreeCtrlElemTypeToClass['border'] = self
1890
+
1891
+ def initialize(parent, keys=nil)
1892
+ super(parent, 'border', keys)
1893
+ end
1894
+ end
1895
+
1896
+ class Tk::TreeCtrl::ImageElement < Tk::TreeCtrl::Element
1897
+ TreeCtrlElemTypeToClass['image'] = self
1898
+
1899
+ def initialize(parent, keys=nil)
1900
+ super(parent, 'image', keys)
1901
+ end
1902
+ end
1903
+
1904
+ class Tk::TreeCtrl::RectangleElement < Tk::TreeCtrl::Element
1905
+ TreeCtrlElemTypeToClass['rect'] = self
1906
+
1907
+ def initialize(parent, keys=nil)
1908
+ super(parent, 'rect', keys)
1909
+ end
1910
+ end
1911
+
1912
+ #####################
1913
+
1914
+ class Tk::TreeCtrl::Item < TkObject
1915
+ TreeCtrlItemID_TBL = TkCore::INTERP.create_table
1916
+
1917
+ TkCore::INTERP.init_ip_env{
1918
+ Tk::TreeCtrl::Item::TreeCtrlItemID_TBL.mutex.synchronize{
1919
+ Tk::TreeCtrl::Item::TreeCtrlItemID_TBL.clear
1920
+ }
1921
+ }
1922
+
1923
+ def self.id2obj(tree, id)
1924
+ tpath = tree.path
1925
+ Tk::TreeCtrl::Item::TreeCtrlItemID_TBL.mutex.synchronize{
1926
+ if Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[tpath]
1927
+ Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[tpath][id]? \
1928
+ Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[tpath][id] : id
1929
+ else
1930
+ id
1931
+ end
1932
+ }
1933
+ end
1934
+
1935
+ def initialize(parent, keys={})
1936
+ @tree = parent
1937
+ @tpath = parent.path
1938
+ @path = @id = @tree.item_create(keys)
1939
+
1940
+ Tk::TreeCtrl::Item::TreeCtrlItemID_TBL.mutex.synchronize{
1941
+ Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[@tpath] ||= {}
1942
+ Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[@tpath][@id] = self
1943
+ }
1944
+ end
1945
+
1946
+ def id
1947
+ @id
1948
+ end
1949
+
1950
+ def to_s
1951
+ @id.to_s.dup
1952
+ end
1953
+
1954
+ def ancestors
1955
+ @tree.item_ancestors(@id)
1956
+ end
1957
+
1958
+ def bbox(*args)
1959
+ @tree.item_bbox(@id, *args)
1960
+ end
1961
+
1962
+ def children
1963
+ @tree.item_children(@id)
1964
+ end
1965
+
1966
+ def collapse
1967
+ @tree.item_collapse(@id)
1968
+ self
1969
+ end
1970
+
1971
+ def collapse_recurse
1972
+ @tree.item_collapse_recurse(@id)
1973
+ self
1974
+ end
1975
+
1976
+ def complex(*args)
1977
+ @tree.item_complex(@id, *args)
1978
+ self
1979
+ end
1980
+
1981
+ def cget(opt)
1982
+ @tree.item_cget(@id, opt)
1983
+ end
1984
+ def cget_strict(opt)
1985
+ @tree.item_cget_strict(@id, opt)
1986
+ end
1987
+
1988
+ def configure(*args)
1989
+ @tree.item_configure(@id, *args)
1990
+ end
1991
+
1992
+ def configinfo(*args)
1993
+ @tree.item_configinfo(@id, *args)
1994
+ end
1995
+
1996
+ def current_configinfo(*args)
1997
+ @tree.current_item_configinfo(@id, *args)
1998
+ end
1999
+
2000
+ def delete
2001
+ @tree.item_delete(@id)
2002
+ self
2003
+ end
2004
+
2005
+ def element_dump
2006
+ @tree.item_dump(@id)
2007
+ end
2008
+
2009
+ def element_dump_hash
2010
+ @tree.item_dump_hash(@id)
2011
+ end
2012
+
2013
+ def element_actual(column, elem, key)
2014
+ @tree.item_element_actual(@id, column, elem, key)
2015
+ end
2016
+
2017
+ def element_cget(opt)
2018
+ @tree.item_element_cget(@id, opt)
2019
+ end
2020
+ def element_cget_strict(opt)
2021
+ @tree.item_element_cget_strict(@id, opt)
2022
+ end
2023
+
2024
+ def element_configure(*args)
2025
+ @tree.item_element_configure(@id, *args)
2026
+ end
2027
+
2028
+ def element_configinfo(*args)
2029
+ @tree.item_element_configinfo(@id, *args)
2030
+ end
2031
+
2032
+ def current_element_configinfo(*args)
2033
+ @tree.current_item_element_configinfo(@id, *args)
2034
+ end
2035
+
2036
+ def expand
2037
+ @tree.item_expand(@id)
2038
+ self
2039
+ end
2040
+
2041
+ def expand_recurse
2042
+ @tree.item_expand_recurse(@id)
2043
+ self
2044
+ end
2045
+
2046
+ def firstchild(child=nil)
2047
+ if child
2048
+ @tree.item_firstchild(@id, child)
2049
+ self
2050
+ else
2051
+ @tree.item_firstchild(@id)
2052
+ end
2053
+ end
2054
+ alias first_child firstchild
2055
+
2056
+ def hasbutton(st=None)
2057
+ if st == None
2058
+ @tree.item_hasbutton(@id)
2059
+ else
2060
+ @tree.item_hasbutton(@id, st)
2061
+ self
2062
+ end
2063
+ end
2064
+ alias has_button hasbutton
2065
+
2066
+ def hasbutton?
2067
+ @tree.item_hasbutton(@id)
2068
+ end
2069
+ alias has_button? hasbutton?
2070
+
2071
+ def index
2072
+ @tree.item_index(@id)
2073
+ end
2074
+
2075
+ def isancestor(des)
2076
+ @tree.item_isancestor(@id, des)
2077
+ end
2078
+ alias is_ancestor isancestor
2079
+ alias isancestor? isancestor
2080
+ alias is_ancestor? isancestor
2081
+ alias ancestor? isancestor
2082
+
2083
+ def isopen
2084
+ @tree.item_isopen(@id)
2085
+ end
2086
+ alias is_open isopen
2087
+ alias isopen? isopen
2088
+ alias is_open? isopen
2089
+ alias isopened? isopen
2090
+ alias is_opened? isopen
2091
+ alias open? isopen
2092
+
2093
+ def lastchild(child=nil)
2094
+ if child
2095
+ @tree.item_lastchild(@id, child)
2096
+ self
2097
+ else
2098
+ @tree.item_lastchild(@id)
2099
+ end
2100
+ end
2101
+ alias last_child lastchild
2102
+
2103
+ def nextsibling(nxt=nil)
2104
+ if nxt
2105
+ @tree.item_nextsibling(@id, nxt)
2106
+ self
2107
+ else
2108
+ @tree.item_nextsibling(@id)
2109
+ end
2110
+ end
2111
+ alias next_sibling nextsibling
2112
+
2113
+ def numchildren
2114
+ @tree.item_numchildren(@id)
2115
+ end
2116
+ alias num_children numchildren
2117
+ alias children_size numchildren
2118
+
2119
+ def parent_index
2120
+ @tree.item_parent(@id)
2121
+ end
2122
+
2123
+ def prevsibling(nxt=nil)
2124
+ if nxt
2125
+ @tree.item_prevsibling(@id, nxt)
2126
+ self
2127
+ else
2128
+ @tree.item_prevsibling(@id)
2129
+ end
2130
+ end
2131
+ alias prev_sibling prevsibling
2132
+
2133
+ def remove
2134
+ @tree.item_remove(@id)
2135
+ end
2136
+
2137
+ def rnc
2138
+ @tree.item_rnc(@id)
2139
+ end
2140
+
2141
+ def sort(*opts)
2142
+ @tree.item_sort(@id, *opts)
2143
+ end
2144
+ def sort_not_really(*opts)
2145
+ @tree.item_sort_not_really(@id, *opts)
2146
+ self
2147
+ end
2148
+
2149
+ def state_forcolumn(column, *args)
2150
+ @tree.item_state_forcolumn(@id, column, *args)
2151
+ self
2152
+ end
2153
+ alias state_for_column state_forcolumn
2154
+
2155
+ def state_get(*args)
2156
+ @tree.item_state_get(@id, *args)
2157
+ end
2158
+
2159
+ def state_set(*args)
2160
+ @tree.item_state_set(@id, *args)
2161
+ self
2162
+ end
2163
+
2164
+ def style_elements(column)
2165
+ @tree.item_style_elements(@id, column)
2166
+ end
2167
+
2168
+ def style_map(column, style, map)
2169
+ @tree.item_style_map(@id, column, style, map)
2170
+ self
2171
+ end
2172
+
2173
+ def style_set(column=nil, *args)
2174
+ if args.empty?
2175
+ @tree.item_style_set(@id, column)
2176
+ else
2177
+ @tree.item_style_set(@id, column, *args)
2178
+ self
2179
+ end
2180
+ end
2181
+
2182
+ def item_text(column, txt=nil, *args)
2183
+ if args.empty?
2184
+ if txt
2185
+ @tree.item_text(@id, column, txt)
2186
+ self
2187
+ else
2188
+ @tree.item_text(@id, column)
2189
+ end
2190
+ else
2191
+ @tree.item_text(@id, column, txt, *args)
2192
+ self
2193
+ end
2194
+ end
2195
+
2196
+ def toggle
2197
+ @tree.item_toggle(@id)
2198
+ self
2199
+ end
2200
+
2201
+ def toggle_recurse
2202
+ @tree.item_toggle_recurse(@id)
2203
+ self
2204
+ end
2205
+
2206
+ def visible(st=None)
2207
+ if st == None
2208
+ @tree.item_visible(@id)
2209
+ else
2210
+ @tree.item_visible(@id, st)
2211
+ self
2212
+ end
2213
+ end
2214
+ end
2215
+
2216
+ #####################
2217
+
2218
+ class Tk::TreeCtrl::Style < TkObject
2219
+ TreeCtrlStyleID_TBL = TkCore::INTERP.create_table
2220
+
2221
+ (TreeCtrlStyleID = ['treectrl_style'.freeze, '00000'.taint]).instance_eval{
2222
+ @mutex = Mutex.new
2223
+ def mutex; @mutex; end
2224
+ freeze
2225
+ }
2226
+
2227
+ TkCore::INTERP.init_ip_env{
2228
+ Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL.mutex.synchronize{
2229
+ Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL.clear
2230
+ }
2231
+ }
2232
+
2233
+ def self.id2obj(tree, id)
2234
+ tpath = tree.path
2235
+ Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL.mutex.synchronize{
2236
+ if Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[tpath]
2237
+ Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[tpath][id]? \
2238
+ Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[tpath][id] : id
2239
+ else
2240
+ id
2241
+ end
2242
+ }
2243
+ end
2244
+
2245
+ def initialize(parent, keys=nil)
2246
+ @tree = parent
2247
+ @tpath = parent.path
2248
+
2249
+ Tk::TreeCtrl::Style::TreeCtrlStyleID.mutex.synchronize{
2250
+ @path = @id =
2251
+ Tk::TreeCtrl::Style::TreeCtrlStyleID.join(TkCore::INTERP._ip_id_)
2252
+ Tk::TreeCtrl::Style::TreeCtrlStyleID[1].succ!
2253
+ }
2254
+
2255
+ Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL.mutex.synchronize{
2256
+ Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[@tpath] ||= {}
2257
+ Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[@tpath][@id] = self
2258
+ }
2259
+
2260
+ @tree.style_create(@id, keys)
2261
+ end
2262
+
2263
+ def id
2264
+ @id
2265
+ end
2266
+
2267
+ def to_s
2268
+ @id.dup
2269
+ end
2270
+
2271
+ def cget(opt)
2272
+ @tree.style_cget(@id, opt)
2273
+ end
2274
+ def cget_strict(opt)
2275
+ @tree.style_cget_strict(@id, opt)
2276
+ end
2277
+
2278
+ def configure(*args)
2279
+ @tree.style_configure(@id, *args)
2280
+ end
2281
+
2282
+ def configinfo(*args)
2283
+ @tree.style_configinfo(@id, *args)
2284
+ end
2285
+
2286
+ def current_configinfo(*args)
2287
+ @tree.current_style_configinfo(@id, *args)
2288
+ end
2289
+
2290
+ def delete
2291
+ @tree.style_delete(@id)
2292
+ self
2293
+ end
2294
+
2295
+ def elements(*elems)
2296
+ if elems.empty?
2297
+ @tree.style_elements(@id)
2298
+ else
2299
+ @tree.style_elements(@id, *elems)
2300
+ self
2301
+ end
2302
+ end
2303
+
2304
+ def layout(elem, keys=None)
2305
+ if keys && keys != None && keys.kind_of?(Hash)
2306
+ @tree.style_layout(@id, elem, keys)
2307
+ self
2308
+ else
2309
+ @tree.style_layout(@id, elem, keys)
2310
+ end
2311
+ end
2312
+ end
2313
+
2314
+ module Tk::TreeCtrl::BindCallback
2315
+ include Tk
2316
+ extend Tk
2317
+ end
2318
+
2319
+ class << Tk::TreeCtrl::BindCallback
2320
+ def percentsCmd(*args)
2321
+ tk_call('::TreeCtrl::PercentsCmd', *args)
2322
+ end
2323
+ def cursorCheck(w, x, y)
2324
+ tk_call('::TreeCtrl::CursorCheck', w, x, y)
2325
+ end
2326
+ def cursorCheckAux(w)
2327
+ tk_call('::TreeCtrl::CursorCheckAux', w)
2328
+ end
2329
+ def cursorCancel(w)
2330
+ tk_call('::TreeCtrl::CursorCancel', w)
2331
+ end
2332
+ def buttonPress1(w, x, y)
2333
+ tk_call('::TreeCtrl::ButtonPress1', w, x, y)
2334
+ end
2335
+ def doubleButton1(w, x, y)
2336
+ tk_call('::TreeCtrl::DoubleButton1', w, x, y)
2337
+ end
2338
+ def motion1(w, x, y)
2339
+ tk_call('::TreeCtrl::Motion1', w, x, y)
2340
+ end
2341
+ def leave1(w, x, y)
2342
+ tk_call('::TreeCtrl::Leave1', w, x, y)
2343
+ end
2344
+ def release1(w, x, y)
2345
+ tk_call('::TreeCtrl::Release1', w, x, y)
2346
+ end
2347
+ def beginSelect(w, el)
2348
+ tk_call('::TreeCtrl::BeginSelect', w, el)
2349
+ end
2350
+ def motion(w, le)
2351
+ tk_call('::TreeCtrl::Motion', w, el)
2352
+ end
2353
+ def beginExtend(w, el)
2354
+ tk_call('::TreeCtrl::BeginExtend', w, el)
2355
+ end
2356
+ def beginToggle(w, el)
2357
+ tk_call('::TreeCtrl::BeginToggle', w, el)
2358
+ end
2359
+ def cancelRepeat
2360
+ tk_call('::TreeCtrl::CancelRepeat')
2361
+ end
2362
+ def autoScanCheck(w, x, y)
2363
+ tk_call('::TreeCtrl::AutoScanCheck', w, x, y)
2364
+ end
2365
+ def autoScanCheckAux(w)
2366
+ tk_call('::TreeCtrl::AutoScanCheckAux', w)
2367
+ end
2368
+ def autoScanCancel(w)
2369
+ tk_call('::TreeCtrl::AutoScanCancel', w)
2370
+ end
2371
+ def up_down(w, n)
2372
+ tk_call('::TreeCtrl::UpDown', w, n)
2373
+ end
2374
+ def left_right(w, n)
2375
+ tk_call('::TreeCtrl::LeftRight', w, n)
2376
+ end
2377
+ def setActiveItem(w, idx)
2378
+ tk_call('::TreeCtrl::SetActiveItem', w, idx)
2379
+ end
2380
+ def extendUpDown(w, amount)
2381
+ tk_call('::TreeCtrl::ExtendUpDown', w, amount)
2382
+ end
2383
+ def dataExtend(w, el)
2384
+ tk_call('::TreeCtrl::DataExtend', w, el)
2385
+ end
2386
+ def cancel(w)
2387
+ tk_call('::TreeCtrl::Cancel', w)
2388
+ end
2389
+ def selectAll(w)
2390
+ tk_call('::TreeCtrl::selectAll', w)
2391
+ end
2392
+ def marqueeBegin(w, x, y)
2393
+ tk_call('::TreeCtrl::MarqueeBegin', w, x, y)
2394
+ end
2395
+ def marqueeUpdate(w, x, y)
2396
+ tk_call('::TreeCtrl::MarqueeUpdate', w, x, y)
2397
+ end
2398
+ def marqueeEnd(w, x, y)
2399
+ tk_call('::TreeCtrl::MarqueeEnd', w, x, y)
2400
+ end
2401
+ def scanMark(w, x, y)
2402
+ tk_call('::TreeCtrl::ScanMark', w, x, y)
2403
+ end
2404
+ def scanDrag(w, x, y)
2405
+ tk_call('::TreeCtrl::ScanDrag', w, x, y)
2406
+ end
2407
+
2408
+ # filelist-bindings
2409
+ def fileList_button1(w, x, y)
2410
+ tk_call('::TreeCtrl::FileListButton1', w, x, y)
2411
+ end
2412
+ def fileList_motion1(w, x, y)
2413
+ tk_call('::TreeCtrl::FileListMotion1', w, x, y)
2414
+ end
2415
+ def fileList_motion(w, x, y)
2416
+ tk_call('::TreeCtrl::FileListMotion', w, x, y)
2417
+ end
2418
+ def fileList_leave1(w, x, y)
2419
+ tk_call('::TreeCtrl::FileListLeave1', w, x, y)
2420
+ end
2421
+ def fileList_release1(w, x, y)
2422
+ tk_call('::TreeCtrl::FileListRelease1', w, x, y)
2423
+ end
2424
+ def fileList_edit(w, i, s, e)
2425
+ tk_call('::TreeCtrl::FileListEdit', w, i, s, e)
2426
+ end
2427
+ def fileList_editCancel(w)
2428
+ tk_call('::TreeCtrl::FileListEditCancel', w)
2429
+ end
2430
+ def fileList_autoScanCheck(w, x, y)
2431
+ tk_call('::TreeCtrl::FileListAutoScanCheck', w, x, y)
2432
+ end
2433
+ def fileList_autoScanCheckAux(w)
2434
+ tk_call('::TreeCtrl::FileListAutoScanCheckAux', w)
2435
+ end
2436
+
2437
+ def entryOpen(w, item, col, elem)
2438
+ tk_call('::TreeCtrl::EntryOpen', w, item, col, elem)
2439
+ end
2440
+ def entryExpanderOpen(w, item, col, elem)
2441
+ tk_call('::TreeCtrl::EntryExpanderOpen', w, item, col, elem)
2442
+ end
2443
+ def entryClose(w, accept)
2444
+ tk_call('::TreeCtrl::EntryClose', w, accept)
2445
+ end
2446
+ def entryExpanderKeypress(w)
2447
+ tk_call('::TreeCtrl::EntryExpanderKeypress', w)
2448
+ end
2449
+ def textOpen(w, item, col, elem, width=0, height=0)
2450
+ tk_call('::TreeCtrl::TextOpen', w, item, col, elem, width, height)
2451
+ end
2452
+ def textExpanderOpen(w, item, col, elem, width)
2453
+ tk_call('::TreeCtrl::TextOpen', w, item, col, elem, width)
2454
+ end
2455
+ def textClose(w, accept)
2456
+ tk_call('::TreeCtrl::TextClose', w, accept)
2457
+ end
2458
+ def textExpanderKeypress(w)
2459
+ tk_call('::TreeCtrl::TextExpanderKeypress', w)
2460
+ end
2461
+ end