tk-win 0.2.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (329) hide show
  1. data/.document +5 -0
  2. data/.gitignore +21 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +17 -0
  5. data/Rakefile +46 -0
  6. data/VERSION +1 -0
  7. data/lib/tcltk.rb +367 -0
  8. data/lib/tk.rb +5682 -0
  9. data/lib/tk/after.rb +6 -0
  10. data/lib/tk/autoload.rb +760 -0
  11. data/lib/tk/bgerror.rb +29 -0
  12. data/lib/tk/bindtag.rb +138 -0
  13. data/lib/tk/button.rb +31 -0
  14. data/lib/tk/canvas.rb +816 -0
  15. data/lib/tk/canvastag.rb +459 -0
  16. data/lib/tk/checkbutton.rb +32 -0
  17. data/lib/tk/clipboard.rb +75 -0
  18. data/lib/tk/clock.rb +71 -0
  19. data/lib/tk/composite.rb +484 -0
  20. data/lib/tk/console.rb +52 -0
  21. data/lib/tk/dialog.rb +326 -0
  22. data/lib/tk/encodedstr.rb +187 -0
  23. data/lib/tk/entry.rb +120 -0
  24. data/lib/tk/event.rb +562 -0
  25. data/lib/tk/font.rb +2351 -0
  26. data/lib/tk/frame.rb +132 -0
  27. data/lib/tk/grid.rb +279 -0
  28. data/lib/tk/image.rb +275 -0
  29. data/lib/tk/itemconfig.rb +1222 -0
  30. data/lib/tk/itemfont.rb +327 -0
  31. data/lib/tk/kinput.rb +71 -0
  32. data/lib/tk/label.rb +22 -0
  33. data/lib/tk/labelframe.rb +31 -0
  34. data/lib/tk/listbox.rb +284 -0
  35. data/lib/tk/macpkg.rb +80 -0
  36. data/lib/tk/menu.rb +718 -0
  37. data/lib/tk/menubar.rb +137 -0
  38. data/lib/tk/menuspec.rb +456 -0
  39. data/lib/tk/message.rb +24 -0
  40. data/lib/tk/mngfocus.rb +33 -0
  41. data/lib/tk/msgcat.rb +296 -0
  42. data/lib/tk/namespace.rb +551 -0
  43. data/lib/tk/optiondb.rb +377 -0
  44. data/lib/tk/optionobj.rb +212 -0
  45. data/lib/tk/pack.rb +107 -0
  46. data/lib/tk/package.rb +143 -0
  47. data/lib/tk/palette.rb +55 -0
  48. data/lib/tk/panedwindow.rb +260 -0
  49. data/lib/tk/place.rb +128 -0
  50. data/lib/tk/radiobutton.rb +73 -0
  51. data/lib/tk/root.rb +95 -0
  52. data/lib/tk/scale.rb +112 -0
  53. data/lib/tk/scrollable.rb +82 -0
  54. data/lib/tk/scrollbar.rb +183 -0
  55. data/lib/tk/scrollbox.rb +39 -0
  56. data/lib/tk/selection.rb +86 -0
  57. data/lib/tk/spinbox.rb +144 -0
  58. data/lib/tk/tagfont.rb +43 -0
  59. data/lib/tk/text.rb +1604 -0
  60. data/lib/tk/textimage.rb +88 -0
  61. data/lib/tk/textmark.rb +204 -0
  62. data/lib/tk/texttag.rb +321 -0
  63. data/lib/tk/textwindow.rb +154 -0
  64. data/lib/tk/timer.rb +669 -0
  65. data/lib/tk/toplevel.rb +264 -0
  66. data/lib/tk/ttk_selector.rb +98 -0
  67. data/lib/tk/txtwin_abst.rb +39 -0
  68. data/lib/tk/validation.rb +397 -0
  69. data/lib/tk/variable.rb +1799 -0
  70. data/lib/tk/virtevent.rb +139 -0
  71. data/lib/tk/winfo.rb +392 -0
  72. data/lib/tk/winpkg.rb +156 -0
  73. data/lib/tk/wm.rb +552 -0
  74. data/lib/tk/xim.rb +122 -0
  75. data/lib/tkafter.rb +4 -0
  76. data/lib/tkbgerror.rb +4 -0
  77. data/lib/tkcanvas.rb +4 -0
  78. data/lib/tkclass.rb +47 -0
  79. data/lib/tkconsole.rb +4 -0
  80. data/lib/tkdialog.rb +4 -0
  81. data/lib/tkentry.rb +4 -0
  82. data/lib/tkextlib/ICONS.rb +13 -0
  83. data/lib/tkextlib/ICONS/icons.rb +129 -0
  84. data/lib/tkextlib/ICONS/setup.rb +8 -0
  85. data/lib/tkextlib/SUPPORT_STATUS +198 -0
  86. data/lib/tkextlib/blt.rb +189 -0
  87. data/lib/tkextlib/blt/barchart.rb +79 -0
  88. data/lib/tkextlib/blt/bitmap.rb +112 -0
  89. data/lib/tkextlib/blt/busy.rb +83 -0
  90. data/lib/tkextlib/blt/component.rb +2218 -0
  91. data/lib/tkextlib/blt/container.rb +28 -0
  92. data/lib/tkextlib/blt/cutbuffer.rb +23 -0
  93. data/lib/tkextlib/blt/dragdrop.rb +269 -0
  94. data/lib/tkextlib/blt/eps.rb +32 -0
  95. data/lib/tkextlib/blt/graph.rb +67 -0
  96. data/lib/tkextlib/blt/htext.rb +112 -0
  97. data/lib/tkextlib/blt/setup.rb +8 -0
  98. data/lib/tkextlib/blt/spline.rb +23 -0
  99. data/lib/tkextlib/blt/stripchart.rb +74 -0
  100. data/lib/tkextlib/blt/table.rb +412 -0
  101. data/lib/tkextlib/blt/tabnotebook.rb +110 -0
  102. data/lib/tkextlib/blt/tabset.rb +504 -0
  103. data/lib/tkextlib/blt/ted.rb +68 -0
  104. data/lib/tkextlib/blt/tile.rb +25 -0
  105. data/lib/tkextlib/blt/tile/button.rb +16 -0
  106. data/lib/tkextlib/blt/tile/checkbutton.rb +17 -0
  107. data/lib/tkextlib/blt/tile/frame.rb +16 -0
  108. data/lib/tkextlib/blt/tile/label.rb +16 -0
  109. data/lib/tkextlib/blt/tile/radiobutton.rb +17 -0
  110. data/lib/tkextlib/blt/tile/scrollbar.rb +16 -0
  111. data/lib/tkextlib/blt/tile/toplevel.rb +16 -0
  112. data/lib/tkextlib/blt/tree.rb +1058 -0
  113. data/lib/tkextlib/blt/treeview.rb +1287 -0
  114. data/lib/tkextlib/blt/unix_dnd.rb +141 -0
  115. data/lib/tkextlib/blt/vector.rb +256 -0
  116. data/lib/tkextlib/blt/watch.rb +175 -0
  117. data/lib/tkextlib/blt/win_printer.rb +61 -0
  118. data/lib/tkextlib/blt/winop.rb +107 -0
  119. data/lib/tkextlib/bwidget.rb +153 -0
  120. data/lib/tkextlib/bwidget/arrowbutton.rb +21 -0
  121. data/lib/tkextlib/bwidget/bitmap.rb +21 -0
  122. data/lib/tkextlib/bwidget/button.rb +31 -0
  123. data/lib/tkextlib/bwidget/buttonbox.rb +90 -0
  124. data/lib/tkextlib/bwidget/combobox.rb +62 -0
  125. data/lib/tkextlib/bwidget/dialog.rb +194 -0
  126. data/lib/tkextlib/bwidget/dragsite.rb +31 -0
  127. data/lib/tkextlib/bwidget/dropsite.rb +39 -0
  128. data/lib/tkextlib/bwidget/dynamichelp.rb +63 -0
  129. data/lib/tkextlib/bwidget/entry.rb +43 -0
  130. data/lib/tkextlib/bwidget/label.rb +41 -0
  131. data/lib/tkextlib/bwidget/labelentry.rb +80 -0
  132. data/lib/tkextlib/bwidget/labelframe.rb +52 -0
  133. data/lib/tkextlib/bwidget/listbox.rb +361 -0
  134. data/lib/tkextlib/bwidget/mainframe.rb +132 -0
  135. data/lib/tkextlib/bwidget/messagedlg.rb +192 -0
  136. data/lib/tkextlib/bwidget/notebook.rb +166 -0
  137. data/lib/tkextlib/bwidget/pagesmanager.rb +73 -0
  138. data/lib/tkextlib/bwidget/panedwindow.rb +42 -0
  139. data/lib/tkextlib/bwidget/panelframe.rb +67 -0
  140. data/lib/tkextlib/bwidget/passwddlg.rb +44 -0
  141. data/lib/tkextlib/bwidget/progressbar.rb +20 -0
  142. data/lib/tkextlib/bwidget/progressdlg.rb +58 -0
  143. data/lib/tkextlib/bwidget/scrollableframe.rb +40 -0
  144. data/lib/tkextlib/bwidget/scrolledwindow.rb +48 -0
  145. data/lib/tkextlib/bwidget/scrollview.rb +25 -0
  146. data/lib/tkextlib/bwidget/selectcolor.rb +73 -0
  147. data/lib/tkextlib/bwidget/selectfont.rb +91 -0
  148. data/lib/tkextlib/bwidget/separator.rb +20 -0
  149. data/lib/tkextlib/bwidget/setup.rb +8 -0
  150. data/lib/tkextlib/bwidget/spinbox.rb +98 -0
  151. data/lib/tkextlib/bwidget/statusbar.rb +62 -0
  152. data/lib/tkextlib/bwidget/titleframe.rb +33 -0
  153. data/lib/tkextlib/bwidget/tree.rb +500 -0
  154. data/lib/tkextlib/bwidget/widget.rb +129 -0
  155. data/lib/tkextlib/itcl.rb +13 -0
  156. data/lib/tkextlib/itcl/incr_tcl.rb +178 -0
  157. data/lib/tkextlib/itcl/setup.rb +13 -0
  158. data/lib/tkextlib/itk.rb +13 -0
  159. data/lib/tkextlib/itk/incr_tk.rb +446 -0
  160. data/lib/tkextlib/itk/setup.rb +13 -0
  161. data/lib/tkextlib/iwidgets.rb +94 -0
  162. data/lib/tkextlib/iwidgets/buttonbox.rb +121 -0
  163. data/lib/tkextlib/iwidgets/calendar.rb +125 -0
  164. data/lib/tkextlib/iwidgets/canvasprintbox.rb +53 -0
  165. data/lib/tkextlib/iwidgets/canvasprintdialog.rb +38 -0
  166. data/lib/tkextlib/iwidgets/checkbox.rb +130 -0
  167. data/lib/tkextlib/iwidgets/combobox.rb +104 -0
  168. data/lib/tkextlib/iwidgets/dateentry.rb +20 -0
  169. data/lib/tkextlib/iwidgets/datefield.rb +58 -0
  170. data/lib/tkextlib/iwidgets/dialog.rb +20 -0
  171. data/lib/tkextlib/iwidgets/dialogshell.rb +121 -0
  172. data/lib/tkextlib/iwidgets/disjointlistbox.rb +50 -0
  173. data/lib/tkextlib/iwidgets/entryfield.rb +185 -0
  174. data/lib/tkextlib/iwidgets/extbutton.rb +40 -0
  175. data/lib/tkextlib/iwidgets/extfileselectionbox.rb +46 -0
  176. data/lib/tkextlib/iwidgets/extfileselectiondialog.rb +33 -0
  177. data/lib/tkextlib/iwidgets/feedback.rb +35 -0
  178. data/lib/tkextlib/iwidgets/fileselectionbox.rb +46 -0
  179. data/lib/tkextlib/iwidgets/fileselectiondialog.rb +33 -0
  180. data/lib/tkextlib/iwidgets/finddialog.rb +42 -0
  181. data/lib/tkextlib/iwidgets/hierarchy.rb +365 -0
  182. data/lib/tkextlib/iwidgets/hyperhelp.rb +50 -0
  183. data/lib/tkextlib/iwidgets/labeledframe.rb +39 -0
  184. data/lib/tkextlib/iwidgets/labeledwidget.rb +45 -0
  185. data/lib/tkextlib/iwidgets/mainwindow.rb +67 -0
  186. data/lib/tkextlib/iwidgets/menubar.rb +212 -0
  187. data/lib/tkextlib/iwidgets/messagebox.rb +93 -0
  188. data/lib/tkextlib/iwidgets/messagedialog.rb +20 -0
  189. data/lib/tkextlib/iwidgets/notebook.rb +175 -0
  190. data/lib/tkextlib/iwidgets/optionmenu.rb +92 -0
  191. data/lib/tkextlib/iwidgets/panedwindow.rb +134 -0
  192. data/lib/tkextlib/iwidgets/promptdialog.rb +131 -0
  193. data/lib/tkextlib/iwidgets/pushbutton.rb +35 -0
  194. data/lib/tkextlib/iwidgets/radiobox.rb +121 -0
  195. data/lib/tkextlib/iwidgets/scopedobject.rb +24 -0
  196. data/lib/tkextlib/iwidgets/scrolledcanvas.rb +353 -0
  197. data/lib/tkextlib/iwidgets/scrolledframe.rb +59 -0
  198. data/lib/tkextlib/iwidgets/scrolledhtml.rb +58 -0
  199. data/lib/tkextlib/iwidgets/scrolledlistbox.rb +207 -0
  200. data/lib/tkextlib/iwidgets/scrolledtext.rb +568 -0
  201. data/lib/tkextlib/iwidgets/scrolledwidget.rb +20 -0
  202. data/lib/tkextlib/iwidgets/selectionbox.rb +102 -0
  203. data/lib/tkextlib/iwidgets/selectiondialog.rb +92 -0
  204. data/lib/tkextlib/iwidgets/setup.rb +8 -0
  205. data/lib/tkextlib/iwidgets/shell.rb +38 -0
  206. data/lib/tkextlib/iwidgets/spindate.rb +48 -0
  207. data/lib/tkextlib/iwidgets/spinint.rb +30 -0
  208. data/lib/tkextlib/iwidgets/spinner.rb +169 -0
  209. data/lib/tkextlib/iwidgets/spintime.rb +48 -0
  210. data/lib/tkextlib/iwidgets/tabnotebook.rb +181 -0
  211. data/lib/tkextlib/iwidgets/tabset.rb +145 -0
  212. data/lib/tkextlib/iwidgets/timeentry.rb +25 -0
  213. data/lib/tkextlib/iwidgets/timefield.rb +58 -0
  214. data/lib/tkextlib/iwidgets/toolbar.rb +112 -0
  215. data/lib/tkextlib/iwidgets/watch.rb +56 -0
  216. data/lib/tkextlib/pkg_checker.rb +184 -0
  217. data/lib/tkextlib/setup.rb +8 -0
  218. data/lib/tkextlib/tcllib.rb +105 -0
  219. data/lib/tkextlib/tcllib/autoscroll.rb +158 -0
  220. data/lib/tkextlib/tcllib/ctext.rb +160 -0
  221. data/lib/tkextlib/tcllib/cursor.rb +97 -0
  222. data/lib/tkextlib/tcllib/datefield.rb +57 -0
  223. data/lib/tkextlib/tcllib/dialog.rb +84 -0
  224. data/lib/tkextlib/tcllib/getstring.rb +134 -0
  225. data/lib/tkextlib/tcllib/history.rb +73 -0
  226. data/lib/tkextlib/tcllib/ico.rb +146 -0
  227. data/lib/tkextlib/tcllib/ip_entry.rb +75 -0
  228. data/lib/tkextlib/tcllib/panelframe.rb +78 -0
  229. data/lib/tkextlib/tcllib/plotchart.rb +1404 -0
  230. data/lib/tkextlib/tcllib/ruler.rb +65 -0
  231. data/lib/tkextlib/tcllib/screenruler.rb +68 -0
  232. data/lib/tkextlib/tcllib/scrollwin.rb +61 -0
  233. data/lib/tkextlib/tcllib/setup.rb +8 -0
  234. data/lib/tkextlib/tcllib/style.rb +61 -0
  235. data/lib/tkextlib/tcllib/superframe.rb +51 -0
  236. data/lib/tkextlib/tcllib/swaplist.rb +150 -0
  237. data/lib/tkextlib/tcllib/tablelist.rb +28 -0
  238. data/lib/tkextlib/tcllib/tablelist_core.rb +1072 -0
  239. data/lib/tkextlib/tcllib/tablelist_tile.rb +43 -0
  240. data/lib/tkextlib/tcllib/tkpiechart.rb +314 -0
  241. data/lib/tkextlib/tcllib/tooltip.rb +104 -0
  242. data/lib/tkextlib/tcllib/widget.rb +82 -0
  243. data/lib/tkextlib/tclx.rb +13 -0
  244. data/lib/tkextlib/tclx/setup.rb +8 -0
  245. data/lib/tkextlib/tclx/tclx.rb +74 -0
  246. data/lib/tkextlib/tile.rb +449 -0
  247. data/lib/tkextlib/tile/dialog.rb +102 -0
  248. data/lib/tkextlib/tile/setup.rb +8 -0
  249. data/lib/tkextlib/tile/sizegrip.rb +32 -0
  250. data/lib/tkextlib/tile/style.rb +336 -0
  251. data/lib/tkextlib/tile/tbutton.rb +34 -0
  252. data/lib/tkextlib/tile/tcheckbutton.rb +38 -0
  253. data/lib/tkextlib/tile/tcombobox.rb +55 -0
  254. data/lib/tkextlib/tile/tentry.rb +49 -0
  255. data/lib/tkextlib/tile/tframe.rb +34 -0
  256. data/lib/tkextlib/tile/tlabel.rb +34 -0
  257. data/lib/tkextlib/tile/tlabelframe.rb +38 -0
  258. data/lib/tkextlib/tile/tmenubutton.rb +38 -0
  259. data/lib/tkextlib/tile/tnotebook.rb +147 -0
  260. data/lib/tkextlib/tile/tpaned.rb +245 -0
  261. data/lib/tkextlib/tile/tprogressbar.rb +57 -0
  262. data/lib/tkextlib/tile/tradiobutton.rb +38 -0
  263. data/lib/tkextlib/tile/treeview.rb +1306 -0
  264. data/lib/tkextlib/tile/tscale.rb +56 -0
  265. data/lib/tkextlib/tile/tscrollbar.rb +63 -0
  266. data/lib/tkextlib/tile/tseparator.rb +34 -0
  267. data/lib/tkextlib/tile/tsquare.rb +30 -0
  268. data/lib/tkextlib/tkDND.rb +18 -0
  269. data/lib/tkextlib/tkDND/setup.rb +8 -0
  270. data/lib/tkextlib/tkDND/shape.rb +125 -0
  271. data/lib/tkextlib/tkDND/tkdnd.rb +182 -0
  272. data/lib/tkextlib/tkHTML.rb +13 -0
  273. data/lib/tkextlib/tkHTML/htmlwidget.rb +453 -0
  274. data/lib/tkextlib/tkHTML/setup.rb +8 -0
  275. data/lib/tkextlib/tkimg.rb +36 -0
  276. data/lib/tkextlib/tkimg/bmp.rb +33 -0
  277. data/lib/tkextlib/tkimg/gif.rb +33 -0
  278. data/lib/tkextlib/tkimg/ico.rb +33 -0
  279. data/lib/tkextlib/tkimg/jpeg.rb +33 -0
  280. data/lib/tkextlib/tkimg/pcx.rb +33 -0
  281. data/lib/tkextlib/tkimg/pixmap.rb +44 -0
  282. data/lib/tkextlib/tkimg/png.rb +33 -0
  283. data/lib/tkextlib/tkimg/ppm.rb +33 -0
  284. data/lib/tkextlib/tkimg/ps.rb +33 -0
  285. data/lib/tkextlib/tkimg/setup.rb +8 -0
  286. data/lib/tkextlib/tkimg/sgi.rb +33 -0
  287. data/lib/tkextlib/tkimg/sun.rb +33 -0
  288. data/lib/tkextlib/tkimg/tga.rb +33 -0
  289. data/lib/tkextlib/tkimg/tiff.rb +33 -0
  290. data/lib/tkextlib/tkimg/window.rb +33 -0
  291. data/lib/tkextlib/tkimg/xbm.rb +33 -0
  292. data/lib/tkextlib/tkimg/xpm.rb +33 -0
  293. data/lib/tkextlib/tktable.rb +14 -0
  294. data/lib/tkextlib/tktable/setup.rb +8 -0
  295. data/lib/tkextlib/tktable/tktable.rb +966 -0
  296. data/lib/tkextlib/tktrans.rb +14 -0
  297. data/lib/tkextlib/tktrans/setup.rb +8 -0
  298. data/lib/tkextlib/tktrans/tktrans.rb +64 -0
  299. data/lib/tkextlib/treectrl.rb +13 -0
  300. data/lib/tkextlib/treectrl/setup.rb +8 -0
  301. data/lib/tkextlib/treectrl/tktreectrl.rb +2522 -0
  302. data/lib/tkextlib/trofs.rb +13 -0
  303. data/lib/tkextlib/trofs/setup.rb +8 -0
  304. data/lib/tkextlib/trofs/trofs.rb +51 -0
  305. data/lib/tkextlib/version.rb +6 -0
  306. data/lib/tkextlib/vu.rb +48 -0
  307. data/lib/tkextlib/vu/bargraph.rb +61 -0
  308. data/lib/tkextlib/vu/charts.rb +53 -0
  309. data/lib/tkextlib/vu/dial.rb +102 -0
  310. data/lib/tkextlib/vu/pie.rb +286 -0
  311. data/lib/tkextlib/vu/setup.rb +8 -0
  312. data/lib/tkextlib/vu/spinbox.rb +22 -0
  313. data/lib/tkextlib/winico.rb +14 -0
  314. data/lib/tkextlib/winico/setup.rb +8 -0
  315. data/lib/tkextlib/winico/winico.rb +224 -0
  316. data/lib/tkfont.rb +4 -0
  317. data/lib/tkmacpkg.rb +4 -0
  318. data/lib/tkmenubar.rb +4 -0
  319. data/lib/tkmngfocus.rb +4 -0
  320. data/lib/tkpalette.rb +4 -0
  321. data/lib/tkscrollbox.rb +4 -0
  322. data/lib/tktext.rb +4 -0
  323. data/lib/tkvirtevent.rb +4 -0
  324. data/lib/tkwinpkg.rb +4 -0
  325. data/spec/spec.opts +1 -0
  326. data/spec/spec_helper.rb +9 -0
  327. data/spec/tk-win_spec.rb +7 -0
  328. data/tk-win.gemspec +373 -0
  329. metadata +412 -0
