tk-win 0.2.0-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.rdoc +17 -0
- data/Rakefile +46 -0
- data/VERSION +1 -0
- data/lib/tcltk.rb +367 -0
- data/lib/tk.rb +5682 -0
- data/lib/tk/after.rb +6 -0
- data/lib/tk/autoload.rb +760 -0
- data/lib/tk/bgerror.rb +29 -0
- data/lib/tk/bindtag.rb +138 -0
- data/lib/tk/button.rb +31 -0
- data/lib/tk/canvas.rb +816 -0
- data/lib/tk/canvastag.rb +459 -0
- data/lib/tk/checkbutton.rb +32 -0
- data/lib/tk/clipboard.rb +75 -0
- data/lib/tk/clock.rb +71 -0
- data/lib/tk/composite.rb +484 -0
- data/lib/tk/console.rb +52 -0
- data/lib/tk/dialog.rb +326 -0
- data/lib/tk/encodedstr.rb +187 -0
- data/lib/tk/entry.rb +120 -0
- data/lib/tk/event.rb +562 -0
- data/lib/tk/font.rb +2351 -0
- data/lib/tk/frame.rb +132 -0
- data/lib/tk/grid.rb +279 -0
- data/lib/tk/image.rb +275 -0
- data/lib/tk/itemconfig.rb +1222 -0
- data/lib/tk/itemfont.rb +327 -0
- data/lib/tk/kinput.rb +71 -0
- data/lib/tk/label.rb +22 -0
- data/lib/tk/labelframe.rb +31 -0
- data/lib/tk/listbox.rb +284 -0
- data/lib/tk/macpkg.rb +80 -0
- data/lib/tk/menu.rb +718 -0
- data/lib/tk/menubar.rb +137 -0
- data/lib/tk/menuspec.rb +456 -0
- data/lib/tk/message.rb +24 -0
- data/lib/tk/mngfocus.rb +33 -0
- data/lib/tk/msgcat.rb +296 -0
- data/lib/tk/namespace.rb +551 -0
- data/lib/tk/optiondb.rb +377 -0
- data/lib/tk/optionobj.rb +212 -0
- data/lib/tk/pack.rb +107 -0
- data/lib/tk/package.rb +143 -0
- data/lib/tk/palette.rb +55 -0
- data/lib/tk/panedwindow.rb +260 -0
- data/lib/tk/place.rb +128 -0
- data/lib/tk/radiobutton.rb +73 -0
- data/lib/tk/root.rb +95 -0
- data/lib/tk/scale.rb +112 -0
- data/lib/tk/scrollable.rb +82 -0
- data/lib/tk/scrollbar.rb +183 -0
- data/lib/tk/scrollbox.rb +39 -0
- data/lib/tk/selection.rb +86 -0
- data/lib/tk/spinbox.rb +144 -0
- data/lib/tk/tagfont.rb +43 -0
- data/lib/tk/text.rb +1604 -0
- data/lib/tk/textimage.rb +88 -0
- data/lib/tk/textmark.rb +204 -0
- data/lib/tk/texttag.rb +321 -0
- data/lib/tk/textwindow.rb +154 -0
- data/lib/tk/timer.rb +669 -0
- data/lib/tk/toplevel.rb +264 -0
- data/lib/tk/ttk_selector.rb +98 -0
- data/lib/tk/txtwin_abst.rb +39 -0
- data/lib/tk/validation.rb +397 -0
- data/lib/tk/variable.rb +1799 -0
- data/lib/tk/virtevent.rb +139 -0
- data/lib/tk/winfo.rb +392 -0
- data/lib/tk/winpkg.rb +156 -0
- data/lib/tk/wm.rb +552 -0
- data/lib/tk/xim.rb +122 -0
- data/lib/tkafter.rb +4 -0
- data/lib/tkbgerror.rb +4 -0
- data/lib/tkcanvas.rb +4 -0
- data/lib/tkclass.rb +47 -0
- data/lib/tkconsole.rb +4 -0
- data/lib/tkdialog.rb +4 -0
- data/lib/tkentry.rb +4 -0
- data/lib/tkextlib/ICONS.rb +13 -0
- data/lib/tkextlib/ICONS/icons.rb +129 -0
- data/lib/tkextlib/ICONS/setup.rb +8 -0
- data/lib/tkextlib/SUPPORT_STATUS +198 -0
- data/lib/tkextlib/blt.rb +189 -0
- data/lib/tkextlib/blt/barchart.rb +79 -0
- data/lib/tkextlib/blt/bitmap.rb +112 -0
- data/lib/tkextlib/blt/busy.rb +83 -0
- data/lib/tkextlib/blt/component.rb +2218 -0
- data/lib/tkextlib/blt/container.rb +28 -0
- data/lib/tkextlib/blt/cutbuffer.rb +23 -0
- data/lib/tkextlib/blt/dragdrop.rb +269 -0
- data/lib/tkextlib/blt/eps.rb +32 -0
- data/lib/tkextlib/blt/graph.rb +67 -0
- data/lib/tkextlib/blt/htext.rb +112 -0
- data/lib/tkextlib/blt/setup.rb +8 -0
- data/lib/tkextlib/blt/spline.rb +23 -0
- data/lib/tkextlib/blt/stripchart.rb +74 -0
- data/lib/tkextlib/blt/table.rb +412 -0
- data/lib/tkextlib/blt/tabnotebook.rb +110 -0
- data/lib/tkextlib/blt/tabset.rb +504 -0
- data/lib/tkextlib/blt/ted.rb +68 -0
- data/lib/tkextlib/blt/tile.rb +25 -0
- data/lib/tkextlib/blt/tile/button.rb +16 -0
- data/lib/tkextlib/blt/tile/checkbutton.rb +17 -0
- data/lib/tkextlib/blt/tile/frame.rb +16 -0
- data/lib/tkextlib/blt/tile/label.rb +16 -0
- data/lib/tkextlib/blt/tile/radiobutton.rb +17 -0
- data/lib/tkextlib/blt/tile/scrollbar.rb +16 -0
- data/lib/tkextlib/blt/tile/toplevel.rb +16 -0
- data/lib/tkextlib/blt/tree.rb +1058 -0
- data/lib/tkextlib/blt/treeview.rb +1287 -0
- data/lib/tkextlib/blt/unix_dnd.rb +141 -0
- data/lib/tkextlib/blt/vector.rb +256 -0
- data/lib/tkextlib/blt/watch.rb +175 -0
- data/lib/tkextlib/blt/win_printer.rb +61 -0
- data/lib/tkextlib/blt/winop.rb +107 -0
- data/lib/tkextlib/bwidget.rb +153 -0
- data/lib/tkextlib/bwidget/arrowbutton.rb +21 -0
- data/lib/tkextlib/bwidget/bitmap.rb +21 -0
- data/lib/tkextlib/bwidget/button.rb +31 -0
- data/lib/tkextlib/bwidget/buttonbox.rb +90 -0
- data/lib/tkextlib/bwidget/combobox.rb +62 -0
- data/lib/tkextlib/bwidget/dialog.rb +194 -0
- data/lib/tkextlib/bwidget/dragsite.rb +31 -0
- data/lib/tkextlib/bwidget/dropsite.rb +39 -0
- data/lib/tkextlib/bwidget/dynamichelp.rb +63 -0
- data/lib/tkextlib/bwidget/entry.rb +43 -0
- data/lib/tkextlib/bwidget/label.rb +41 -0
- data/lib/tkextlib/bwidget/labelentry.rb +80 -0
- data/lib/tkextlib/bwidget/labelframe.rb +52 -0
- data/lib/tkextlib/bwidget/listbox.rb +361 -0
- data/lib/tkextlib/bwidget/mainframe.rb +132 -0
- data/lib/tkextlib/bwidget/messagedlg.rb +192 -0
- data/lib/tkextlib/bwidget/notebook.rb +166 -0
- data/lib/tkextlib/bwidget/pagesmanager.rb +73 -0
- data/lib/tkextlib/bwidget/panedwindow.rb +42 -0
- data/lib/tkextlib/bwidget/panelframe.rb +67 -0
- data/lib/tkextlib/bwidget/passwddlg.rb +44 -0
- data/lib/tkextlib/bwidget/progressbar.rb +20 -0
- data/lib/tkextlib/bwidget/progressdlg.rb +58 -0
- data/lib/tkextlib/bwidget/scrollableframe.rb +40 -0
- data/lib/tkextlib/bwidget/scrolledwindow.rb +48 -0
- data/lib/tkextlib/bwidget/scrollview.rb +25 -0
- data/lib/tkextlib/bwidget/selectcolor.rb +73 -0
- data/lib/tkextlib/bwidget/selectfont.rb +91 -0
- data/lib/tkextlib/bwidget/separator.rb +20 -0
- data/lib/tkextlib/bwidget/setup.rb +8 -0
- data/lib/tkextlib/bwidget/spinbox.rb +98 -0
- data/lib/tkextlib/bwidget/statusbar.rb +62 -0
- data/lib/tkextlib/bwidget/titleframe.rb +33 -0
- data/lib/tkextlib/bwidget/tree.rb +500 -0
- data/lib/tkextlib/bwidget/widget.rb +129 -0
- data/lib/tkextlib/itcl.rb +13 -0
- data/lib/tkextlib/itcl/incr_tcl.rb +178 -0
- data/lib/tkextlib/itcl/setup.rb +13 -0
- data/lib/tkextlib/itk.rb +13 -0
- data/lib/tkextlib/itk/incr_tk.rb +446 -0
- data/lib/tkextlib/itk/setup.rb +13 -0
- data/lib/tkextlib/iwidgets.rb +94 -0
- data/lib/tkextlib/iwidgets/buttonbox.rb +121 -0
- data/lib/tkextlib/iwidgets/calendar.rb +125 -0
- data/lib/tkextlib/iwidgets/canvasprintbox.rb +53 -0
- data/lib/tkextlib/iwidgets/canvasprintdialog.rb +38 -0
- data/lib/tkextlib/iwidgets/checkbox.rb +130 -0
- data/lib/tkextlib/iwidgets/combobox.rb +104 -0
- data/lib/tkextlib/iwidgets/dateentry.rb +20 -0
- data/lib/tkextlib/iwidgets/datefield.rb +58 -0
- data/lib/tkextlib/iwidgets/dialog.rb +20 -0
- data/lib/tkextlib/iwidgets/dialogshell.rb +121 -0
- data/lib/tkextlib/iwidgets/disjointlistbox.rb +50 -0
- data/lib/tkextlib/iwidgets/entryfield.rb +185 -0
- data/lib/tkextlib/iwidgets/extbutton.rb +40 -0
- data/lib/tkextlib/iwidgets/extfileselectionbox.rb +46 -0
- data/lib/tkextlib/iwidgets/extfileselectiondialog.rb +33 -0
- data/lib/tkextlib/iwidgets/feedback.rb +35 -0
- data/lib/tkextlib/iwidgets/fileselectionbox.rb +46 -0
- data/lib/tkextlib/iwidgets/fileselectiondialog.rb +33 -0
- data/lib/tkextlib/iwidgets/finddialog.rb +42 -0
- data/lib/tkextlib/iwidgets/hierarchy.rb +365 -0
- data/lib/tkextlib/iwidgets/hyperhelp.rb +50 -0
- data/lib/tkextlib/iwidgets/labeledframe.rb +39 -0
- data/lib/tkextlib/iwidgets/labeledwidget.rb +45 -0
- data/lib/tkextlib/iwidgets/mainwindow.rb +67 -0
- data/lib/tkextlib/iwidgets/menubar.rb +212 -0
- data/lib/tkextlib/iwidgets/messagebox.rb +93 -0
- data/lib/tkextlib/iwidgets/messagedialog.rb +20 -0
- data/lib/tkextlib/iwidgets/notebook.rb +175 -0
- data/lib/tkextlib/iwidgets/optionmenu.rb +92 -0
- data/lib/tkextlib/iwidgets/panedwindow.rb +134 -0
- data/lib/tkextlib/iwidgets/promptdialog.rb +131 -0
- data/lib/tkextlib/iwidgets/pushbutton.rb +35 -0
- data/lib/tkextlib/iwidgets/radiobox.rb +121 -0
- data/lib/tkextlib/iwidgets/scopedobject.rb +24 -0
- data/lib/tkextlib/iwidgets/scrolledcanvas.rb +353 -0
- data/lib/tkextlib/iwidgets/scrolledframe.rb +59 -0
- data/lib/tkextlib/iwidgets/scrolledhtml.rb +58 -0
- data/lib/tkextlib/iwidgets/scrolledlistbox.rb +207 -0
- data/lib/tkextlib/iwidgets/scrolledtext.rb +568 -0
- data/lib/tkextlib/iwidgets/scrolledwidget.rb +20 -0
- data/lib/tkextlib/iwidgets/selectionbox.rb +102 -0
- data/lib/tkextlib/iwidgets/selectiondialog.rb +92 -0
- data/lib/tkextlib/iwidgets/setup.rb +8 -0
- data/lib/tkextlib/iwidgets/shell.rb +38 -0
- data/lib/tkextlib/iwidgets/spindate.rb +48 -0
- data/lib/tkextlib/iwidgets/spinint.rb +30 -0
- data/lib/tkextlib/iwidgets/spinner.rb +169 -0
- data/lib/tkextlib/iwidgets/spintime.rb +48 -0
- data/lib/tkextlib/iwidgets/tabnotebook.rb +181 -0
- data/lib/tkextlib/iwidgets/tabset.rb +145 -0
- data/lib/tkextlib/iwidgets/timeentry.rb +25 -0
- data/lib/tkextlib/iwidgets/timefield.rb +58 -0
- data/lib/tkextlib/iwidgets/toolbar.rb +112 -0
- data/lib/tkextlib/iwidgets/watch.rb +56 -0
- data/lib/tkextlib/pkg_checker.rb +184 -0
- data/lib/tkextlib/setup.rb +8 -0
- data/lib/tkextlib/tcllib.rb +105 -0
- data/lib/tkextlib/tcllib/autoscroll.rb +158 -0
- data/lib/tkextlib/tcllib/ctext.rb +160 -0
- data/lib/tkextlib/tcllib/cursor.rb +97 -0
- data/lib/tkextlib/tcllib/datefield.rb +57 -0
- data/lib/tkextlib/tcllib/dialog.rb +84 -0
- data/lib/tkextlib/tcllib/getstring.rb +134 -0
- data/lib/tkextlib/tcllib/history.rb +73 -0
- data/lib/tkextlib/tcllib/ico.rb +146 -0
- data/lib/tkextlib/tcllib/ip_entry.rb +75 -0
- data/lib/tkextlib/tcllib/panelframe.rb +78 -0
- data/lib/tkextlib/tcllib/plotchart.rb +1404 -0
- data/lib/tkextlib/tcllib/ruler.rb +65 -0
- data/lib/tkextlib/tcllib/screenruler.rb +68 -0
- data/lib/tkextlib/tcllib/scrollwin.rb +61 -0
- data/lib/tkextlib/tcllib/setup.rb +8 -0
- data/lib/tkextlib/tcllib/style.rb +61 -0
- data/lib/tkextlib/tcllib/superframe.rb +51 -0
- data/lib/tkextlib/tcllib/swaplist.rb +150 -0
- data/lib/tkextlib/tcllib/tablelist.rb +28 -0
- data/lib/tkextlib/tcllib/tablelist_core.rb +1072 -0
- data/lib/tkextlib/tcllib/tablelist_tile.rb +43 -0
- data/lib/tkextlib/tcllib/tkpiechart.rb +314 -0
- data/lib/tkextlib/tcllib/tooltip.rb +104 -0
- data/lib/tkextlib/tcllib/widget.rb +82 -0
- data/lib/tkextlib/tclx.rb +13 -0
- data/lib/tkextlib/tclx/setup.rb +8 -0
- data/lib/tkextlib/tclx/tclx.rb +74 -0
- data/lib/tkextlib/tile.rb +449 -0
- data/lib/tkextlib/tile/dialog.rb +102 -0
- data/lib/tkextlib/tile/setup.rb +8 -0
- data/lib/tkextlib/tile/sizegrip.rb +32 -0
- data/lib/tkextlib/tile/style.rb +336 -0
- data/lib/tkextlib/tile/tbutton.rb +34 -0
- data/lib/tkextlib/tile/tcheckbutton.rb +38 -0
- data/lib/tkextlib/tile/tcombobox.rb +55 -0
- data/lib/tkextlib/tile/tentry.rb +49 -0
- data/lib/tkextlib/tile/tframe.rb +34 -0
- data/lib/tkextlib/tile/tlabel.rb +34 -0
- data/lib/tkextlib/tile/tlabelframe.rb +38 -0
- data/lib/tkextlib/tile/tmenubutton.rb +38 -0
- data/lib/tkextlib/tile/tnotebook.rb +147 -0
- data/lib/tkextlib/tile/tpaned.rb +245 -0
- data/lib/tkextlib/tile/tprogressbar.rb +57 -0
- data/lib/tkextlib/tile/tradiobutton.rb +38 -0
- data/lib/tkextlib/tile/treeview.rb +1306 -0
- data/lib/tkextlib/tile/tscale.rb +56 -0
- data/lib/tkextlib/tile/tscrollbar.rb +63 -0
- data/lib/tkextlib/tile/tseparator.rb +34 -0
- data/lib/tkextlib/tile/tsquare.rb +30 -0
- data/lib/tkextlib/tkDND.rb +18 -0
- data/lib/tkextlib/tkDND/setup.rb +8 -0
- data/lib/tkextlib/tkDND/shape.rb +125 -0
- data/lib/tkextlib/tkDND/tkdnd.rb +182 -0
- data/lib/tkextlib/tkHTML.rb +13 -0
- data/lib/tkextlib/tkHTML/htmlwidget.rb +453 -0
- data/lib/tkextlib/tkHTML/setup.rb +8 -0
- data/lib/tkextlib/tkimg.rb +36 -0
- data/lib/tkextlib/tkimg/bmp.rb +33 -0
- data/lib/tkextlib/tkimg/gif.rb +33 -0
- data/lib/tkextlib/tkimg/ico.rb +33 -0
- data/lib/tkextlib/tkimg/jpeg.rb +33 -0
- data/lib/tkextlib/tkimg/pcx.rb +33 -0
- data/lib/tkextlib/tkimg/pixmap.rb +44 -0
- data/lib/tkextlib/tkimg/png.rb +33 -0
- data/lib/tkextlib/tkimg/ppm.rb +33 -0
- data/lib/tkextlib/tkimg/ps.rb +33 -0
- data/lib/tkextlib/tkimg/setup.rb +8 -0
- data/lib/tkextlib/tkimg/sgi.rb +33 -0
- data/lib/tkextlib/tkimg/sun.rb +33 -0
- data/lib/tkextlib/tkimg/tga.rb +33 -0
- data/lib/tkextlib/tkimg/tiff.rb +33 -0
- data/lib/tkextlib/tkimg/window.rb +33 -0
- data/lib/tkextlib/tkimg/xbm.rb +33 -0
- data/lib/tkextlib/tkimg/xpm.rb +33 -0
- data/lib/tkextlib/tktable.rb +14 -0
- data/lib/tkextlib/tktable/setup.rb +8 -0
- data/lib/tkextlib/tktable/tktable.rb +966 -0
- data/lib/tkextlib/tktrans.rb +14 -0
- data/lib/tkextlib/tktrans/setup.rb +8 -0
- data/lib/tkextlib/tktrans/tktrans.rb +64 -0
- data/lib/tkextlib/treectrl.rb +13 -0
- data/lib/tkextlib/treectrl/setup.rb +8 -0
- data/lib/tkextlib/treectrl/tktreectrl.rb +2522 -0
- data/lib/tkextlib/trofs.rb +13 -0
- data/lib/tkextlib/trofs/setup.rb +8 -0
- data/lib/tkextlib/trofs/trofs.rb +51 -0
- data/lib/tkextlib/version.rb +6 -0
- data/lib/tkextlib/vu.rb +48 -0
- data/lib/tkextlib/vu/bargraph.rb +61 -0
- data/lib/tkextlib/vu/charts.rb +53 -0
- data/lib/tkextlib/vu/dial.rb +102 -0
- data/lib/tkextlib/vu/pie.rb +286 -0
- data/lib/tkextlib/vu/setup.rb +8 -0
- data/lib/tkextlib/vu/spinbox.rb +22 -0
- data/lib/tkextlib/winico.rb +14 -0
- data/lib/tkextlib/winico/setup.rb +8 -0
- data/lib/tkextlib/winico/winico.rb +224 -0
- data/lib/tkfont.rb +4 -0
- data/lib/tkmacpkg.rb +4 -0
- data/lib/tkmenubar.rb +4 -0
- data/lib/tkmngfocus.rb +4 -0
- data/lib/tkpalette.rb +4 -0
- data/lib/tkscrollbox.rb +4 -0
- data/lib/tktext.rb +4 -0
- data/lib/tkvirtevent.rb +4 -0
- data/lib/tkwinpkg.rb +4 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/tk-win_spec.rb +7 -0
- data/tk-win.gemspec +373 -0
- metadata +412 -0
data/lib/tk/after.rb
ADDED
data/lib/tk/autoload.rb
ADDED
@@ -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'
|