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,6 @@
1
+ #
2
+ # tk/after.rb : methods for Tcl/Tk after command
3
+ #
4
+ # $Id: after.rb 25189 2009-10-02 12:04:37Z akr $
5
+ #
6
+ require 'tk/timer'
@@ -0,0 +1,760 @@
1
+ #
2
+ # autoload
3
+ #
4
+ ############################################
5
+ # geometry manager
6
+ module Tk
7
+ autoload :Grid, 'tk/grid'
8
+ def Grid(*args); TkGrid.configure(*args); end
9
+
10
+ autoload :Pack, 'tk/pack'
11
+ def Pack(*args); TkPack.configure(*args); end
12
+
13
+ autoload :Place, 'tk/place'
14
+ def Place(*args); TkPlace.configure(*args); end
15
+ end
16
+
17
+ autoload :TkGrid, 'tk/grid'
18
+ def TkGrid(*args); TkGrid.configure(*args); end
19
+
20
+ autoload :TkPack, 'tk/pack'
21
+ def TkPack(*args); TkPack.configure(*args); end
22
+
23
+ autoload :TkPlace, 'tk/place'
24
+ def TkPlace(*args); TkPlace.configure(*args); end
25
+
26
+
27
+ ############################################
28
+ # classes on Tk module
29
+ module Tk
30
+ autoload :Busy, 'tk/busy'
31
+
32
+ autoload :Button, 'tk/button'
33
+
34
+ autoload :Canvas, 'tk/canvas'
35
+
36
+ autoload :CheckButton, 'tk/checkbutton'
37
+ autoload :Checkbutton, 'tk/checkbutton'
38
+
39
+ autoload :Entry, 'tk/entry'
40
+
41
+ autoload :Frame, 'tk/frame'
42
+
43
+ autoload :Label, 'tk/label'
44
+
45
+ autoload :LabelFrame, 'tk/labelframe'
46
+ autoload :Labelframe, 'tk/labelframe'
47
+
48
+ autoload :Listbox, 'tk/listbox'
49
+
50
+ autoload :Menu, 'tk/menu'
51
+ autoload :MenuClone, 'tk/menu'
52
+ autoload :CloneMenu, 'tk/menu'
53
+ autoload :SystemMenu, 'tk/menu'
54
+ autoload :SysMenu_Help, 'tk/menu'
55
+ autoload :SysMenu_System, 'tk/menu'
56
+ autoload :SysMenu_Apple, 'tk/menu'
57
+ autoload :Menubutton, 'tk/menu'
58
+ autoload :MenuButton, 'tk/menu'
59
+ autoload :OptionMenubutton, 'tk/menu'
60
+ autoload :OptionMenBbutton, 'tk/menu'
61
+
62
+ autoload :Message, 'tk/message'
63
+
64
+ autoload :PanedWindow, 'tk/panedwindow'
65
+ autoload :Panedwindow, 'tk/panedwindow'
66
+
67
+ autoload :RadioButton, 'tk/radiobutton'
68
+ autoload :Radiobutton, 'tk/radiobutton'
69
+
70
+ autoload :Root, 'tk/root'
71
+
72
+ autoload :Scale, 'tk/scale'
73
+
74
+ autoload :Scrollbar, 'tk/scrollbar'
75
+ autoload :XScrollbar, 'tk/scrollbar'
76
+ autoload :YScrollbar, 'tk/scrollbar'
77
+
78
+ autoload :Spinbox, 'tk/spinbox'
79
+
80
+ autoload :Text, 'tk/text'
81
+
82
+ autoload :Toplevel, 'tk/toplevel'
83
+ end
84
+
85
+
86
+ ############################################
87
+ # sub-module of Tk
88
+ module Tk
89
+ autoload :Clock, 'tk/clock'
90
+
91
+ autoload :OptionObj, 'tk/optionobj'
92
+
93
+ autoload :X_Scrollable, 'tk/scrollable'
94
+ autoload :Y_Scrollable, 'tk/scrollable'
95
+ autoload :Scrollable, 'tk/scrollable'
96
+
97
+ autoload :Wm, 'tk/wm'
98
+ autoload :Wm_for_General, 'tk/wm'
99
+
100
+ autoload :MacResource, 'tk/macpkg'
101
+
102
+ autoload :WinDDE, 'tk/winpkg'
103
+ autoload :WinRegistry, 'tk/winpkg'
104
+
105
+ autoload :ValidateConfigure, 'tk/validation'
106
+ autoload :ItemValidateConfigure, 'tk/validation'
107
+
108
+ autoload :EncodedString, 'tk/encodedstr'
109
+ def Tk.EncodedString(str, enc = nil); Tk::EncodedString.new(str, enc); end
110
+
111
+ autoload :BinaryString, 'tk/encodedstr'
112
+ def Tk.BinaryString(str); Tk::BinaryString.new(str); end
113
+
114
+ autoload :UTF8_String, 'tk/encodedstr'
115
+ def Tk.UTF8_String(str); Tk::UTF8_String.new(str); end
116
+
117
+ end
118
+
119
+
120
+ ############################################
121
+ # toplevel classes/modules (fixed)
122
+ autoload :TkBgError, 'tk/bgerror'
123
+
124
+ autoload :TkBindTag, 'tk/bindtag'
125
+ autoload :TkBindTagAll, 'tk/bindtag'
126
+ autoload :TkDatabaseClass, 'tk/bindtag'
127
+
128
+ autoload :TkConsole, 'tk/console'
129
+
130
+ autoload :TkcItem, 'tk/canvas'
131
+ autoload :TkcArc, 'tk/canvas'
132
+ autoload :TkcBitmap, 'tk/canvas'
133
+ autoload :TkcImage, 'tk/canvas'
134
+ autoload :TkcLine, 'tk/canvas'
135
+ autoload :TkcOval, 'tk/canvas'
136
+ autoload :TkcPolygon, 'tk/canvas'
137
+ autoload :TkcRectangle, 'tk/canvas'
138
+ autoload :TkcText, 'tk/canvas'
139
+ autoload :TkcWindow, 'tk/canvas'
140
+
141
+ autoload :TkcTagAccess, 'tk/canvastag'
142
+ autoload :TkcTag, 'tk/canvastag'
143
+ autoload :TkcTagString, 'tk/canvastag'
144
+ autoload :TkcNamedTag, 'tk/canvastag'
145
+ autoload :TkcTagAll, 'tk/canvastag'
146
+ autoload :TkcTagCurrent, 'tk/canvastag'
147
+ autoload :TkcTagGroup, 'tk/canvastag'
148
+
149
+ autoload :TkClipboard, 'tk/clipboard'
150
+
151
+ autoload :TkComposite, 'tk/composite'
152
+
153
+ autoload :TkConsole, 'tk/console'
154
+
155
+ autoload :TkDialog, 'tk/dialog'
156
+ autoload :TkDialog2, 'tk/dialog'
157
+ autoload :TkDialogObj, 'tk/dialog'
158
+ autoload :TkWarning, 'tk/dialog'
159
+ autoload :TkWarning2, 'tk/dialog'
160
+ autoload :TkWarningObj, 'tk/dialog'
161
+
162
+ autoload :TkEvent, 'tk/event'
163
+
164
+ autoload :TkFont, 'tk/font'
165
+ autoload :TkNamedFont, 'tk/font'
166
+
167
+ autoload :TkImage, 'tk/image'
168
+ autoload :TkBitmapImage, 'tk/image'
169
+ autoload :TkPhotoImage, 'tk/image'
170
+
171
+ autoload :TkItemConfigMethod, 'tk/itemconfig'
172
+
173
+ autoload :TkTreatItemFont, 'tk/itemfont'
174
+
175
+ autoload :TkKinput, 'tk/kinput'
176
+
177
+ autoload :TkSystemMenu, 'tk/menu'
178
+
179
+ autoload :TkMenubar, 'tk/menubar'
180
+
181
+ autoload :TkMenuSpec, 'tk/menuspec'
182
+
183
+ autoload :TkManageFocus, 'tk/mngfocus'
184
+
185
+ autoload :TkMsgCatalog, 'tk/msgcat'
186
+ autoload :TkMsgCat, 'tk/msgcat'
187
+
188
+ autoload :TkNamespace, 'tk/namespace'
189
+
190
+ autoload :TkOptionDB, 'tk/optiondb'
191
+ autoload :TkOption, 'tk/optiondb'
192
+ autoload :TkResourceDB, 'tk/optiondb'
193
+
194
+ autoload :TkPackage, 'tk/package'
195
+
196
+ autoload :TkPalette, 'tk/palette'
197
+
198
+ autoload :TkRoot, 'tk/root'
199
+
200
+ autoload :TkScrollbox, 'tk/scrollbox'
201
+
202
+ autoload :TkSelection, 'tk/selection'
203
+
204
+ autoload :TkTreatTagFont, 'tk/tagfont'
205
+
206
+ autoload :TkTextImage, 'tk/textimage'
207
+ autoload :TktImage, 'tk/textimage'
208
+
209
+ autoload :TkTextMark, 'tk/textmark'
210
+ autoload :TkTextNamedMark, 'tk/textmark'
211
+ autoload :TkTextMarkInsert, 'tk/textmark'
212
+ autoload :TkTextMarkCurrent, 'tk/textmark'
213
+ autoload :TkTextMarkAnchor, 'tk/textmark'
214
+ autoload :TktMark, 'tk/textmark'
215
+ autoload :TktNamedMark, 'tk/textmark'
216
+ autoload :TktMarkInsert, 'tk/textmark'
217
+ autoload :TktMarkCurrent, 'tk/textmark'
218
+ autoload :TktMarkAnchor, 'tk/textmark'
219
+
220
+ autoload :TkTextTag, 'tk/texttag'
221
+ autoload :TkTextNamedTag, 'tk/texttag'
222
+ autoload :TkTextTagSel, 'tk/texttag'
223
+ autoload :TktTag, 'tk/texttag'
224
+ autoload :TktNamedTag, 'tk/texttag'
225
+ autoload :TktTagSel, 'tk/texttag'
226
+
227
+ autoload :TkTextWindow, 'tk/textwindow'
228
+ autoload :TktWindow, 'tk/textwindow'
229
+
230
+ autoload :TkAfter, 'tk/timer'
231
+ autoload :TkTimer, 'tk/timer'
232
+ autoload :TkRTTimer, 'tk/timer'
233
+
234
+ autoload :TkTextWin, 'tk/txtwin_abst'
235
+
236
+ autoload :TkValidation, 'tk/validation'
237
+ autoload :TkValidateCommand, 'tk/validation'
238
+
239
+ autoload :TkVariable, 'tk/variable'
240
+ autoload :TkVarAccess, 'tk/variable'
241
+
242
+ autoload :TkVirtualEvent, 'tk/virtevent'
243
+ autoload :TkNamedVirtualEvent,'tk/virtevent'
244
+
245
+ autoload :TkWinfo, 'tk/winfo'
246
+
247
+ autoload :TkXIM, 'tk/xim'
248
+
249
+
250
+ ############################################
251
+ # toplevel classes/modules (switchable)
252
+ module Tk
253
+ @TOPLEVEL_ALIAS_TABLE = {}
254
+ @TOPLEVEL_ALIAS_TABLE[:Tk] = {
255
+ :TkButton => 'tk/button',
256
+
257
+ :TkCanvas => 'tk/canvas',
258
+
259
+ :TkCheckButton => 'tk/checkbutton',
260
+ :TkCheckbutton => 'tk/checkbutton',
261
+
262
+ # :TkDialog => 'tk/dialog',
263
+ # :TkDialog2 => 'tk/dialog',
264
+ # :TkDialogObj => 'tk/dialog',
265
+ # :TkWarning => 'tk/dialog',
266
+ # :TkWarning2 => 'tk/dialog',
267
+ # :TkWarningObj => 'tk/dialog',
268
+
269
+ :TkEntry => 'tk/entry',
270
+
271
+ :TkFrame => 'tk/frame',
272
+
273
+ :TkLabel => 'tk/label',
274
+
275
+ :TkLabelFrame => 'tk/labelframe',
276
+ :TkLabelframe => 'tk/labelframe',
277
+
278
+ :TkListbox => 'tk/listbox',
279
+
280
+ :TkMacResource => 'tk/macpkg',
281
+
282
+ :TkMenu => 'tk/menu',
283
+ :TkMenuClone => 'tk/menu',
284
+ :TkCloneMenu => 'tk/menu',
285
+ # :TkSystemMenu => 'tk/menu',
286
+ :TkSysMenu_Help => 'tk/menu',
287
+ :TkSysMenu_System => 'tk/menu',
288
+ :TkSysMenu_Apple => 'tk/menu',
289
+ :TkMenubutton => 'tk/menu',
290
+ :TkMenuButton => 'tk/menu',
291
+ :TkOptionMenubutton => 'tk/menu',
292
+ :TkOptionMenuButton => 'tk/menu',
293
+
294
+ :TkMessage => 'tk/message',
295
+
296
+ :TkPanedWindow => 'tk/panedwindow',
297
+ :TkPanedwindow => 'tk/panedwindow',
298
+
299
+ :TkRadioButton => 'tk/radiobutton',
300
+ :TkRadiobutton => 'tk/radiobutton',
301
+
302
+ # :TkRoot => 'tk/root',
303
+
304
+ :TkScale => 'tk/scale',
305
+
306
+ :TkScrollbar => 'tk/scrollbar',
307
+ :TkXScrollbar => 'tk/scrollbar',
308
+ :TkYScrollbar => 'tk/scrollbar',
309
+
310
+ :TkSpinbox => 'tk/spinbox',
311
+
312
+ :TkText => 'tk/text',
313
+
314
+ :TkToplevel => 'tk/toplevel',
315
+
316
+ :TkWinDDE => 'tk/winpkg',
317
+ :TkWinRegistry => 'tk/winpkg',
318
+ }
319
+
320
+ @TOPLEVEL_ALIAS_OWNER = {}
321
+
322
+ @TOPLEVEL_ALIAS_SETUP_PROC = {}
323
+
324
+ @AUTOLOAD_FILE_SYM_TABLE = Hash.new{|h,k| h[k]={}} # TABLE[file][sym] -> obj
325
+
326
+ @current_default_widget_set = nil
327
+
328
+ module TOPLEVEL_ALIASES; end
329
+ end
330
+
331
+ class Object
332
+ include Tk::TOPLEVEL_ALIASES
333
+ end
334
+
335
+ ############################################
336
+ # methods to control default widget set
337
+ ############################################
338
+
339
+ class << Tk
340
+ def default_widget_set
341
+ @current_default_widget_set
342
+ end
343
+
344
+ def default_widget_set=(target)
345
+ target = target.to_sym
346
+ return target if target == @current_default_widget_set
347
+
348
+ if (cmd = @TOPLEVEL_ALIAS_SETUP_PROC[target])
349
+ cmd.call(target)
350
+ end
351
+
352
+ _replace_toplevel_aliases(target)
353
+ end
354
+
355
+ def widget_set_symbols
356
+ @TOPLEVEL_ALIAS_TABLE.keys
357
+ end
358
+
359
+ def toplevel_aliases_on_widget_set(widget_set)
360
+ if (tbl = @TOPLEVEL_ALIAS_TABLE[widget_set.to_sym])
361
+ tbl.collect{|k, v| (v.nil?)? nil: k}.compact
362
+ else
363
+ fail ArgumentError, "unknown widget_set #{widget_set.to_sym.inspect}"
364
+ end
365
+ end
366
+
367
+ def __toplevel_alias_setup_proc__(*target_list, &cmd)
368
+ target_list.each{|target| @TOPLEVEL_ALIAS_SETUP_PROC[target.to_sym] = cmd}
369
+ end
370
+
371
+ def topobj_defined?(sym) #=> alias_filename or object or false
372
+ Object.autoload?(sym) ||
373
+ (Object.const_defined?(sym) && Object.const_get(sym))
374
+ end
375
+ def topalias_defined?(sym) #=> alias_filename or object or false
376
+ Tk::TOPLEVEL_ALIASES.autoload?(sym) ||
377
+ (Tk::TOPLEVEL_ALIASES.const_defined?(sym) &&
378
+ Tk::TOPLEVEL_ALIASES.const_get(sym))
379
+ end
380
+ def define_topobj(sym, obj)
381
+ if obj.kind_of? String
382
+ # obj is an autoload path
383
+ Object.autoload(sym, obj)
384
+ unless Object.autoload?(sym)
385
+ # file is autoloaded?
386
+ if @AUTOLOAD_FILE_SYM_TABLE.has_key?(obj) &&
387
+ (loaded_obj = @AUTOLOAD_FILE_SYM_TABLE[obj][sym])
388
+ Object.const_set(sym, loaded_obj)
389
+ else
390
+ fail ArgumentError, "cannot define autoload file (already loaded?)"
391
+ end
392
+ end
393
+ else
394
+ # object
395
+ Object.const_set(sym, obj)
396
+ end
397
+ end
398
+ def define_topalias(sym, obj)
399
+ if obj.kind_of? String
400
+ # obj is an autoload path
401
+ Tk::TOPLEVEL_ALIASES.autoload(sym, obj)
402
+ unless Tk::TOPLEVEL_ALIASES.autoload?(sym)
403
+ # file is autoloaded?
404
+ if @AUTOLOAD_FILE_SYM_TABLE.has_key?(obj) &&
405
+ (loaded_obj = @AUTOLOAD_FILE_SYM_TABLE[obj][sym])
406
+ Tk::TOPLEVEL_ALIASES.const_set(sym, loaded_obj)
407
+ else
408
+ fail ArgumentError, "cannot define autoload file (already loaded?)"
409
+ end
410
+ end
411
+ else
412
+ # object
413
+ Tk::TOPLEVEL_ALIASES.const_set(sym, obj)
414
+ end
415
+ end
416
+ def replace_topobj(sym, obj) #=> old_obj (alias_filename or object) or nil
417
+ if old_obj = topobj_defined?(sym)
418
+ Object.class_eval{remove_const sym} rescue nil # ignore err
419
+ end
420
+ define_topobj(sym, obj)
421
+ old_obj
422
+ end
423
+ def replace_topalias(sym, obj) #=> old_obj (alias_filename or object) or nil
424
+ if old_obj = topalias_defined?(sym)
425
+ Tk::TOPLEVEL_ALIASES.module_eval{remove_const sym} rescue nil #ignore err
426
+ end
427
+ define_topalias(sym, obj)
428
+ old_obj
429
+ end
430
+ private :topobj_defined?, :topalias_defined?
431
+ private :define_topobj, :define_topalias
432
+ private :replace_topobj, :replace_topalias
433
+
434
+ def __regist_toplevel_aliases__(target, obj, *symbols)
435
+ # initial regist
436
+ @TOPLEVEL_ALIAS_TABLE[target = target.to_sym] ||= {}
437
+ symbols.each{|sym|
438
+ @TOPLEVEL_ALIAS_TABLE[target][sym = sym.to_sym] = obj
439
+ if !topalias_defined?(sym) || target == @current_default_widget_set
440
+ @TOPLEVEL_ALIAS_OWNER[sym] = target
441
+ replace_topalias(sym, obj)
442
+ replace_topobj(sym, obj) unless obj.kind_of?(String) # NOT autoload
443
+ end
444
+ }
445
+ end
446
+
447
+ def regist_sym_for_loaded_file(auto, obj, sym)
448
+ @AUTOLOAD_FILE_SYM_TABLE[auto][sym] = obj
449
+
450
+ reg = /^#{Regexp.quote(auto)}(\.rb|\.so|)$/
451
+ @TOPLEVEL_ALIAS_TABLE.each_key{|set|
452
+ if @TOPLEVEL_ALIAS_TABLE[set][sym] =~ reg
453
+ @TOPLEVEL_ALIAS_TABLE[set][sym] = obj
454
+ if @TOPLEVEL_ALIAS_OWNER[sym].nil? || @TOPLEVEL_ALIAS_OWNER[sym] == set
455
+ replace_topalias(sym, obj)
456
+ replace_topobj(sym, obj) if set == @current_default_widget_set
457
+ end
458
+ end
459
+ }
460
+ if (f = Object.autoload?(sym)) && f =~ reg
461
+ replace_topobj(sym, obj)
462
+ end
463
+ if (f = Tk::TOPLEVEL_ALIASES.autoload?(sym)) && f =~ reg
464
+ replace_topalias(sym, obj)
465
+ end
466
+ end
467
+ private :regist_sym_for_loaded_file
468
+
469
+ def set_topalias(target, obj, sym)
470
+ # obj is a kind of String : define autoload path
471
+ # Class : use the class object
472
+ if target == @current_default_widget_set
473
+ case @TOPLEVEL_ALIAS_OWNER[sym]
474
+ when false
475
+ # Object::sym is out of control. --> not change
476
+ # Make ALIAS::sym under control, because target widget set is current.
477
+ # Keep OWNER[sym]
478
+ @TOPLEVEL_ALIAS_TABLE[target][sym] = obj
479
+ replace_topalias(sym, obj)
480
+
481
+ when target
482
+ if current_obj = topobj_defined?(sym)
483
+ if current_obj == obj
484
+ # Make current_obj under control.
485
+ # Keep Object::sym.
486
+ # Keep OWNER[sym].
487
+ @TOPLEVEL_ALIAS_TABLE[target][sym] = obj
488
+ replace_topalias(sym, obj)
489
+
490
+ else # current_obj != obj
491
+ if current_obj == topalias_defined?(sym)
492
+ # Change controlled object
493
+ # Keep OWNER[sym].
494
+ @TOPLEVEL_ALIAS_TABLE[target][sym] = obj
495
+ replace_topalias(sym, obj)
496
+ replace_topobj(sym, obj)
497
+
498
+ else # current_obj != topalias_defined?(sym)
499
+ # Maybe current_obj is defined by user. --> OWNER[sym] = faise
500
+ # Keep Object::sym.
501
+ @TOPLEVEL_ALIAS_OWNER[sym] = false
502
+ @TOPLEVEL_ALIAS_TABLE[target][sym] = obj
503
+ replace_topalias(sym, obj)
504
+ end
505
+ end
506
+
507
+ else # NOT topobj_defined?(sym)
508
+ # New definition for sym at target.
509
+ # Keep OWNER[sym].
510
+ @TOPLEVEL_ALIAS_TABLE[target][sym] = obj
511
+ replace_topalias(sym, obj)
512
+ define_topobj(sym, obj)
513
+ end
514
+
515
+ when nil
516
+ # New definition for sym at target.
517
+ @TOPLEVEL_ALIAS_OWNER[sym] = target
518
+ @TOPLEVEL_ALIAS_TABLE[target][sym] = obj
519
+ replace_topalias(sym, obj)
520
+
521
+ else # others
522
+ # Maybe planning to make sym under control.
523
+ @TOPLEVEL_ALIAS_OWNER[sym] = target
524
+ @TOPLEVEL_ALIAS_TABLE[target][sym] = obj
525
+ replace_topalias(sym, obj)
526
+ replace_topobj(sym, obj)
527
+ end
528
+
529
+ else # target != @current_default_widget_set
530
+ case @TOPLEVEL_ALIAS_OWNER[sym]
531
+ when false
532
+ # Object::sym is out of control. --> not change
533
+ if topalias_defined?(sym)
534
+ # ALIAS[sym] may be defined by other widget set.
535
+ # Keep Object::sym (even if it is not defined)
536
+ # Keep ALIAS[sym].
537
+ # Keep OWNER[sym].
538
+ @TOPLEVEL_ALIAS_TABLE[target][sym] = obj
539
+
540
+ else # NOT topalias_defined?(sym)
541
+ # Nobody controls ALIAS[sym].
542
+ # At leaset, current widget set doesn't control ALIAS[sym].
543
+ # Keep Object::sym (even if it is not defined)
544
+ # Keep OWNER[sym].
545
+ @TOPLEVEL_ALIAS_TABLE[target][sym] = obj
546
+ define_topalias(sym, obj)
547
+ end
548
+
549
+ when target
550
+ # Maybe change controlled object, because Object::sym is under control.
551
+ # Keep OWNER[sym].
552
+ @TOPLEVEL_ALIAS_TABLE[target][sym] = obj
553
+ replace_topalias(sym, obj)
554
+ replace_topobj(sym, obj)
555
+
556
+ when nil
557
+ # New definition for sym
558
+ @TOPLEVEL_ALIAS_OWNER[sym] = target
559
+ @TOPLEVEL_ALIAS_TABLE[target][sym] = obj
560
+ replace_topalias(sym, obj)
561
+ replace_topobj(sym, obj)
562
+
563
+ else # others
564
+ # An other widget set controls sym.
565
+ # Keep Object::sym (even if it is not defined)
566
+ # Keep ALIAS[sym].
567
+ # Keep OWNER[sym].
568
+ @TOPLEVEL_ALIAS_TABLE[target][sym] = obj
569
+
570
+ end
571
+ end
572
+
573
+ sym
574
+ end
575
+ private :set_topalias
576
+
577
+ def __set_toplevel_aliases__(target, obj, *symbols)
578
+ # obj is a kind of String : define autoload path
579
+ # Class : use the class object
580
+ target = target.to_sym
581
+ symbols.each{|sym| set_topalias(target, obj, sym.to_sym)}
582
+ end
583
+
584
+ def __set_loaded_toplevel_aliases__(autopath, target, obj, *symbols)
585
+ # autopath is an autoload file
586
+ # Currently, this method doesn't support that autoload loads
587
+ # different toplevels between <basename>.rb and <basename>.so extension.
588
+ shortpath = (autopath =~ /^(.*)(.rb|.so)$/)? $1: autopath
589
+ target = target.to_sym
590
+ symbols.map!{|sym| sym.to_sym}
591
+
592
+ symbols.each{|sym| regist_sym_for_loaded_file(shortpath, obj, sym) }
593
+ symbols.each{|sym| set_topalias(target, obj, sym)}
594
+ end
595
+
596
+ def backup_current_topdef(sym)
597
+ return if (current = @current_default_widget_set).nil?
598
+
599
+ case @TOPLEVEL_ALIAS_OWNER[sym]
600
+ when false
601
+ # Object::sym is out of control.
602
+ if (cur_alias = topalias_defined?(sym)) && ! cur_alias.kind_of?(String)
603
+ @TOPLEVEL_ALIAS_TABLE[current][sym] = cur_alias
604
+ end
605
+
606
+ when current
607
+ if cur_obj = topobj_defined?(sym)
608
+ if ! cur_obj.kind_of?(String) && (cur_alias = topalias_defined?(sym))
609
+ if cur_alias.kind_of?(String)
610
+ # Mayby, user replaced Object::sym.
611
+ # Make Object::sym out of control.
612
+ @TOPLEVEL_ALIAS_OWNER[sym] = false
613
+ elsif cur_obj == cur_alias
614
+ # Possibley, defined normally. Backup it
615
+ @TOPLEVEL_ALIAS_TABLE[current][sym] = cur_alias
616
+ else
617
+ # Mayby, user replaced Object::sym.
618
+ # Make Object::sym out of control.
619
+ @TOPLEVEL_ALIAS_OWNER[sym] = false
620
+ end
621
+ end
622
+ else
623
+ # Mayby, user replaced Object::sym.
624
+ # Make Object::sym out of control.
625
+ @TOPLEVEL_ALIAS_OWNER[sym] = false
626
+ end
627
+
628
+ when nil
629
+ # Object::sym is out of control.
630
+ if (cur_alias = topalias_defined?(sym)) && ! cur_alias.kind_of?(String)
631
+ # Possibley, defined normally. Backup it.
632
+ @TOPLEVEL_ALIAS_TABLE[current][sym] = cur_alias
633
+ end
634
+ else
635
+ # No authority to control Object::sym and ALIASES::sym.
636
+ # Do nothing.
637
+ end
638
+ end
639
+ private :backup_current_topdef
640
+
641
+ def _replace_toplevel_aliases(target)
642
+ # backup
643
+ @TOPLEVEL_ALIAS_TABLE[target].each_key{|sym|
644
+ backup_current_topdef(sym)
645
+ }
646
+
647
+ # replace
648
+ @TOPLEVEL_ALIAS_TABLE[target].each_key{|sym|
649
+ next if (obj = @TOPLEVEL_ALIAS_TABLE[target][sym]).nil?
650
+ if @TOPLEVEL_ALIAS_OWNER[sym] == false
651
+ # Object::sym is out of control. --> not change
652
+ # Keep OWNER[sym].
653
+ replace_topalias(sym, obj)
654
+ else
655
+ # New definition
656
+ @TOPLEVEL_ALIAS_OWNER[sym] = target
657
+ replace_topalias(sym, obj)
658
+ replace_topobj(sym, obj)
659
+ end
660
+ }
661
+
662
+ # change default_widget_set
663
+ @current_default_widget_set = target
664
+ end
665
+ private :_replace_toplevel_aliases
666
+
667
+ def __import_toplevel_aliases__(target, *symbols)
668
+ current = @current_default_widget_set
669
+ symbols.each{|sym|
670
+ sym = sym.to_sym
671
+ if (obj = @TOPLEVEL_ALIAS_TABLE[target][sym]).nil?
672
+ # remove
673
+ @TOPLEVEL_ALIAS_TABLE[current].delete(sym)
674
+ @TOPLEVEL_ALIAS_OWNER.delete(sym)
675
+ Tk::TOPLEVEL_ALIASES.module_eval{remove_const sym} if topalias_defined?(sym)
676
+ Object.class_eval{remove_const sym} if topobj_defined?(sym)
677
+
678
+ elsif obj == false
679
+ # remove, but OWNER[sym] <- false and not treat Object::sym
680
+ @TOPLEVEL_ALIAS_TABLE[current].delete(sym)
681
+ @TOPLEVEL_ALIAS_OWNER[sym] = false
682
+ Tk::TOPLEVEL_ALIASES.module_eval{remove_const sym} if topalias_defined?(sym)
683
+
684
+ elsif @TOPLEVEL_ALIAS_OWNER[sym] == false
685
+ # Object::sym is out of control. --> not change
686
+ # Keep OWNER[sym].
687
+ @TOPLEVEL_ALIAS_TABLE[current][sym] = obj
688
+ replace_topalias(sym, obj)
689
+
690
+ else
691
+ # new definition under control
692
+ @TOPLEVEL_ALIAS_OWNER[sym] = current
693
+ @TOPLEVEL_ALIAS_TABLE[current][sym] = obj
694
+ replace_topalias(sym, obj)
695
+ replace_topobj(sym, obj)
696
+ end
697
+ }
698
+ end
699
+
700
+ def __remove_toplevel_aliases__(*symbols)
701
+ # remove toplevel aliases of current widget set
702
+ current = @current_default_widget_set
703
+ symbols.each{|sym|
704
+ sym = sym.to_sym
705
+ @TOPLEVEL_ALIAS_TABLE[current].delete(sym)
706
+ @TOPLEVEL_ALIAS_OWNER.delete(sym)
707
+ Tk::TOPLEVEL_ALIASES.module_eval{remove_const sym} if topalias_defined?(sym)
708
+ Object.class_eval{remove_const sym} if topobj_defined?(sym)
709
+ }
710
+ end
711
+
712
+ def __reset_toplevel_owner__(*symbols)
713
+ symbols.each{|sym| @TOPLEVEL_ALIAS_OWNER.delete(sym.to_sym)}
714
+ end
715
+
716
+ def __disable_toplevel_control__(*symbols)
717
+ symbols.each{|sym| @TOPLEVEL_ALIAS_OWNER[sym.to_sym] = false}
718
+ end
719
+
720
+ def __create_widget_set__(new_set, src_set={})
721
+ new_set = new_set.to_sym
722
+ if @TOPLEVEL_ALIAS_TABLE[new_set]
723
+ fail RuntimeError, "A widget-set #{new_set.inspect} is already exist."
724
+ end
725
+ if src_set.kind_of?(Symbol)
726
+ # new_set is an alias name of existed widget set.
727
+ @TOPLEVEL_ALIAS_TABLE[new_set] = @TOPLEVEL_ALIAS_TABLE[src_set]
728
+ else
729
+ @TOPLEVEL_ALIAS_TABLE[new_set] = {}
730
+ src_set.each{|sym, obj| set_topalias(new_set, obj, sym.to_sym) }
731
+ end
732
+ end
733
+ end
734
+
735
+
736
+ ############################################
737
+ # setup default widget set => :Tk
738
+ Tk.default_widget_set = :Tk
739
+
740
+
741
+ ############################################
742
+ # depend on the version of Tcl/Tk
743
+ # major, minor, type, patchlevel = TclTkLib.get_version
744
+
745
+ ############################################
746
+ # Ttk (Tile) support
747
+ =begin
748
+ if major > 8 ||
749
+ (major == 8 && minor > 5) ||
750
+ (major == 8 && minor == 5 && type >= TclTkLib::RELEASE_TYPE::BETA)
751
+ # Tcl/Tk 8.5 beta or later
752
+ Object.autoload :Ttk, 'tkextlib/tile'
753
+ Tk.autoload :Tile, 'tkextlib/tile'
754
+
755
+ require 'tk/ttk_selector'
756
+ end
757
+ =end
758
+ Object.autoload :Ttk, 'tkextlib/tile'
759
+ Tk.autoload :Tile, 'tkextlib/tile'
760
+ require 'tk/ttk_selector'