@@ -0,0 +1,28 @@
1
+ #
2
+ # tkextlib/tcllib/tablelist.rb
3
+ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
4
+ #
5
+ # * Part of tcllib extension
6
+ # * A multi-column listbox
7
+
8
+ require 'tk'
9
+ require 'tkextlib/tcllib.rb'
10
+
11
+ # check Tile extension :: If already loaded, use tablelist_tile.
12
+ unless defined? Tk::Tcllib::Tablelist_usingTile
13
+ Tk::Tcllib::Tablelist_usingTile =
14
+ TkPackage.provide('tile') || TkPackage.provide('Ttk')
15
+ end
16
+
17
+ if Tk::Tcllib::Tablelist_usingTile
18
+ # with Tile
19
+ require 'tkextlib/tcllib/tablelist_tile'
20
+
21
+ else
22
+ # without Tile
23
+
24
+ # TkPackage.require('tablelist', '4.2')
25
+ TkPackage.require('tablelist')
26
+
27
+ require 'tkextlib/tcllib/tablelist_core'
28
+ end
@@ -0,0 +1,1072 @@
1
+ #
2
+ # tkextlib/tcllib/tablelist_core.rb
3
+ #
4
+ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
5
+ #
6
+ # * Part of tcllib extension
7
+ # * This file is required by 'tkextlib/tcllib/tablelist.rb' or
8
+ # 'tkextlib/tcllib/tablelist_tile.rb'.
9
+ #
10
+
11
+ module Tk
12
+ module Tcllib
13
+ class Tablelist < TkWindow
14
+ if Tk::Tcllib::Tablelist_usingTile
15
+ PACKAGE_NAME = 'Tablelist_tile'.freeze
16
+ else
17
+ PACKAGE_NAME = 'Tablelist'.freeze
18
+ end
19
+ def self.package_name
20
+ PACKAGE_NAME
21
+ end
22
+
23
+ def self.package_version
24
+ begin
25
+ TkPackage.require(self.package_name)
26
+ rescue
27
+ ''
28
+ end
29
+ end
30
+
31
+ def self.use_Tile?
32
+ (Tk::Tcllib::Tablelist_usingTile)? true: false
33
+ end
34
+ end
35
+ TableList = Tablelist
36
+ end
37
+ end
38
+
39
+ module Tk::Tcllib::TablelistItemConfig
40
+ include TkItemConfigMethod
41
+
42
+ def _to_idx(idx)
43
+ if idx.kind_of?(Array)
44
+ idx.collect{|elem| _get_eval_string(elem)}.join(',')
45
+ else
46
+ idx
47
+ end
48
+ end
49
+ def _from_idx(idx)
50
+ return idx unless idx.kind_of?(String)
51
+
52
+ if idx[0] == ?@ # '@x,y'
53
+ idx
54
+ elsif idx =~ /([^,]+),([^,]+)/
55
+ row = $1, column = $2
56
+ [num_or_str(row), num_or_str(column)]
57
+ else
58
+ num_or_str(idx)
59
+ end
60
+ end
61
+ private :_to_idx, :_from_idx
62
+
63
+ def __item_cget_cmd(mixed_id)
64
+ [self.path, mixed_id[0] + 'cget', _to_idx(mixed_id[1])]
65
+ end
66
+ def __item_config_cmd(mixed_id)
67
+ [self.path, mixed_id[0] + 'configure', _to_idx(mixed_id[1])]
68
+ end
69
+
70
+ def cell_cget_tkstring(tagOrId, option)
71
+ itemcget_tkstring(['cell', tagOrId], option)
72
+ end
73
+ def cell_cget(tagOrId, option)
74
+ itemcget(['cell', tagOrId], option)
75
+ end
76
+ def cell_cget_strict(tagOrId, option)
77
+ itemcget_strict(['cell', tagOrId], option)
78
+ end
79
+ def cell_configure(tagOrId, slot, value=None)
80
+ itemconfigure(['cell', tagOrId], slot, value)
81
+ end
82
+ def cell_configinfo(tagOrId, slot=nil)
83
+ itemconfiginfo(['cell', tagOrId], slot)
84
+ end
85
+ def current_cell_configinfo(tagOrId, slot=nil)
86
+ current_itemconfiginfo(['cell', tagOrId], slot)
87
+ end
88
+ alias cellcget_tkstring cell_cget_tkstring
89
+ alias cellcget cell_cget
90
+ alias cellcget_strict cell_cget_strict
91
+ alias cellconfigure cell_configure
92
+ alias cellconfiginfo cell_configinfo
93
+ alias current_cellconfiginfo current_cell_configinfo
94
+
95
+ def column_cget_tkstring(tagOrId, option)
96
+ itemcget_tkstring(['column', tagOrId], option)
97
+ end
98
+ def column_cget(tagOrId, option)
99
+ itemcget(['column', tagOrId], option)
100
+ end
101
+ def column_cget_strict(tagOrId, option)
102
+ itemcget_strict(['column', tagOrId], option)
103
+ end
104
+ def column_configure(tagOrId, slot, value=None)
105
+ itemconfigure(['column', tagOrId], slot, value)
106
+ end
107
+ def column_configinfo(tagOrId, slot=nil)
108
+ itemconfiginfo(['column', tagOrId], slot)
109
+ end
110
+ def current_column_configinfo(tagOrId, slot=nil)
111
+ current_itemconfiginfo(['column', tagOrId], slot)
112
+ end
113
+ alias columncget_tkstring column_cget_tkstring
114
+ alias columncget column_cget
115
+ alias columncget_strict column_cget_strict
116
+ alias columnconfigure column_configure
117
+ alias columnconfiginfo column_configinfo
118
+ alias current_columnconfiginfo current_column_configinfo
119
+
120
+ def row_cget_tkstring(tagOrId, option)
121
+ itemcget_tkstring(['row', tagOrId], option)
122
+ end
123
+ def row_cget(tagOrId, option)
124
+ itemcget(['row', tagOrId], option)
125
+ end
126
+ def row_cget_strict(tagOrId, option)
127
+ itemcget_strict(['row', tagOrId], option)
128
+ end
129
+ def row_configure(tagOrId, slot, value=None)
130
+ itemconfigure(['row', tagOrId], slot, value)
131
+ end
132
+ def row_configinfo(tagOrId, slot=nil)
133
+ itemconfiginfo(['row', tagOrId], slot)
134
+ end
135
+ def current_row_configinfo(tagOrId, slot=nil)
136
+ current_itemconfiginfo(['row', tagOrId], slot)
137
+ end
138
+ alias rowcget_tkstring row_cget_tkstring
139
+ alias rowcget row_cget
140
+ alias rowcget_strict row_cget_strict
141
+ alias rowconfigure row_configure
142
+ alias rowconfiginfo row_configinfo
143
+ alias current_rowconfiginfo current_row_configinfo
144
+
145
+ private :itemcget_tkstring, :itemcget, :itemcget_strict
146
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
147
+ end
148
+
149
+ class Tk::Tcllib::Tablelist
150
+ include Tk::Tcllib::TablelistItemConfig
151
+ include Scrollable
152
+
153
+ TkCommandNames = ['::tablelist::tablelist'.freeze].freeze
154
+ WidgetClassName = 'Tablelist'.freeze
155
+ WidgetClassNames[WidgetClassName] ||= self
156
+
157
+ def create_self(keys)
158
+ if keys and keys != None
159
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
160
+ *hash_kv(keys, true))
161
+ else
162
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
163
+ end
164
+ end
165
+ private :create_self
166
+
167
+ ##########################
168
+
169
+ def __numval_optkeys
170
+ super() + ['titlecolumns']
171
+ end
172
+ private :__numval_optkeys
173
+
174
+ def __strval_optkeys
175
+ super() + ['snipstring']
176
+ end
177
+ private :__strval_optkeys
178
+
179
+ def __boolval_optkeys
180
+ super() - ['takefocus'] + [
181
+ 'forceeditendcommand', 'movablecolumns', 'movablerows',
182
+ 'protecttitlecolumns', 'resizablecolumns', 'setfocus',
183
+ 'showarrow', 'showlabels', 'showseparators'
184
+ ]
185
+ end
186
+ private :__boolval_optkeys
187
+
188
+ def __listval_optkeys
189
+ super() + ['columns', 'columntitles']
190
+ end
191
+ private :__listval_optkeys
192
+
193
+ def __tkvariable_optkeys
194
+ super() + ['listvariable']
195
+ end
196
+ private :__tkvariable_optkeys
197
+
198
+ def __val2ruby_optkeys # { key=>proc, ... }
199
+ # The method is used to convert a opt-value to a ruby's object.
200
+ # When get the value of the option "key", "proc.call(value)" is called.
201
+ super().update('stretch'=>proc{|v|
202
+ (v == 'all')? v: simplelist(v)
203
+ },
204
+ 'takefocus'=>proc{|v|
205
+ case v
206
+ when '1'
207
+ true
208
+ when '0'
209
+ false
210
+ when ''
211
+ nil
212
+ else # cmd
213
+ tk_tcl2ruby(cmd)
214
+ end
215
+ })
216
+ end
217
+ private :__val2ruby_optkeys
218
+
219
+ def __ruby2val_optkeys # { key=>proc, ... }
220
+ # The method is used to convert a ruby's object to a opt-value.
221
+ # When set the value of the option "key", "proc.call(value)" is called.
222
+ # That is, "-#{key} #{proc.call(value)}".
223
+ super().update('stretch'=>proc{|v|
224
+ (v.kind_of?(Array))? v.collect{|e| _to_idx(e)}: v
225
+ },
226
+ 'takefocus'=>proc{|v|
227
+ case v
228
+ when true
229
+ '1'
230
+ when false
231
+ '0'
232
+ when nil
233
+ ''
234
+ else
235
+ _get_eval_string(v)
236
+ end
237
+ })
238
+ end
239
+ private :__ruby2val_optkeys
240
+
241
+ def __font_optkeys
242
+ super() + ['labelfont']
243
+ end
244
+ private :__font_optkeys
245
+
246
+ ##########################
247
+
248
+ def __item_strval_optkeys(id)
249
+ if id[0] == 'cell'
250
+ super(id) + ['title']
251
+ else
252
+ super(id) - ['text'] + ['title', 'name']
253
+ end
254
+ end
255
+ private :__item_strval_optkeys
256
+
257
+ def __item_boolval_optkeys(id)
258
+ super(id) + [
259
+ 'changesnipside', 'editable', 'hide', 'resizable', 'selectable',
260
+ 'showarrow', 'showlinenumbers', 'stretchable', 'stretchwindow', 'wrap'
261
+ ]
262
+ end
263
+ private :__item_boolval_optkeys
264
+
265
+ def __item_listval_optkeys(id)
266
+ if id[0] == 'cell'
267
+ super(id)
268
+ else
269
+ super(id) + ['text']
270
+ end
271
+ end
272
+ private :__item_listval_optkeys
273
+
274
+ def __item_font_optkeys(id)
275
+ # maybe need to override
276
+ super(id) + ['labelfont']
277
+ end
278
+ private :__item_font_optkeys
279
+
280
+ ##########################
281
+
282
+ def activate(index)
283
+ tk_send('activate', _to_idx(index))
284
+ self
285
+ end
286
+
287
+ def activate_cell(index)
288
+ tk_send('activatecell', _to_idx(index))
289
+ self
290
+ end
291
+ alias activatecell activate_cell
292
+
293
+ def get_attrib(name=nil)
294
+ if name && name != None
295
+ tk_send('attrib', name)
296
+ else
297
+ ret = []
298
+ lst = simplelist(tk_send('attrib'))
299
+ until lst.empty?
300
+ ret << ( [lst.shift] << lst.shift )
301
+ end
302
+ ret
303
+ end
304
+ end
305
+ def set_attrib(*args)
306
+ tk_send('attrib', *(args.flatten))
307
+ self
308
+ end
309
+
310
+ def bbox(index)
311
+ list(tk_send('bbox', _to_idx(index)))
312
+ end
313
+
314
+ def bodypath
315
+ window(tk_send('bodypath'))
316
+ end
317
+
318
+ def bodytag
319
+ TkBindTag.new_by_name(tk_send('bodytag'))
320
+ end
321
+
322
+ def cancel_editing
323
+ tk_send('cancelediting')
324
+ self
325
+ end
326
+ alias cancelediting cancel_editing
327
+
328
+ def get_cellattrib(name=nil)
329
+ if name && name != None
330
+ tk_send('cellattrib', name)
331
+ else
332
+ ret = []
333
+ lst = simplelist(tk_send('cellattrib'))
334
+ until lst.empty?
335
+ ret << ( [lst.shift] << lst.shift )
336
+ end
337
+ ret
338
+ end
339
+ end
340
+ def set_cellattrib(*args)
341
+ tk_send('cellattrib', *(args.flatten))
342
+ self
343
+ end
344
+
345
+ def cellindex(idx)
346
+ _from_idx(tk_send('cellindex', _to_idx(idx)))
347
+ end
348
+
349
+ def cellselection_anchor(idx)
350
+ tk_send('cellselection', 'anchor', _to_idx(idx))
351
+ self
352
+ end
353
+
354
+ def cellselection_clear(first, last=nil)
355
+ if first.kind_of?(Array)
356
+ tk_send('cellselection', 'clear', first.collect{|idx| _to_idx(idx)})
357
+ else
358
+ first = _to_idx(first)
359
+ last = (last)? _to_idx(last): first
360
+ tk_send('cellselection', 'clear', first, last)
361
+ end
362
+ self
363
+ end
364
+
365
+ def cellselection_includes(idx)
366
+ bool(tk_send('cellselection', 'includes', _to_idx(idx)))
367
+ end
368
+
369
+ def cellselection_set(first, last=nil)
370
+ if first.kind_of?(Array)
371
+ tk_send('cellselection', 'set', first.collect{|idx| _to_idx(idx)})
372
+ else
373
+ first = _to_idx(first)
374
+ last = (last)? _to_idx(last): first
375
+ tk_send('cellselection', 'set', first, last)
376
+ end
377
+ self
378
+ end
379
+
380
+ def get_columnattrib(name=nil)
381
+ if name && name != None
382
+ tk_send('columnattrib', name)
383
+ else
384
+ ret = []
385
+ lst = simplelist(tk_send('columnattrib'))
386
+ until lst.empty?
387
+ ret << ( [lst.shift] << lst.shift )
388
+ end
389
+ ret
390
+ end
391
+ end
392
+ def set_columnattrib(*args)
393
+ tk_send('columnattrib', *(args.flatten))
394
+ self
395
+ end
396
+
397
+ def columncount
398
+ number(tk_send('columncount'))
399
+ end
400
+
401
+ def columnindex(idx)
402
+ number(tk_send('columnindex', _to_idx(idx)))
403
+ end
404
+
405
+ def columnwidth(idx, opt=nil)
406
+ if opt
407
+ number(tk_send('columnwidth', _to_idx(idx), "-#{opt}"))
408
+ else
409
+ number(tk_send('columnwidth', _to_idx(idx)))
410
+ end
411
+ end
412
+ def requested_columnwidth(idx)
413
+ columnwidth(idx, 'requested')
414
+ end
415
+ def stretched_columnwidth(idx)
416
+ columnwidth(idx, 'stretched')
417
+ end
418
+ def total_columnwidth(idx)
419
+ columnwidth(idx, 'total')
420
+ end
421
+
422
+ def configcelllist(lst) # lst ==> [idx, opt, val, idx, opt, val, ...]
423
+ ary = []
424
+ lst.slice(3){|idx, opt, val|
425
+ ary << _to_idx(idx) << "-#{opt}" << val
426
+ }
427
+ tk_send('configcelllist', ary)
428
+ self
429
+ end
430
+ alias config_celllist configcelllist
431
+
432
+ def configcells(*args) # args ==> idx, opt, val, idx, opt, val, ...
433
+ ary = []
434
+ args.slice(3){|idx, opt, val|
435
+ ary << _to_idx(idx) << "-#{opt}" << val
436
+ }
437
+ tk_send('configcells', *ary)
438
+ self
439
+ end
440
+ alias config_cells configcells
441
+
442
+ def configcolumnlist(lst) # lst ==> [idx, opt, val, idx, opt, val, ...]
443
+ ary = []
444
+ lst.slice(3){|idx, opt, val|
445
+ ary << _to_idx(idx) << "-#{opt}" << val
446
+ }
447
+ tk_send('configcolumnlist', ary)
448
+ self
449
+ end
450
+ alias config_columnlist configcolumnlist
451
+
452
+ def configcolumns(*args) # args ==> idx, opt, val, idx, opt, val, ...
453
+ ary = []
454
+ args.slice(3){|idx, opt, val|
455
+ ary << _to_idx(idx) << "-#{opt}" << val
456
+ }
457
+ tk_send('configcolumns', *ary)
458
+ self
459
+ end
460
+ alias config_columns configcolumns
461
+
462
+ def configrowlist(lst) # lst ==> [idx, opt, val, idx, opt, val, ...]
463
+ ary = []
464
+ lst.slice(3){|idx, opt, val|
465
+ ary << _to_idx(idx) << "-#{opt}" << val
466
+ }
467
+ tk_send('configrowlist', ary)
468
+ self
469
+ end
470
+ alias config_rowlist configrowlist
471
+
472
+ def configrows(*args) # args ==> idx, opt, val, idx, opt, val, ...
473
+ ary = []
474
+ args.slice(3){|idx, opt, val|
475
+ ary << _to_idx(idx) << "-#{opt}" << val
476
+ }
477
+ tk_send('configrows', *ary)
478
+ self
479
+ end
480
+ alias config_rows configrows
481
+
482
+ def containing(y)
483
+ idx = num_or_str(tk_send('containing', y))
484
+ (idx.kind_of?(Fixnum) && idx < 0)? nil: idx
485
+ end
486
+
487
+ def containing_cell(x, y)
488
+ idx = _from_idx(tk_send('containingcell', x, y))
489
+ if idx.kind_of?(Array)
490
+ [
491
+ ((idx[0].kind_of?(Fixnum) && idx[0] < 0)? nil: idx[0]),
492
+ ((idx[1].kind_of?(Fixnum) && idx[1] < 0)? nil: idx[1])
493
+ ]
494
+ else
495
+ idx
496
+ end
497
+ end
498
+ alias containingcell containing_cell
499
+
500
+ def containing_column(x)
501
+ idx = num_or_str(tk_send('containingcolumn', x))
502
+ (idx.kind_of?(Fixnum) && idx < 0)? nil: idx
503
+ end
504
+ alias containingcolumn containing_column
505
+
506
+ def curcellselection
507
+ simplelist(tk_send('curcellselection')).collect!{|idx| _from_idx(idx)}
508
+ end
509
+
510
+ def curselection
511
+ list(tk_send('curselection'))
512
+ end
513
+
514
+ def delete_items(first, last=nil)
515
+ if first.kind_of?(Array)
516
+ tk_send('delete', first.collect{|idx| _to_idx(idx)})
517
+ else
518
+ first = _to_idx(first)
519
+ last = (last)? _to_idx(last): first
520
+ tk_send('delete', first, last)
521
+ end
522
+ self
523
+ end
524
+ alias delete delete_items
525
+ alias deleteitems delete_items
526
+
527
+ def delete_columns(first, last=nil)
528
+ if first.kind_of?(Array)
529
+ tk_send('deletecolumns', first.collect{|idx| _to_idx(idx)})
530
+ else
531
+ first = _to_idx(first)
532
+ last = (last)? _to_idx(last): first
533
+ tk_send('deletecolumns', first, last)
534
+ end
535
+ self
536
+ end
537
+ alias deletecolumns delete_columns
538
+
539
+ def edit_cell(idx)
540
+ tk_send('editcell', _to_idx(idx))
541
+ self
542
+ end
543
+ alias editcell edit_cell
544
+
545
+ def editwintag
546
+ TkBindTag.new_by_name(tk_send('editwintag'))
547
+ end
548
+
549
+ def editwinpath
550
+ window(tk_send('editwinpath'))
551
+ end
552
+
553
+ def entrypath
554
+ window(tk_send('entrypath'))
555
+ end
556
+
557
+ def fill_column(idx, txt)
558
+ tk_send('fillcolumn', _to_idx(idx), txt)
559
+ self
560
+ end
561
+ alias fillcolumn fill_column
562
+
563
+ def finish_editing
564
+ tk_send('finishediting')
565
+ self
566
+ end
567
+ alias finishediting finish_editing
568
+
569
+ def formatinfo
570
+ key, row, col = simplelist(tk_send('formatinfo'))
571
+ [key, number(row), number(col)]
572
+ end
573
+
574
+ def get(first, last=nil)
575
+ if first.kind_of?(Array)
576
+ simplelist(tk_send('get', first.collect{|idx| _to_idx(idx)})).collect!{|elem| simplelist(elem) }
577
+ else
578
+ first = _to_idx(first)
579
+ last = (last)? _to_idx(last): first
580
+ simplelist(tk_send('get', first, last))
581
+ end
582
+ end
583
+
584
+ def get_cells(first, last=nil)
585
+ if first.kind_of?(Array)
586
+ simplelist(tk_send('getcells', first.collect{|idx| _to_idx(idx)})).collect!{|elem| simplelist(elem) }
587
+ else
588
+ first = _to_idx(first)
589
+ last = (last)? _to_idx(last): first
590
+ simplelist(tk_send('getcells', first, last))
591
+ end
592
+ end
593
+ alias getcells get_cells
594
+
595
+ def get_columns(first, last=nil)
596
+ if first.kind_of?(Array)
597
+ simplelist(tk_send('getcolumns', first.collect{|idx| _to_idx(idx)})).collect!{|elem| simplelist(elem) }
598
+ else
599
+ first = _to_idx(first)
600
+ last = (last)? _to_idx(last): first
601
+ simplelist(tk_send('getcolumns', first, last))
602
+ end
603
+ end
604
+ alias getcolumns get_columns
605
+
606
+ def get_keys(first, last=nil)
607
+ if first.kind_of?(Array)
608
+ simplelist(tk_send('getkeys', first.collect{|idx| _to_idx(idx)})).collect!{|elem| simplelist(elem) }
609
+ else
610
+ first = _to_idx(first)
611
+ last = (last)? _to_idx(last): first
612
+ simplelist(tk_send('getkeys', first, last))
613
+ end
614
+ end
615
+ alias getkeys get_keys
616
+
617
+ def has_attrib?(name)
618
+ bool(tk_send('hasattrib', name))
619
+ end
620
+
621
+ def has_cellattrib?(idx, name)
622
+ bool(tk_send('hascellattrib', _to_idx(idx), name))
623
+ end
624
+
625
+ def has_columnattrib?(idx, name)
626
+ bool(tk_send('hascolumnattrib', _to_idx(idx), name))
627
+ end
628
+
629
+ def has_rowattrib?(idx, name)
630
+ bool(tk_send('hasrowattrib', _to_idx(idx), name))
631
+ end
632
+
633
+ def imagelabelpath(idx)
634
+ window(tk_send('imagelabelpath', _to_idx(idx)))
635
+ end
636
+
637
+ def index(idx)
638
+ number(tk_send('index', _to_idx(idx)))
639
+ end
640
+
641
+ def insert(idx, *items)
642
+ tk_send('insert', _to_idx(idx), *items)
643
+ self
644
+ end
645
+
646
+ def insert_columnlist(idx, columnlist)
647
+ tk_send('insertcolumnlist', _to_idx(idx), columnlist)
648
+ self
649
+ end
650
+ alias insertcolumnlist insert_columnlist
651
+
652
+ def insert_columns(idx, *args)
653
+ tk_send('insertcolums', _to_idx(idx), *args)
654
+ self
655
+ end
656
+ alias insertcolumns insert_columns
657
+
658
+ def insert_list(idx, list)
659
+ tk_send('insertlist', _to_idx(idx), list)
660
+ self
661
+ end
662
+ alias insertlist insert_list
663
+
664
+ def is_elem_snipped?(cellidx, tkvar)
665
+ bool(tk_send('iselemsnipped', _to_idx(cellidx), tkvar))
666
+ end
667
+ alias elem_snipped? is_elem_snipped?
668
+
669
+ def is_title_snipped?(colidx, tkvar)
670
+ bool(tk_send('istitlesnipped', _to_idx(colidx), tkvar))
671
+ end
672
+ alias title_snipped? is_title_snipped?
673
+
674
+ def itemlistvar
675
+ TkVarAccess.new(tk_send('itemlistvar'))
676
+ end
677
+
678
+ def labelpath(idx)
679
+ window(tk_send('labelpath', _to_idx(idx)))
680
+ end
681
+
682
+ def labels
683
+ simplelist(tk_send('labels'))
684
+ end
685
+
686
+ def labeltag
687
+ TkBindTag.new_by_name(tk_send('labeltag'))
688
+ end
689
+
690
+ def move(src, target)
691
+ tk_send('move', _to_idx(src), _to_idx(target))
692
+ self
693
+ end
694
+
695
+ def move_column(src, target)
696
+ tk_send('movecolumn', _to_idx(src), _to_idx(target))
697
+ self
698
+ end
699
+ alias movecolumn move_column
700
+
701
+ def nearest(y)
702
+ _from_idx(tk_send('nearest', y))
703
+ end
704
+
705
+ def nearest_cell(x, y)
706
+ _from_idx(tk_send('nearestcell', x, y))
707
+ end
708
+ alias nearestcell nearest_cell
709
+
710
+ def nearest_column(x)
711
+ _from_idx(tk_send('nearestcolumn', x))
712
+ end
713
+ alias nearestcolumn nearest_column
714
+
715
+ def reject_input
716
+ tk_send('rejectinput')
717
+ self
718
+ end
719
+ alias rejectinput reject_input
720
+
721
+ def reset_sortinfo
722
+ tk_send('resetsortinfo')
723
+ self
724
+ end
725
+ alias resetsortinfo reset_sortinfo
726
+
727
+ def get_rowattrib(name=nil)
728
+ if name && name != None
729
+ tk_send('rowattrib', name)
730
+ else
731
+ ret = []
732
+ lst = simplelist(tk_send('rowattrib'))
733
+ until lst.empty?
734
+ ret << ( [lst.shift] << lst.shift )
735
+ end
736
+ ret
737
+ end
738
+ end
739
+ def set_rowattrib(*args)
740
+ tk_send('rowattrib', *(args.flatten))
741
+ self
742
+ end
743
+
744
+ def scan_mark(x, y)
745
+ tk_send('scan', 'mark', x, y)
746
+ self
747
+ end
748
+
749
+ def scan_dragto(x, y)
750
+ tk_send('scan', 'dragto', x, y)
751
+ self
752
+ end
753
+
754
+ def see(idx)
755
+ tk_send('see', _to_idx(idx))
756
+ self
757
+ end
758
+
759
+ def see_cell(idx)
760
+ tk_send('seecell', _to_idx(idx))
761
+ self
762
+ end
763
+ alias seecell see_cell
764
+
765
+ def see_column(idx)
766
+ tk_send('seecolumn', _to_idx(idx))
767
+ self
768
+ end
769
+ alias seecolumn see_column
770
+
771
+ def selection_anchor(idx)
772
+ tk_send('selection', 'anchor', _to_idx(idx))
773
+ self
774
+ end
775
+
776
+ def selection_clear(first, last=nil)
777
+ if first.kind_of?(Array)
778
+ tk_send('selection', 'clear', first.collect{|idx| _to_idx(idx)})
779
+ else
780
+ first = _to_idx(first)
781
+ last = (last)? _to_idx(last): first
782
+ tk_send('selection', 'clear', first, last)
783
+ end
784
+ self
785
+ end
786
+
787
+ def selection_includes(idx)
788
+ bool(tk_send('selection', 'includes', _to_idx(idx)))
789
+ end
790
+
791
+ def selection_set(first, last=nil)
792
+ if first.kind_of?(Array)
793
+ tk_send('selection', 'set', first.collect{|idx| _to_idx(idx)})
794
+ else
795
+ first = _to_idx(first)
796
+ last = (last)? _to_idx(last): first
797
+ tk_send('selection', 'set', first, last)
798
+ end
799
+ self
800
+ end
801
+
802
+ def separatorpath(idx=nil)
803
+ if idx
804
+ window(tk_send('separatorpath', _to_idx(idx)))
805
+ else
806
+ window(tk_send('separatorpath'))
807
+ end
808
+ end
809
+
810
+ def separators
811
+ simplelist(tk_send('separators')).collect!{|w| window(w)}
812
+ end
813
+
814
+ def size
815
+ number(tk_send('size'))
816
+ end
817
+
818
+ def sort(order=nil)
819
+ if order
820
+ order = order.to_s
821
+ order = '-' << order if order[0] != ?-
822
+ if order.length < 2
823
+ order = nil
824
+ end
825
+ end
826
+ if order
827
+ tk_send('sort', order)
828
+ else
829
+ tk_send('sort')
830
+ end
831
+ self
832
+ end
833
+ def sort_increasing
834
+ tk_send('sort', '-increasing')
835
+ self
836
+ end
837
+ def sort_decreasing
838
+ tk_send('sort', '-decreasing')
839
+ self
840
+ end
841
+
842
+
843
+ # default of 'labelcommand' option
844
+ DEFAULT_labelcommand_value =
845
+ DEFAULT_sortByColumn_cmd = '::tablelist::sortByColumn'
846
+
847
+ # default of 'labelcommand2' option
848
+ DEFAULT_labelcommand2_value =
849
+ DEFAULT_addToSortColumns_cmd = '::tablelist::addToSortColumns'
850
+
851
+ def sortByColumn_with_event_generate(idx)
852
+ tk_call('::tablelist::sortByColumn', @path, _to_idx(idx))
853
+ end
854
+
855
+ def addToSortColumns_with_event_generate(idx)
856
+ tk_call('::tablelist::addToSortColumns', @path, _to_idx(idx))
857
+ end
858
+
859
+ def sort_by_column(idx, order=nil)
860
+ if order
861
+ order = order.to_s
862
+ order = '-' << order if order[0] != ?-
863
+ if order.length < 2
864
+ order = nil
865
+ end
866
+ end
867
+ if order
868
+ tk_send('sortbycolumn', _to_idx(idx), order)
869
+ else
870
+ tk_send('sortbycolumn', _to_idx(idx))
871
+ end
872
+ self
873
+ end
874
+ def sort_by_column_increasing(idx)
875
+ tk_send('sortbycolumn', _to_idx(idx), '-increasing')
876
+ self
877
+ end
878
+ def sort_by_column_decreasing(idx)
879
+ tk_send('sortbycolumn', _to_idx(idx), '-decreasing')
880
+ self
881
+ end
882
+
883
+ def sort_by_columnlist(idxlist, orderlist=None)
884
+ # orderlist :: list of 'increasing' or 'decreasing'
885
+ tk_send('sortbycolumnlist', idxlist.map{|idx| _to_idx(idx)}, orderlist)
886
+ self
887
+ end
888
+
889
+ def sortcolumn
890
+ idx = num_or_str(tk_send('sortcolum'))
891
+ (idx.kind_of?(Fixnum) && idx < 0)? nil: idx
892
+ end
893
+
894
+ def sortcolumnlist
895
+ simplelist(tk_send('sortcolumlist')).map{|col| num_or_str(col)}
896
+ end
897
+
898
+ def sortorder
899
+ tk_send('sortorder')
900
+ end
901
+
902
+ def sortorderlist
903
+ simplelist(tk_send('sortorderlist'))
904
+ end
905
+
906
+ def toggle_columnhide(first, last=nil)
907
+ if first.kind_of?(Array)
908
+ tk_send('togglecolumnhide', first.collect{|idx| _to_idx(idx)})
909
+ else
910
+ first = _to_idx(first)
911
+ last = (last)? _to_idx(last): first
912
+ tk_send('togglecolumnhide', first, last)
913
+ end
914
+ end
915
+
916
+ def toggle_rowhide(first, last=nil)
917
+ if first.kind_of?(Array)
918
+ tk_send('togglerowhide', first.collect{|idx| _to_idx(idx)})
919
+ else
920
+ first = _to_idx(first)
921
+ last = (last)? _to_idx(last): first
922
+ tk_send('togglerowhide', first, last)
923
+ end
924
+ end
925
+
926
+ def toggle_visibility(first, last=nil)
927
+ if first.kind_of?(Array)
928
+ tk_send('togglevisibility', first.collect{|idx| _to_idx(idx)})
929
+ else
930
+ first = _to_idx(first)
931
+ last = (last)? _to_idx(last): first
932
+ tk_send('togglevisibility', first, last)
933
+ end
934
+ self
935
+ end
936
+ alias togglevisibility toggle_visibility
937
+
938
+ def unset_attrib(name)
939
+ tk_send('unsetattrib', name)
940
+ self
941
+ end
942
+
943
+ def unset_cellattrib(idx, name)
944
+ tk_send('unsetcellattrib', _to_idx(idx), name)
945
+ self
946
+ end
947
+
948
+ def unset_columnattrib(idx, name)
949
+ tk_send('unsetcolumnattrib', _to_idx(idx), name)
950
+ self
951
+ end
952
+
953
+ def unset_rowattrib(idx, name)
954
+ tk_send('unsetrowattrib', _to_idx(idx), name)
955
+ self
956
+ end
957
+
958
+ def windowpath(idx)
959
+ window(tk_send('windowpath', _to_idx(idx)))
960
+ end
961
+ end
962
+
963
+ class << Tk::Tcllib::Tablelist
964
+ ############################################################
965
+ # helper commands
966
+ def getTablelistPath(descendant)
967
+ window(Tk.tk_call('::tablelist::getTablelistPath', descendant))
968
+ end
969
+
970
+ def getTablelistColumn(descendant)
971
+ num_or_str(Tk.tk_call('::tablelist::getTablelistColumn', headerlabel))
972
+ end
973
+
974
+
975
+ def convEventFields(descendant, x, y)
976
+ window(Tk.tk_call('::tablelist::convEventFields', descendant, x, y))
977
+ end
978
+
979
+
980
+ ############################################################
981
+ # with the BWidget package
982
+ def addBWidgetEntry(name=None)
983
+ Tk.tk_call('::tablelist::addBWidgetEntry', name)
984
+ end
985
+
986
+ def addBWidgetSpinBox(name=None)
987
+ Tk.tk_call('::tablelist::addBWidgetSpinBox', name)
988
+ end
989
+
990
+ def addBWidgetComboBox(name=None)
991
+ Tk.tk_call('::tablelist::addBWidgetComboBox', name)
992
+ end
993
+
994
+
995
+ ############################################################
996
+ # with the Iwidgets ([incr Widgets]) package
997
+ def addIncrEntryfield(name=None)
998
+ Tk.tk_call('::tablelist::addIncrEntry', name)
999
+ end
1000
+
1001
+ def addIncrDateTimeWidget(type, seconds=false, name=None)
1002
+ # type := 'datefield'|'dateentry'|timefield'|'timeentry'
1003
+ if seconds && seconds != None
1004
+ seconds = '-seconds'
1005
+ else
1006
+ seconds = None
1007
+ end
1008
+ Tk.tk_call('::tablelist::addDateTimeWidget', type, seconds, name)
1009
+ end
1010
+
1011
+ def addIncrSpinner(name=None)
1012
+ Tk.tk_call('::tablelist::addIncrSpinner', name)
1013
+ end
1014
+
1015
+ def addIncrSpinint(name=None)
1016
+ Tk.tk_call('::tablelist::addIncrSpinint', name)
1017
+ end
1018
+
1019
+ def addIncrCombobox(name=None)
1020
+ Tk.tk_call('::tablelist::addIncrCombobox', name)
1021
+ end
1022
+
1023
+
1024
+ ############################################################
1025
+ # with Bryan Oakley's combobox package
1026
+ def addOakleyCombobox(name=None)
1027
+ Tk.tk_call('::tablelist::addOakleyCombobox', name)
1028
+ end
1029
+
1030
+ ############################################################
1031
+ # with the multi-entry package Mentry is a library extension
1032
+ def addDateMentry(format, separator, gmt=false, name=None)
1033
+ if gmt && gmt != None
1034
+ gmt = '-gmt'
1035
+ else
1036
+ gmt = None
1037
+ end
1038
+ Tk.tk_call('::tablelist::addDateMentry', format, separator, gmt, name)
1039
+ end
1040
+
1041
+ def addTimeMentry(format, separator, gmt=false, name=None)
1042
+ if gmt && gmt != None
1043
+ gmt = '-gmt'
1044
+ else
1045
+ gmt = None
1046
+ end
1047
+ Tk.tk_call('::tablelist::addTimeMentry', format, separator, gmt, name)
1048
+ end
1049
+
1050
+ def addDateTimeMentry(format, date_sep, time_sep, gmt=false, name=None)
1051
+ if gmt && gmt != None
1052
+ gmt = '-gmt'
1053
+ else
1054
+ gmt = None
1055
+ end
1056
+ Tk.tk_call('::tablelist::addDateTimeMentry',
1057
+ format, date_sep, time_sep, gmt, name)
1058
+ end
1059
+
1060
+ def addFixedPointMentry(count1, count2, comma=false, name=None)
1061
+ if comma && comma != None
1062
+ comma = '-comma'
1063
+ else
1064
+ comma = None
1065
+ end
1066
+ Tk.tk_call('::tablelist::addFixedPoingMentry', count1, count2, comma, name)
1067
+ end
1068
+
1069
+ def addIPAddrMentry(name=None)
1070
+ Tk.tk_call('::tablelist::addIPAddrMentry', name)
1071
+ end
1072
+ end