tk_as_gem 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +22 -0
- data/Rakefile +11 -0
- data/VERSION +1 -0
- data/ext/ChangeLog.tkextlib +935 -0
- data/ext/MANUAL_tcltklib.eng +469 -0
- data/ext/MANUAL_tcltklib.eucj +579 -0
- data/ext/README.1st +19 -0
- data/ext/README.ActiveTcl +49 -0
- data/ext/README.fork +34 -0
- data/ext/README.macosx-aqua +67 -0
- data/ext/README.tcltklib +85 -0
- data/ext/depend +2 -0
- data/ext/extconf.rb +451 -0
- data/ext/lib/README +30 -0
- data/ext/lib/multi-tk.rb +3491 -0
- data/ext/lib/remote-tk.rb +530 -0
- data/ext/lib/tcltk.rb +367 -0
- data/ext/lib/tk.rb +5584 -0
- data/ext/lib/tk/after.rb +6 -0
- data/ext/lib/tk/autoload.rb +414 -0
- data/ext/lib/tk/bgerror.rb +29 -0
- data/ext/lib/tk/bindtag.rb +138 -0
- data/ext/lib/tk/button.rb +30 -0
- data/ext/lib/tk/canvas.rb +789 -0
- data/ext/lib/tk/canvastag.rb +434 -0
- data/ext/lib/tk/checkbutton.rb +30 -0
- data/ext/lib/tk/clipboard.rb +75 -0
- data/ext/lib/tk/clock.rb +71 -0
- data/ext/lib/tk/composite.rb +458 -0
- data/ext/lib/tk/console.rb +52 -0
- data/ext/lib/tk/dialog.rb +326 -0
- data/ext/lib/tk/encodedstr.rb +187 -0
- data/ext/lib/tk/entry.rb +119 -0
- data/ext/lib/tk/event.rb +542 -0
- data/ext/lib/tk/font.rb +2344 -0
- data/ext/lib/tk/frame.rb +131 -0
- data/ext/lib/tk/grid.rb +279 -0
- data/ext/lib/tk/image.rb +275 -0
- data/ext/lib/tk/itemconfig.rb +1215 -0
- data/ext/lib/tk/itemfont.rb +327 -0
- data/ext/lib/tk/kinput.rb +71 -0
- data/ext/lib/tk/label.rb +21 -0
- data/ext/lib/tk/labelframe.rb +29 -0
- data/ext/lib/tk/listbox.rb +282 -0
- data/ext/lib/tk/macpkg.rb +78 -0
- data/ext/lib/tk/menu.rb +681 -0
- data/ext/lib/tk/menubar.rb +131 -0
- data/ext/lib/tk/menuspec.rb +275 -0
- data/ext/lib/tk/message.rb +22 -0
- data/ext/lib/tk/mngfocus.rb +33 -0
- data/ext/lib/tk/msgcat.rb +296 -0
- data/ext/lib/tk/namespace.rb +551 -0
- data/ext/lib/tk/optiondb.rb +377 -0
- data/ext/lib/tk/optionobj.rb +212 -0
- data/ext/lib/tk/pack.rb +107 -0
- data/ext/lib/tk/package.rb +143 -0
- data/ext/lib/tk/palette.rb +55 -0
- data/ext/lib/tk/panedwindow.rb +258 -0
- data/ext/lib/tk/place.rb +128 -0
- data/ext/lib/tk/radiobutton.rb +71 -0
- data/ext/lib/tk/root.rb +95 -0
- data/ext/lib/tk/scale.rb +111 -0
- data/ext/lib/tk/scrollable.rb +82 -0
- data/ext/lib/tk/scrollbar.rb +177 -0
- data/ext/lib/tk/scrollbox.rb +39 -0
- data/ext/lib/tk/selection.rb +86 -0
- data/ext/lib/tk/spinbox.rb +119 -0
- data/ext/lib/tk/tagfont.rb +43 -0
- data/ext/lib/tk/text.rb +1596 -0
- data/ext/lib/tk/textimage.rb +88 -0
- data/ext/lib/tk/textmark.rb +204 -0
- data/ext/lib/tk/texttag.rb +318 -0
- data/ext/lib/tk/textwindow.rb +154 -0
- data/ext/lib/tk/timer.rb +669 -0
- data/ext/lib/tk/toplevel.rb +262 -0
- data/ext/lib/tk/ttk_selector.rb +76 -0
- data/ext/lib/tk/txtwin_abst.rb +39 -0
- data/ext/lib/tk/validation.rb +397 -0
- data/ext/lib/tk/variable.rb +1765 -0
- data/ext/lib/tk/virtevent.rb +139 -0
- data/ext/lib/tk/winfo.rb +392 -0
- data/ext/lib/tk/winpkg.rb +153 -0
- data/ext/lib/tk/wm.rb +552 -0
- data/ext/lib/tk/xim.rb +122 -0
- data/ext/lib/tkafter.rb +4 -0
- data/ext/lib/tkbgerror.rb +4 -0
- data/ext/lib/tkcanvas.rb +4 -0
- data/ext/lib/tkclass.rb +47 -0
- data/ext/lib/tkconsole.rb +4 -0
- data/ext/lib/tkdialog.rb +4 -0
- data/ext/lib/tkentry.rb +4 -0
- data/ext/lib/tkextlib/ICONS.rb +13 -0
- data/ext/lib/tkextlib/ICONS/icons.rb +129 -0
- data/ext/lib/tkextlib/ICONS/setup.rb +8 -0
- data/ext/lib/tkextlib/SUPPORT_STATUS +196 -0
- data/ext/lib/tkextlib/blt.rb +187 -0
- data/ext/lib/tkextlib/blt/barchart.rb +79 -0
- data/ext/lib/tkextlib/blt/bitmap.rb +112 -0
- data/ext/lib/tkextlib/blt/busy.rb +82 -0
- data/ext/lib/tkextlib/blt/component.rb +2145 -0
- data/ext/lib/tkextlib/blt/container.rb +28 -0
- data/ext/lib/tkextlib/blt/cutbuffer.rb +23 -0
- data/ext/lib/tkextlib/blt/dragdrop.rb +268 -0
- data/ext/lib/tkextlib/blt/eps.rb +32 -0
- data/ext/lib/tkextlib/blt/graph.rb +67 -0
- data/ext/lib/tkextlib/blt/htext.rb +111 -0
- data/ext/lib/tkextlib/blt/setup.rb +8 -0
- data/ext/lib/tkextlib/blt/spline.rb +23 -0
- data/ext/lib/tkextlib/blt/stripchart.rb +74 -0
- data/ext/lib/tkextlib/blt/table.rb +399 -0
- data/ext/lib/tkextlib/blt/tabnotebook.rb +110 -0
- data/ext/lib/tkextlib/blt/tabset.rb +500 -0
- data/ext/lib/tkextlib/blt/ted.rb +65 -0
- data/ext/lib/tkextlib/blt/tile.rb +21 -0
- data/ext/lib/tkextlib/blt/tile/button.rb +16 -0
- data/ext/lib/tkextlib/blt/tile/checkbutton.rb +17 -0
- data/ext/lib/tkextlib/blt/tile/frame.rb +16 -0
- data/ext/lib/tkextlib/blt/tile/label.rb +16 -0
- data/ext/lib/tkextlib/blt/tile/radiobutton.rb +17 -0
- data/ext/lib/tkextlib/blt/tile/scrollbar.rb +16 -0
- data/ext/lib/tkextlib/blt/tile/toplevel.rb +16 -0
- data/ext/lib/tkextlib/blt/tree.rb +1058 -0
- data/ext/lib/tkextlib/blt/treeview.rb +1272 -0
- data/ext/lib/tkextlib/blt/unix_dnd.rb +135 -0
- data/ext/lib/tkextlib/blt/vector.rb +256 -0
- data/ext/lib/tkextlib/blt/watch.rb +175 -0
- data/ext/lib/tkextlib/blt/win_printer.rb +61 -0
- data/ext/lib/tkextlib/blt/winop.rb +107 -0
- data/ext/lib/tkextlib/bwidget.rb +151 -0
- data/ext/lib/tkextlib/bwidget/arrowbutton.rb +21 -0
- data/ext/lib/tkextlib/bwidget/bitmap.rb +21 -0
- data/ext/lib/tkextlib/bwidget/button.rb +31 -0
- data/ext/lib/tkextlib/bwidget/buttonbox.rb +90 -0
- data/ext/lib/tkextlib/bwidget/combobox.rb +51 -0
- data/ext/lib/tkextlib/bwidget/dialog.rb +182 -0
- data/ext/lib/tkextlib/bwidget/dragsite.rb +31 -0
- data/ext/lib/tkextlib/bwidget/dropsite.rb +39 -0
- data/ext/lib/tkextlib/bwidget/dynamichelp.rb +63 -0
- data/ext/lib/tkextlib/bwidget/entry.rb +43 -0
- data/ext/lib/tkextlib/bwidget/label.rb +41 -0
- data/ext/lib/tkextlib/bwidget/labelentry.rb +80 -0
- data/ext/lib/tkextlib/bwidget/labelframe.rb +52 -0
- data/ext/lib/tkextlib/bwidget/listbox.rb +358 -0
- data/ext/lib/tkextlib/bwidget/mainframe.rb +128 -0
- data/ext/lib/tkextlib/bwidget/messagedlg.rb +192 -0
- data/ext/lib/tkextlib/bwidget/notebook.rb +166 -0
- data/ext/lib/tkextlib/bwidget/pagesmanager.rb +73 -0
- data/ext/lib/tkextlib/bwidget/panedwindow.rb +37 -0
- data/ext/lib/tkextlib/bwidget/panelframe.rb +57 -0
- data/ext/lib/tkextlib/bwidget/passwddlg.rb +44 -0
- data/ext/lib/tkextlib/bwidget/progressbar.rb +20 -0
- data/ext/lib/tkextlib/bwidget/progressdlg.rb +58 -0
- data/ext/lib/tkextlib/bwidget/scrollableframe.rb +40 -0
- data/ext/lib/tkextlib/bwidget/scrolledwindow.rb +38 -0
- data/ext/lib/tkextlib/bwidget/scrollview.rb +25 -0
- data/ext/lib/tkextlib/bwidget/selectcolor.rb +73 -0
- data/ext/lib/tkextlib/bwidget/selectfont.rb +86 -0
- data/ext/lib/tkextlib/bwidget/separator.rb +20 -0
- data/ext/lib/tkextlib/bwidget/setup.rb +8 -0
- data/ext/lib/tkextlib/bwidget/spinbox.rb +98 -0
- data/ext/lib/tkextlib/bwidget/statusbar.rb +52 -0
- data/ext/lib/tkextlib/bwidget/titleframe.rb +33 -0
- data/ext/lib/tkextlib/bwidget/tree.rb +453 -0
- data/ext/lib/tkextlib/bwidget/widget.rb +129 -0
- data/ext/lib/tkextlib/itcl.rb +13 -0
- data/ext/lib/tkextlib/itcl/incr_tcl.rb +178 -0
- data/ext/lib/tkextlib/itcl/setup.rb +13 -0
- data/ext/lib/tkextlib/itk.rb +13 -0
- data/ext/lib/tkextlib/itk/incr_tk.rb +446 -0
- data/ext/lib/tkextlib/itk/setup.rb +13 -0
- data/ext/lib/tkextlib/iwidgets.rb +94 -0
- data/ext/lib/tkextlib/iwidgets/buttonbox.rb +120 -0
- data/ext/lib/tkextlib/iwidgets/calendar.rb +125 -0
- data/ext/lib/tkextlib/iwidgets/canvasprintbox.rb +53 -0
- data/ext/lib/tkextlib/iwidgets/canvasprintdialog.rb +38 -0
- data/ext/lib/tkextlib/iwidgets/checkbox.rb +129 -0
- data/ext/lib/tkextlib/iwidgets/combobox.rb +104 -0
- data/ext/lib/tkextlib/iwidgets/dateentry.rb +20 -0
- data/ext/lib/tkextlib/iwidgets/datefield.rb +58 -0
- data/ext/lib/tkextlib/iwidgets/dialog.rb +20 -0
- data/ext/lib/tkextlib/iwidgets/dialogshell.rb +120 -0
- data/ext/lib/tkextlib/iwidgets/disjointlistbox.rb +50 -0
- data/ext/lib/tkextlib/iwidgets/entryfield.rb +185 -0
- data/ext/lib/tkextlib/iwidgets/extbutton.rb +40 -0
- data/ext/lib/tkextlib/iwidgets/extfileselectionbox.rb +46 -0
- data/ext/lib/tkextlib/iwidgets/extfileselectiondialog.rb +33 -0
- data/ext/lib/tkextlib/iwidgets/feedback.rb +35 -0
- data/ext/lib/tkextlib/iwidgets/fileselectionbox.rb +46 -0
- data/ext/lib/tkextlib/iwidgets/fileselectiondialog.rb +33 -0
- data/ext/lib/tkextlib/iwidgets/finddialog.rb +42 -0
- data/ext/lib/tkextlib/iwidgets/hierarchy.rb +365 -0
- data/ext/lib/tkextlib/iwidgets/hyperhelp.rb +50 -0
- data/ext/lib/tkextlib/iwidgets/labeledframe.rb +39 -0
- data/ext/lib/tkextlib/iwidgets/labeledwidget.rb +45 -0
- data/ext/lib/tkextlib/iwidgets/mainwindow.rb +67 -0
- data/ext/lib/tkextlib/iwidgets/menubar.rb +211 -0
- data/ext/lib/tkextlib/iwidgets/messagebox.rb +92 -0
- data/ext/lib/tkextlib/iwidgets/messagedialog.rb +20 -0
- data/ext/lib/tkextlib/iwidgets/notebook.rb +174 -0
- data/ext/lib/tkextlib/iwidgets/optionmenu.rb +92 -0
- data/ext/lib/tkextlib/iwidgets/panedwindow.rb +133 -0
- data/ext/lib/tkextlib/iwidgets/promptdialog.rb +131 -0
- data/ext/lib/tkextlib/iwidgets/pushbutton.rb +35 -0
- data/ext/lib/tkextlib/iwidgets/radiobox.rb +120 -0
- data/ext/lib/tkextlib/iwidgets/scopedobject.rb +24 -0
- data/ext/lib/tkextlib/iwidgets/scrolledcanvas.rb +353 -0
- data/ext/lib/tkextlib/iwidgets/scrolledframe.rb +59 -0
- data/ext/lib/tkextlib/iwidgets/scrolledhtml.rb +58 -0
- data/ext/lib/tkextlib/iwidgets/scrolledlistbox.rb +207 -0
- data/ext/lib/tkextlib/iwidgets/scrolledtext.rb +564 -0
- data/ext/lib/tkextlib/iwidgets/scrolledwidget.rb +20 -0
- data/ext/lib/tkextlib/iwidgets/selectionbox.rb +102 -0
- data/ext/lib/tkextlib/iwidgets/selectiondialog.rb +92 -0
- data/ext/lib/tkextlib/iwidgets/setup.rb +8 -0
- data/ext/lib/tkextlib/iwidgets/shell.rb +38 -0
- data/ext/lib/tkextlib/iwidgets/spindate.rb +48 -0
- data/ext/lib/tkextlib/iwidgets/spinint.rb +30 -0
- data/ext/lib/tkextlib/iwidgets/spinner.rb +169 -0
- data/ext/lib/tkextlib/iwidgets/spintime.rb +48 -0
- data/ext/lib/tkextlib/iwidgets/tabnotebook.rb +180 -0
- data/ext/lib/tkextlib/iwidgets/tabset.rb +144 -0
- data/ext/lib/tkextlib/iwidgets/timeentry.rb +25 -0
- data/ext/lib/tkextlib/iwidgets/timefield.rb +58 -0
- data/ext/lib/tkextlib/iwidgets/toolbar.rb +112 -0
- data/ext/lib/tkextlib/iwidgets/watch.rb +56 -0
- data/ext/lib/tkextlib/pkg_checker.rb +184 -0
- data/ext/lib/tkextlib/setup.rb +8 -0
- data/ext/lib/tkextlib/tcllib.rb +90 -0
- data/ext/lib/tkextlib/tcllib/README +135 -0
- data/ext/lib/tkextlib/tcllib/autoscroll.rb +158 -0
- data/ext/lib/tkextlib/tcllib/ctext.rb +160 -0
- data/ext/lib/tkextlib/tcllib/cursor.rb +97 -0
- data/ext/lib/tkextlib/tcllib/datefield.rb +57 -0
- data/ext/lib/tkextlib/tcllib/dialog.rb +84 -0
- data/ext/lib/tkextlib/tcllib/getstring.rb +134 -0
- data/ext/lib/tkextlib/tcllib/history.rb +73 -0
- data/ext/lib/tkextlib/tcllib/ico.rb +116 -0
- data/ext/lib/tkextlib/tcllib/ip_entry.rb +66 -0
- data/ext/lib/tkextlib/tcllib/panelframe.rb +72 -0
- data/ext/lib/tkextlib/tcllib/plotchart.rb +886 -0
- data/ext/lib/tkextlib/tcllib/ruler.rb +65 -0
- data/ext/lib/tkextlib/tcllib/screenruler.rb +68 -0
- data/ext/lib/tkextlib/tcllib/scrollwin.rb +61 -0
- data/ext/lib/tkextlib/tcllib/setup.rb +8 -0
- data/ext/lib/tkextlib/tcllib/style.rb +61 -0
- data/ext/lib/tkextlib/tcllib/superframe.rb +51 -0
- data/ext/lib/tkextlib/tcllib/swaplist.rb +150 -0
- data/ext/lib/tkextlib/tcllib/tablelist.rb +27 -0
- data/ext/lib/tkextlib/tcllib/tablelist_core.rb +782 -0
- data/ext/lib/tkextlib/tcllib/tablelist_tile.rb +25 -0
- data/ext/lib/tkextlib/tcllib/tkpiechart.rb +314 -0
- data/ext/lib/tkextlib/tcllib/tooltip.rb +95 -0
- data/ext/lib/tkextlib/tcllib/widget.rb +48 -0
- data/ext/lib/tkextlib/tclx.rb +13 -0
- data/ext/lib/tkextlib/tclx/setup.rb +8 -0
- data/ext/lib/tkextlib/tclx/tclx.rb +74 -0
- data/ext/lib/tkextlib/tile.rb +419 -0
- data/ext/lib/tkextlib/tile/dialog.rb +96 -0
- data/ext/lib/tkextlib/tile/setup.rb +8 -0
- data/ext/lib/tkextlib/tile/sizegrip.rb +29 -0
- data/ext/lib/tkextlib/tile/style.rb +316 -0
- data/ext/lib/tkextlib/tile/tbutton.rb +33 -0
- data/ext/lib/tkextlib/tile/tcheckbutton.rb +36 -0
- data/ext/lib/tkextlib/tile/tcombobox.rb +54 -0
- data/ext/lib/tkextlib/tile/tentry.rb +48 -0
- data/ext/lib/tkextlib/tile/tframe.rb +33 -0
- data/ext/lib/tkextlib/tile/tlabel.rb +33 -0
- data/ext/lib/tkextlib/tile/tlabelframe.rb +36 -0
- data/ext/lib/tkextlib/tile/tmenubutton.rb +36 -0
- data/ext/lib/tkextlib/tile/tnotebook.rb +139 -0
- data/ext/lib/tkextlib/tile/tpaned.rb +231 -0
- data/ext/lib/tkextlib/tile/tprogressbar.rb +56 -0
- data/ext/lib/tkextlib/tile/tradiobutton.rb +36 -0
- data/ext/lib/tkextlib/tile/treeview.rb +1239 -0
- data/ext/lib/tkextlib/tile/tscale.rb +53 -0
- data/ext/lib/tkextlib/tile/tscrollbar.rb +54 -0
- data/ext/lib/tkextlib/tile/tseparator.rb +33 -0
- data/ext/lib/tkextlib/tile/tsquare.rb +30 -0
- data/ext/lib/tkextlib/tkDND.rb +18 -0
- data/ext/lib/tkextlib/tkDND/setup.rb +8 -0
- data/ext/lib/tkextlib/tkDND/shape.rb +125 -0
- data/ext/lib/tkextlib/tkDND/tkdnd.rb +182 -0
- data/ext/lib/tkextlib/tkHTML.rb +13 -0
- data/ext/lib/tkextlib/tkHTML/htmlwidget.rb +453 -0
- data/ext/lib/tkextlib/tkHTML/setup.rb +8 -0
- data/ext/lib/tkextlib/tkimg.rb +36 -0
- data/ext/lib/tkextlib/tkimg/README +26 -0
- data/ext/lib/tkextlib/tkimg/bmp.rb +33 -0
- data/ext/lib/tkextlib/tkimg/gif.rb +33 -0
- data/ext/lib/tkextlib/tkimg/ico.rb +33 -0
- data/ext/lib/tkextlib/tkimg/jpeg.rb +33 -0
- data/ext/lib/tkextlib/tkimg/pcx.rb +33 -0
- data/ext/lib/tkextlib/tkimg/pixmap.rb +44 -0
- data/ext/lib/tkextlib/tkimg/png.rb +33 -0
- data/ext/lib/tkextlib/tkimg/ppm.rb +33 -0
- data/ext/lib/tkextlib/tkimg/ps.rb +33 -0
- data/ext/lib/tkextlib/tkimg/setup.rb +8 -0
- data/ext/lib/tkextlib/tkimg/sgi.rb +33 -0
- data/ext/lib/tkextlib/tkimg/sun.rb +33 -0
- data/ext/lib/tkextlib/tkimg/tga.rb +33 -0
- data/ext/lib/tkextlib/tkimg/tiff.rb +33 -0
- data/ext/lib/tkextlib/tkimg/window.rb +33 -0
- data/ext/lib/tkextlib/tkimg/xbm.rb +33 -0
- data/ext/lib/tkextlib/tkimg/xpm.rb +33 -0
- data/ext/lib/tkextlib/tktable.rb +14 -0
- data/ext/lib/tkextlib/tktable/setup.rb +8 -0
- data/ext/lib/tkextlib/tktable/tktable.rb +957 -0
- data/ext/lib/tkextlib/tktrans.rb +14 -0
- data/ext/lib/tkextlib/tktrans/setup.rb +8 -0
- data/ext/lib/tkextlib/tktrans/tktrans.rb +64 -0
- data/ext/lib/tkextlib/treectrl.rb +13 -0
- data/ext/lib/tkextlib/treectrl/setup.rb +8 -0
- data/ext/lib/tkextlib/treectrl/tktreectrl.rb +2461 -0
- data/ext/lib/tkextlib/trofs.rb +13 -0
- data/ext/lib/tkextlib/trofs/setup.rb +8 -0
- data/ext/lib/tkextlib/trofs/trofs.rb +51 -0
- data/ext/lib/tkextlib/version.rb +6 -0
- data/ext/lib/tkextlib/vu.rb +48 -0
- data/ext/lib/tkextlib/vu/bargraph.rb +61 -0
- data/ext/lib/tkextlib/vu/charts.rb +53 -0
- data/ext/lib/tkextlib/vu/dial.rb +102 -0
- data/ext/lib/tkextlib/vu/pie.rb +282 -0
- data/ext/lib/tkextlib/vu/setup.rb +8 -0
- data/ext/lib/tkextlib/vu/spinbox.rb +22 -0
- data/ext/lib/tkextlib/winico.rb +14 -0
- data/ext/lib/tkextlib/winico/setup.rb +8 -0
- data/ext/lib/tkextlib/winico/winico.rb +224 -0
- data/ext/lib/tkfont.rb +4 -0
- data/ext/lib/tkmacpkg.rb +4 -0
- data/ext/lib/tkmenubar.rb +4 -0
- data/ext/lib/tkmngfocus.rb +4 -0
- data/ext/lib/tkpalette.rb +4 -0
- data/ext/lib/tkscrollbox.rb +4 -0
- data/ext/lib/tktext.rb +4 -0
- data/ext/lib/tkvirtevent.rb +4 -0
- data/ext/lib/tkwinpkg.rb +4 -0
- data/ext/old-README.tcltklib.eucj +159 -0
- data/ext/stubs.c +531 -0
- data/ext/stubs.h +33 -0
- data/ext/tcltklib.c +10155 -0
- data/ext/tkutil/.cvsignore +3 -0
- data/ext/tkutil/depend +1 -0
- data/ext/tkutil/extconf.rb +14 -0
- data/ext/tkutil/tkutil.c +1789 -0
- metadata +418 -0
@@ -0,0 +1,282 @@
|
|
1
|
+
#
|
2
|
+
# tk/listbox.rb : treat listbox widget
|
3
|
+
#
|
4
|
+
require 'tk'
|
5
|
+
require 'tk/itemconfig'
|
6
|
+
require 'tk/scrollable'
|
7
|
+
require 'tk/txtwin_abst'
|
8
|
+
|
9
|
+
module TkListItemConfig
|
10
|
+
include TkItemConfigMethod
|
11
|
+
|
12
|
+
def __item_listval_optkeys(id)
|
13
|
+
[]
|
14
|
+
end
|
15
|
+
private :__item_listval_optkeys
|
16
|
+
end
|
17
|
+
|
18
|
+
class Tk::Listbox<TkTextWin
|
19
|
+
include TkListItemConfig
|
20
|
+
include Scrollable
|
21
|
+
|
22
|
+
TkCommandNames = ['listbox'.freeze].freeze
|
23
|
+
WidgetClassName = 'Listbox'.freeze
|
24
|
+
WidgetClassNames[WidgetClassName] = self
|
25
|
+
|
26
|
+
#def create_self(keys)
|
27
|
+
# if keys and keys != None
|
28
|
+
# tk_call_without_enc('listbox', @path, *hash_kv(keys, true))
|
29
|
+
# else
|
30
|
+
# tk_call_without_enc('listbox', @path)
|
31
|
+
# end
|
32
|
+
#end
|
33
|
+
#private :create_self
|
34
|
+
|
35
|
+
def __tkvariable_optkeys
|
36
|
+
super() << 'listvariable'
|
37
|
+
end
|
38
|
+
private :__tkvariable_optkeys
|
39
|
+
|
40
|
+
def tagid(id)
|
41
|
+
#id.to_s
|
42
|
+
_get_eval_string(id)
|
43
|
+
end
|
44
|
+
|
45
|
+
def activate(y)
|
46
|
+
tk_send_without_enc('activate', y)
|
47
|
+
self
|
48
|
+
end
|
49
|
+
def curselection
|
50
|
+
list(tk_send_without_enc('curselection'))
|
51
|
+
end
|
52
|
+
def get(first, last=nil)
|
53
|
+
if last
|
54
|
+
# tk_split_simplelist(_fromUTF8(tk_send_without_enc('get', first, last)))
|
55
|
+
tk_split_simplelist(tk_send_without_enc('get', first, last), false, true)
|
56
|
+
else
|
57
|
+
_fromUTF8(tk_send_without_enc('get', first))
|
58
|
+
end
|
59
|
+
end
|
60
|
+
def nearest(y)
|
61
|
+
tk_send_without_enc('nearest', y).to_i
|
62
|
+
end
|
63
|
+
def size
|
64
|
+
tk_send_without_enc('size').to_i
|
65
|
+
end
|
66
|
+
def selection_anchor(index)
|
67
|
+
tk_send_without_enc('selection', 'anchor', index)
|
68
|
+
self
|
69
|
+
end
|
70
|
+
def selection_clear(first, last=None)
|
71
|
+
tk_send_without_enc('selection', 'clear', first, last)
|
72
|
+
self
|
73
|
+
end
|
74
|
+
def selection_includes(index)
|
75
|
+
bool(tk_send_without_enc('selection', 'includes', index))
|
76
|
+
end
|
77
|
+
def selection_set(first, last=None)
|
78
|
+
tk_send_without_enc('selection', 'set', first, last)
|
79
|
+
self
|
80
|
+
end
|
81
|
+
|
82
|
+
def index(idx)
|
83
|
+
tk_send_without_enc('index', idx).to_i
|
84
|
+
end
|
85
|
+
|
86
|
+
def value
|
87
|
+
get('0', 'end')
|
88
|
+
end
|
89
|
+
|
90
|
+
def value= (vals)
|
91
|
+
unless vals.kind_of?(Array)
|
92
|
+
fail ArgumentError, 'an Array is expected'
|
93
|
+
end
|
94
|
+
tk_send_without_enc('delete', '0', 'end')
|
95
|
+
tk_send_without_enc('insert', '0',
|
96
|
+
*(vals.collect{|v| _get_eval_enc_str(v)}))
|
97
|
+
vals
|
98
|
+
end
|
99
|
+
|
100
|
+
def clear
|
101
|
+
tk_send_without_enc('delete', '0', 'end')
|
102
|
+
self
|
103
|
+
end
|
104
|
+
alias erase clear
|
105
|
+
|
106
|
+
=begin
|
107
|
+
def itemcget(index, key)
|
108
|
+
case key.to_s
|
109
|
+
when 'text', 'label', 'show'
|
110
|
+
_fromUTF8(tk_send_without_enc('itemcget', index, "-#{key}"))
|
111
|
+
when 'font', 'kanjifont'
|
112
|
+
#fnt = tk_tcl2ruby(tk_send('itemcget', index, "-#{key}"))
|
113
|
+
fnt = tk_tcl2ruby(_fromUTF8(tk_send_without_enc('itemcget', index,
|
114
|
+
'-font')))
|
115
|
+
unless fnt.kind_of?(TkFont)
|
116
|
+
fnt = tagfontobj(index, fnt)
|
117
|
+
end
|
118
|
+
if key.to_s == 'kanjifont' && JAPANIZED_TK && TK_VERSION =~ /^4\.*/
|
119
|
+
# obsolete; just for compatibility
|
120
|
+
fnt.kanji_font
|
121
|
+
else
|
122
|
+
fnt
|
123
|
+
end
|
124
|
+
else
|
125
|
+
tk_tcl2ruby(_fromUTF8(tk_send_without_enc('itemcget', index, "-#{key}")))
|
126
|
+
end
|
127
|
+
end
|
128
|
+
def itemconfigure(index, key, val=None)
|
129
|
+
if key.kind_of? Hash
|
130
|
+
if (key['font'] || key[:font] ||
|
131
|
+
key['kanjifont'] || key[:kanjifont] ||
|
132
|
+
key['latinfont'] || key[:latinfont] ||
|
133
|
+
key['asciifont'] || key[:asciifont] )
|
134
|
+
tagfont_configure(index, _symbolkey2str(key))
|
135
|
+
else
|
136
|
+
tk_send_without_enc('itemconfigure', index, *hash_kv(key, true))
|
137
|
+
end
|
138
|
+
|
139
|
+
else
|
140
|
+
if (key == 'font' || key == :font ||
|
141
|
+
key == 'kanjifont' || key == :kanjifont ||
|
142
|
+
key == 'latinfont' || key == :latinfont ||
|
143
|
+
key == 'asciifont' || key == :asciifont )
|
144
|
+
if val == None
|
145
|
+
tagfontobj(index)
|
146
|
+
else
|
147
|
+
tagfont_configure(index, {key=>val})
|
148
|
+
end
|
149
|
+
else
|
150
|
+
tk_call('itemconfigure', index, "-#{key}", val)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
self
|
154
|
+
end
|
155
|
+
|
156
|
+
def itemconfiginfo(index, key=nil)
|
157
|
+
if TkComm::GET_CONFIGINFO_AS_ARRAY
|
158
|
+
if key
|
159
|
+
case key.to_s
|
160
|
+
when 'text', 'label', 'show'
|
161
|
+
conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
|
162
|
+
when 'font', 'kanjifont'
|
163
|
+
conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
|
164
|
+
conf[4] = tagfont_configinfo(index, conf[4])
|
165
|
+
else
|
166
|
+
conf = tk_split_list(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
|
167
|
+
end
|
168
|
+
conf[0] = conf[0][1..-1]
|
169
|
+
conf
|
170
|
+
else
|
171
|
+
ret = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', index))).collect{|conflist|
|
172
|
+
conf = tk_split_simplelist(conflist)
|
173
|
+
conf[0] = conf[0][1..-1]
|
174
|
+
case conf[0]
|
175
|
+
when 'text', 'label', 'show'
|
176
|
+
else
|
177
|
+
if conf[3]
|
178
|
+
if conf[3].index('{')
|
179
|
+
conf[3] = tk_split_list(conf[3])
|
180
|
+
else
|
181
|
+
conf[3] = tk_tcl2ruby(conf[3])
|
182
|
+
end
|
183
|
+
end
|
184
|
+
if conf[4]
|
185
|
+
if conf[4].index('{')
|
186
|
+
conf[4] = tk_split_list(conf[4])
|
187
|
+
else
|
188
|
+
conf[4] = tk_tcl2ruby(conf[4])
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
conf[1] = conf[1][1..-1] if conf.size == 2 # alias info
|
193
|
+
conf
|
194
|
+
}
|
195
|
+
fontconf = ret.assoc('font')
|
196
|
+
if fontconf
|
197
|
+
ret.delete_if{|item| item[0] == 'font' || item[0] == 'kanjifont'}
|
198
|
+
fontconf[4] = tagfont_configinfo(index, fontconf[4])
|
199
|
+
ret.push(fontconf)
|
200
|
+
else
|
201
|
+
ret
|
202
|
+
end
|
203
|
+
end
|
204
|
+
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
|
205
|
+
if key
|
206
|
+
case key.to_s
|
207
|
+
when 'text', 'label', 'show'
|
208
|
+
conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
|
209
|
+
when 'font', 'kanjifont'
|
210
|
+
conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
|
211
|
+
conf[4] = tagfont_configinfo(index, conf[4])
|
212
|
+
else
|
213
|
+
conf = tk_split_list(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
|
214
|
+
end
|
215
|
+
key = conf.shift[1..-1]
|
216
|
+
{ key => conf }
|
217
|
+
else
|
218
|
+
ret = {}
|
219
|
+
tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', index))).each{|conflist|
|
220
|
+
conf = tk_split_simplelist(conflist)
|
221
|
+
key = conf.shift[1..-1]
|
222
|
+
case key
|
223
|
+
when 'text', 'label', 'show'
|
224
|
+
else
|
225
|
+
if conf[2]
|
226
|
+
if conf[2].index('{')
|
227
|
+
conf[2] = tk_split_list(conf[2])
|
228
|
+
else
|
229
|
+
conf[2] = tk_tcl2ruby(conf[2])
|
230
|
+
end
|
231
|
+
end
|
232
|
+
if conf[3]
|
233
|
+
if conf[3].index('{')
|
234
|
+
conf[3] = tk_split_list(conf[3])
|
235
|
+
else
|
236
|
+
conf[3] = tk_tcl2ruby(conf[3])
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
240
|
+
if conf.size == 1
|
241
|
+
ret[key] = conf[0][1..-1] # alias info
|
242
|
+
else
|
243
|
+
ret[key] = conf
|
244
|
+
end
|
245
|
+
}
|
246
|
+
fontconf = ret['font']
|
247
|
+
if fontconf
|
248
|
+
ret.delete('font')
|
249
|
+
ret.delete('kanjifont')
|
250
|
+
fontconf[3] = tagfont_configinfo(index, fontconf[3])
|
251
|
+
ret['font'] = fontconf
|
252
|
+
end
|
253
|
+
ret
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
def current_itemconfiginfo(index, key=nil)
|
259
|
+
if TkComm::GET_CONFIGINFO_AS_ARRAY
|
260
|
+
if key
|
261
|
+
conf = itemconfiginfo(index, key)
|
262
|
+
{conf[0] => conf[4]}
|
263
|
+
else
|
264
|
+
ret = {}
|
265
|
+
itemconfiginfo(index).each{|conf|
|
266
|
+
ret[conf[0]] = conf[4] if conf.size > 2
|
267
|
+
}
|
268
|
+
ret
|
269
|
+
end
|
270
|
+
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
|
271
|
+
ret = {}
|
272
|
+
itemconfiginfo(index, key).each{|k, conf|
|
273
|
+
ret[k] = conf[-1] if conf.kind_of?(Array)
|
274
|
+
}
|
275
|
+
ret
|
276
|
+
end
|
277
|
+
end
|
278
|
+
=end
|
279
|
+
end
|
280
|
+
|
281
|
+
#TkListbox = Tk::Listbox unless Object.const_defined? :TkListbox
|
282
|
+
Tk.__set_toplevel_aliases__(:Tk, Tk::Listbox, :TkListbox)
|
@@ -0,0 +1,78 @@
|
|
1
|
+
#
|
2
|
+
# tk/macpkg.rb : methods for Tcl/Tk packages for Macintosh
|
3
|
+
# 2000/11/22 by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
|
4
|
+
#
|
5
|
+
# ATTENTION !!
|
6
|
+
# This is NOT TESTED. Because I have no test-environment.
|
7
|
+
#
|
8
|
+
#
|
9
|
+
require 'tk'
|
10
|
+
|
11
|
+
module Tk
|
12
|
+
def Tk.load_tclscript_rsrc(resource_name, file=None)
|
13
|
+
# Mac only
|
14
|
+
tk_call('source', '-rsrc', resource_name, file)
|
15
|
+
end
|
16
|
+
|
17
|
+
def Tk.load_tclscript_rsrcid(resource_id, file=None)
|
18
|
+
# Mac only
|
19
|
+
tk_call('source', '-rsrcid', resource_id, file)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
module Tk::MacResource
|
24
|
+
end
|
25
|
+
#TkMacResource = Tk::MacResource
|
26
|
+
Tk.__set_toplevel_aliases__(:Tk, Tk::MacResource, :TkMacResource)
|
27
|
+
|
28
|
+
module Tk::MacResource
|
29
|
+
extend Tk
|
30
|
+
extend Tk::MacResource
|
31
|
+
|
32
|
+
TkCommandNames = ['resource'.freeze].freeze
|
33
|
+
|
34
|
+
PACKAGE_NAME = 'resource'.freeze
|
35
|
+
def self.package_name
|
36
|
+
PACKAGE_NAME
|
37
|
+
end
|
38
|
+
|
39
|
+
tk_call_without_enc('package', 'require', 'resource')
|
40
|
+
|
41
|
+
def close(rsrcRef)
|
42
|
+
tk_call('resource', 'close', rsrcRef)
|
43
|
+
end
|
44
|
+
|
45
|
+
def delete(rsrcType, opts=nil)
|
46
|
+
tk_call('resource', 'delete', *(hash_kv(opts) << rsrcType))
|
47
|
+
end
|
48
|
+
|
49
|
+
def files(rsrcRef=nil)
|
50
|
+
if rsrcRef
|
51
|
+
tk_call('resource', 'files', rsrcRef)
|
52
|
+
else
|
53
|
+
tk_split_simplelist(tk_call('resource', 'files'))
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def list(rsrcType, rsrcRef=nil)
|
58
|
+
tk_split_simplelist(tk_call('resource', 'list', rsrcType, rsrcRef))
|
59
|
+
end
|
60
|
+
|
61
|
+
def open(fname, access=nil)
|
62
|
+
tk_call('resource', 'open', fname, access)
|
63
|
+
end
|
64
|
+
|
65
|
+
def read(rsrcType, rsrcID, rsrcRef=nil)
|
66
|
+
tk_call('resource', 'read', rsrcType, rsrcID, rsrcRef)
|
67
|
+
end
|
68
|
+
|
69
|
+
def types(rsrcRef=nil)
|
70
|
+
tk_split_simplelist(tk_call('resource', 'types', rsrcRef))
|
71
|
+
end
|
72
|
+
|
73
|
+
def write(rsrcType, data, opts=nil)
|
74
|
+
tk_call('resource', 'write', *(hash_kv(opts) << rsrcType << data))
|
75
|
+
end
|
76
|
+
|
77
|
+
module_function :close, :delete, :files, :list, :open, :read, :types, :write
|
78
|
+
end
|
data/ext/lib/tk/menu.rb
ADDED
@@ -0,0 +1,681 @@
|
|
1
|
+
#
|
2
|
+
# tk/menu.rb : treat menu and menubutton
|
3
|
+
#
|
4
|
+
require 'tk'
|
5
|
+
require 'tk/itemconfig'
|
6
|
+
require 'tk/menuspec'
|
7
|
+
|
8
|
+
module TkMenuEntryConfig
|
9
|
+
include TkItemConfigMethod
|
10
|
+
|
11
|
+
def __item_cget_cmd(id)
|
12
|
+
[self.path, 'entrycget', id]
|
13
|
+
end
|
14
|
+
private :__item_cget_cmd
|
15
|
+
|
16
|
+
def __item_config_cmd(id)
|
17
|
+
[self.path, 'entryconfigure', id]
|
18
|
+
end
|
19
|
+
private :__item_config_cmd
|
20
|
+
|
21
|
+
def __item_strval_optkeys(id)
|
22
|
+
super(id) << 'selectcolor'
|
23
|
+
end
|
24
|
+
private :__item_strval_optkeys
|
25
|
+
|
26
|
+
def __item_listval_optkeys(id)
|
27
|
+
[]
|
28
|
+
end
|
29
|
+
private :__item_listval_optkeys
|
30
|
+
|
31
|
+
def __item_val2ruby_optkeys(id) # { key=>proc, ... }
|
32
|
+
super(id).update('menu'=>proc{|i, v| window(v)})
|
33
|
+
end
|
34
|
+
private :__item_val2ruby_optkeys
|
35
|
+
|
36
|
+
alias entrycget itemcget
|
37
|
+
alias entrycget_strict itemcget_strict
|
38
|
+
alias entryconfigure itemconfigure
|
39
|
+
alias entryconfiginfo itemconfiginfo
|
40
|
+
alias current_entryconfiginfo current_itemconfiginfo
|
41
|
+
|
42
|
+
private :itemcget, :itemcget_strict
|
43
|
+
private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
|
44
|
+
end
|
45
|
+
|
46
|
+
class Tk::Menu<TkWindow
|
47
|
+
include Wm
|
48
|
+
include TkMenuEntryConfig
|
49
|
+
extend TkMenuSpec
|
50
|
+
|
51
|
+
TkCommandNames = ['menu'.freeze].freeze
|
52
|
+
WidgetClassName = 'Menu'.freeze
|
53
|
+
WidgetClassNames[WidgetClassName] = self
|
54
|
+
|
55
|
+
#def create_self(keys)
|
56
|
+
# if keys and keys != None
|
57
|
+
# tk_call_without_enc('menu', @path, *hash_kv(keys, true))
|
58
|
+
# else
|
59
|
+
# tk_call_without_enc('menu', @path)
|
60
|
+
# end
|
61
|
+
#end
|
62
|
+
#private :create_self
|
63
|
+
|
64
|
+
def __strval_optkeys
|
65
|
+
super() << 'selectcolor' << 'title'
|
66
|
+
end
|
67
|
+
private :__strval_optkeys
|
68
|
+
|
69
|
+
def __boolval_optkeys
|
70
|
+
super() << 'tearoff'
|
71
|
+
end
|
72
|
+
private :__boolval_optkeys
|
73
|
+
|
74
|
+
def self.new_menuspec(menu_spec, parent = nil, tearoff = false, keys = nil)
|
75
|
+
if parent.kind_of?(Hash)
|
76
|
+
keys = _symbolkey2str(parent)
|
77
|
+
parent = keys.delete('parent')
|
78
|
+
tearoff = keys.delete('tearoff')
|
79
|
+
elsif tearoff.kind_of?(Hash)
|
80
|
+
keys = _symbolkey2str(tearoff)
|
81
|
+
tearoff = keys.delete('tearoff')
|
82
|
+
elsif keys
|
83
|
+
keys = _symbolkey2str(keys)
|
84
|
+
else
|
85
|
+
keys = {}
|
86
|
+
end
|
87
|
+
|
88
|
+
widgetname = keys.delete('widgetname')
|
89
|
+
_create_menu(parent, menu_spec, widgetname, tearoff, keys)
|
90
|
+
end
|
91
|
+
|
92
|
+
def tagid(id)
|
93
|
+
#id.to_s
|
94
|
+
_get_eval_string(id)
|
95
|
+
end
|
96
|
+
|
97
|
+
def activate(index)
|
98
|
+
tk_send_without_enc('activate', _get_eval_enc_str(index))
|
99
|
+
self
|
100
|
+
end
|
101
|
+
def add(type, keys=nil)
|
102
|
+
tk_send_without_enc('add', type, *hash_kv(keys, true))
|
103
|
+
self
|
104
|
+
end
|
105
|
+
def add_cascade(keys=nil)
|
106
|
+
add('cascade', keys)
|
107
|
+
end
|
108
|
+
def add_checkbutton(keys=nil)
|
109
|
+
add('checkbutton', keys)
|
110
|
+
end
|
111
|
+
def add_command(keys=nil)
|
112
|
+
add('command', keys)
|
113
|
+
end
|
114
|
+
def add_radiobutton(keys=nil)
|
115
|
+
add('radiobutton', keys)
|
116
|
+
end
|
117
|
+
def add_separator(keys=nil)
|
118
|
+
add('separator', keys)
|
119
|
+
end
|
120
|
+
|
121
|
+
def clone_menu(*args)
|
122
|
+
if args[0].kind_of?(TkWindow)
|
123
|
+
parent = args.shift
|
124
|
+
else
|
125
|
+
parent = self
|
126
|
+
end
|
127
|
+
|
128
|
+
if args[0].kind_of?(String) || args[0].kind_of?(Symbol) # menu type
|
129
|
+
type = args.shift
|
130
|
+
else
|
131
|
+
type = None # 'normal'
|
132
|
+
end
|
133
|
+
|
134
|
+
if args[0].kind_of?(Hash)
|
135
|
+
keys = _symbolkey2str(args.shift)
|
136
|
+
else
|
137
|
+
keys = {}
|
138
|
+
end
|
139
|
+
|
140
|
+
parent = keys.delete('parent') if keys.has_key?('parent')
|
141
|
+
type = keys.delete('type') if keys.has_key?('type')
|
142
|
+
|
143
|
+
if keys.empty?
|
144
|
+
Tk::MenuClone.new(self, parent, type)
|
145
|
+
else
|
146
|
+
Tk::MenuClone.new(self, parent, type, keys)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def index(idx)
|
151
|
+
ret = tk_send_without_enc('index', _get_eval_enc_str(idx))
|
152
|
+
(ret == 'none')? nil: number(ret)
|
153
|
+
end
|
154
|
+
def invoke(index)
|
155
|
+
_fromUTF8(tk_send_without_enc('invoke', _get_eval_enc_str(index)))
|
156
|
+
end
|
157
|
+
def insert(index, type, keys=nil)
|
158
|
+
tk_send_without_enc('insert', _get_eval_enc_str(index),
|
159
|
+
type, *hash_kv(keys, true))
|
160
|
+
self
|
161
|
+
end
|
162
|
+
def delete(first, last=nil)
|
163
|
+
if last
|
164
|
+
tk_send_without_enc('delete', _get_eval_enc_str(first),
|
165
|
+
_get_eval_enc_str(last))
|
166
|
+
else
|
167
|
+
tk_send_without_enc('delete', _get_eval_enc_str(first))
|
168
|
+
end
|
169
|
+
self
|
170
|
+
end
|
171
|
+
def popup(x, y, index=nil)
|
172
|
+
if index
|
173
|
+
tk_call_without_enc('tk_popup', path, x, y,
|
174
|
+
_get_eval_enc_str(index))
|
175
|
+
else
|
176
|
+
tk_call_without_enc('tk_popup', path, x, y)
|
177
|
+
end
|
178
|
+
self
|
179
|
+
end
|
180
|
+
def post(x, y)
|
181
|
+
_fromUTF8(tk_send_without_enc('post', x, y))
|
182
|
+
end
|
183
|
+
def postcascade(index)
|
184
|
+
tk_send_without_enc('postcascade', _get_eval_enc_str(index))
|
185
|
+
self
|
186
|
+
end
|
187
|
+
def postcommand(cmd=Proc.new)
|
188
|
+
configure_cmd 'postcommand', cmd
|
189
|
+
self
|
190
|
+
end
|
191
|
+
def set_focus
|
192
|
+
tk_call_without_enc('tk_menuSetFocus', path)
|
193
|
+
self
|
194
|
+
end
|
195
|
+
def tearoffcommand(cmd=Proc.new)
|
196
|
+
configure_cmd 'tearoffcommand', cmd
|
197
|
+
self
|
198
|
+
end
|
199
|
+
def menutype(index)
|
200
|
+
tk_send_without_enc('type', _get_eval_enc_str(index))
|
201
|
+
end
|
202
|
+
def unpost
|
203
|
+
tk_send_without_enc('unpost')
|
204
|
+
self
|
205
|
+
end
|
206
|
+
def xposition(index)
|
207
|
+
number(tk_send_without_enc('xposition', _get_eval_enc_str(index)))
|
208
|
+
end
|
209
|
+
def yposition(index)
|
210
|
+
number(tk_send_without_enc('yposition', _get_eval_enc_str(index)))
|
211
|
+
end
|
212
|
+
|
213
|
+
=begin
|
214
|
+
def entrycget(index, key)
|
215
|
+
case key.to_s
|
216
|
+
when 'text', 'label', 'show'
|
217
|
+
_fromUTF8(tk_send_without_enc('entrycget',
|
218
|
+
_get_eval_enc_str(index), "-#{key}"))
|
219
|
+
when 'font', 'kanjifont'
|
220
|
+
#fnt = tk_tcl2ruby(tk_send('entrycget', index, "-#{key}"))
|
221
|
+
fnt = tk_tcl2ruby(_fromUTF8(tk_send_without_enc('entrycget', _get_eval_enc_str(index), '-font')))
|
222
|
+
unless fnt.kind_of?(TkFont)
|
223
|
+
fnt = tagfontobj(index, fnt)
|
224
|
+
end
|
225
|
+
if key.to_s == 'kanjifont' && JAPANIZED_TK && TK_VERSION =~ /^4\.*/
|
226
|
+
# obsolete; just for compatibility
|
227
|
+
fnt.kanji_font
|
228
|
+
else
|
229
|
+
fnt
|
230
|
+
end
|
231
|
+
else
|
232
|
+
tk_tcl2ruby(_fromUTF8(tk_send_without_enc('entrycget', _get_eval_enc_str(index), "-#{key}")))
|
233
|
+
end
|
234
|
+
end
|
235
|
+
def entryconfigure(index, key, val=None)
|
236
|
+
if key.kind_of? Hash
|
237
|
+
if (key['font'] || key[:font] ||
|
238
|
+
key['kanjifont'] || key[:kanjifont] ||
|
239
|
+
key['latinfont'] || key[:latinfont] ||
|
240
|
+
key['asciifont'] || key[:asciifont])
|
241
|
+
tagfont_configure(index, _symbolkey2str(key))
|
242
|
+
else
|
243
|
+
tk_send_without_enc('entryconfigure', _get_eval_enc_str(index),
|
244
|
+
*hash_kv(key, true))
|
245
|
+
end
|
246
|
+
|
247
|
+
else
|
248
|
+
if (key == 'font' || key == :font ||
|
249
|
+
key == 'kanjifont' || key == :kanjifont ||
|
250
|
+
key == 'latinfont' || key == :latinfont ||
|
251
|
+
key == 'asciifont' || key == :asciifont )
|
252
|
+
if val == None
|
253
|
+
tagfontobj(index)
|
254
|
+
else
|
255
|
+
tagfont_configure(index, {key=>val})
|
256
|
+
end
|
257
|
+
else
|
258
|
+
tk_call('entryconfigure', index, "-#{key}", val)
|
259
|
+
end
|
260
|
+
end
|
261
|
+
self
|
262
|
+
end
|
263
|
+
|
264
|
+
def entryconfiginfo(index, key=nil)
|
265
|
+
if TkComm::GET_CONFIGINFO_AS_ARRAY
|
266
|
+
if key
|
267
|
+
case key.to_s
|
268
|
+
when 'text', 'label', 'show'
|
269
|
+
conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
|
270
|
+
when 'font', 'kanjifont'
|
271
|
+
conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
|
272
|
+
conf[4] = tagfont_configinfo(index, conf[4])
|
273
|
+
else
|
274
|
+
conf = tk_split_list(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
|
275
|
+
end
|
276
|
+
conf[0] = conf[0][1..-1]
|
277
|
+
conf
|
278
|
+
else
|
279
|
+
ret = tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure', _get_eval_enc_str(index)))).collect{|conflist|
|
280
|
+
conf = tk_split_simplelist(conflist)
|
281
|
+
conf[0] = conf[0][1..-1]
|
282
|
+
case conf[0]
|
283
|
+
when 'text', 'label', 'show'
|
284
|
+
else
|
285
|
+
if conf[3]
|
286
|
+
if conf[3].index('{')
|
287
|
+
conf[3] = tk_split_list(conf[3])
|
288
|
+
else
|
289
|
+
conf[3] = tk_tcl2ruby(conf[3])
|
290
|
+
end
|
291
|
+
end
|
292
|
+
if conf[4]
|
293
|
+
if conf[4].index('{')
|
294
|
+
conf[4] = tk_split_list(conf[4])
|
295
|
+
else
|
296
|
+
conf[4] = tk_tcl2ruby(conf[4])
|
297
|
+
end
|
298
|
+
end
|
299
|
+
end
|
300
|
+
conf[1] = conf[1][1..-1] if conf.size == 2 # alias info
|
301
|
+
conf
|
302
|
+
}
|
303
|
+
if fontconf
|
304
|
+
ret.delete_if{|item| item[0] == 'font' || item[0] == 'kanjifont'}
|
305
|
+
fontconf[4] = tagfont_configinfo(index, fontconf[4])
|
306
|
+
ret.push(fontconf)
|
307
|
+
else
|
308
|
+
ret
|
309
|
+
end
|
310
|
+
end
|
311
|
+
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
|
312
|
+
if key
|
313
|
+
case key.to_s
|
314
|
+
when 'text', 'label', 'show'
|
315
|
+
conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
|
316
|
+
when 'font', 'kanjifont'
|
317
|
+
conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
|
318
|
+
conf[4] = tagfont_configinfo(index, conf[4])
|
319
|
+
else
|
320
|
+
conf = tk_split_list(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
|
321
|
+
end
|
322
|
+
key = conf.shift[1..-1]
|
323
|
+
{ key => conf }
|
324
|
+
else
|
325
|
+
ret = {}
|
326
|
+
tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure', _get_eval_enc_str(index)))).each{|conflist|
|
327
|
+
conf = tk_split_simplelist(conflist)
|
328
|
+
key = conf.shift[1..-1]
|
329
|
+
case key
|
330
|
+
when 'text', 'label', 'show'
|
331
|
+
else
|
332
|
+
if conf[2]
|
333
|
+
if conf[2].index('{')
|
334
|
+
conf[2] = tk_split_list(conf[2])
|
335
|
+
else
|
336
|
+
conf[2] = tk_tcl2ruby(conf[2])
|
337
|
+
end
|
338
|
+
end
|
339
|
+
if conf[3]
|
340
|
+
if conf[3].index('{')
|
341
|
+
conf[3] = tk_split_list(conf[3])
|
342
|
+
else
|
343
|
+
conf[3] = tk_tcl2ruby(conf[3])
|
344
|
+
end
|
345
|
+
end
|
346
|
+
end
|
347
|
+
if conf.size == 1
|
348
|
+
ret[key] = conf[0][1..-1] # alias info
|
349
|
+
else
|
350
|
+
ret[key] = conf
|
351
|
+
end
|
352
|
+
}
|
353
|
+
fontconf = ret['font']
|
354
|
+
if fontconf
|
355
|
+
ret.delete('font')
|
356
|
+
ret.delete('kanjifont')
|
357
|
+
fontconf[3] = tagfont_configinfo(index, fontconf[3])
|
358
|
+
ret['font'] = fontconf
|
359
|
+
end
|
360
|
+
ret
|
361
|
+
end
|
362
|
+
end
|
363
|
+
end
|
364
|
+
|
365
|
+
def current_entryconfiginfo(index, key=nil)
|
366
|
+
if TkComm::GET_CONFIGINFO_AS_ARRAY
|
367
|
+
if key
|
368
|
+
conf = entryconfiginfo(index, key)
|
369
|
+
{conf[0] => conf[4]}
|
370
|
+
else
|
371
|
+
ret = {}
|
372
|
+
entryconfiginfo(index).each{|conf|
|
373
|
+
ret[conf[0]] = conf[4] if conf.size > 2
|
374
|
+
}
|
375
|
+
ret
|
376
|
+
end
|
377
|
+
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
|
378
|
+
ret = {}
|
379
|
+
entryconfiginfo(index, key).each{|k, conf|
|
380
|
+
ret[k] = conf[-1] if conf.kind_of?(Array)
|
381
|
+
}
|
382
|
+
ret
|
383
|
+
end
|
384
|
+
end
|
385
|
+
=end
|
386
|
+
end
|
387
|
+
|
388
|
+
#TkMenu = Tk::Menu unless Object.const_defined? :TkMenu
|
389
|
+
Tk.__set_toplevel_aliases__(:Tk, Tk::Menu, :TkMenu)
|
390
|
+
|
391
|
+
|
392
|
+
class Tk::MenuClone<Tk::Menu
|
393
|
+
=begin
|
394
|
+
def initialize(parent, type=None)
|
395
|
+
widgetname = nil
|
396
|
+
if parent.kind_of? Hash
|
397
|
+
keys = _symbolkey2str(parent)
|
398
|
+
parent = keys.delete('parent')
|
399
|
+
widgetname = keys.delete('widgetname')
|
400
|
+
type = keys.delete('type'); type = None unless type
|
401
|
+
end
|
402
|
+
#unless parent.kind_of?(TkMenu)
|
403
|
+
# fail ArgumentError, "parent must be TkMenu"
|
404
|
+
#end
|
405
|
+
@parent = parent
|
406
|
+
install_win(@parent.path, widgetname)
|
407
|
+
tk_call_without_enc(@parent.path, 'clone', @path, type)
|
408
|
+
end
|
409
|
+
=end
|
410
|
+
def initialize(src_menu, *args)
|
411
|
+
widgetname = nil
|
412
|
+
|
413
|
+
if args[0].kind_of?(TkWindow) # parent window
|
414
|
+
parent = args.shift
|
415
|
+
else
|
416
|
+
parent = src_menu
|
417
|
+
end
|
418
|
+
|
419
|
+
if args[0].kind_of?(String) || args[0].kind_of?(Symbol) # menu type
|
420
|
+
type = args.shift
|
421
|
+
else
|
422
|
+
type = None # 'normal'
|
423
|
+
end
|
424
|
+
|
425
|
+
if args[0].kind_of?(Hash)
|
426
|
+
keys = _symbolkey2str(args.shift)
|
427
|
+
parent = keys.delete('parent') if keys.has_key?('parent')
|
428
|
+
widgetname = keys.delete('widgetname')
|
429
|
+
type = keys.delete('type') if keys.has_key?('type')
|
430
|
+
else
|
431
|
+
keys = nil
|
432
|
+
end
|
433
|
+
|
434
|
+
@src_menu = src_menu
|
435
|
+
@parent = parent
|
436
|
+
@type = type
|
437
|
+
install_win(@parent.path, widgetname)
|
438
|
+
tk_call_without_enc(@src_menu.path, 'clone', @path, @type)
|
439
|
+
configure(keys) if keys && !keys.empty?
|
440
|
+
end
|
441
|
+
|
442
|
+
def source_menu
|
443
|
+
@src_menu
|
444
|
+
end
|
445
|
+
end
|
446
|
+
Tk::CloneMenu = Tk::MenuClone
|
447
|
+
#TkMenuClone = Tk::MenuClone unless Object.const_defined? :TkMenuClone
|
448
|
+
#TkCloneMenu = Tk::CloneMenu unless Object.const_defined? :TkCloneMenu
|
449
|
+
Tk.__set_toplevel_aliases__(:Tk, Tk::MenuClone, :TkMenuClone, :TkCloneMenu)
|
450
|
+
|
451
|
+
module Tk::SystemMenu
|
452
|
+
def initialize(parent, keys=nil)
|
453
|
+
if parent.kind_of? Hash
|
454
|
+
keys = _symbolkey2str(parent)
|
455
|
+
parent = keys.delete('parent')
|
456
|
+
end
|
457
|
+
#unless parent.kind_of? TkMenu
|
458
|
+
# fail ArgumentError, "parent must be a TkMenu object"
|
459
|
+
#end
|
460
|
+
# @path = Kernel.format("%s.%s", parent.path, self.class::SYSMENU_NAME)
|
461
|
+
@path = parent.path + '.' + self.class::SYSMENU_NAME
|
462
|
+
#TkComm::Tk_WINDOWS[@path] = self
|
463
|
+
TkCore::INTERP.tk_windows[@path] = self
|
464
|
+
if self.method(:create_self).arity == 0
|
465
|
+
p 'create_self has no arg' if $DEBUG
|
466
|
+
create_self
|
467
|
+
configure(keys) if keys
|
468
|
+
else
|
469
|
+
p 'create_self has an arg' if $DEBUG
|
470
|
+
create_self(keys)
|
471
|
+
end
|
472
|
+
end
|
473
|
+
end
|
474
|
+
TkSystemMenu = Tk::SystemMenu
|
475
|
+
|
476
|
+
|
477
|
+
class Tk::SysMenu_Help<Tk::Menu
|
478
|
+
# for all platform
|
479
|
+
include Tk::SystemMenu
|
480
|
+
SYSMENU_NAME = 'help'
|
481
|
+
end
|
482
|
+
#TkSysMenu_Help = Tk::SysMenu_Help unless Object.const_defined? :TkSysMenu_Help
|
483
|
+
Tk.__set_toplevel_aliases__(:Tk, Tk::SysMenu_Help, :TkSysMenu_Help)
|
484
|
+
|
485
|
+
|
486
|
+
class Tk::SysMenu_System<Tk::Menu
|
487
|
+
# for Windows
|
488
|
+
include Tk::SystemMenu
|
489
|
+
SYSMENU_NAME = 'system'
|
490
|
+
end
|
491
|
+
#TkSysMenu_System = Tk::SysMenu_System unless Object.const_defined? :TkSysMenu_System
|
492
|
+
Tk.__set_toplevel_aliases__(:Tk, Tk::SysMenu_System, :TkSysMenu_System)
|
493
|
+
|
494
|
+
|
495
|
+
class Tk::SysMenu_Apple<Tk::Menu
|
496
|
+
# for Machintosh
|
497
|
+
include Tk::SystemMenu
|
498
|
+
SYSMENU_NAME = 'apple'
|
499
|
+
end
|
500
|
+
#TkSysMenu_Apple = Tk::SysMenu_Apple unless Object.const_defined? :TkSysMenu_Apple
|
501
|
+
Tk.__set_toplevel_aliases__(:Tk, Tk::SysMenu_Apple, :TkSysMenu_Apple)
|
502
|
+
|
503
|
+
|
504
|
+
class Tk::Menubutton<Tk::Label
|
505
|
+
TkCommandNames = ['menubutton'.freeze].freeze
|
506
|
+
WidgetClassName = 'Menubutton'.freeze
|
507
|
+
WidgetClassNames[WidgetClassName] = self
|
508
|
+
def create_self(keys)
|
509
|
+
if keys and keys != None
|
510
|
+
unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
|
511
|
+
# tk_call_without_enc('menubutton', @path, *hash_kv(keys, true))
|
512
|
+
tk_call_without_enc(self.class::TkCommandNames[0], @path,
|
513
|
+
*hash_kv(keys, true))
|
514
|
+
else
|
515
|
+
begin
|
516
|
+
tk_call_without_enc(self.class::TkCommandNames[0], @path,
|
517
|
+
*hash_kv(keys, true))
|
518
|
+
rescue
|
519
|
+
tk_call_without_enc(self.class::TkCommandNames[0], @path)
|
520
|
+
keys = __check_available_configure_options(keys)
|
521
|
+
unless keys.empty?
|
522
|
+
tk_call_without_enc('destroy', @path) rescue nil
|
523
|
+
tk_call_without_enc(self.class::TkCommandNames[0], @path,
|
524
|
+
*hash_kv(keys, true))
|
525
|
+
end
|
526
|
+
end
|
527
|
+
end
|
528
|
+
else
|
529
|
+
# tk_call_without_enc('menubutton', @path)
|
530
|
+
tk_call_without_enc(self.class::TkCommandNames[0], @path)
|
531
|
+
end
|
532
|
+
end
|
533
|
+
private :create_self
|
534
|
+
|
535
|
+
def __boolval_optkeys
|
536
|
+
super() << 'indicatoron'
|
537
|
+
end
|
538
|
+
private :__boolval_optkeys
|
539
|
+
|
540
|
+
end
|
541
|
+
Tk::MenuButton = Tk::Menubutton
|
542
|
+
#TkMenubutton = Tk::Menubutton unless Object.const_defined? :TkMenubutton
|
543
|
+
#TkMenuButton = Tk::MenuButton unless Object.const_defined? :TkMenuButton
|
544
|
+
Tk.__set_toplevel_aliases__(:Tk, Tk::Menubutton, :TkMenubutton, :TkMenuButton)
|
545
|
+
|
546
|
+
|
547
|
+
class Tk::OptionMenubutton<Tk::Menubutton
|
548
|
+
TkCommandNames = ['tk_optionMenu'.freeze].freeze
|
549
|
+
|
550
|
+
class OptionMenu<TkMenu
|
551
|
+
def initialize(path) #==> return value of tk_optionMenu
|
552
|
+
@path = path
|
553
|
+
#TkComm::Tk_WINDOWS[@path] = self
|
554
|
+
TkCore::INTERP.tk_windows[@path] = self
|
555
|
+
end
|
556
|
+
end
|
557
|
+
|
558
|
+
def initialize(*args)
|
559
|
+
# args :: [parent,] [var,] [value[, ...],] [keys]
|
560
|
+
# parent --> TkWindow or nil
|
561
|
+
# var --> TkVariable or nil
|
562
|
+
# keys --> Hash
|
563
|
+
# keys[:parent] or keys['parent'] --> parent
|
564
|
+
# keys[:variable] or keys['variable'] --> var
|
565
|
+
# keys[:values] or keys['values'] --> value, ...
|
566
|
+
# other Hash keys are menubutton options
|
567
|
+
keys = {}
|
568
|
+
keys = args.pop if args[-1].kind_of?(Hash)
|
569
|
+
keys = _symbolkey2str(keys)
|
570
|
+
|
571
|
+
parent = nil
|
572
|
+
if !args.empty? && (args[0].kind_of?(TkWindow) || args[0] == nil)
|
573
|
+
keys.delete('parent') # ignore
|
574
|
+
parent = args.shift
|
575
|
+
else
|
576
|
+
parent = keys.delete('parent')
|
577
|
+
end
|
578
|
+
|
579
|
+
@variable = nil
|
580
|
+
if !args.empty? && (args[0].kind_of?(TkVariable) || args[0] == nil)
|
581
|
+
keys.delete('variable') # ignore
|
582
|
+
@variable = args.shift
|
583
|
+
else
|
584
|
+
@variable = keys.delete('variable')
|
585
|
+
end
|
586
|
+
@variable = TkVariable.new unless @variable
|
587
|
+
|
588
|
+
(args = keys.delete('values') || []) if args.empty?
|
589
|
+
if args.empty?
|
590
|
+
args << @variable.value
|
591
|
+
else
|
592
|
+
@variable.value = args[0]
|
593
|
+
end
|
594
|
+
|
595
|
+
install_win(if parent then parent.path end)
|
596
|
+
@menu = OptionMenu.new(tk_call('tk_optionMenu',
|
597
|
+
@path, @variable.id, *args))
|
598
|
+
|
599
|
+
configure(keys) if keys
|
600
|
+
end
|
601
|
+
|
602
|
+
def value
|
603
|
+
@variable.value
|
604
|
+
end
|
605
|
+
|
606
|
+
def value=(val)
|
607
|
+
@variable.value = val
|
608
|
+
end
|
609
|
+
|
610
|
+
def activate(index)
|
611
|
+
@menu.activate(index)
|
612
|
+
self
|
613
|
+
end
|
614
|
+
def add(value)
|
615
|
+
@menu.add('radiobutton', 'variable'=>@variable,
|
616
|
+
'label'=>value, 'value'=>value)
|
617
|
+
self
|
618
|
+
end
|
619
|
+
def index(index)
|
620
|
+
@menu.index(index)
|
621
|
+
end
|
622
|
+
def invoke(index)
|
623
|
+
@menu.invoke(index)
|
624
|
+
end
|
625
|
+
def insert(index, value)
|
626
|
+
@menu.insert(index, 'radiobutton', 'variable'=>@variable,
|
627
|
+
'label'=>value, 'value'=>value)
|
628
|
+
self
|
629
|
+
end
|
630
|
+
def delete(index, last=None)
|
631
|
+
@menu.delete(index, last)
|
632
|
+
self
|
633
|
+
end
|
634
|
+
def xposition(index)
|
635
|
+
@menu.xposition(index)
|
636
|
+
end
|
637
|
+
def yposition(index)
|
638
|
+
@menu.yposition(index)
|
639
|
+
end
|
640
|
+
def menu
|
641
|
+
@menu
|
642
|
+
end
|
643
|
+
def menucget(key)
|
644
|
+
@menu.cget(key)
|
645
|
+
end
|
646
|
+
def menucget_strict(key)
|
647
|
+
@menu.cget_strict(key)
|
648
|
+
end
|
649
|
+
def menuconfigure(key, val=None)
|
650
|
+
@menu.configure(key, val)
|
651
|
+
self
|
652
|
+
end
|
653
|
+
def menuconfiginfo(key=nil)
|
654
|
+
@menu.configinfo(key)
|
655
|
+
end
|
656
|
+
def current_menuconfiginfo(key=nil)
|
657
|
+
@menu.current_configinfo(key)
|
658
|
+
end
|
659
|
+
def entrycget(index, key)
|
660
|
+
@menu.entrycget(index, key)
|
661
|
+
end
|
662
|
+
def entrycget_strict(index, key)
|
663
|
+
@menu.entrycget_strict(index, key)
|
664
|
+
end
|
665
|
+
def entryconfigure(index, key, val=None)
|
666
|
+
@menu.entryconfigure(index, key, val)
|
667
|
+
self
|
668
|
+
end
|
669
|
+
def entryconfiginfo(index, key=nil)
|
670
|
+
@menu.entryconfiginfo(index, key)
|
671
|
+
end
|
672
|
+
def current_entryconfiginfo(index, key=nil)
|
673
|
+
@menu.current_entryconfiginfo(index, key)
|
674
|
+
end
|
675
|
+
end
|
676
|
+
|
677
|
+
Tk::OptionMenuButton = Tk::OptionMenubutton
|
678
|
+
#TkOptionMenubutton = Tk::OptionMenubutton unless Object.const_defined? :TkOptionMenubutton
|
679
|
+
#TkOptionMenuButton = Tk::OptionMenuButton unless Object.const_defined? :TkOptionMenuButton
|
680
|
+
Tk.__set_toplevel_aliases__(:Tk, Tk::OptionMenubutton,
|
681
|
+
:TkOptionMenubutton, :TkOptionMenuButton)
|