tk-win 0.2.0-x86-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,1222 @@
1
+ #
2
+ # tk/itemconfig.rb : control item/tag configuration of widget
3
+ #
4
+ require 'tk'
5
+ require 'tkutil'
6
+ require 'tk/itemfont.rb'
7
+
8
+ module TkItemConfigOptkeys
9
+ include TkUtil
10
+
11
+ def __item_optkey_aliases(id)
12
+ {}
13
+ end
14
+ private :__item_optkey_aliases
15
+
16
+ def __item_numval_optkeys(id)
17
+ []
18
+ end
19
+ private :__item_numval_optkeys
20
+
21
+ def __item_numstrval_optkeys(id)
22
+ []
23
+ end
24
+ private :__item_numstrval_optkeys
25
+
26
+ def __item_boolval_optkeys(id)
27
+ ['exportselection', 'jump', 'setgrid', 'takefocus']
28
+ end
29
+ private :__item_boolval_optkeys
30
+
31
+ def __item_strval_optkeys(id)
32
+ # maybe need to override
33
+ [
34
+ 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile',
35
+ 'activebackground', 'activeforeground', 'background',
36
+ 'disabledforeground', 'disabledbackground', 'foreground',
37
+ 'highlightbackground', 'highlightcolor', 'insertbackground',
38
+ 'selectbackground', 'selectforeground', 'troughcolor'
39
+ ]
40
+ end
41
+ private :__item_strval_optkeys
42
+
43
+ def __item_listval_optkeys(id)
44
+ []
45
+ end
46
+ private :__item_listval_optkeys
47
+
48
+ def __item_numlistval_optkeys(id)
49
+ # maybe need to override
50
+ ['dash', 'activedash', 'disableddash']
51
+ end
52
+ private :__item_numlistval_optkeys
53
+
54
+ def __item_tkvariable_optkeys(id)
55
+ ['variable', 'textvariable']
56
+ end
57
+ private :__item_tkvariable_optkeys
58
+
59
+ def __item_val2ruby_optkeys(id) # { key=>method, ... }
60
+ # The method is used to convert a opt-value to a ruby's object.
61
+ # When get the value of the option "key", "method.call(id, val)" is called.
62
+ {}
63
+ end
64
+ private :__item_val2ruby_optkeys
65
+
66
+ def __item_ruby2val_optkeys(id) # { key=>method, ... }
67
+ # The method is used to convert a ruby's object to a opt-value.
68
+ # When set the value of the option "key", "method.call(id, val)" is called.
69
+ # That is, "-#{key} #{method.call(id, value)}".
70
+ {}
71
+ end
72
+ private :__item_ruby2val_optkeys
73
+
74
+ def __item_methodcall_optkeys(id) # { key=>method, ... }
75
+ # Use the method for both of get and set.
76
+ # Usually, the 'key' will not be a widget option.
77
+ #
78
+ # maybe need to override
79
+ # {'coords'=>'coords'}
80
+ {}
81
+ end
82
+ private :__item_methodcall_optkeys
83
+
84
+ ################################################
85
+
86
+ def __item_keyonly_optkeys(id) # { def_key=>(undef_key|nil), ... }
87
+ # maybe need to override
88
+ {}
89
+ end
90
+ private :__item_keyonly_optkeys
91
+
92
+
93
+ def __conv_item_keyonly_opts(id, keys)
94
+ return keys unless keys.kind_of?(Hash)
95
+ keyonly = __item_keyonly_optkeys(id)
96
+ keys2 = {}
97
+ keys.each{|k, v|
98
+ optkey = keyonly.find{|kk,vv| kk.to_s == k.to_s}
99
+ if optkey
100
+ defkey, undefkey = optkey
101
+ if v
102
+ keys2[defkey.to_s] = None
103
+ else
104
+ keys2[undefkey.to_s] = None
105
+ end
106
+ else
107
+ keys2[k.to_s] = v
108
+ end
109
+ }
110
+ keys2
111
+ end
112
+
113
+ def itemconfig_hash_kv(id, keys, enc_mode = nil, conf = nil)
114
+ hash_kv(__conv_item_keyonly_opts(id, keys), enc_mode, conf)
115
+ end
116
+ end
117
+
118
+ module TkItemConfigMethod
119
+ include TkUtil
120
+ include TkTreatItemFont
121
+ include TkItemConfigOptkeys
122
+
123
+ def TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
124
+ @mode || false
125
+ end
126
+ def TkItemConfigMethod.__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode)
127
+ fail SecurityError, "can't change the mode" if $SAFE>=4
128
+ @mode = (mode)? true: false
129
+ end
130
+
131
+ def __item_cget_cmd(id)
132
+ # maybe need to override
133
+ [self.path, 'itemcget', id]
134
+ end
135
+ private :__item_cget_cmd
136
+
137
+ def __item_config_cmd(id)
138
+ # maybe need to override
139
+ [self.path, 'itemconfigure', id]
140
+ end
141
+ private :__item_config_cmd
142
+
143
+ def __item_confinfo_cmd(id)
144
+ # maybe need to override
145
+ __item_config_cmd(id)
146
+ end
147
+ private :__item_confinfo_cmd
148
+
149
+ def __item_configinfo_struct(id)
150
+ # maybe need to override
151
+ {:key=>0, :alias=>1, :db_name=>1, :db_class=>2,
152
+ :default_value=>3, :current_value=>4}
153
+ end
154
+ private :__item_configinfo_struct
155
+
156
+ ################################################
157
+
158
+ def tagid(tagOrId)
159
+ # maybe need to override
160
+ tagOrId
161
+ end
162
+
163
+ ################################################
164
+
165
+
166
+ def itemcget_tkstring(tagOrId, option)
167
+ opt = option.to_s
168
+ fail ArgumentError, "Invalid option `#{option.inspect}'" if opt.length == 0
169
+ tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{opt}"))
170
+ end
171
+
172
+ def __itemcget_core(tagOrId, option)
173
+ orig_opt = option
174
+ option = option.to_s
175
+
176
+ if option.length == 0
177
+ fail ArgumentError, "Invalid option `#{orig_opt.inspect}'"
178
+ end
179
+
180
+ alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == option}
181
+ if real_name
182
+ option = real_name.to_s
183
+ end
184
+
185
+ if ( method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[option] )
186
+ optval = tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}"))
187
+ begin
188
+ return method.call(tagOrId, optval)
189
+ rescue => e
190
+ warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
191
+ return optval
192
+ end
193
+ end
194
+
195
+ if ( method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[option] )
196
+ return self.__send__(method, tagOrId)
197
+ end
198
+
199
+ case option
200
+ when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
201
+ begin
202
+ number(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}")))
203
+ rescue
204
+ nil
205
+ end
206
+
207
+ when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
208
+ num_or_str(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}")))
209
+
210
+ when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
211
+ begin
212
+ bool(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}")))
213
+ rescue
214
+ nil
215
+ end
216
+
217
+ when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
218
+ simplelist(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}")))
219
+
220
+ when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
221
+ conf = tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}"))
222
+ if conf =~ /^[0-9]/
223
+ list(conf)
224
+ else
225
+ conf
226
+ end
227
+
228
+ when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
229
+ v = tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}"))
230
+ (v.empty?)? nil: TkVarAccess.new(v)
231
+
232
+ when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
233
+ _fromUTF8(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}")))
234
+
235
+ when /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/
236
+ fontcode = $1
237
+ fontkey = $2
238
+ fnt = tk_tcl2ruby(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{fontkey}")), true)
239
+ unless fnt.kind_of?(TkFont)
240
+ fnt = tagfontobj(tagid(tagOrId), fontkey)
241
+ end
242
+ if fontcode == 'kanji' && JAPANIZED_TK && TK_VERSION =~ /^4\.*/
243
+ # obsolete; just for compatibility
244
+ fnt.kanji_font
245
+ else
246
+ fnt
247
+ end
248
+ else
249
+ tk_tcl2ruby(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}")), true)
250
+ end
251
+ end
252
+ private :__itemcget_core
253
+
254
+ def itemcget(tagOrId, option)
255
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
256
+ __itemcget_core(tagOrId, option)
257
+ else
258
+ begin
259
+ __itemcget_core(tagOrId, option)
260
+ rescue => e
261
+ begin
262
+ if __current_itemconfiginfo(tagOrId).has_key?(option.to_s)
263
+ # not tag error & option is known -> error on known option
264
+ fail e
265
+ else
266
+ # not tag error & option is unknown
267
+ nil
268
+ end
269
+ rescue
270
+ fail e # tag error
271
+ end
272
+ end
273
+ end
274
+ end
275
+ def itemcget_strict(tagOrId, option)
276
+ # never use TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
277
+ __itemcget_core(tagOrId, option)
278
+ end
279
+
280
+ def __itemconfigure_core(tagOrId, slot, value=None)
281
+ if slot.kind_of? Hash
282
+ slot = _symbolkey2str(slot)
283
+
284
+ __item_optkey_aliases(tagid(tagOrId)).each{|alias_name, real_name|
285
+ alias_name = alias_name.to_s
286
+ if slot.has_key?(alias_name)
287
+ slot[real_name.to_s] = slot.delete(alias_name)
288
+ end
289
+ }
290
+
291
+ __item_methodcall_optkeys(tagid(tagOrId)).each{|key, method|
292
+ value = slot.delete(key.to_s)
293
+ self.__send__(method, tagOrId, value) if value
294
+ }
295
+
296
+ __item_ruby2val_optkeys(tagid(tagOrId)).each{|key, method|
297
+ key = key.to_s
298
+ slot[key] = method.call(tagOrId, slot[key]) if slot.has_key?(key)
299
+ }
300
+
301
+ __item_keyonly_optkeys(tagid(tagOrId)).each{|defkey, undefkey|
302
+ conf = slot.find{|kk, vv| kk == defkey.to_s}
303
+ if conf
304
+ k, v = conf
305
+ if v
306
+ slot[k] = None
307
+ else
308
+ slot[undefkey.to_s] = None if undefkey
309
+ slot.delete(k)
310
+ end
311
+ end
312
+ }
313
+
314
+ if (slot.find{|k, v| k =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/})
315
+ tagfont_configure(tagid(tagOrId), slot)
316
+ elsif slot.size > 0
317
+ tk_call(*(__item_config_cmd(tagid(tagOrId)).concat(hash_kv(slot))))
318
+ end
319
+
320
+ else
321
+ orig_slot = slot
322
+ slot = slot.to_s
323
+ if slot.length == 0
324
+ fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
325
+ end
326
+
327
+ alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
328
+ if real_name
329
+ slot = real_name.to_s
330
+ end
331
+
332
+ if ( conf = __item_keyonly_optkeys(tagid(tagOrId)).find{|k, v| k.to_s == slot } )
333
+ defkey, undefkey = conf
334
+ if value
335
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{defkey}"))
336
+ elsif undefkey
337
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{undefkey}"))
338
+ end
339
+ elsif ( method = _symbolkey2str(__item_ruby2val_optkeys(tagid(tagOrId)))[slot] )
340
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}" << method.call(tagOrId, value)))
341
+ elsif ( method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot] )
342
+ self.__send__(method, tagOrId, value)
343
+ elsif (slot =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/)
344
+ if value == None
345
+ tagfontobj(tagid(tagOrId), $2)
346
+ else
347
+ tagfont_configure(tagid(tagOrId), {slot=>value})
348
+ end
349
+ else
350
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}" << value))
351
+ end
352
+ end
353
+ self
354
+ end
355
+ private :__itemconfigure_core
356
+
357
+ def __check_available_itemconfigure_options(tagOrId, keys)
358
+ id = tagid(tagOrId)
359
+
360
+ availables = self.__current_itemconfiginfo(id).keys
361
+
362
+ # add non-standard keys
363
+ availables |= __font_optkeys.map{|k|
364
+ [k.to_s, "latin#{k}", "ascii#{k}", "kanji#{k}"]
365
+ }.flatten
366
+ availables |= __item_methodcall_optkeys(id).keys.map{|k| k.to_s}
367
+ availables |= __item_keyonly_optkeys(id).keys.map{|k| k.to_s}
368
+
369
+ keys = _symbolkey2str(keys)
370
+
371
+ keys.delete_if{|k, v| !(availables.include?(k))}
372
+ end
373
+
374
+ def itemconfigure(tagOrId, slot, value=None)
375
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
376
+ __itemconfigure_core(tagOrId, slot, value)
377
+ else
378
+ if slot.kind_of?(Hash)
379
+ begin
380
+ __itemconfigure_core(tagOrId, slot)
381
+ rescue
382
+ slot = __check_available_itemconfigure_options(tagOrId, slot)
383
+ __itemconfigure_core(tagOrId, slot) unless slot.empty?
384
+ end
385
+ else
386
+ begin
387
+ __itemconfigure_core(tagOrId, slot, value)
388
+ rescue => e
389
+ begin
390
+ if __current_itemconfiginfo(tagOrId).has_key?(slot.to_s)
391
+ # not tag error & option is known -> error on known option
392
+ fail e
393
+ else
394
+ # not tag error & option is unknown
395
+ nil
396
+ end
397
+ rescue
398
+ fail e # tag error
399
+ end
400
+ end
401
+ end
402
+ end
403
+ self
404
+ end
405
+
406
+ def __itemconfiginfo_core(tagOrId, slot = nil)
407
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
408
+ if (slot && slot.to_s =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/)
409
+ fontkey = $2
410
+ # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{fontkey}"))))
411
+ conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{fontkey}")), false, true)
412
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
413
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
414
+ if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
415
+ || conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
416
+ fnt = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
417
+ if TkFont.is_system_font?(fnt)
418
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = TkNamedFont.new(fnt)
419
+ end
420
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = tagfontobj(tagid(tagOrId), fontkey)
421
+ elsif ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
422
+ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 \
423
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- )
424
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
425
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
426
+ end
427
+ conf
428
+ else
429
+ if slot
430
+ slot = slot.to_s
431
+
432
+ alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
433
+ if real_name
434
+ slot = real_name.to_s
435
+ end
436
+
437
+ case slot
438
+ when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
439
+ method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[slot]
440
+ conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
441
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
442
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
443
+ optval = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
444
+ begin
445
+ val = method.call(tagOrId, optval)
446
+ rescue => e
447
+ warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
448
+ val = optval
449
+ end
450
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = val
451
+ end
452
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
453
+ optval = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
454
+ begin
455
+ val = method.call(tagOrId, optval)
456
+ rescue => e
457
+ warn("Warning:: #{e.message} (when #{method}lcall(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
458
+ val = optval
459
+ end
460
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = val
461
+ end
462
+
463
+ when /^(#{__item_methodcall_optkeys(tagid(tagOrId)).keys.join('|')})$/
464
+ method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot]
465
+ return [slot, '', '', '', self.__send__(method, tagOrId)]
466
+
467
+ when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
468
+ # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
469
+ conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
470
+
471
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
472
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
473
+ begin
474
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
475
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
476
+ rescue
477
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
478
+ end
479
+ end
480
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
481
+ begin
482
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
483
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
484
+ rescue
485
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
486
+ end
487
+ end
488
+
489
+ when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
490
+ # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
491
+ conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
492
+
493
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
494
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
495
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
496
+ num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
497
+ end
498
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
499
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
500
+ num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
501
+ end
502
+
503
+ when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
504
+ # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
505
+ conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
506
+
507
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
508
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
509
+ begin
510
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
511
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
512
+ rescue
513
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
514
+ end
515
+ end
516
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
517
+ begin
518
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
519
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
520
+ rescue
521
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
522
+ end
523
+ end
524
+
525
+ when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
526
+ # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
527
+ conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
528
+
529
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
530
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
531
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
532
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
533
+ end
534
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
535
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
536
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
537
+ end
538
+
539
+ when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
540
+ # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
541
+ conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
542
+
543
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
544
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \
545
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ )
546
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
547
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
548
+ end
549
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \
550
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ )
551
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
552
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
553
+ end
554
+
555
+ when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
556
+ # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
557
+ conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
558
+
559
+ when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
560
+ conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
561
+
562
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
563
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
564
+ v = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
565
+ if v.empty?
566
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
567
+ else
568
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = TkVarAccess.new(v)
569
+ end
570
+ end
571
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
572
+ v = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
573
+ if v.empty?
574
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
575
+ else
576
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = TkVarAccess.new(v)
577
+ end
578
+ end
579
+
580
+ else
581
+ # conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
582
+ conf = tk_split_list(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), 0, false, true)
583
+ end
584
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
585
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
586
+
587
+ if ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
588
+ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 \
589
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- )
590
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
591
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
592
+ end
593
+
594
+ conf
595
+
596
+ else
597
+ # ret = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)))))).collect{|conflist|
598
+ # conf = tk_split_simplelist(conflist)
599
+ ret = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)))), false, false).collect{|conflist|
600
+ conf = tk_split_simplelist(conflist, false, true)
601
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
602
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
603
+
604
+ optkey = conf[__item_configinfo_struct(tagid(tagOrId))[:key]]
605
+ case optkey
606
+ when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
607
+ method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[optkey]
608
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
609
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
610
+ optval = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
611
+ begin
612
+ val = method(tagOrId, optval)
613
+ rescue => e
614
+ warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
615
+ val = optval
616
+ end
617
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = val
618
+ end
619
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
620
+ optval = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
621
+ begin
622
+ val = method.call(tagOrId, optval)
623
+ rescue => e
624
+ warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
625
+ val = optval
626
+ end
627
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = val
628
+ end
629
+
630
+ when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
631
+ # do nothing
632
+
633
+ when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
634
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
635
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
636
+ begin
637
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
638
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
639
+ rescue
640
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
641
+ end
642
+ end
643
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
644
+ begin
645
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
646
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
647
+ rescue
648
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
649
+ end
650
+ end
651
+
652
+ when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
653
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
654
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
655
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
656
+ num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
657
+ end
658
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
659
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
660
+ num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
661
+ end
662
+
663
+ when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
664
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
665
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
666
+ begin
667
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
668
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
669
+ rescue
670
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
671
+ end
672
+ end
673
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
674
+ begin
675
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
676
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
677
+ rescue
678
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
679
+ end
680
+ end
681
+
682
+ when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
683
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
684
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
685
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
686
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
687
+ end
688
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
689
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
690
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
691
+ end
692
+
693
+ when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
694
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
695
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \
696
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ )
697
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
698
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
699
+ end
700
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \
701
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ )
702
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
703
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
704
+ end
705
+
706
+ when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
707
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
708
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
709
+ v = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
710
+ if v.empty?
711
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
712
+ else
713
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = TkVarAccess.new(v)
714
+ end
715
+ end
716
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
717
+ v = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
718
+ if v.empty?
719
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
720
+ else
721
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = TkVarAccess.new(v)
722
+ end
723
+ end
724
+
725
+ else
726
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
727
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
728
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]].index('{')
729
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
730
+ tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
731
+ else
732
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
733
+ tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
734
+ end
735
+ end
736
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
737
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]].index('{')
738
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
739
+ tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
740
+ else
741
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
742
+ tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
743
+ end
744
+ end
745
+ end
746
+
747
+ if ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
748
+ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 \
749
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- )
750
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
751
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
752
+ end
753
+
754
+ conf
755
+ }
756
+
757
+ __item_font_optkeys(tagid(tagOrId)).each{|optkey|
758
+ optkey = optkey.to_s
759
+ fontconf = ret.assoc(optkey)
760
+ if fontconf && fontconf.size > 2
761
+ ret.delete_if{|inf| inf[0] =~ /^(|latin|ascii|kanji)#{optkey}$/}
762
+ fnt = fontconf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
763
+ if TkFont.is_system_font?(fnt)
764
+ fontconf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = TkNamedFont.new(fnt)
765
+ end
766
+ fontconf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = tagfontobj(tagid(tagOrId), optkey)
767
+ ret.push(fontconf)
768
+ end
769
+ }
770
+
771
+ __item_methodcall_optkeys(tagid(tagOrId)).each{|optkey, method|
772
+ ret << [optkey.to_s, '', '', '', self.__send__(method, tagOrId)]
773
+ }
774
+
775
+ ret
776
+ end
777
+ end
778
+
779
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
780
+ if (slot && slot.to_s =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/)
781
+ fontkey = $2
782
+ # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{fontkey}"))))
783
+ conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{fontkey}")), false, true)
784
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
785
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
786
+
787
+ if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
788
+ || conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
789
+ fnt = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
790
+ if TkFont.is_system_font?(fnt)
791
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = TkNamedFont.new(fnt)
792
+ end
793
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = tagfontobj(tagid(tagOrId), fontkey)
794
+ { conf.shift => conf }
795
+ elsif ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
796
+ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
797
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?-
798
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
799
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
800
+ end
801
+ { conf[0] => conf[1] }
802
+ else
803
+ { conf.shift => conf }
804
+ end
805
+ else
806
+ if slot
807
+ slot = slot.to_s
808
+
809
+ alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
810
+ if real_name
811
+ slot = real_name.to_s
812
+ end
813
+
814
+ case slot
815
+ when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
816
+ method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[slot]
817
+ conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
818
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
819
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
820
+ optval = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
821
+ begin
822
+ val = method.call(tagOrId, optval)
823
+ rescue => e
824
+ warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
825
+ val = optval
826
+ end
827
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = val
828
+ end
829
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
830
+ optval = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
831
+ begin
832
+ val = method.call(tagOrId, optval)
833
+ rescue => e
834
+ warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
835
+ val = optval
836
+ end
837
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = val
838
+ end
839
+
840
+ when /^(#{__item_methodcall_optkeys(tagid(tagOrId)).keys.join('|')})$/
841
+ method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot]
842
+ return {slot => ['', '', '', self.__send__(method, tagOrId)]}
843
+
844
+ when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
845
+ # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
846
+ conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
847
+
848
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
849
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
850
+ begin
851
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
852
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
853
+ rescue
854
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
855
+ end
856
+ end
857
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
858
+ begin
859
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
860
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
861
+ rescue
862
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
863
+ end
864
+ end
865
+
866
+ when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
867
+ # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
868
+ conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
869
+
870
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
871
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
872
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
873
+ num_or_stre(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
874
+ end
875
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
876
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
877
+ num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
878
+ end
879
+
880
+ when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
881
+ # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
882
+ conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
883
+
884
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
885
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
886
+ begin
887
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
888
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
889
+ rescue
890
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
891
+ end
892
+ end
893
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
894
+ begin
895
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
896
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
897
+ rescue
898
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
899
+ end
900
+ end
901
+
902
+ when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
903
+ # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
904
+ conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
905
+
906
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
907
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
908
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
909
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
910
+ end
911
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
912
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
913
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
914
+ end
915
+
916
+ when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
917
+ # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
918
+ conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
919
+
920
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
921
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \
922
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ )
923
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
924
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
925
+ end
926
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \
927
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ )
928
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
929
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
930
+ end
931
+
932
+ when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
933
+ # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
934
+ conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
935
+
936
+ when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
937
+ conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
938
+
939
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
940
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
941
+ v = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
942
+ if v.empty?
943
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
944
+ else
945
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = TkVarAccess.new(v)
946
+ end
947
+ end
948
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
949
+ v = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
950
+ if v.empty?
951
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
952
+ else
953
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = TkVarAccess.new(v)
954
+ end
955
+ end
956
+
957
+ else
958
+ # conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
959
+ conf = tk_split_list(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), 0, false, true)
960
+ end
961
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
962
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
963
+
964
+ if ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
965
+ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
966
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?-
967
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
968
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
969
+ end
970
+ { conf[0] => conf[1] }
971
+ else
972
+ { conf.shift => conf }
973
+ end
974
+
975
+ else
976
+ ret = {}
977
+ # tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)))))).each{|conflist|
978
+ # conf = tk_split_simplelist(conflist)
979
+ tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)))), false, false).each{|conflist|
980
+ conf = tk_split_simplelist(conflist, false, true)
981
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
982
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
983
+
984
+ optkey = conf[__item_configinfo_struct(tagid(tagOrId))[:key]]
985
+ case optkey
986
+ when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
987
+ method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[optkey]
988
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
989
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
990
+ optval = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
991
+ begin
992
+ val = method.call(tagOrId, optval)
993
+ rescue => e
994
+ warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
995
+ val = optval
996
+ end
997
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = val
998
+ end
999
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
1000
+ optval = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
1001
+ begin
1002
+ val = method.call(tagOrId, optval)
1003
+ rescue => e
1004
+ warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
1005
+ val = optval
1006
+ end
1007
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = val
1008
+ end
1009
+
1010
+ when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
1011
+ # do nothing
1012
+
1013
+ when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
1014
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
1015
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
1016
+ begin
1017
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
1018
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
1019
+ rescue
1020
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
1021
+ end
1022
+ end
1023
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
1024
+ begin
1025
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
1026
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
1027
+ rescue
1028
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
1029
+ end
1030
+ end
1031
+
1032
+ when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
1033
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
1034
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
1035
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
1036
+ num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
1037
+ end
1038
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
1039
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
1040
+ num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
1041
+ end
1042
+
1043
+ when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
1044
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
1045
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
1046
+ begin
1047
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
1048
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
1049
+ rescue
1050
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
1051
+ end
1052
+ end
1053
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
1054
+ begin
1055
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
1056
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
1057
+ rescue
1058
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
1059
+ end
1060
+ end
1061
+
1062
+ when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
1063
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
1064
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
1065
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
1066
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
1067
+ end
1068
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
1069
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
1070
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
1071
+ end
1072
+
1073
+ when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
1074
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
1075
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \
1076
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ )
1077
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
1078
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
1079
+ end
1080
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \
1081
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ )
1082
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
1083
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
1084
+ end
1085
+
1086
+ when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
1087
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
1088
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
1089
+ v = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
1090
+ if v.empty?
1091
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
1092
+ else
1093
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = TkVarAccess.new(v)
1094
+ end
1095
+ end
1096
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
1097
+ v = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
1098
+ if v.empty?
1099
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
1100
+ else
1101
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = TkVarAccess.new(v)
1102
+ end
1103
+ end
1104
+
1105
+ else
1106
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
1107
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
1108
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]].index('{')
1109
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
1110
+ tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
1111
+ else
1112
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
1113
+ tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
1114
+ end
1115
+ end
1116
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
1117
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]].index('{')
1118
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
1119
+ tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
1120
+ else
1121
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
1122
+ tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
1123
+ end
1124
+ end
1125
+ end
1126
+
1127
+ if ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
1128
+ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
1129
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?-
1130
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
1131
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
1132
+ end
1133
+ ret[conf[0]] = conf[1]
1134
+ else
1135
+ ret[conf.shift] = conf
1136
+ end
1137
+ }
1138
+
1139
+ __item_font_optkeys(tagid(tagOrId)).each{|optkey|
1140
+ optkey = optkey.to_s
1141
+ fontconf = ret[optkey]
1142
+ if fontconf.kind_of?(Array)
1143
+ ret.delete(optkey)
1144
+ ret.delete('latin' << optkey)
1145
+ ret.delete('ascii' << optkey)
1146
+ ret.delete('kanji' << optkey)
1147
+ fnt = fontconf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
1148
+ if TkFont.is_system_font?(fnt)
1149
+ fontconf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = TkNamedFont.new(fnt)
1150
+ end
1151
+ fontconf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = tagfontobj(tagid(tagOrId), optkey)
1152
+ ret[optkey] = fontconf
1153
+ end
1154
+ }
1155
+
1156
+ __item_methodcall_optkeys(tagid(tagOrId)).each{|optkey, method|
1157
+ ret[optkey.to_s] = ['', '', '', self.__send__(method, tagOrId)]
1158
+ }
1159
+
1160
+ ret
1161
+ end
1162
+ end
1163
+ end
1164
+ end
1165
+ private :__itemconfiginfo_core
1166
+
1167
+ def itemconfiginfo(tagOrId, slot = nil)
1168
+ if slot && TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
1169
+ begin
1170
+ __itemconfiginfo_core(tagOrId, slot)
1171
+ rescue => e
1172
+ begin
1173
+ __itemconfiginfo_core(tagOrId)
1174
+ # not tag error -> option is unknown
1175
+ Array.new(__item_configinfo_struct.values.max).unshift(slot.to_s)
1176
+ rescue
1177
+ fail e # tag error
1178
+ end
1179
+ end
1180
+ else
1181
+ __itemconfiginfo_core(tagOrId, slot)
1182
+ end
1183
+ end
1184
+
1185
+ def __current_itemconfiginfo(tagOrId, slot = nil)
1186
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
1187
+ if slot
1188
+ org_slot = slot
1189
+ begin
1190
+ conf = __itemconfiginfo_core(tagOrId, slot)
1191
+ if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
1192
+ || conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
1193
+ return {conf[0] => conf[-1]}
1194
+ end
1195
+ slot = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]]
1196
+ end while(org_slot != slot)
1197
+ fail RuntimeError,
1198
+ "there is a configure alias loop about '#{org_slot}'"
1199
+ else
1200
+ ret = {}
1201
+ __itemconfiginfo_core(tagOrId).each{|conf|
1202
+ if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
1203
+ || conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
1204
+ ret[conf[0]] = conf[-1]
1205
+ end
1206
+ }
1207
+
1208
+ ret
1209
+ end
1210
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
1211
+ ret = {}
1212
+ __itemconfiginfo_core(tagOrId, slot).each{|key, conf|
1213
+ ret[key] = conf[-1] if conf.kind_of?(Array)
1214
+ }
1215
+ ret
1216
+ end
1217
+ end
1218
+
1219
+ def current_itemconfiginfo(tagOrId, slot = nil)
1220
+ __current_itemconfiginfo(tagOrId, slot)
1221
+ end
1222
+ end