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,131 @@
|
|
1
|
+
#
|
2
|
+
# tk/menubar.rb
|
3
|
+
#
|
4
|
+
# Original version:
|
5
|
+
# Copyright (C) 1998 maeda shugo. All rights reserved.
|
6
|
+
# This file can be distributed under the terms of the Ruby.
|
7
|
+
|
8
|
+
# Usage:
|
9
|
+
#
|
10
|
+
# menu_spec = [
|
11
|
+
# [['File', 0],
|
12
|
+
# ['Open', proc{puts('Open clicked')}, 0],
|
13
|
+
# '---',
|
14
|
+
# ['Quit', proc{exit}, 0]],
|
15
|
+
# [['Edit', 0],
|
16
|
+
# ['Cut', proc{puts('Cut clicked')}, 2],
|
17
|
+
# ['Copy', proc{puts('Copy clicked')}, 0],
|
18
|
+
# ['Paste', proc{puts('Paste clicked')}, 0]]
|
19
|
+
# ]
|
20
|
+
# menubar = TkMenubar.new(nil, menu_spec,
|
21
|
+
# 'tearoff'=>false,
|
22
|
+
# 'foreground'=>'grey40',
|
23
|
+
# 'activeforeground'=>'red',
|
24
|
+
# 'font'=>'-adobe-helvetica-bold-r-*--12-*-iso8859-1')
|
25
|
+
# menubar.pack('side'=>'top', 'fill'=>'x')
|
26
|
+
#
|
27
|
+
#
|
28
|
+
# OR
|
29
|
+
#
|
30
|
+
#
|
31
|
+
# menubar = TkMenubar.new
|
32
|
+
# menubar.add_menu([['File', 0],
|
33
|
+
# ['Open', proc{puts('Open clicked')}, 0],
|
34
|
+
# '---',
|
35
|
+
# ['Quit', proc{exit}, 0]])
|
36
|
+
# menubar.add_menu([['Edit', 0],
|
37
|
+
# ['Cut', proc{puts('Cut clicked')}, 2],
|
38
|
+
# ['Copy', proc{puts('Copy clicked')}, 0],
|
39
|
+
# ['Paste', proc{puts('Paste clicked')}, 0]])
|
40
|
+
# menubar.configure('tearoff', false)
|
41
|
+
# menubar.configure('foreground', 'grey40')
|
42
|
+
# menubar.configure('activeforeground', 'red')
|
43
|
+
# menubar.configure('font', '-adobe-helvetica-bold-r-*--12-*-iso8859-1')
|
44
|
+
# menubar.pack('side'=>'top', 'fill'=>'x')
|
45
|
+
#
|
46
|
+
#
|
47
|
+
# OR
|
48
|
+
#
|
49
|
+
# radio_var = TkVariable.new('y')
|
50
|
+
# menu_spec = [
|
51
|
+
# [['File', 0],
|
52
|
+
# {:label=>'Open', :command=>proc{puts('Open clicked')}, :underline=>0},
|
53
|
+
# '---',
|
54
|
+
# ['Check_A', TkVariable.new(true), 6],
|
55
|
+
# {:type=>'checkbutton', :label=>'Check_B',
|
56
|
+
# :variable=>TkVariable.new, :underline=>6},
|
57
|
+
# '---',
|
58
|
+
# ['Radio_X', [radio_var, 'x'], 6],
|
59
|
+
# ['Radio_Y', [radio_var, 'y'], 6],
|
60
|
+
# ['Radio_Z', [radio_var, 'z'], 6],
|
61
|
+
# '---',
|
62
|
+
# ['cascade', [
|
63
|
+
# ['sss', proc{p 'sss'}, 0],
|
64
|
+
# ['ttt', proc{p 'ttt'}, 0],
|
65
|
+
# ['uuu', proc{p 'uuu'}, 0],
|
66
|
+
# ['vvv', proc{p 'vvv'}, 0],
|
67
|
+
# ], 0],
|
68
|
+
# '---',
|
69
|
+
# ['Quit', proc{exit}, 0]],
|
70
|
+
# [['Edit', 0],
|
71
|
+
# ['Cut', proc{puts('Cut clicked')}, 2],
|
72
|
+
# ['Copy', proc{puts('Copy clicked')}, 0],
|
73
|
+
# ['Paste', proc{puts('Paste clicked')}, 0]]
|
74
|
+
# ]
|
75
|
+
# menubar = TkMenubar.new(nil, menu_spec,
|
76
|
+
# 'tearoff'=>false,
|
77
|
+
# 'foreground'=>'grey40',
|
78
|
+
# 'activeforeground'=>'red',
|
79
|
+
# 'font'=>'Helvetia 12 bold')
|
80
|
+
# menubar.pack('side'=>'top', 'fill'=>'x')
|
81
|
+
|
82
|
+
# See tk/menuspce.rb about the format of the menu_spec
|
83
|
+
|
84
|
+
# To use add_menu, configuration must be done by calling configure after
|
85
|
+
# adding all menus by add_menu, not by the constructor arguments.
|
86
|
+
|
87
|
+
require 'tk'
|
88
|
+
require 'tk/frame'
|
89
|
+
require 'tk/composite'
|
90
|
+
require 'tk/menuspec'
|
91
|
+
|
92
|
+
class TkMenubar<Tk::Frame
|
93
|
+
include TkComposite
|
94
|
+
include TkMenuSpec
|
95
|
+
|
96
|
+
def initialize(parent = nil, spec = nil, options = nil)
|
97
|
+
if parent.kind_of? Hash
|
98
|
+
options = _symbolkey2str(parent)
|
99
|
+
spec = options.delete('spec')
|
100
|
+
super(options)
|
101
|
+
else
|
102
|
+
super(parent, options)
|
103
|
+
end
|
104
|
+
|
105
|
+
@menus = []
|
106
|
+
|
107
|
+
spec.each{|info| add_menu(info)} if spec
|
108
|
+
|
109
|
+
options.each{|key, value| configure(key, value)} if options
|
110
|
+
end
|
111
|
+
|
112
|
+
def add_menu(menu_info)
|
113
|
+
mbtn, menu = _create_menubutton(@frame, menu_info)
|
114
|
+
|
115
|
+
submenus = _get_cascade_menus(menu).flatten
|
116
|
+
|
117
|
+
@menus.push([mbtn, menu])
|
118
|
+
delegate('tearoff', menu, *submenus)
|
119
|
+
delegate('foreground', mbtn, menu, *submenus)
|
120
|
+
delegate('background', mbtn, menu, *submenus)
|
121
|
+
delegate('disabledforeground', mbtn, menu, *submenus)
|
122
|
+
delegate('activeforeground', mbtn, menu, *submenus)
|
123
|
+
delegate('activebackground', mbtn, menu, *submenus)
|
124
|
+
delegate('font', mbtn, menu, *submenus)
|
125
|
+
delegate('kanjifont', mbtn, menu, *submenus)
|
126
|
+
end
|
127
|
+
|
128
|
+
def [](index)
|
129
|
+
return @menus[index]
|
130
|
+
end
|
131
|
+
end
|
@@ -0,0 +1,275 @@
|
|
1
|
+
#
|
2
|
+
# tk/menuspec.rb
|
3
|
+
# Hidethoshi NAGAI (nagai@ai.kyutech.ac.jp)
|
4
|
+
#
|
5
|
+
# based on tkmenubar.rb :
|
6
|
+
# Copyright (C) 1998 maeda shugo. All rights reserved.
|
7
|
+
# This file can be distributed under the terms of the Ruby.
|
8
|
+
#
|
9
|
+
# The format of the menu_spec is:
|
10
|
+
# [ menu_info, menu_info, ... ]
|
11
|
+
#
|
12
|
+
# And the format of the menu_info is:
|
13
|
+
# [
|
14
|
+
# [text, underline, configs], # menu button/entry (*1)
|
15
|
+
# [label, command, underline, accelerator, configs], # command entry
|
16
|
+
# [label, TkVar_obj, underline, accelerator, configs], # checkbutton entry
|
17
|
+
# [label, [TkVar_obj, value],
|
18
|
+
# underline, accelerator, configs], # radiobutton entry
|
19
|
+
# [label, [[...menu_info...], [...menu_info...], ...],
|
20
|
+
# underline, accelerator, configs], # cascade entry (*2)
|
21
|
+
# '---', # separator
|
22
|
+
# ...
|
23
|
+
# ]
|
24
|
+
#
|
25
|
+
# underline, accelerator, and configs are optional pearameters.
|
26
|
+
# Hashes are OK instead of Arrays. Then the entry type ('command',
|
27
|
+
# 'checkbutton', 'radiobutton' or 'cascade') is given by 'type' key
|
28
|
+
# (e.g. :type=>'cascade'). When type is 'cascade', an array of menu_info
|
29
|
+
# is acceptable for 'menu' key (then, create sub-menu).
|
30
|
+
#
|
31
|
+
# NOTE: (*1)
|
32
|
+
# If you want to make special menus (*.help for UNIX, *.system for Win,
|
33
|
+
# and *.apple for Mac), append 'menu_name'=>name (name is 'help' for UNIX,
|
34
|
+
# 'system' for Win, and 'apple' for Mac) option to the configs hash of
|
35
|
+
# menu button/entry information.
|
36
|
+
#
|
37
|
+
# NOTE: (*2)
|
38
|
+
# If you want to configure a cascade menu, add :menu_config=>{...configs..}
|
39
|
+
# to the configs of the cascade entry.
|
40
|
+
|
41
|
+
module TkMenuSpec
|
42
|
+
def _create_menu(parent, menu_info, menu_name = nil,
|
43
|
+
tearoff = false, default_opts = nil)
|
44
|
+
if tearoff.kind_of?(Hash)
|
45
|
+
default_opts = tearoff
|
46
|
+
tearoff = false
|
47
|
+
end
|
48
|
+
|
49
|
+
if menu_name.kind_of?(Hash)
|
50
|
+
default_opts = menu_name
|
51
|
+
menu_name = nil
|
52
|
+
tearoff = false
|
53
|
+
end
|
54
|
+
|
55
|
+
if default_opts.kind_of?(Hash)
|
56
|
+
orig_opts = _symbolkey2str(default_opts)
|
57
|
+
else
|
58
|
+
orig_opts = {}
|
59
|
+
end
|
60
|
+
|
61
|
+
tearoff = orig_opts.delete('tearoff') if orig_opts.key?('tearoff')
|
62
|
+
|
63
|
+
if menu_name
|
64
|
+
#menu = Tk::Menu.new(parent, :widgetname=>menu_name, :tearoff=>tearoff)
|
65
|
+
# --> use current TkMenu class
|
66
|
+
menu = TkMenu.new(parent, :widgetname=>menu_name, :tearoff=>tearoff)
|
67
|
+
else
|
68
|
+
#menu = Tk::Menu.new(parent, :tearoff=>tearoff)
|
69
|
+
# --> use current TkMenu class
|
70
|
+
menu = TkMenu.new(parent, :tearoff=>tearoff)
|
71
|
+
end
|
72
|
+
|
73
|
+
for item_info in menu_info
|
74
|
+
if item_info.kind_of?(Hash)
|
75
|
+
options = orig_opts.dup
|
76
|
+
options.update(_symbolkey2str(item_info))
|
77
|
+
item_type = (options.delete('type') || 'command').to_s
|
78
|
+
menu_name = options.delete('menu_name')
|
79
|
+
menu_opts = orig_opts.dup
|
80
|
+
menu_opts.update(_symbolkey2str(options.delete('menu_config') || {}))
|
81
|
+
if item_type == 'cascade' && options['menu'].kind_of?(Array)
|
82
|
+
# create cascade menu
|
83
|
+
submenu = _create_menu(menu, options['menu'], menu_name,
|
84
|
+
tearoff, menu_opts)
|
85
|
+
options['menu'] = submenu
|
86
|
+
end
|
87
|
+
menu.add(item_type, options)
|
88
|
+
|
89
|
+
elsif item_info.kind_of?(Array)
|
90
|
+
options = orig_opts.dup
|
91
|
+
|
92
|
+
options['label'] = item_info[0] if item_info[0]
|
93
|
+
|
94
|
+
case item_info[1]
|
95
|
+
when TkVariable
|
96
|
+
# checkbutton
|
97
|
+
item_type = 'checkbutton'
|
98
|
+
options['variable'] = item_info[1]
|
99
|
+
options['onvalue'] = true
|
100
|
+
options['offvalue'] = false
|
101
|
+
|
102
|
+
when Array
|
103
|
+
# radiobutton or cascade
|
104
|
+
if item_info[1][0].kind_of?(TkVariable)
|
105
|
+
# radiobutton
|
106
|
+
item_type = 'radiobutton'
|
107
|
+
options['variable'] = item_info[1][0]
|
108
|
+
options['value'] = item_info[1][1] if item_info[1][1]
|
109
|
+
|
110
|
+
else
|
111
|
+
# cascade
|
112
|
+
item_type = 'cascade'
|
113
|
+
menu_opts = orig_opts.dup
|
114
|
+
if item_info[4] && item_info[4].kind_of?(Hash)
|
115
|
+
opts = _symbolkey2str(item_info[4])
|
116
|
+
menu_name = opts.delete('menu_name')
|
117
|
+
menu_config = opts.delete('menu_config') || {}
|
118
|
+
menu_opts.update(_symbolkey2str(menu_config))
|
119
|
+
end
|
120
|
+
submenu = _create_menu(menu, item_info[1], menu_name,
|
121
|
+
tearoff, menu_opts)
|
122
|
+
options['menu'] = submenu
|
123
|
+
end
|
124
|
+
|
125
|
+
else
|
126
|
+
# command
|
127
|
+
item_type = 'command'
|
128
|
+
options['command'] = item_info[1] if item_info[1]
|
129
|
+
end
|
130
|
+
|
131
|
+
options['underline'] = item_info[2] if item_info[2]
|
132
|
+
options['accelerator'] = item_info[3] if item_info[3]
|
133
|
+
if item_info[4] && item_info[4].kind_of?(Hash)
|
134
|
+
opts = _symbolkey2str(item_info[4])
|
135
|
+
if item_type == 'cascade'
|
136
|
+
opts.delete('menu_name')
|
137
|
+
opts.delete('menu_config')
|
138
|
+
end
|
139
|
+
options.update(opts)
|
140
|
+
end
|
141
|
+
menu.add(item_type, options)
|
142
|
+
|
143
|
+
elsif /^-+$/ =~ item_info
|
144
|
+
menu.add('separator')
|
145
|
+
|
146
|
+
else
|
147
|
+
menu.add('command', 'label' => item_info)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
menu
|
152
|
+
end
|
153
|
+
private :_create_menu
|
154
|
+
|
155
|
+
def _use_menubar?(parent)
|
156
|
+
use_menubar = false
|
157
|
+
if parent.kind_of?(Tk::Root) || parent.kind_of?(Tk::Toplevel)
|
158
|
+
true
|
159
|
+
elsif parent.current_configinfo.has_key?('menu')
|
160
|
+
true
|
161
|
+
else
|
162
|
+
false
|
163
|
+
end
|
164
|
+
end
|
165
|
+
private :_use_menubar?
|
166
|
+
|
167
|
+
def _create_menu_for_menubar(parent)
|
168
|
+
#unless (mbar = parent.menu).kind_of?(TkMenu)
|
169
|
+
# --> use current TkMenu class
|
170
|
+
mbar = parent.menu
|
171
|
+
unless mbar.kind_of?(Tk::Menu) || mbar.kind_of?(TkMenu)
|
172
|
+
#mbar = Tk::Menu.new(parent, :tearoff=>false)
|
173
|
+
mbar = TkMenu.new(parent, :tearoff=>false)
|
174
|
+
parent.menu(mbar)
|
175
|
+
end
|
176
|
+
mbar
|
177
|
+
end
|
178
|
+
private :_create_menu_for_menubar
|
179
|
+
|
180
|
+
def _create_menubutton(parent, menu_info, tearoff=false, default_opts = nil)
|
181
|
+
btn_info = menu_info[0]
|
182
|
+
|
183
|
+
if tearoff.kind_of?(Hash)
|
184
|
+
default_opts = tearoff
|
185
|
+
tearoff = false
|
186
|
+
end
|
187
|
+
|
188
|
+
if default_opts.kind_of?(Hash)
|
189
|
+
keys = _symbolkey2str(default_opts)
|
190
|
+
else
|
191
|
+
keys = {}
|
192
|
+
end
|
193
|
+
|
194
|
+
tearoff = keys.delete('tearoff') if keys.key?('tearoff')
|
195
|
+
|
196
|
+
if _use_menubar?(parent)
|
197
|
+
# menubar by menu entries
|
198
|
+
mbar = _create_menu_for_menubar(parent)
|
199
|
+
|
200
|
+
menu_name = nil
|
201
|
+
|
202
|
+
if btn_info.kind_of?(Hash)
|
203
|
+
keys.update(_symbolkey2str(btn_info))
|
204
|
+
menu_name = keys.delete('menu_name')
|
205
|
+
keys['label'] = keys.delete('text') if keys.key?('text')
|
206
|
+
elsif btn_info.kind_of?(Array)
|
207
|
+
keys['label'] = btn_info[0] if btn_info[0]
|
208
|
+
keys['underline'] = btn_info[1] if btn_info[1]
|
209
|
+
if btn_info[2]&&btn_info[2].kind_of?(Hash)
|
210
|
+
keys.update(_symbolkey2str(btn_info[2]))
|
211
|
+
menu_name = keys.delete('menu_name')
|
212
|
+
end
|
213
|
+
else
|
214
|
+
keys = {:label=>btn_info}
|
215
|
+
end
|
216
|
+
|
217
|
+
menu = _create_menu(mbar, menu_info[1..-1], menu_name,
|
218
|
+
tearoff, default_opts)
|
219
|
+
menu.tearoff(tearoff)
|
220
|
+
|
221
|
+
keys['menu'] = menu
|
222
|
+
mbar.add('cascade', keys)
|
223
|
+
|
224
|
+
[mbar, menu]
|
225
|
+
|
226
|
+
else
|
227
|
+
# menubar by menubuttons
|
228
|
+
#mbtn = Tk::Menubutton.new(parent)
|
229
|
+
# --> use current TkMenubutton class
|
230
|
+
mbtn = TkMenubutton.new(parent)
|
231
|
+
|
232
|
+
menu_name = nil
|
233
|
+
|
234
|
+
if btn_info.kind_of?(Hash)
|
235
|
+
keys.update(_symbolkey2str(btn_info))
|
236
|
+
menu_name = keys.delete('menu_name')
|
237
|
+
keys['text'] = keys.delete('label') if keys.key?('label')
|
238
|
+
mbtn.configure(keys)
|
239
|
+
elsif btn_info.kind_of?(Array)
|
240
|
+
mbtn.configure('text', btn_info[0]) if btn_info[0]
|
241
|
+
mbtn.configure('underline', btn_info[1]) if btn_info[1]
|
242
|
+
# mbtn.configure('accelerator', btn_info[2]) if btn_info[2]
|
243
|
+
if btn_info[2]&&btn_info[2].kind_of?(Hash)
|
244
|
+
keys.update(_symbolkey2str(btn_info[2]))
|
245
|
+
menu_name = keys.delete('menu_name')
|
246
|
+
mbtn.configure(keys)
|
247
|
+
end
|
248
|
+
else
|
249
|
+
mbtn.configure('text', btn_info)
|
250
|
+
end
|
251
|
+
|
252
|
+
mbtn.pack('side' => 'left')
|
253
|
+
|
254
|
+
menu = _create_menu(mbtn, menu_info[1..-1], menu_name,
|
255
|
+
tearoff, default_opts)
|
256
|
+
|
257
|
+
mbtn.menu(menu)
|
258
|
+
|
259
|
+
[mbtn, menu]
|
260
|
+
end
|
261
|
+
end
|
262
|
+
private :_create_menubutton
|
263
|
+
|
264
|
+
def _get_cascade_menus(menu)
|
265
|
+
menus = []
|
266
|
+
(0..(menu.index('last'))).each{|idx|
|
267
|
+
if menu.menutype(idx) == 'cascade'
|
268
|
+
submenu = menu.entrycget(idx, 'menu')
|
269
|
+
menus << [submenu, _get_cascade_menus(submenu)]
|
270
|
+
end
|
271
|
+
}
|
272
|
+
menus
|
273
|
+
end
|
274
|
+
private :_get_cascade_menus
|
275
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#
|
2
|
+
# tk/message.rb : treat message widget
|
3
|
+
#
|
4
|
+
require 'tk'
|
5
|
+
require 'tk/label'
|
6
|
+
|
7
|
+
class Tk::Message<Tk::Label
|
8
|
+
TkCommandNames = ['message'.freeze].freeze
|
9
|
+
WidgetClassName = 'Message'.freeze
|
10
|
+
WidgetClassNames[WidgetClassName] = self
|
11
|
+
#def create_self(keys)
|
12
|
+
# if keys and keys != None
|
13
|
+
# tk_call_without_enc('message', @path, *hash_kv(keys, true))
|
14
|
+
# else
|
15
|
+
# tk_call_without_enc('message', @path)
|
16
|
+
# end
|
17
|
+
#end
|
18
|
+
private :create_self
|
19
|
+
end
|
20
|
+
|
21
|
+
#TkMessage = Tk::Message unless Object.const_defined? :TkMessage
|
22
|
+
Tk.__set_toplevel_aliases__(:Tk, Tk::Message, :TkMessage)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#
|
2
|
+
# tk/mngfocus.rb : methods for Tcl/Tk standard library 'focus.tcl'
|
3
|
+
# by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
|
4
|
+
#
|
5
|
+
require 'tk'
|
6
|
+
|
7
|
+
module TkManageFocus
|
8
|
+
extend Tk
|
9
|
+
|
10
|
+
TkCommandNames = [
|
11
|
+
'tk_focusFollowMouse'.freeze,
|
12
|
+
'tk_focusNext'.freeze,
|
13
|
+
'tk_focusPrev'.freeze
|
14
|
+
].freeze
|
15
|
+
|
16
|
+
def TkManageFocus.followsMouse
|
17
|
+
tk_call_without_enc('tk_focusFollowsMouse')
|
18
|
+
end
|
19
|
+
|
20
|
+
def TkManageFocus.next(win)
|
21
|
+
tk_tcl2ruby(tk_call('tk_focusNext', win))
|
22
|
+
end
|
23
|
+
def focusNext
|
24
|
+
TkManageFocus.next(self)
|
25
|
+
end
|
26
|
+
|
27
|
+
def TkManageFocus.prev(win)
|
28
|
+
tk_tcl2ruby(tk_call('tk_focusPrev', win))
|
29
|
+
end
|
30
|
+
def focusPrev
|
31
|
+
TkManageFocus.prev(self)
|
32
|
+
end
|
33
|
+
end
|