From 3dd3b2136b0050c669d0881ae804b1fae8ea6567 Mon Sep 17 00:00:00 2001 From: nagai Date: Sat, 22 Oct 2005 22:17:08 +0000 Subject: * ext/tk/extconf.rb: improbe messages [ruby-core:06325]. * ext/tk/lib/tk.rb, ext/tk/lib/tk/canvas.rb, ext/tk/lib/tk/entry.rb, ext/tk/lib/tk/frame.rb, ext/tk/lib/tk/image.rb, ext/tk/lib/tk/itemconfig.rb, ext/tk/lib/tk/labelframe.rb, ext/tk/lib/tk/listbox.rb, ext/tk/lib/tk/menu.rb, ext/tk/lib/tk/radiobutton.rb, ext/tk/lib/tk/scale.rb, ext/tk/lib/tk/spinbox.rb, ext/tk/lib/tk/text.rb, ext/tk/lib/tk/toplevel.rb: improve conversion of option values. * ext/tk/lib/tkextlib/*: ditto. * ext/tk/lib/tkextlib/*: update to support ActiveTcl8.4.11.2. * ext/tk/lib/tkextlib/trofs/*: support Trofs 0.4.3. * ext/tk/lib/tkextlib/tile/*: support Tile 0.7.2. * ext/tk/lib/tkextlib/vu/*: support vu 2.3.0. * ext/tk/lib/tkextlib/tcllib/*: support Tcllib 1.8 (Tklib 0.3). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/tk/ChangeLog.tkextlib | 14 + ext/tk/extconf.rb | 37 +- ext/tk/lib/tk.rb | 12 +- ext/tk/lib/tk/canvas.rb | 24 + ext/tk/lib/tk/entry.rb | 5 + ext/tk/lib/tk/frame.rb | 5 + ext/tk/lib/tk/image.rb | 5 + ext/tk/lib/tk/itemconfig.rb | 10 +- ext/tk/lib/tk/labelframe.rb | 5 + ext/tk/lib/tk/listbox.rb | 5 + ext/tk/lib/tk/menu.rb | 26 + ext/tk/lib/tk/radiobutton.rb | 10 + ext/tk/lib/tk/scale.rb | 5 + ext/tk/lib/tk/spinbox.rb | 15 + ext/tk/lib/tk/text.rb | 5 + ext/tk/lib/tk/toplevel.rb | 15 + ext/tk/lib/tkextlib/SUPPORT_STATUS | 81 +-- ext/tk/lib/tkextlib/blt/barchart.rb | 5 +- ext/tk/lib/tkextlib/blt/component.rb | 5 +- ext/tk/lib/tkextlib/blt/container.rb | 5 + ext/tk/lib/tkextlib/blt/dragdrop.rb | 15 + ext/tk/lib/tkextlib/blt/eps.rb | 17 + ext/tk/lib/tkextlib/blt/graph.rb | 2 +- ext/tk/lib/tkextlib/blt/htext.rb | 5 + ext/tk/lib/tkextlib/blt/stripchart.rb | 3 +- ext/tk/lib/tkextlib/blt/table.rb | 5 + ext/tk/lib/tkextlib/blt/tabset.rb | 15 + ext/tk/lib/tkextlib/blt/treeview.rb | 20 +- ext/tk/lib/tkextlib/bwidget/button.rb | 5 + ext/tk/lib/tkextlib/bwidget/buttonbox.rb | 5 + ext/tk/lib/tkextlib/bwidget/dialog.rb | 10 + ext/tk/lib/tkextlib/bwidget/dynamichelp.rb | 5 + ext/tk/lib/tkextlib/bwidget/entry.rb | 10 + ext/tk/lib/tkextlib/bwidget/label.rb | 10 + ext/tk/lib/tkextlib/bwidget/labelentry.rb | 10 + ext/tk/lib/tkextlib/bwidget/labelframe.rb | 11 + ext/tk/lib/tkextlib/bwidget/listbox.rb | 5 + ext/tk/lib/tkextlib/bwidget/mainframe.rb | 14 + ext/tk/lib/tkextlib/bwidget/messagedlg.rb | 11 + ext/tk/lib/tkextlib/bwidget/notebook.rb | 5 + ext/tk/lib/tkextlib/bwidget/panelframe.rb | 51 ++ ext/tk/lib/tkextlib/bwidget/passwddlg.rb | 11 + ext/tk/lib/tkextlib/bwidget/scrollview.rb | 5 + ext/tk/lib/tkextlib/bwidget/selectfont.rb | 6 + ext/tk/lib/tkextlib/bwidget/spinbox.rb | 15 + ext/tk/lib/tkextlib/bwidget/statusbar.rb | 46 ++ ext/tk/lib/tkextlib/bwidget/tree.rb | 11 + ext/tk/lib/tkextlib/itk/incr_tk.rb | 5 + ext/tk/lib/tkextlib/iwidgets/buttonbox.rb | 5 + ext/tk/lib/tkextlib/iwidgets/calendar.rb | 18 + ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb | 10 + ext/tk/lib/tkextlib/iwidgets/checkbox.rb | 5 + ext/tk/lib/tkextlib/iwidgets/combobox.rb | 5 + ext/tk/lib/tkextlib/iwidgets/datefield.rb | 15 + ext/tk/lib/tkextlib/iwidgets/dialogshell.rb | 5 + ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb | 5 + ext/tk/lib/tkextlib/iwidgets/entryfield.rb | 5 + ext/tk/lib/tkextlib/iwidgets/extbutton.rb | 10 + .../lib/tkextlib/iwidgets/extfileselectionbox.rb | 13 + ext/tk/lib/tkextlib/iwidgets/feedback.rb | 5 + ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb | 13 + ext/tk/lib/tkextlib/iwidgets/finddialog.rb | 13 + ext/tk/lib/tkextlib/iwidgets/hierarchy.rb | 15 + ext/tk/lib/tkextlib/iwidgets/hyperhelp.rb | 10 + ext/tk/lib/tkextlib/iwidgets/labeledframe.rb | 10 + ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb | 10 + ext/tk/lib/tkextlib/iwidgets/mainwindow.rb | 15 + ext/tk/lib/tkextlib/iwidgets/menubar.rb | 15 + ext/tk/lib/tkextlib/iwidgets/messagebox.rb | 10 + ext/tk/lib/tkextlib/iwidgets/notebook.rb | 9 +- ext/tk/lib/tkextlib/iwidgets/optionmenu.rb | 5 + ext/tk/lib/tkextlib/iwidgets/panedwindow.rb | 5 + ext/tk/lib/tkextlib/iwidgets/pushbutton.rb | 5 + ext/tk/lib/tkextlib/iwidgets/radiobox.rb | 5 + ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb | 10 + ext/tk/lib/tkextlib/iwidgets/scrolledhtml.rb | 15 + ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb | 10 + ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb | 10 + ext/tk/lib/tkextlib/iwidgets/selectionbox.rb | 10 + ext/tk/lib/tkextlib/iwidgets/spindate.rb | 10 + ext/tk/lib/tkextlib/iwidgets/spinint.rb | 10 + ext/tk/lib/tkextlib/iwidgets/spintime.rb | 10 + ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb | 19 +- ext/tk/lib/tkextlib/iwidgets/tabset.rb | 10 + ext/tk/lib/tkextlib/iwidgets/timeentry.rb | 5 + ext/tk/lib/tkextlib/iwidgets/timefield.rb | 15 + ext/tk/lib/tkextlib/iwidgets/toolbar.rb | 20 + ext/tk/lib/tkextlib/iwidgets/watch.rb | 11 + ext/tk/lib/tkextlib/tcllib.rb | 37 +- ext/tk/lib/tkextlib/tcllib/autoscroll.rb | 12 +- ext/tk/lib/tkextlib/tcllib/ctext.rb | 11 + ext/tk/lib/tkextlib/tcllib/dialog.rb | 84 +++ ext/tk/lib/tkextlib/tcllib/getstring.rb | 131 ++++ ext/tk/lib/tkextlib/tcllib/history.rb | 73 ++ ext/tk/lib/tkextlib/tcllib/ip_entry.rb | 5 + ext/tk/lib/tkextlib/tcllib/panelframe.rb | 72 ++ ext/tk/lib/tkextlib/tcllib/plotchart.rb | 154 ++++- ext/tk/lib/tkextlib/tcllib/ruler.rb | 65 ++ ext/tk/lib/tkextlib/tcllib/screenruler.rb | 68 ++ ext/tk/lib/tkextlib/tcllib/scrollwin.rb | 61 ++ ext/tk/lib/tkextlib/tcllib/style.rb | 1 + ext/tk/lib/tkextlib/tcllib/superframe.rb | 51 ++ ext/tk/lib/tkextlib/tcllib/swaplist.rb | 147 ++++ ext/tk/lib/tkextlib/tcllib/tablelist.rb | 27 + ext/tk/lib/tkextlib/tcllib/tablelist_core.rb | 770 +++++++++++++++++++++ ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb | 25 + ext/tk/lib/tkextlib/tcllib/tkpiechart.rb | 16 + ext/tk/lib/tkextlib/tcllib/tooltip.rb | 95 +++ ext/tk/lib/tkextlib/tcllib/widget.rb | 48 ++ ext/tk/lib/tkextlib/tile.rb | 57 +- ext/tk/lib/tkextlib/tile/dialog.rb | 84 +++ ext/tk/lib/tkextlib/tile/style.rb | 17 +- ext/tk/lib/tkextlib/tile/tcombobox.rb | 10 + ext/tk/lib/tkextlib/tile/tentry.rb | 10 + ext/tk/lib/tkextlib/tile/tnotebook.rb | 19 +- ext/tk/lib/tkextlib/tile/tprogressbar.rb | 24 +- ext/tk/lib/tkextlib/tile/treeview.rb | 11 + ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb | 5 + ext/tk/lib/tkextlib/tktable/tktable.rb | 27 + ext/tk/lib/tkextlib/treectrl/tktreectrl.rb | 196 +++++- ext/tk/lib/tkextlib/trofs.rb | 13 + ext/tk/lib/tkextlib/trofs/setup.rb | 8 + ext/tk/lib/tkextlib/trofs/trofs.rb | 51 ++ ext/tk/lib/tkextlib/vu/bargraph.rb | 10 + ext/tk/lib/tkextlib/vu/charts.rb | 6 + ext/tk/lib/tkextlib/winico/winico.rb | 1 + 126 files changed, 3429 insertions(+), 106 deletions(-) create mode 100644 ext/tk/lib/tkextlib/bwidget/panelframe.rb create mode 100644 ext/tk/lib/tkextlib/bwidget/statusbar.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/dialog.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/getstring.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/history.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/panelframe.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/ruler.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/screenruler.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/scrollwin.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/superframe.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/swaplist.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/tablelist.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/tablelist_core.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/tooltip.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/widget.rb create mode 100644 ext/tk/lib/tkextlib/tile/dialog.rb create mode 100644 ext/tk/lib/tkextlib/trofs.rb create mode 100644 ext/tk/lib/tkextlib/trofs/setup.rb create mode 100644 ext/tk/lib/tkextlib/trofs/trofs.rb (limited to 'ext/tk') diff --git a/ext/tk/ChangeLog.tkextlib b/ext/tk/ChangeLog.tkextlib index 2e66015d78..a4e8d87398 100644 --- a/ext/tk/ChangeLog.tkextlib +++ b/ext/tk/ChangeLog.tkextlib @@ -1,3 +1,17 @@ +2005-10-23 Hidetoshi NAGAI + + * ext/tk/lib/tkextlib/*: update to support ActiveTcl8.4.11.2 + + * ext/tk/lib/tkextlib/trofs/*: support Trofs 0.4.3 + + * ext/tk/lib/tkextlib/tile/*: support Tile 0.7.2 + + * ext/tk/lib/tkextlib/vu/*: support vu 2.3.0 + + * ext/tk/lib/tkextlib/tcllib/*: support Tcllib 1.8 (Tklib 0.3) + + * ext/tk/lib/tkextlib/*: improve conversion of option values + 2005-10-04 Hidetoshi NAGAI * ext/tk/lib/tkextlib/tktable/tktable.rb: border_* instance methods diff --git a/ext/tk/extconf.rb b/ext/tk/extconf.rb index 93522f4b9e..95fdef7968 100644 --- a/ext/tk/extconf.rb +++ b/ext/tk/extconf.rb @@ -172,10 +172,11 @@ def pthread_check() ** PTHREAD SUPPORT CHECK WARNING: ** ** We cannot check the consistency of pthread support between Ruby -** and Tcl/Tk library on your environment (do coss-compile?). If the -** consistency is not kept, some memory troubles (e.g. "Hang-up" or -** "Segmentation Fault") may bother you. We strongly recommend you to -** check the consistency by your own hand. +** and the Tcl/Tk library in your environment (are you perhaps +** cross-compiling?). If pthread support for these 2 packages is +** inconsistent you may find you get errors when running Ruby/Tk +** (e.g. hangs or segmentation faults). We strongly recommend +** you to check the consistency manually. ** ***************************************************************************** ') @@ -215,17 +216,17 @@ EOF ** ** PTHREAD SUPPORT MODE WARNING: ** -** Ruby is compiled with --enable-pthread, but your Tcl/Tk libraries -** seems to be compiled without "pthread support". Although You can -** create tcltklib library, this combination may cause memory trouble -** (e.g. "Hang-up" or "Segmentation Fault"). If you have no reason you -** must have to keep current pthread support status, we recommend you -** to make both or neither libraries to support pthread. +** Ruby is compiled with --enable-pthread, but your Tcl/Tk library +** seems to be compiled without pthread support. Although you can +** create the tcltklib library, this combination may cause errors +** (e.g. hangs or segmentation faults). If you have no reason to +** keep the current pthread support status, we recommend you reconfigure +** and recompile the libraries so that both or neither support pthreads. ** ** If you want change the status of pthread support, please recompile ** Ruby without "--enable-pthread" configure option or recompile Tcl/Tk ** with "--enable-threads" configure option (if your Tcl/Tk is later -** than or equal to Tcl/Tk8.1). +** than or equal to Tcl/Tk 8.1). ** ***************************************************************************** ') @@ -247,16 +248,16 @@ EOF puts(%Q'\ ***************************************************************************** ** -** PTHREAD SUPPORT MODE ERRROR: +** PTHREAD SUPPORT MODE ERROR: ** ** Ruby is not compiled with --enable-pthread, but your Tcl/Tk -** libararies seems to be compiled with "pthread support". This -** combination possibly cause "Hang-up" or "Segmentation Fault" -** frequently when Ruby/Tk is working. We NEVER recommend you to -** create the library under such combination of pthread support. +** library seems to be compiled with pthread support. This +** combination may cause frequent hang or segmentation fault +** errors when Ruby/Tk is working. We recommend that you NEVER +** create the library with such a combination of pthread support. ** -** Please recompile Ruby with "--enable-pthread" configure option -** or recompile Tcl/Tk with "--disable-threads" configure option. +** Please recompile Ruby with the "--enable-pthread" configure option +** or recompile Tcl/Tk with the "--disable-threads" configure option. ** ***************************************************************************** ') diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb index c3e92f4097..3f3a136b87 100644 --- a/ext/tk/lib/tk.rb +++ b/ext/tk/lib/tk.rb @@ -2696,12 +2696,18 @@ module TkConfigMethod private :__numstrval_optkeys def __boolval_optkeys - [] + ['exportselection', 'jump', 'setgrid', 'takefocus'] end private :__boolval_optkeys def __strval_optkeys - ['text', 'label', 'show', 'data', 'file'] + [ + 'text', 'label', 'show', 'data', 'file', + 'activebackground', 'activeforeground', 'background', + 'disabledforeground', 'disabledbackground', 'foreground', + 'highlightbackground', 'highlightcolor', 'insertbackground', + 'selectbackground', 'selectforeground', 'troughcolor' + ] end private :__strval_optkeys @@ -4437,7 +4443,7 @@ end #Tk.freeze module Tk - RELEASE_DATE = '2005-09-17'.freeze + RELEASE_DATE = '2005-10-23'.freeze autoload :AUTO_PATH, 'tk/variable' autoload :TCL_PACKAGE_PATH, 'tk/variable' diff --git a/ext/tk/lib/tk/canvas.rb b/ext/tk/lib/tk/canvas.rb index 97bc6cc14a..94b43ebc39 100644 --- a/ext/tk/lib/tk/canvas.rb +++ b/ext/tk/lib/tk/canvas.rb @@ -11,11 +11,25 @@ require 'tk/scrollable' module TkCanvasItemConfig include TkItemConfigMethod + def __item_strval_optkeys(id) + # maybe need to override + super(id) + [ + 'fill', 'activefill', 'disabledfill', + 'outline', 'activeoutline', 'disabledoutline' + ] + end + private :__item_strval_optkeys + def __item_methodcall_optkeys(id) {'coords'=>'coords'} end private :__item_methodcall_optkeys + def __item_val2ruby_optkeys(id) # { key=>proc, ... } + super(id).update('window'=>proc{|i, v| window(v)}) + end + private :__val2ruby_optkeys + def __item_pathname(tagOrId) if tagOrId.kind_of?(TkcItem) || tagOrId.kind_of?(TkcTag) self.path + ';' + tagOrId.id.to_s @@ -47,6 +61,16 @@ class TkCanvasproc, ... } + super().update('labelwidget'=>proc{|v| window(v)}) + end + private :__val2ruby_optkeys end TkLabelframe = TkLabelFrame diff --git a/ext/tk/lib/tk/listbox.rb b/ext/tk/lib/tk/listbox.rb index 295a9bf88c..41d02d279e 100644 --- a/ext/tk/lib/tk/listbox.rb +++ b/ext/tk/lib/tk/listbox.rb @@ -32,6 +32,11 @@ class TkListboxproc, ... } + super(id).update('menu'=>proc{|i, v| window(v)}) + end + private :__val2ruby_optkeys + alias entrycget itemcget alias entryconfigure itemconfigure alias entryconfiginfo itemconfiginfo @@ -49,6 +59,16 @@ class TkMenuproc, ... } { 'variable'=>proc{|v| tk_trace_variable(v)} # for backward compatibility diff --git a/ext/tk/lib/tk/scale.rb b/ext/tk/lib/tk/scale.rb index 7214c46f5e..0b703aa055 100644 --- a/ext/tk/lib/tk/scale.rb +++ b/ext/tk/lib/tk/scale.rb @@ -24,6 +24,11 @@ class TkScaleproc, ... } + super().update('menu'=>proc{|v| window(v)}) + end + private :__val2ruby_optkeys + def __methodcall_optkeys # { key=>method, ... } TOPLEVEL_METHODCALL_OPTKEYS end diff --git a/ext/tk/lib/tkextlib/SUPPORT_STATUS b/ext/tk/lib/tkextlib/SUPPORT_STATUS index 81cffb5ed3..33eded5050 100644 --- a/ext/tk/lib/tkextlib/SUPPORT_STATUS +++ b/ext/tk/lib/tkextlib/SUPPORT_STATUS @@ -1,7 +1,7 @@ [ current support status of Tcl/Tk extensions ] - *******<<< RELEASE_DATE of the libraries : 2005/10/04 >>>******* + *******<<< RELEASE_DATE of the libraries : 2005/10/23 >>>******* The following list shows *CURRENT* status when this file was modifyed at last. If you want to add other Tcl/Tk extensions to the planed list @@ -55,7 +55,7 @@ script may give you some hints about that. ===< support with some examples (may be beta quality) >======================= -Tcllib 1.7 http://sf.net/projects/tcllib +Tcllib 1.8 http://sf.net/projects/tcllib ==> tcllib (partial support; Tklib part only) IWidgets 4.0.2 http://sf.net/projects/incrTcl ==> iwidgets @@ -66,7 +66,7 @@ TkTable 2.9 http://sf.net/projects/tktable ==> tktable * see also written by Ferenc Engard (ferenc@engard.hu) -vu 2.1.0 http://tktable.sourceforge.net ==> vu +vu 2.3.0 http://tktable.sourceforge.net ==> vu TkHTML 2.0 http://www.hwaci.com/sw/tkhtml/index.html ==> tkHTML @@ -75,15 +75,16 @@ ICONS 1.0 http://www.satisoft.com/tcltk/icons/ ==> ICONS TkImg 1.3 http://sf.net/projects/tkimg ==> tkimg -BLT 2.4z http://sourceforge.net/projects/blt +BLT 2.4z http://sourceforge.net/projects/blt * see also tcltk-ext library on RAA (http://raa.ruby-lang.org/) ==> blt TkTreeCtrl CVS/Hd(2005-03-25) - http://tktreectrl.sourceforge.net/ ==> treectrl + http://tktreectrl.sourceforge.net/ ==> treectrl + +Tile 0.7.2 http://tktable.sourceforge.net/tile/ ==> tile -Tile 0.6 http://tktable.sourceforge.net/tile/ ==> tile ===< support (may be alpha or beta quality) >================================= @@ -96,97 +97,99 @@ TclX CVS/Hd(2005-02-07) ==> tclx (partial support; infox command and XPG/3 message catalogs only) +Trofs 0.4.3 http://math.nist.gov/~DPorter/tcltk/trofs/ + ===< possibly available (not tested; alpha quality) >========================= -winico CVS/Hd(2004-11-02) - http://tktable.sourceforge.net - ==> winico (win32 only) +winico 0.6 + http://tktable.sourceforge.net + ==> winico (win32 only) TkTrans latest(2004-10-11) - http://www2.cmp.uea.ac.uk/~fuzz/tktrans/default.html - ==> tktrans (win32 only) + http://www2.cmp.uea.ac.uk/~fuzz/tktrans/default.html + ==> tktrans (win32 only) -TkDND 1.0a2 http://sourceforge.net/projects/tkdnd ==> tkDND +TkDND 1.0a2 http://sourceforge.net/projects/tkdnd ==> tkDND ===< plan to support (alpha quality libraries may be included) >============== -GraphViz *** http://www.graphviz.org/ +GraphViz *** http://www.graphviz.org/ -Tkgeomap *** http://tkgeomap.sourceforge.net/index.html +Tkgeomap *** http://tkgeomap.sourceforge.net/index.html ===< not determined to supprt or not >======================================== -Tix *** http://tixlibrary.sourceforge.net/ +Tix *** http://tixlibrary.sourceforge.net/ * see also tcltk-ext library on RAA (http://raa.ruby-lang.org/) -TkZinc *** http://www.tkzinc.org/ +TkZinc *** http://www.tkzinc.org/ -Wbc *** http://home.t-online.de/home/csaba.nemethi/ +Wbc *** http://home.t-online.de/home/csaba.nemethi/ -Mentry *** http://home.t-online.de/home/csaba.nemethi/ +Mentry *** http://home.t-online.de/home/csaba.nemethi/ -Tablelist *** http://home.t-online.de/home/csaba.nemethi/ +Tablelist *** http://home.t-online.de/home/csaba.nemethi/ -ANIGIF *** http://cardtable.sourceforge.net/tcltk/ +ANIGIF *** http://cardtable.sourceforge.net/tcltk/ -IMG_ROTATE *** http://cardtable.sourceforge.net/tcltk/ +IMG_ROTATE *** http://cardtable.sourceforge.net/tcltk/ -TclVfs *** http://sourceforge.net/projects/tclvfs/ +TclVfs *** http://sourceforge.net/projects/tclvfs/ -vfwtcl *** http://sourceforge.net/projects/avicaptcl +vfwtcl *** http://sourceforge.net/projects/avicaptcl * Win32 only -multicast *** http://sourceforge.net/projects/avicaptcl +multicast *** http://sourceforge.net/projects/avicaptcl * Win32 only -XBit *** http://www.geocities.com/~chengye/ +XBit *** http://www.geocities.com/~chengye/ * current implementation is for Windows only -QuickTimeTcl *** http://hem.fyristorg.com/matben/qt/ +QuickTimeTcl *** http://hem.fyristorg.com/matben/qt/ * works under Mac OS (8,9,X) or Windows ===< may not support (already exist, out of Ruby/Tk scope, and so on) >======= -TkCon *** http://sf.net/projects/tkcon +TkCon *** http://sf.net/projects/tkcon -Expect *** http://sf.net/projects/expect +Expect *** http://sf.net/projects/expect -TclXML *** http://sf.net/projects/tclxml +TclXML *** http://sf.net/projects/tclxml -TclXSLT *** http://sf.net/projects/tclxml +TclXSLT *** http://sf.net/projects/tclxml -TclDOM *** http://sf.net/projects/tclxml +TclDOM *** http://sf.net/projects/tclxml -TclSOAP *** http://sf.net/projects/tclsoap +TclSOAP *** http://sf.net/projects/tclsoap -Snack *** http://www.speech.kth.se/~kare/snack2.2.tar.gz +Snack *** http://www.speech.kth.se/~kare/snack2.2.tar.gz * use Snack for Ruby (see http://rbsnack.sourceforge.net/) -Tcom *** http://www.vex.net/~cthuang/tcom/ +Tcom *** http://www.vex.net/~cthuang/tcom/ -tDOM *** http://www.tdom.org +tDOM *** http://www.tdom.org -Mk4tcl *** http://www.equi4.com/metakit/tcl.html +Mk4tcl *** http://www.equi4.com/metakit/tcl.html -Memchan *** http://memchan.sourceforge.net/ +Memchan *** http://memchan.sourceforge.net/ -XOTcl *** http://www.xotcl.org/ +XOTcl *** http://www.xotcl.org/ ===< tool (may not supprt) >================================================== tbcload/tclcompiler - *** http://www.tcl.tk/software/tclpro/ + *** http://www.tcl.tk/software/tclpro/ (End of List) diff --git a/ext/tk/lib/tkextlib/blt/barchart.rb b/ext/tk/lib/tkextlib/blt/barchart.rb index 241ce11632..cb481c5889 100644 --- a/ext/tk/lib/tkextlib/blt/barchart.rb +++ b/ext/tk/lib/tkextlib/blt/barchart.rb @@ -17,12 +17,13 @@ module Tk::BLT include GraphCommand def __boolval_optkeys - ['bufferelements', 'invertxy'] + ['bufferelements', 'buffergraph', 'invertxy'] end private :__boolval_optkeys def __strval_optkeys - ['text', 'label', 'title', 'file'] + ['text', 'label', 'title', 'file', + 'background', 'plotbackground'] end private :__strval_optkeys diff --git a/ext/tk/lib/tkextlib/blt/component.rb b/ext/tk/lib/tkextlib/blt/component.rb index 0b58195c96..ad78a5430b 100644 --- a/ext/tk/lib/tkextlib/blt/component.rb +++ b/ext/tk/lib/tkextlib/blt/component.rb @@ -30,7 +30,8 @@ module Tk::BLT def __item_strval_optkeys(id) ['text', 'label', 'limits', 'title', - 'show', 'file', 'maskdata', 'maskfile'] + 'show', 'file', 'maskdata', 'maskfile', + 'color', 'titlecolor', 'fill', 'outline', 'offdash'] end private :__item_strval_optkeys @@ -40,7 +41,7 @@ module Tk::BLT private :__item_listval_optkeys def __item_numlistval_optkeys(id) - ['dashes'] + ['dashes', 'majorticks', 'minorticks'] end private :__item_numlistval_optkeys diff --git a/ext/tk/lib/tkextlib/blt/container.rb b/ext/tk/lib/tkextlib/blt/container.rb index ef711bbcc6..60ba1dec1e 100644 --- a/ext/tk/lib/tkextlib/blt/container.rb +++ b/ext/tk/lib/tkextlib/blt/container.rb @@ -13,6 +13,11 @@ module Tk::BLT WidgetClassNames[WidgetClassName] = self end + def __strval_optkeys + super() << 'name' + end + private :__strval_optkeys + def find_command(pat) list(tk_send_without_enc(tk_call(self.path, 'find', '-command', pat))) end diff --git a/ext/tk/lib/tkextlib/blt/dragdrop.rb b/ext/tk/lib/tkextlib/blt/dragdrop.rb index 3d7d652dde..68fb9e591a 100644 --- a/ext/tk/lib/tkextlib/blt/dragdrop.rb +++ b/ext/tk/lib/tkextlib/blt/dragdrop.rb @@ -39,6 +39,21 @@ module Tk::BLT end private :__item_config_cmd + def __item_boolval_optkeys(id) + super(id) << 'selftarget' + end + private :__item_boolval_optkeys + + def __item_listval_optkeys(id) + super(id) << 'send' + end + private :__item_listval_optkeys + + def __item_strval_optkeys(id) + super(id) << 'rejectbg' << 'rejectfg' << 'tokenbg' + end + private :__item_strval_optkeys + undef itemcget private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo diff --git a/ext/tk/lib/tkextlib/blt/eps.rb b/ext/tk/lib/tkextlib/blt/eps.rb index 43b2f8adc0..586a42470c 100644 --- a/ext/tk/lib/tkextlib/blt/eps.rb +++ b/ext/tk/lib/tkextlib/blt/eps.rb @@ -13,3 +13,20 @@ module Tk::BLT CItemTypeToClass[CItemTypeName] = self end end + +class TkCanvas + alias __BLT_EPS_item_strval_optkeys __item_strval_optkeys + def __item_strval_optkeys(id) + __BLT_EPS_item_strval_optkeys(id) + [ + 'shadowcolor', 'title', 'titlecolor' + ] + end + private :__item_strval_optkeys + + alias __BLT_EPS_item_boolval_optkeys __item_boolval_optkeys + def __item_boolval_optkeys(id) + __BLT_EPS_item_boolval_optkeys(id) + ['showimage'] + end + private :__item_boolval_optkeys +end + diff --git a/ext/tk/lib/tkextlib/blt/graph.rb b/ext/tk/lib/tkextlib/blt/graph.rb index e9fbdd587a..9ae99bff5c 100644 --- a/ext/tk/lib/tkextlib/blt/graph.rb +++ b/ext/tk/lib/tkextlib/blt/graph.rb @@ -22,7 +22,7 @@ module Tk::BLT private :__boolval_optkeys def __strval_optkeys - ['text', 'label', 'title', 'file'] + ['text', 'label', 'title', 'file', 'plotbackground'] end private :__strval_optkeys diff --git a/ext/tk/lib/tkextlib/blt/htext.rb b/ext/tk/lib/tkextlib/blt/htext.rb index 3bc35b7e10..a0cf3dc036 100644 --- a/ext/tk/lib/tkextlib/blt/htext.rb +++ b/ext/tk/lib/tkextlib/blt/htext.rb @@ -26,6 +26,11 @@ module Tk::BLT alias window_configuinfo itemconfiginfo alias current_window_configuinfo current_itemconfiginfo + def __strval_optkeys + super() << 'filename' + end + private :__strval_optkeys + def append(win, keys={}) tk_send('append', _epath(win), keys) self diff --git a/ext/tk/lib/tkextlib/blt/stripchart.rb b/ext/tk/lib/tkextlib/blt/stripchart.rb index 64c5c1abf8..fe5afbb095 100644 --- a/ext/tk/lib/tkextlib/blt/stripchart.rb +++ b/ext/tk/lib/tkextlib/blt/stripchart.rb @@ -22,7 +22,8 @@ module Tk::BLT private :__boolval_optkeys def __strval_optkeys - ['text', 'label', 'title', 'file'] + ['text', 'label', 'title', 'file', + 'background', 'plotbackground'] end private :__strval_optkeys diff --git a/ext/tk/lib/tkextlib/blt/table.rb b/ext/tk/lib/tkextlib/blt/table.rb index dc9cd0627e..fc1bf54e65 100644 --- a/ext/tk/lib/tkextlib/blt/table.rb +++ b/ext/tk/lib/tkextlib/blt/table.rb @@ -140,6 +140,11 @@ class << Tk::BLT::Table private :__itemcget, :__itemconfigure private :__itemconfiginfo, :__current_itemconfiginfo + def __boolval_optkeys + super() << 'propagate' + end + private :__boolval_optkeys + def tagid(tag) if tag.kind_of?(Array) case tag[0] diff --git a/ext/tk/lib/tkextlib/blt/tabset.rb b/ext/tk/lib/tkextlib/blt/tabset.rb index 693cce5073..c26b6ee001 100644 --- a/ext/tk/lib/tkextlib/blt/tabset.rb +++ b/ext/tk/lib/tkextlib/blt/tabset.rb @@ -189,6 +189,16 @@ module Tk::BLT ######################################## + def __boolval_optkeys + super() << 'samewidth' << 'tearoff' + end + private :__strval_optkeys + + def __strval_optkeys + super() << 'tabbackground' << 'tabforeground' + end + private :__strval_optkeys + def __item_cget_cmd(id) [self.path, 'tab', 'cget', id] end @@ -213,6 +223,11 @@ module Tk::BLT alias tab_configinfo itemconfiginfo alias current_tab_configinfo current_itemconfiginfo + def __item_strval_optkeys(id) + super(id) << 'shadow' + end + private :__item_strval_optkeys + def tagid(tab) if tab.kind_of?(Tk::BLT::Tabset::Tab) tab.id diff --git a/ext/tk/lib/tkextlib/blt/treeview.rb b/ext/tk/lib/tkextlib/blt/treeview.rb index 4687d41b55..0343d28b9c 100644 --- a/ext/tk/lib/tkextlib/blt/treeview.rb +++ b/ext/tk/lib/tkextlib/blt/treeview.rb @@ -44,6 +44,19 @@ module Tk::BLT::Treeview::ConfigMethod end private :__item_boolval_optkeys + def __item_strval_optkeys(id) + case id + when Array + # id := [ 'column', name ] + super() << 'titleforeground' << 'titleshadow' + when 'sort' + ['decreasing'] + else + [] + end + end + private :__item_strval_optkeys + def __item_listval_optkeys(id) case id when 'entry' @@ -197,11 +210,16 @@ class Tk::BLT::Treeview ######################## def __boolval_optkeys - ['autocreate', 'exportselection', 'flat', 'hideroot', + ['autocreate', 'allowduplicates', 'exportselection', 'flat', 'hideroot', 'newtags', 'showtitles', 'sortselection'] end private :__boolval_optkeys + def __strval_optkeys + super() + ['focusforeground', 'linecolor', 'separator', 'trim'] + end + private :__strval_optkeys + ######################## class OpenCloseCommand < TkValidateCommand diff --git a/ext/tk/lib/tkextlib/bwidget/button.rb b/ext/tk/lib/tkextlib/bwidget/button.rb index 1432458cc7..4a9d4a7948 100644 --- a/ext/tk/lib/tkextlib/bwidget/button.rb +++ b/ext/tk/lib/tkextlib/bwidget/button.rb @@ -19,6 +19,11 @@ class Tk::BWidget::Button WidgetClassName = 'Button'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() << 'helptext' + end + private :__strval_optkeys + def __tkvariable_optkeys super() << 'helpvar' end diff --git a/ext/tk/lib/tkextlib/bwidget/buttonbox.rb b/ext/tk/lib/tkextlib/bwidget/buttonbox.rb index 477de8a61f..ef999239f9 100644 --- a/ext/tk/lib/tkextlib/bwidget/buttonbox.rb +++ b/ext/tk/lib/tkextlib/bwidget/buttonbox.rb @@ -21,6 +21,11 @@ class Tk::BWidget::ButtonBox include TkItemConfigMethod + def __boolval_optkeys + super() << 'homogeneous' + end + private :__boolval_optkeys + def tagid(tagOrId) if tagOrId.kind_of?(Tk::BWidget::Button) name = tagOrId[:name] diff --git a/ext/tk/lib/tkextlib/bwidget/dialog.rb b/ext/tk/lib/tkextlib/bwidget/dialog.rb index d175a2d8bb..2790d88d24 100644 --- a/ext/tk/lib/tkextlib/bwidget/dialog.rb +++ b/ext/tk/lib/tkextlib/bwidget/dialog.rb @@ -22,6 +22,16 @@ class Tk::BWidget::Dialog include TkItemConfigMethod + def __strval_optkeys + super() << 'title' + end + private :__strval_optkeys + + def __boolval_optkeys + super() << 'transient' << 'homogeneous' + end + private :__boolval_optkeys + def initialize(parent=nil, keys=nil) @relative = '' if parent.kind_of?(Hash) diff --git a/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb b/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb index 4766a1ec6d..224304f2ab 100644 --- a/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb +++ b/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb @@ -21,6 +21,11 @@ module Tk::BWidget::DynamicHelp 'DynamicHelp::configure' end + def __strval_optkeys + super() << 'topbackground' + end + private :__strval_optkeys + def self.__cget_cmd ['DynamicHelp::configure'] end diff --git a/ext/tk/lib/tkextlib/bwidget/entry.rb b/ext/tk/lib/tkextlib/bwidget/entry.rb index 855d2194f2..aafb4aa7ff 100644 --- a/ext/tk/lib/tkextlib/bwidget/entry.rb +++ b/ext/tk/lib/tkextlib/bwidget/entry.rb @@ -21,6 +21,16 @@ class Tk::BWidget::Entry WidgetClassName = 'Entry'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() << 'helptext' << 'insertbackground' + end + private :__strval_optkeys + + def __boolval_optkeys + super() << 'dragenabled' << 'dropenabled' << 'editable' + end + private :__boolval_optkeys + def __tkvariable_optkeys super() << 'helpvar' end diff --git a/ext/tk/lib/tkextlib/bwidget/label.rb b/ext/tk/lib/tkextlib/bwidget/label.rb index 68bf8cdac4..ce10ecaf8b 100644 --- a/ext/tk/lib/tkextlib/bwidget/label.rb +++ b/ext/tk/lib/tkextlib/bwidget/label.rb @@ -19,6 +19,16 @@ class Tk::BWidget::Label WidgetClassName = 'Label'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() << 'helptext' + end + private :__strval_optkeys + + def __boolval_optkeys + super() << 'dragenabled' << 'dropenabled' + end + private :__boolval_optkeys + def __tkvariable_optkeys super() << 'helpvar' end diff --git a/ext/tk/lib/tkextlib/bwidget/labelentry.rb b/ext/tk/lib/tkextlib/bwidget/labelentry.rb index b516a7d206..931feb9b48 100644 --- a/ext/tk/lib/tkextlib/bwidget/labelentry.rb +++ b/ext/tk/lib/tkextlib/bwidget/labelentry.rb @@ -23,11 +23,21 @@ class Tk::BWidget::LabelEntry WidgetClassName = 'LabelEntry'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() << 'helptext' << 'insertbackground' << 'entryfg' << 'entrybg' + end + private :__strval_optkeys + def __tkvariable_optkeys super() << 'helpvar' end private :__tkvariable_optkeys + def __font_optkeys + super() << 'labelfont' + end + private :__font_optkeys + #def entrybind(*args) # _bind([path, 'bind'], *args) # self diff --git a/ext/tk/lib/tkextlib/bwidget/labelframe.rb b/ext/tk/lib/tkextlib/bwidget/labelframe.rb index 3450be6e70..f7b267eebb 100644 --- a/ext/tk/lib/tkextlib/bwidget/labelframe.rb +++ b/ext/tk/lib/tkextlib/bwidget/labelframe.rb @@ -6,6 +6,7 @@ require 'tk' require 'tk/frame' require 'tkextlib/bwidget.rb' +require 'tkextlib/bwidget/label' module Tk module BWidget @@ -19,6 +20,16 @@ class Tk::BWidget::LabelFrame WidgetClassName = 'LabelFrame'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() << 'helptext' + end + private :__strval_optkeys + + def __boolval_optkeys + super() << 'dragenabled' << 'dropenabled' + end + private :__boolval_optkeys + def __tkvariable_optkeys super() << 'helpvar' end diff --git a/ext/tk/lib/tkextlib/bwidget/listbox.rb b/ext/tk/lib/tkextlib/bwidget/listbox.rb index 3d26081e6c..1267500661 100644 --- a/ext/tk/lib/tkextlib/bwidget/listbox.rb +++ b/ext/tk/lib/tkextlib/bwidget/listbox.rb @@ -35,6 +35,11 @@ class Tk::BWidget::ListBox end end + def __boolval_optkeys + super() << 'autofocus' << 'dragenabled' << 'dropenabled' << 'selectfill' + end + private :__boolval_optkeys + def tagid(tag) if tag.kind_of?(Tk::BWidget::ListBox::Item) tag.id diff --git a/ext/tk/lib/tkextlib/bwidget/mainframe.rb b/ext/tk/lib/tkextlib/bwidget/mainframe.rb index 7f87894586..c54e878557 100644 --- a/ext/tk/lib/tkextlib/bwidget/mainframe.rb +++ b/ext/tk/lib/tkextlib/bwidget/mainframe.rb @@ -20,11 +20,25 @@ class Tk::BWidget::MainFrame WidgetClassName = 'MainFrame'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() << 'progressfg' + end + private :__strval_optkeys + def __tkvariable_optkeys super() << 'progressvar' end private :__tkvariable_optkeys + def __val2ruby_optkeys # { key=>proc, ... } + # The method is used to convert a opt-value to a ruby's object. + # When get the value of the option "key", "proc.call(value)" is called. + { + 'menu'=>proc{|v| simplelist(v).collect!{|elem| simplelist(v)}} + } + end + private :__val2ruby_optkeys + def add_indicator(keys={}, &b) win = window(tk_send('addindicator', *hash_kv(keys))) win.instance_eval(&b) if b diff --git a/ext/tk/lib/tkextlib/bwidget/messagedlg.rb b/ext/tk/lib/tkextlib/bwidget/messagedlg.rb index d7b2bbc32b..9c946d0630 100644 --- a/ext/tk/lib/tkextlib/bwidget/messagedlg.rb +++ b/ext/tk/lib/tkextlib/bwidget/messagedlg.rb @@ -5,6 +5,7 @@ require 'tk' require 'tkextlib/bwidget.rb' +require 'tkextlib/bwidget/dialog.rb' module Tk module BWidget @@ -43,6 +44,16 @@ class Tk::BWidget::MessageDlg end private :create_self + def __strval_optkeys + super() << 'message' << 'title' + end + private :__strval_optkeys + + def __listval_optkeys + super() << 'buttons' + end + private :__listval_optkeys + def cget(slot) slot = slot.to_s if slot == 'relative' diff --git a/ext/tk/lib/tkextlib/bwidget/notebook.rb b/ext/tk/lib/tkextlib/bwidget/notebook.rb index 2bef13dffd..5146d4915d 100644 --- a/ext/tk/lib/tkextlib/bwidget/notebook.rb +++ b/ext/tk/lib/tkextlib/bwidget/notebook.rb @@ -29,6 +29,11 @@ class Tk::BWidget::NoteBook end end + def __boolval_optkeys + super() << 'homogeneous' + end + private :__boolval_optkeys + def tagid(id) if id.kind_of?(TkWindow) #id.path diff --git a/ext/tk/lib/tkextlib/bwidget/panelframe.rb b/ext/tk/lib/tkextlib/bwidget/panelframe.rb new file mode 100644 index 0000000000..13f8817d74 --- /dev/null +++ b/ext/tk/lib/tkextlib/bwidget/panelframe.rb @@ -0,0 +1,51 @@ +# +# tkextlib/bwidget/panelframe.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# + +require 'tk' +require 'tk/frame' +require 'tkextlib/bwidget.rb' + +module Tk + module BWidget + class PanelFrame < TkWindow + end + end +end + +class Tk::BWidget::PanelFrame + TkCommandNames = ['PanelFrame'.freeze].freeze + WidgetClassName = 'PanelFrame'.freeze + WidgetClassNames[WidgetClassName] = self + + def __strval_optkeys + super() + ['panelforeground', 'panelbackground'] + end + private :__strval_optkeys + + def add(win, keys={}) + tk_send('add', win, keys) + self + end + + def delete(*wins) + tk_send('delete', *wins) + self + end + + def get_frame(&b) + win = window(tk_send_without_enc('getframe')) + win.instance_eval(&b) if b + win + end + + def items + list(tk_send('items')) + end + + def remove(*wins) + tk_send('remove', *wins) + self + end +end diff --git a/ext/tk/lib/tkextlib/bwidget/passwddlg.rb b/ext/tk/lib/tkextlib/bwidget/passwddlg.rb index bfab7a078f..0b635d97bb 100644 --- a/ext/tk/lib/tkextlib/bwidget/passwddlg.rb +++ b/ext/tk/lib/tkextlib/bwidget/passwddlg.rb @@ -19,6 +19,17 @@ class Tk::BWidget::PasswdDlg WidgetClassName = 'PasswdDlg'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() << 'loginhelptext' << 'loginlabel' << 'logintext' << + 'passwdlabel' << 'passwdtext' + end + private :__strval_optkeys + + def __boolval_optkeys + super() << 'passwdeditable' << 'homogeneous' + end + private :__boolval_optkeys + def __tkvariable_optkeys super() << 'loginhelpvar' << 'logintextvariable' << 'passwdhelpvar' << 'passwdtextvariable' diff --git a/ext/tk/lib/tkextlib/bwidget/scrollview.rb b/ext/tk/lib/tkextlib/bwidget/scrollview.rb index 5da528bd49..0546af2c43 100644 --- a/ext/tk/lib/tkextlib/bwidget/scrollview.rb +++ b/ext/tk/lib/tkextlib/bwidget/scrollview.rb @@ -17,4 +17,9 @@ class Tk::BWidget::ScrollView TkCommandNames = ['ScrollView'.freeze].freeze WidgetClassName = 'ScrollView'.freeze WidgetClassNames[WidgetClassName] = self + + def __strval_optkeys + super() << 'fill' + end + private :__strval_optkeys end diff --git a/ext/tk/lib/tkextlib/bwidget/selectfont.rb b/ext/tk/lib/tkextlib/bwidget/selectfont.rb index 46ca0dbca8..478787602a 100644 --- a/ext/tk/lib/tkextlib/bwidget/selectfont.rb +++ b/ext/tk/lib/tkextlib/bwidget/selectfont.rb @@ -25,9 +25,15 @@ class Tk::BWidget::SelectFont WidgetClassName = 'SelectFont'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() << 'sampletext' << 'title' + end + private :__strval_optkeys + def __font_optkeys [] # without fontobj operation end + private :__font_optkeys def create tk_call(self.class::TkCommandNames[0], @path, *hash_kv(@keys)) diff --git a/ext/tk/lib/tkextlib/bwidget/spinbox.rb b/ext/tk/lib/tkextlib/bwidget/spinbox.rb index 9560abb663..ca4c046e5c 100644 --- a/ext/tk/lib/tkextlib/bwidget/spinbox.rb +++ b/ext/tk/lib/tkextlib/bwidget/spinbox.rb @@ -22,6 +22,21 @@ class Tk::BWidget::SpinBox WidgetClassName = 'SpinBox'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() << 'helptext' << 'insertbackground' << 'entryfg' << 'entrybg' + end + private :__strval_optkeys + + def __boolval_optkeys + super() << 'dragenabled' << 'dropenabled' << 'editable' + end + private :__boolval_optkeys + + def __listval_optkeys + super() << 'values' + end + private :__listval_optkeys + def __tkvariable_optkeys super() << 'helpvar' end diff --git a/ext/tk/lib/tkextlib/bwidget/statusbar.rb b/ext/tk/lib/tkextlib/bwidget/statusbar.rb new file mode 100644 index 0000000000..df16e4c0b7 --- /dev/null +++ b/ext/tk/lib/tkextlib/bwidget/statusbar.rb @@ -0,0 +1,46 @@ +# +# tkextlib/bwidget/statusbar.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# + +require 'tk' +require 'tk/frame' +require 'tkextlib/bwidget.rb' + +module Tk + module BWidget + class StatusBar < TkWindow + end + end +end + +class Tk::BWidget::StatusBar + TkCommandNames = ['StatusBar'.freeze].freeze + WidgetClassName = 'StatusBar'.freeze + WidgetClassNames[WidgetClassName] = self + + def __boolval_optkeys + super() << 'showresize' + end + private :__boolval_optkeys + + def add(win, keys={}) + tk_send('add', win, keys) + self + end + + def delete(*wins) + tk_send('delete', *wins) + self + end + + def get_frame(&b) + win = window(tk_send_without_enc('getframe')) + win.instance_eval(&b) if b + win + end + + def items + list(tk_send('items')) + end +end diff --git a/ext/tk/lib/tkextlib/bwidget/tree.rb b/ext/tk/lib/tkextlib/bwidget/tree.rb index c405736653..e7178debe2 100644 --- a/ext/tk/lib/tkextlib/bwidget/tree.rb +++ b/ext/tk/lib/tkextlib/bwidget/tree.rb @@ -32,6 +32,17 @@ class Tk::BWidget::Tree end end + def __strval_optkeys + super() << 'crossfill' << 'linesfill' + end + private :__strval_optkeys + + def __boolval_optkeys + super() << 'dragenabled' << 'dropenabled' << + 'redraw' << 'selectfill' << 'showlines' + end + private :__boolval_optkeys + def __tkvariable_optkeys super() << 'helpvar' end diff --git a/ext/tk/lib/tkextlib/itk/incr_tk.rb b/ext/tk/lib/tkextlib/itk/incr_tk.rb index 9f96109f1a..d37fd12a7c 100644 --- a/ext/tk/lib/tkextlib/itk/incr_tk.rb +++ b/ext/tk/lib/tkextlib/itk/incr_tk.rb @@ -115,6 +115,11 @@ module Tk include Wm include TkMenuSpec + + def __strval_optkeys + super() << 'title' + end + private :__strval_optkeys end ############################ diff --git a/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb b/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb index 1ff190b9ff..a055e07ac9 100644 --- a/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb @@ -32,6 +32,11 @@ class Tk::Iwidgets::Buttonbox end private :__item_config_cmd + def __item_boolval_optkeys(id) + super(id) << 'defaultring' + end + private :__item_boolval_optkeys + def tagid(tagOrId) if tagOrId.kind_of?(Tk::Itk::Component) tagOrId.name diff --git a/ext/tk/lib/tkextlib/iwidgets/calendar.rb b/ext/tk/lib/tkextlib/iwidgets/calendar.rb index 97688bb7d0..0152f8593a 100644 --- a/ext/tk/lib/tkextlib/iwidgets/calendar.rb +++ b/ext/tk/lib/tkextlib/iwidgets/calendar.rb @@ -18,6 +18,24 @@ class Tk::Iwidgets::Calendar WidgetClassName = 'Calendar'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() + [ + 'buttonforeground', 'outline', 'selectcolor', + 'weekdaybackground', 'weekendbackground' + ] + end + private :__strval_optkeys + + def __listval_optkeys + super() << 'days' + end + private :__listval_optkeys + + def __font_optkeys + super() + ['currentdatefont', 'datefont', 'dayfont', 'titlefont'] + end + private :__font_optkeys + #################################### include Tk::ValidateConfigure diff --git a/ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb b/ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb index 1e2a476591..fa5e90ad05 100644 --- a/ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb @@ -18,6 +18,16 @@ class Tk::Iwidgets::Canvasprintbox WidgetClassName = 'Canvasprintbox'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() << 'filename' + end + private :__strval_optkeys + + def __boolval_optkeys + super() << 'stretch' + end + private :__boolval_optkeys + def get_output tk_call(@path, 'getoutput') end diff --git a/ext/tk/lib/tkextlib/iwidgets/checkbox.rb b/ext/tk/lib/tkextlib/iwidgets/checkbox.rb index 05d0e1d813..abd23299a8 100644 --- a/ext/tk/lib/tkextlib/iwidgets/checkbox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/checkbox.rb @@ -32,6 +32,11 @@ class Tk::Iwidgets::Checkbox end private :__item_config_cmd + def __item_boolval_optkeys(id) + super(id) << 'defaultring' + end + private :__item_boolval_optkeys + def tagid(tagOrId) if tagOrId.kind_of?(Tk::Itk::Component) tagOrId.name diff --git a/ext/tk/lib/tkextlib/iwidgets/combobox.rb b/ext/tk/lib/tkextlib/iwidgets/combobox.rb index 1cf10b4004..a6d54d78fa 100644 --- a/ext/tk/lib/tkextlib/iwidgets/combobox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/combobox.rb @@ -18,6 +18,11 @@ class Tk::Iwidgets::Combobox WidgetClassName = 'Combobox'.freeze WidgetClassNames[WidgetClassName] = self + def __boolval_optkeys + super() << 'completion' << 'dropdown' << 'editable' << 'unique' + end + private :__boolval_optkeys + def clear(component=None) tk_call(@path, 'clear', component) self diff --git a/ext/tk/lib/tkextlib/iwidgets/datefield.rb b/ext/tk/lib/tkextlib/iwidgets/datefield.rb index 924aef9c4d..632f3334dc 100644 --- a/ext/tk/lib/tkextlib/iwidgets/datefield.rb +++ b/ext/tk/lib/tkextlib/iwidgets/datefield.rb @@ -18,6 +18,21 @@ class Tk::Iwidgets::Datefield WidgetClassName = 'Datefield'.freeze WidgetClassNames[WidgetClassName] = self + def __boolval_optkeys + super() << 'gmt' + end + private :__boolval_optkeys + + def __strval_optkeys + super() << 'textbackground' + end + private :__strval_optkeys + + def __font_optkeys + super() << 'textfont' + end + private :__font_optkeys + def get_string tk_call(@path, 'get', '-string') end diff --git a/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb b/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb index 88b9a97094..d6c668621d 100644 --- a/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb +++ b/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb @@ -32,6 +32,11 @@ class Tk::Iwidgets::Dialogshell end private :__item_config_cmd + def __item_boolval_optkeys(id) + super(id) << 'defaultring' + end + private :__item_boolval_optkeys + def tagid(tagOrId) if tagOrId.kind_of?(Tk::Itk::Component) tagOrId.name diff --git a/ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb b/ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb index 8418467925..9bc063ba69 100644 --- a/ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb @@ -18,6 +18,11 @@ class Tk::Iwidgets::Disjointlistbox WidgetClassName = 'Disjointlistbox'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() << 'lhslabeltext' << 'rhslabeltext' << 'lhsbuttonlabel' << 'rhsbuttonlabel' + end + private :__strval_optkeys + def set_lhs(*items) tk_call(@path, 'setlhs', items) self diff --git a/ext/tk/lib/tkextlib/iwidgets/entryfield.rb b/ext/tk/lib/tkextlib/iwidgets/entryfield.rb index 7a54b7c803..6aa933ce06 100644 --- a/ext/tk/lib/tkextlib/iwidgets/entryfield.rb +++ b/ext/tk/lib/tkextlib/iwidgets/entryfield.rb @@ -18,6 +18,11 @@ class Tk::Iwidgets::Entryfield WidgetClassName = 'Entryfield'.freeze WidgetClassNames[WidgetClassName] = self + def __font_optkeys + super() << 'textfont' + end + private :__font_optkeys + #################################### include Tk::ValidateConfigure diff --git a/ext/tk/lib/tkextlib/iwidgets/extbutton.rb b/ext/tk/lib/tkextlib/iwidgets/extbutton.rb index 7b1e35aa2d..158d9d474a 100644 --- a/ext/tk/lib/tkextlib/iwidgets/extbutton.rb +++ b/ext/tk/lib/tkextlib/iwidgets/extbutton.rb @@ -18,6 +18,16 @@ class Tk::Iwidgets::Extbutton WidgetClassName = 'Extbutton'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() << 'bitmapforeground' << 'ringbackground' + end + private :__strval_optkeys + + def __boolval_optkeys + super() << 'defaultring' + end + private :__boolval_optkeys + def invoke tk_call(@path, 'invoke') self diff --git a/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb b/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb index 282647893c..501f4c90a0 100644 --- a/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb @@ -18,6 +18,19 @@ class Tk::Iwidgets::Extfileselectionbox WidgetClassName = 'Extfileselectionbox'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() + [ + 'dirslabel', 'fileslabel', 'filterlabel', 'mask', 'nomatchstring', + 'selectionlabel' + ] + end + private :__strval_optkeys + + def __boolval_optkeys + super() + ['dirson', 'fileson', 'filteron', 'selectionon'] + end + private :__boolval_optkeys + def child_site window(tk_call(@path, 'childsite')) end diff --git a/ext/tk/lib/tkextlib/iwidgets/feedback.rb b/ext/tk/lib/tkextlib/iwidgets/feedback.rb index d7439d818a..0a25237a24 100644 --- a/ext/tk/lib/tkextlib/iwidgets/feedback.rb +++ b/ext/tk/lib/tkextlib/iwidgets/feedback.rb @@ -18,6 +18,11 @@ class Tk::Iwidgets::Feedback WidgetClassName = 'Feedback'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() << 'barcolor' + end + private :__strval_optkeys + def reset tk_call(@path, 'reset') self diff --git a/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb b/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb index 46de13d1b2..7b331d0b40 100644 --- a/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb @@ -18,6 +18,19 @@ class Tk::Iwidgets::Fileselectionbox WidgetClassName = 'Fileselectionbox'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() + [ + 'directory', 'dirslabel', 'fileslabel', 'filterlabel', 'mask', + 'nomatchstring', 'selectionlabel' + ] + end + private :__strval_optkeys + + def __boolval_optkeys + super() + ['dirson', 'fileson', 'filteron', 'selectionon'] + end + private :__boolval_optkeys + def child_site window(tk_call(@path, 'childsite')) end diff --git a/ext/tk/lib/tkextlib/iwidgets/finddialog.rb b/ext/tk/lib/tkextlib/iwidgets/finddialog.rb index a161c3c2a4..75e219c37e 100644 --- a/ext/tk/lib/tkextlib/iwidgets/finddialog.rb +++ b/ext/tk/lib/tkextlib/iwidgets/finddialog.rb @@ -18,6 +18,19 @@ class Tk::Iwidgets::Finddialog WidgetClassName = 'Finddialog'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() + [ + 'patternbackground', 'patternforeground', + 'searchbackground', 'searchforeground' + ] + end + private :__strval_optkeys + + def __val2ruby_optkeys # { key=>proc, ... } + super().update('textwidget'=>proc{|v| window(v)}) + end + private :__val2ruby_optkeys + def clear tk_call(@path, 'clear') self diff --git a/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb b/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb index 862876ee9f..4cc6aeecbd 100644 --- a/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb +++ b/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb @@ -101,6 +101,21 @@ class Tk::Iwidgets::Hierarchy #################################### + def __boolval_optkeys + super() << 'alwaysquery' << 'expanded' << 'filter' + end + private :__boolval_optkeys + + def __strval_optkeys + super() << 'markbackground' << 'markforeground' << 'textbackground' + end + private :__strval_optkeys + + def __font_optkeys + super() << 'textfont' + end + private :__font_optkeys + def clear tk_call(@path, 'clear') self diff --git a/ext/tk/lib/tkextlib/iwidgets/hyperhelp.rb b/ext/tk/lib/tkextlib/iwidgets/hyperhelp.rb index 22e86339a6..77b0e090cd 100644 --- a/ext/tk/lib/tkextlib/iwidgets/hyperhelp.rb +++ b/ext/tk/lib/tkextlib/iwidgets/hyperhelp.rb @@ -18,6 +18,16 @@ class Tk::Iwidgets::Hyperhelp WidgetClassName = 'Hyperhelp'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() << 'helpdir' + end + private :__strval_optkeys + + def __listval_optkeys + super() << 'topics' + end + private :__listval_optkeys + def show_topic(topic) tk_call(@path, 'showtopic', topic) self diff --git a/ext/tk/lib/tkextlib/iwidgets/labeledframe.rb b/ext/tk/lib/tkextlib/iwidgets/labeledframe.rb index 363047018f..e77e85045d 100644 --- a/ext/tk/lib/tkextlib/iwidgets/labeledframe.rb +++ b/ext/tk/lib/tkextlib/iwidgets/labeledframe.rb @@ -18,11 +18,21 @@ class Tk::Iwidgets::Labeledframe WidgetClassName = 'Labeledframe'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() << 'labeltext' + end + private :__strval_optkeys + def __tkvariable_optkeys super() << 'labelvariable' end private :__tkvariable_optkeys + def __font_optkeys + super() << 'labelfont' + end + private :__font_optkeys + def child_site window(tk_call(@path, 'childsite')) end diff --git a/ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb b/ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb index cbd5fa0957..99387710cb 100644 --- a/ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb +++ b/ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb @@ -20,11 +20,21 @@ class Tk::Iwidgets::Labeledwidget WidgetClassName = 'Labeledwidget'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() << 'labeltext' + end + private :__strval_optkeys + def __tkvariable_optkeys super() << 'labelvariable' end private :__tkvariable_optkeys + def __font_optkeys + super() << 'labelfont' + end + private :__font_optkeys + def self.alignlabels(*wins) tk_call('::iwidgets::Labeledwidget::alignlabels', *wins) end diff --git a/ext/tk/lib/tkextlib/iwidgets/mainwindow.rb b/ext/tk/lib/tkextlib/iwidgets/mainwindow.rb index 4570afc6d0..4b2541b997 100644 --- a/ext/tk/lib/tkextlib/iwidgets/mainwindow.rb +++ b/ext/tk/lib/tkextlib/iwidgets/mainwindow.rb @@ -18,6 +18,21 @@ class Tk::Iwidgets::Mainwindow WidgetClassName = 'Mainwindow'.freeze WidgetClassNames[WidgetClassName] = self + def __boolval_optkeys + super() << 'helpline' << 'statusline' + end + private :__boolval_optkeys + + def __strval_optkeys + super() << 'menubarbackground' << 'menubarforeground' << 'toolbarforeground' + end + private :__strval_optkeys + + def __font_optkeys + super() << 'menubarfont' << 'toolbarfont' + end + private :__font_optkeys + def child_site window(tk_call(@path, 'childsite')) end diff --git a/ext/tk/lib/tkextlib/iwidgets/menubar.rb b/ext/tk/lib/tkextlib/iwidgets/menubar.rb index ba4bb5f40d..dea3d34c2a 100644 --- a/ext/tk/lib/tkextlib/iwidgets/menubar.rb +++ b/ext/tk/lib/tkextlib/iwidgets/menubar.rb @@ -18,6 +18,11 @@ class Tk::Iwidgets::Menubar WidgetClassName = 'Menubar'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() << 'menubuttons' + end + private :__strval_optkeys + def __tkvariable_optkeys super() << 'helpvariable' end @@ -37,6 +42,16 @@ class Tk::Iwidgets::Menubar end private :__item_config_cmd + def __item_strval_optkeys(id) + super(id) << 'selectcolor' + end + private :__item_strval_optkeys + + def __item_tkvariable_optkeys(id) + super(id) << 'helpstr' + end + private :__item_tkvariable_optkeys + def tagid(tagOrId) if tagOrId.kind_of?(Tk::Itk::Component) tagOrId.name diff --git a/ext/tk/lib/tkextlib/iwidgets/messagebox.rb b/ext/tk/lib/tkextlib/iwidgets/messagebox.rb index 608f6f7adb..2bbbec7666 100644 --- a/ext/tk/lib/tkextlib/iwidgets/messagebox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/messagebox.rb @@ -41,6 +41,11 @@ class Tk::Iwidgets::Messagebox end end + def __item_boolval_optkeys(id) + super(id) << 'bell' << 'show' + end + private :__item_boolval_optkeys + alias typecget itemcget alias typeconfigure itemconfigure alias typeconfiginfo itemconfiginfo @@ -51,6 +56,11 @@ class Tk::Iwidgets::Messagebox #################################### + def __strval_optkeys + super() << 'filename' << 'savedir' + end + private :__strval_optkeys + def type_add(tag=nil, keys={}) if tag.kind_of?(Hash) keys = tag diff --git a/ext/tk/lib/tkextlib/iwidgets/notebook.rb b/ext/tk/lib/tkextlib/iwidgets/notebook.rb index 4df56cce7f..0f9d713ea1 100644 --- a/ext/tk/lib/tkextlib/iwidgets/notebook.rb +++ b/ext/tk/lib/tkextlib/iwidgets/notebook.rb @@ -23,12 +23,12 @@ class Tk::Iwidgets::Notebook include TkItemConfigMethod def __item_cget_cmd(id) - [self.path, 'tabcget', id] + [self.path, 'pagecget', id] end private :__item_cget_cmd def __item_config_cmd(id) - [self.path, 'tabconfigure', id] + [self.path, 'pageconfigure', id] end private :__item_config_cmd @@ -51,6 +51,11 @@ class Tk::Iwidgets::Notebook #################################### + def __boolval_optkeys + super() << 'auto' + end + private :__boolval_optkeys + def add(keys={}) window(tk_call(@path, 'add', *hash_kv(keys))) end diff --git a/ext/tk/lib/tkextlib/iwidgets/optionmenu.rb b/ext/tk/lib/tkextlib/iwidgets/optionmenu.rb index 226163a150..0c74440be7 100644 --- a/ext/tk/lib/tkextlib/iwidgets/optionmenu.rb +++ b/ext/tk/lib/tkextlib/iwidgets/optionmenu.rb @@ -18,6 +18,11 @@ class Tk::Iwidgets::Optionmenu WidgetClassName = 'Optionmenu'.freeze WidgetClassNames[WidgetClassName] = self + def __boolval_optkeys + super() << 'cyclicon' + end + private :__boolval_optkeys + def delete(first, last=nil) if last tk_call(@path, 'delete', first, last) diff --git a/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb b/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb index a205036239..035df0a5b8 100644 --- a/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb +++ b/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb @@ -51,6 +51,11 @@ class Tk::Iwidgets::Panedwindow #################################### + def __boolval_optkeys + super() << 'showhandle' + end + private :__boolval_optkeys + def add(tag=nil, keys={}) if tag.kind_of?(Hash) keys = tag diff --git a/ext/tk/lib/tkextlib/iwidgets/pushbutton.rb b/ext/tk/lib/tkextlib/iwidgets/pushbutton.rb index 25d3633507..c21007ca6c 100644 --- a/ext/tk/lib/tkextlib/iwidgets/pushbutton.rb +++ b/ext/tk/lib/tkextlib/iwidgets/pushbutton.rb @@ -18,6 +18,11 @@ class Tk::Iwidgets::Pushbutton WidgetClassName = 'Pushbutton'.freeze WidgetClassNames[WidgetClassName] = self + def __boolval_optkeys + super() << 'defaultring' + end + private :__boolval_optkeys + def invoke tk_call_without_enc(@path, 'invoke') self diff --git a/ext/tk/lib/tkextlib/iwidgets/radiobox.rb b/ext/tk/lib/tkextlib/iwidgets/radiobox.rb index 84c15082d6..d4316754f2 100644 --- a/ext/tk/lib/tkextlib/iwidgets/radiobox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/radiobox.rb @@ -32,6 +32,11 @@ class Tk::Iwidgets::Radiobox end private :__item_config_cmd + def __item_boolval_optkeys(id) + super(id) << 'defaultring' + end + private :__item_boolval_optkeys + def tagid(tagOrId) if tagOrId.kind_of?(Tk::Itk::Component) tagOrId.name diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb index 2a6f3a71b6..407c8f2aad 100644 --- a/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb +++ b/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb @@ -21,6 +21,16 @@ class Tk::Iwidgets::Scrolledcanvas ################################ + def __boolval_optkeys + super() << 'autoresize' + end + private :__boolval_optkeys + + def __strval_optkeys + super() << 'textbackground' + end + private :__strval_optkeys + def initialize(*args) super(*args) @canvas = component_widget('canvas') diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledhtml.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledhtml.rb index 7023d889d1..9b69ef07fe 100644 --- a/ext/tk/lib/tkextlib/iwidgets/scrolledhtml.rb +++ b/ext/tk/lib/tkextlib/iwidgets/scrolledhtml.rb @@ -18,6 +18,21 @@ class Tk::Iwidgets::Scrolledhtml WidgetClassName = 'Scrolledhtml'.freeze WidgetClassNames[WidgetClassName] = self + def __boolval_optkeys + super() << 'update' + end + private :__boolval_optkeys + + def __strval_optkeys + super() << 'fontname' << 'link' << 'alink' << 'textbackground' + end + private :__strval_optkeys + + def __font_optkeys + super() << 'fixedfont' + end + private :__font_optkeys + def import(href) tk_call(@path, 'import', href) self diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb index c933bf2985..cd1f6f0f79 100644 --- a/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb @@ -19,11 +19,21 @@ class Tk::Iwidgets::Scrolledlistbox WidgetClassName = 'Scrolledlistbox'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() << 'textbackground' + end + private :__strval_optkeys + def __tkvariable_optkeys super() << 'listvariable' end private :__tkvariable_optkeys + def __font_optkeys + super() << 'textfont' + end + private :__font_optkeys + ################################ def initialize(*args) diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb index 8e4162aaf2..fdafc8dc7f 100644 --- a/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb +++ b/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb @@ -19,6 +19,16 @@ class Tk::Iwidgets::Scrolledtext WidgetClassName = 'Scrolledtext'.freeze WidgetClassNames[WidgetClassName] = self + def __strval_optkeys + super() << 'textbackground' + end + private :__strval_optkeys + + def __font_optkeys + super() << 'textfont' + end + private :__font_optkeys + ################################ def initialize(*args) diff --git a/ext/tk/lib/tkextlib/iwidgets/selectionbox.rb b/ext/tk/lib/tkextlib/iwidgets/selectionbox.rb index 154a9792da..bb81fcca5e 100644 --- a/ext/tk/lib/tkextlib/iwidgets/selectionbox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/selectionbox.rb @@ -18,6 +18,16 @@ class Tk::Iwidgets::Selectionbox WidgetClassName = 'Selectionbox'.freeze WidgetClassNames[WidgetClassName] = self + def __boolval_optkeys + super() << 'itemson' << 'selectionon' + end + private :__boolval_optkeys + + def __strval_optkeys + super() << 'itemslabel' << 'selectionlabel' + end + private :__strval_optkeys + def child_site window(tk_call(@path, 'childsite')) end diff --git a/ext/tk/lib/tkextlib/iwidgets/spindate.rb b/ext/tk/lib/tkextlib/iwidgets/spindate.rb index 6099ba77b9..2c98eb4629 100644 --- a/ext/tk/lib/tkextlib/iwidgets/spindate.rb +++ b/ext/tk/lib/tkextlib/iwidgets/spindate.rb @@ -18,6 +18,16 @@ class Tk::Iwidgets::Spindate WidgetClassName = 'Spindate'.freeze WidgetClassNames[WidgetClassName] = self + def __boolval_optkeys + super() << 'dayon' << 'monthon' << 'yearon' + end + private :__boolval_optkeys + + def __strval_optkeys + super() << 'daylabel' << 'monthformat' << 'monthlabel' << 'yearlabel' + end + private :__strval_optkeys + def get_string tk_call(@path, 'get', '-string') end diff --git a/ext/tk/lib/tkextlib/iwidgets/spinint.rb b/ext/tk/lib/tkextlib/iwidgets/spinint.rb index 071b6ab8f7..5eb944d081 100644 --- a/ext/tk/lib/tkextlib/iwidgets/spinint.rb +++ b/ext/tk/lib/tkextlib/iwidgets/spinint.rb @@ -17,4 +17,14 @@ class Tk::Iwidgets::Spinint TkCommandNames = ['::iwidgets::spinint'.freeze].freeze WidgetClassName = 'Spinint'.freeze WidgetClassNames[WidgetClassName] = self + + def __boolval_optkeys + super() << 'wrap' + end + private :__boolval_optkeys + + def __numlistval_optkeys + super() << 'range' + end + private :__numlistval_optkeys end diff --git a/ext/tk/lib/tkextlib/iwidgets/spintime.rb b/ext/tk/lib/tkextlib/iwidgets/spintime.rb index c1e1f5e5f1..0ff683ab56 100644 --- a/ext/tk/lib/tkextlib/iwidgets/spintime.rb +++ b/ext/tk/lib/tkextlib/iwidgets/spintime.rb @@ -18,6 +18,16 @@ class Tk::Iwidgets::Spintime WidgetClassName = 'Spintime'.freeze WidgetClassNames[WidgetClassName] = self + def __boolval_optkeys + super() << 'houron' << 'militaryon' << 'minutelabel' << 'secondlabel' + end + private :__boolval_optkeys + + def __strval_optkeys + super() << 'hourlabel' << 'minuteon' << 'secondon' + end + private :__strval_optkeys + def get_string tk_call(@path, 'get', '-string') end diff --git a/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb b/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb index 5321331551..0d9715f87b 100644 --- a/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb +++ b/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb @@ -23,15 +23,20 @@ class Tk::Iwidgets::Tabnotebook include TkItemConfigMethod def __item_cget_cmd(id) - [self.path, 'tabcget', id] + [self.path, 'pagecget', id] end private :__item_cget_cmd def __item_config_cmd(id) - [self.path, 'tabconfigure', id] + [self.path, 'pageconfigure', id] end private :__item_config_cmd + def __item_strval_optkeys(id) + super(id) << 'tabbackground' << 'tabforeground' + end + private :__item_strval_optkeys + def tagid(tagOrId) if tagOrId.kind_of?(Tk::Itk::Component) tagOrId.name @@ -51,6 +56,16 @@ class Tk::Iwidgets::Tabnotebook #################################### + def __boolval_optkeys + super() << 'auto' << 'equaltabs' << 'raiseselect' << 'tabborders' + end + private :__boolval_optkeys + + def __strval_optkeys + super() << 'backdrop' << 'tabbackground' << 'tabforeground' + end + private :__strval_optkeys + def initialize(*args) super(*args) @tabset = self.component_widget('tabset') diff --git a/ext/tk/lib/tkextlib/iwidgets/tabset.rb b/ext/tk/lib/tkextlib/iwidgets/tabset.rb index 1b76916ab7..54e56d0514 100644 --- a/ext/tk/lib/tkextlib/iwidgets/tabset.rb +++ b/ext/tk/lib/tkextlib/iwidgets/tabset.rb @@ -51,6 +51,16 @@ class Tk::Iwidgets::Tabset #################################### + def __boolval_optkeys + super() << 'equaltabs' << 'raiseselect' << 'tabborders' + end + private :__boolval_optkeys + + def __strval_optkeys + super() << 'backdrop' + end + private :__strval_optkeys + def add(keys={}) window(tk_call(@path, 'add', *hash_kv(keys))) end diff --git a/ext/tk/lib/tkextlib/iwidgets/timeentry.rb b/ext/tk/lib/tkextlib/iwidgets/timeentry.rb index 987cddc1e0..588da77dc8 100644 --- a/ext/tk/lib/tkextlib/iwidgets/timeentry.rb +++ b/ext/tk/lib/tkextlib/iwidgets/timeentry.rb @@ -17,4 +17,9 @@ class Tk::Iwidgets::Timeentry TkCommandNames = ['::iwidgets::timeentry'.freeze].freeze WidgetClassName = 'Timeentry'.freeze WidgetClassNames[WidgetClassName] = self + + def __strval_optkeys + super() << 'closetext' + end + private :__strval_optkeys end diff --git a/ext/tk/lib/tkextlib/iwidgets/timefield.rb b/ext/tk/lib/tkextlib/iwidgets/timefield.rb index 602093eb7e..28e1504797 100644 --- a/ext/tk/lib/tkextlib/iwidgets/timefield.rb +++ b/ext/tk/lib/tkextlib/iwidgets/timefield.rb @@ -18,6 +18,21 @@ class Tk::Iwidgets::Timefield WidgetClassName = 'Timefield'.freeze WidgetClassNames[WidgetClassName] = self + def __boolval_optkeys + super() << 'gmt' + end + private :__boolval_optkeys + + def __strval_optkeys + super() << 'textbackground' + end + private :__strval_optkeys + + def __font_optkeys + super() << 'textfont' + end + private :__font_optkeys + def get_string tk_call(@path, 'get', '-string') end diff --git a/ext/tk/lib/tkextlib/iwidgets/toolbar.rb b/ext/tk/lib/tkextlib/iwidgets/toolbar.rb index 74bb0cc96c..17cfa62156 100644 --- a/ext/tk/lib/tkextlib/iwidgets/toolbar.rb +++ b/ext/tk/lib/tkextlib/iwidgets/toolbar.rb @@ -37,6 +37,11 @@ class Tk::Iwidgets::Toolbar end private :__item_config_cmd + def __item_strval_optkeys(id) + super(id) << 'helpstr' << 'balloonstr' + end + private :__item_strval_optkeys + def tagid(tagOrId) if tagOrId.kind_of?(Tk::Itk::Component) tagOrId.name @@ -48,6 +53,21 @@ class Tk::Iwidgets::Toolbar #################################### + def __strval_optkeys + super() << 'balloonbackground' << 'balloonforeground' + end + private :__strval_optkeys + + def __tkvariable_optkeys + super() << 'helpvariable' + end + private :__tkvariable_optkeys + + def __font_optkeys + super() << 'balloonfont' + end + private :__font_optkeys + def add(type, tag=nil, keys={}) if tag.kind_of?(Hash) keys = tag diff --git a/ext/tk/lib/tkextlib/iwidgets/watch.rb b/ext/tk/lib/tkextlib/iwidgets/watch.rb index f62c0b931e..ab2b687cf9 100644 --- a/ext/tk/lib/tkextlib/iwidgets/watch.rb +++ b/ext/tk/lib/tkextlib/iwidgets/watch.rb @@ -18,6 +18,17 @@ class Tk::Iwidgets::Watch WidgetClassName = 'Watch'.freeze WidgetClassNames[WidgetClassName] = self + def __boolval_optkeys + super() << 'showampm' + end + private :__boolval_optkeys + + def __strval_optkeys + super() << 'clockcolor' << 'hourcolor' << 'minutecolor' << + 'pivotcolor' << 'secondcolor' << 'tickcolor' + end + private :__strval_optkeys + def get_string tk_call(@path, 'get', '-string') end diff --git a/ext/tk/lib/tkextlib/tcllib.rb b/ext/tk/lib/tkextlib/tcllib.rb index f238a975a4..c6138f4275 100644 --- a/ext/tk/lib/tkextlib/tcllib.rb +++ b/ext/tk/lib/tkextlib/tcllib.rb @@ -43,24 +43,45 @@ module Tk TkComm::TkExtlibAutoloadModule.unshift(self) # package:: ctext - autoload :CText, 'tkextlib/tcllib/ctext' + autoload :CText, 'tkextlib/tcllib/ctext' + + # package:: getstring + autoload :GetString_Dialog, 'tkextlib/tcllib/getstring' + + # package:: history + autoload :History, 'tkextlib/tcllib/history' # package:: datefield - autoload :Datefield, 'tkextlib/tcllib/datefield' - autoload :DateField, 'tkextlib/tcllib/datefield' + autoload :Datefield, 'tkextlib/tcllib/datefield' + autoload :DateField, 'tkextlib/tcllib/datefield' # package:: ico - autoload :ICO, 'tkextlib/tcllib/ico' + autoload :ICO, 'tkextlib/tcllib/ico' # package:: ipentry - autoload :IP_Entry, 'tkextlib/tcllib/ip_entry' - autoload :IPEntry, 'tkextlib/tcllib/ip_entry' + autoload :IP_Entry, 'tkextlib/tcllib/ip_entry' + autoload :IPEntry, 'tkextlib/tcllib/ip_entry' + + # package:: swaplist + autoload :Swaplist_Dialog, 'tkextlib/tcllib/swaplist' # package:: Plotchart - autoload :Plotchart, 'tkextlib/tcllib/plotchart' + autoload :Plotchart, 'tkextlib/tcllib/plotchart' + + # package:: tablelist + autoload :Tablelist, 'tkextlib/tcllib/tablelist' + autoload :TableList, 'tkextlib/tcllib/tablelist' + autoload :Tablelist_Tile, 'tkextlib/tcllib/tablelist_tile' + autoload :TableList_Tile, 'tkextlib/tcllib/tablelist_tile' # package:: tkpiechart - autoload :Tkpiechart, 'tkextlib/tcllib/tkpiechart' + autoload :Tkpiechart, 'tkextlib/tcllib/tkpiechart' + + # package:: tooltip + autoload :Tooltip, 'tkextlib/tcllib/tooltip' + + # package:: widget + autoload :Wdiget, 'tkextlib/tcllib/widget' end end diff --git a/ext/tk/lib/tkextlib/tcllib/autoscroll.rb b/ext/tk/lib/tkextlib/tcllib/autoscroll.rb index f2c898458f..6940a9174c 100644 --- a/ext/tk/lib/tkextlib/tcllib/autoscroll.rb +++ b/ext/tk/lib/tkextlib/tcllib/autoscroll.rb @@ -125,6 +125,7 @@ class TkScrollbar end # TkPackage.require('autoscroll', '1.0') +# TkPackage.require('autoscroll', '1.1') TkPackage.require('autoscroll') module Tk @@ -142,7 +143,16 @@ module Tk def self.unautoscroll(win) tk_call_without_enc('::autoscroll::unautoscroll', win.path) end + + def self.wrap + # v1.1 + tk_call_without_enc('::autoscroll::wrap') + end + + def self.unwrap + # v1.1 + tk_call_without_enc('::autoscroll::unwrap') + end end end end - diff --git a/ext/tk/lib/tkextlib/tcllib/ctext.rb b/ext/tk/lib/tkextlib/tcllib/ctext.rb index aa2ef20365..70a45dd8e7 100644 --- a/ext/tk/lib/tkextlib/tcllib/ctext.rb +++ b/ext/tk/lib/tkextlib/tcllib/ctext.rb @@ -47,6 +47,17 @@ class Tk::Tcllib::CText end private :create_self + def __strval_optkeys + super() << 'linemapfg' << 'linemapbg' << + 'linemap_select_fg' << 'linemap_select_bg' + end + private :__strval_optkeys + + def __boolval_optkeys + super() << 'highlight' << 'linemap_markable' + end + private :__boolval_optkeys + def append(*args) tk_send('append', *args) end diff --git a/ext/tk/lib/tkextlib/tcllib/dialog.rb b/ext/tk/lib/tkextlib/tcllib/dialog.rb new file mode 100644 index 0000000000..825621b5a1 --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/dialog.rb @@ -0,0 +1,84 @@ +# +# tkextlib/tcllib/dialog.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * Generic dialog widget (themed) +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('widget::dialog', '1.2') +TkPackage.require('widget::dialog') + +module Tk::Tcllib + module Widget + class Dialog < TkWindow + PACKAGE_NAME = 'widget::dialog'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('widget::dialog') + rescue + '' + end + end + end + end +end + +class Tk::Tcllib::Widget::Dialog + TkCommandNames = ['::widget::dialog'.freeze].freeze + + def __boolval_optkeys + ['separator', 'synchronous', 'transient'] + end + private :__boolval_optkeys + + def create_self(keys) + if keys and keys != None + tk_call_without_enc(self.class::TkCommandNames[0], @path, + *hash_kv(keys, true)) + else + tk_call_without_enc(self.class::TkCommandNames[0], @path) + end + end + private :create_self + + def add(what, *args) + window(tk_send('add', *args)) + end + + def get_frame + window(tk_send('getframe')) + end + + def set_widget(widget) + tk_send('setwidget', widget) + self + end + + def display + tk_send('display') + self + end + alias show display + + def cancel + tk_send('cancel') + self + end + + def close(reason = None) + tk_send('close', reason) + end + + def withdraw + tk_send('withdraw') + self + end +end diff --git a/ext/tk/lib/tkextlib/tcllib/getstring.rb b/ext/tk/lib/tkextlib/tcllib/getstring.rb new file mode 100644 index 0000000000..bf5e54e8cf --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/getstring.rb @@ -0,0 +1,131 @@ +# +# tkextlib/tcllib/getstring.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * A dialog which consists of an Entry, OK, and Cancel buttons. +# + +require 'tk' +require 'tk/entry' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('getstring', '0.1') +TkPackage.require('getstring') + +module Tk::Tcllib + class GetString_Dialog < TkWindow + PACKAGE_NAME = 'getstring'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('getstring') + rescue + '' + end + end + end +end + + +class Tk::Tcllib::GetString_Dialog + TkCommandNames = ['::getstring::tk_getString'.freeze].freeze + WidgetClassName = 'TkSDialog'.freeze + WidgetClassNames[WidgetClassName] = self + + def self.show(*args) + dialog = self.new(*args) + dialog.show + [dialog.status, dialog.value] + end + def self.display(*args) + self.show(*args) + end + + def initialize(*args) # args = (parent=nil, text='', keys=nil) + keys = args.pop + if keys.kind_of?(Hash) + text = args.pop + @keys = _symbolkey2str(keys) + args.push(keys) + else + text = keys + @keys = {} + end + if text + @text = text.dup + else + @text = '' + end + + @variable = TkVariable.new + @status = nil + + super(*args) + end + + def create_self(keys) + # dummy + end + private :create_self + + def show + @variable.value = '' + @status = bool(tk_call(self.class::TkCommandNames[0], + @path, @variable, @text, *hash_kv(@keys))) + end + alias display show + + def status + @status + end + + def value + @variable.value + end + + def cget(slot) + slot = slot.to_s + if slot == 'text' + @text + else + @keys[slot] + end + end + + def configure(slot, value=None) + if slot.kind_of?(Hash) + slot.each{|k, v| configure(k, v)} + else + slot = slot.to_s + value = _symbolkey2str(value) if value.kind_of?(Hash) + if value && value != None + if slot == 'text' + @text = value.to_s + else + @keys[slot] = value + end + else + if slot == 'text' + @text = '' + else + @keys.delete(slot) + end + end + end + self + end + + def configinfo(slot = nil) + if slot + slot = slot.to_s + [ slot, nil, nil, nil, ( (slot == 'text')? @text: @keys[slot] ) ] + else + @keys.collect{|k, v| [ k, nil, nil, nil, v ] } \ + << [ 'text', nil, nil, nil, @text ] + end + end +end diff --git a/ext/tk/lib/tkextlib/tcllib/history.rb b/ext/tk/lib/tkextlib/tcllib/history.rb new file mode 100644 index 0000000000..a01a4ebfcc --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/history.rb @@ -0,0 +1,73 @@ +# +# tkextlib/tcllib/history.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * Provides a history for Entry widgets +# + +require 'tk' +require 'tk/entry' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('history', '0.1') +TkPackage.require('history') + +module Tk::Tcllib + module History + PACKAGE_NAME = 'history'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('history') + rescue + '' + end + end + end +end + +module Tk::Tcllib::History + extend TkCore + + def self.init(entry, length=None) + tk_call_without_enc('::history::init', entry.path, length) + entry.extend(self) # add methods to treat history to the entry widget + end + + def self.remove(entry) + tk_call_without_enc('::history::remove', entry.path) + entry + end + + def history_remove + tk_call_without_enc('::history::remove', @path) + self + end + + def history_add(text) + tk_call('::history::add', @path, text) + self + end + + def history_get + simplelist(tk_call_without_enc('::history::get', @path)) + end + + def history_clear + tk_call_without_enc('::history::clear', @path) + self + end + + def history_configure(opt, value) + tk_call('::history::configure', @path, opt, value) + self + end + + def history_configinfo(opt) + tk_call('::history::configure', @path, opt) + end +end diff --git a/ext/tk/lib/tkextlib/tcllib/ip_entry.rb b/ext/tk/lib/tkextlib/tcllib/ip_entry.rb index e24d1ba147..8c9e0bd683 100644 --- a/ext/tk/lib/tkextlib/tcllib/ip_entry.rb +++ b/ext/tk/lib/tkextlib/tcllib/ip_entry.rb @@ -51,6 +51,11 @@ class Tk::Tcllib::IP_Entry end private :create_self + def __strval_optkeys + super() << 'fg' << 'bg' << 'insertbackground' + end + private :__strval_optkeys + def complete? bool(tk_send_without_enc('complete')) end diff --git a/ext/tk/lib/tkextlib/tcllib/panelframe.rb b/ext/tk/lib/tkextlib/tcllib/panelframe.rb new file mode 100644 index 0000000000..2a4562e779 --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/panelframe.rb @@ -0,0 +1,72 @@ +# +# tkextlib/tcllib/panelframe.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * Create PanelFrame widgets. +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('widget::panelframe', '1.0') +TkPackage.require('widget::panelframe') + +module Tk::Tcllib + module Widget + class PanelFrame < TkWindow + PACKAGE_NAME = 'widget::panelframe'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('widget::panelframe') + rescue + '' + end + end + end + Panelframe = PanelFrame + end +end + +class Tk::Tcllib::Widget::PanelFrame + TkCommandNames = ['::widget::panelframe'.freeze].freeze + + def create_self(keys) + if keys and keys != None + tk_call_without_enc(self.class::TkCommandNames[0], @path, + *hash_kv(keys, true)) + else + tk_call_without_enc(self.class::TkCommandNames[0], @path) + end + end + private :create_self + + def add(what, *args) + window(tk_send('add', *args)) + end + + #def get_frame + # window(tk_send('getframe')) + #end + + def set_widget(widget) + tk_send('setwidget', widget) + self + end + + def remove(*wins) + tk_send('remove', *wins) + end + def remove_destroy(*wins) + tk_send('remove', '-destroy', *wins) + end + alias delete remove_destroy + + def items + simplelist(tk_send('items')).collect!{|w| window(w)} + end +end diff --git a/ext/tk/lib/tkextlib/tcllib/plotchart.rb b/ext/tk/lib/tkextlib/tcllib/plotchart.rb index a8d2be00a8..f5f344ceb3 100644 --- a/ext/tk/lib/tkextlib/tcllib/plotchart.rb +++ b/ext/tk/lib/tkextlib/tcllib/plotchart.rb @@ -61,6 +61,7 @@ require 'tk' require 'tkextlib/tcllib.rb' # TkPackage.require('Plotchart', '0.9') +# TkPackage.require('Plotchart', '1.1') TkPackage.require('Plotchart') module Tk @@ -272,6 +273,51 @@ module Tk::Tcllib::Plotchart self end + def contourlines(xcrd, ycrd, vals, clss=None) + xcrd = array2tk_list(xcrd) if xcrd.kind_of?(Array) + ycrd = array2tk_list(ycrd) if ycrd.kind_of?(Array) + vals = array2tk_list(vals) if vals.kind_of?(Array) + clss = array2tk_list(clss) if clss.kind_of?(Array) + + tk_call_without_enc(@chart, 'contourlines', xcrd, ycrd, vals, clss) + self + end + + def contourfill(xcrd, ycrd, vals, klasses=None) + xcrd = array2tk_list(xcrd) if xcrd.kind_of?(Array) + ycrd = array2tk_list(ycrd) if ycrd.kind_of?(Array) + vals = array2tk_list(vals) if vals.kind_of?(Array) + clss = array2tk_list(clss) if clss.kind_of?(Array) + + tk_call_without_enc(@chart, 'contourfill', xcrd, ycrd, vals, clss) + self + end + + def contourbox(xcrd, ycrd, vals, klasses=None) + xcrd = array2tk_list(xcrd) if xcrd.kind_of?(Array) + ycrd = array2tk_list(ycrd) if ycrd.kind_of?(Array) + vals = array2tk_list(vals) if vals.kind_of?(Array) + clss = array2tk_list(clss) if clss.kind_of?(Array) + + tk_call_without_enc(@chart, 'contourbox', xcrd, ycrd, vals, clss) + self + end + + def color_map(colors) + colors = array2tk_list(colors) if colors.kind_of?(Array) + + tk_call_without_enc(@chart, 'colorMap', colors) + self + end + + def grid_cells(xcrd, ycrd) + xcrd = array2tk_list(xcrd) if xcrd.kind_of?(Array) + ycrd = array2tk_list(ycrd) if ycrd.kind_of?(Array) + + tk_call_without_enc(@chart, 'grid', xcrd, ycrd) + self + end + def dataconfig(series, key, value=None) if key.kind_of?(Hash) tk_call_without_enc(@chart, 'dataconfig', series, *hash_kv(key, true)) @@ -479,6 +525,13 @@ module Tk::Tcllib::Plotchart self end + def plot_funcont(conts, cmd=Proc.new) + conts = array2tk_list(conts) if conts.kind_of?(Array) + Tk.ip_eval("proc #{@path}_#{@chart} {x y} {#{install_cmd(cmd)} $x $y}") + tk_call_without_enc(@chart, 'plotfuncont', "#{@path}_#{@chart}", conts) + self + end + def grid_size(nxcells, nycells) tk_call_without_enc(@chart, 'gridsize', nxcells, nycells) self @@ -633,7 +686,7 @@ module Tk::Tcllib::Plotchart # time_end := String of time format (e.g. "1 january 2004") # items := Expected/maximum number of items # ( This determines the vertical spacing. ) - if args[0].kind_of?(Array) + if args[0].kind_of?(String) @time_begin = args.shift @time_end = args.shift @items = args.shift @@ -679,6 +732,105 @@ module Tk::Tcllib::Plotchart end end + ############################ + class Gnattchart < TkCanvas + include ChartMethod + + TkCommandNames = [ + 'canvas'.freeze, + '::Plotchart::createGnattchart'.freeze + ].freeze + + def initialize(*args) + # args := ([parent,] time_begin, time_end, items [, text_width] [, keys]) + # time_begin := String of time format (e.g. "1 january 2004") + # time_end := String of time format (e.g. "1 january 2004") + # items := Expected/maximum number of items + # ( This determines the vertical spacing. ) + if args[0].kind_of?(String) + @time_begin = args.shift + @time_end = args.shift + @items = args.shift + + if args[0].kind_of?(Fixnum) + @text_width = args.shift + else + @text_width = None + end + + super(*args) # create canvas widget + else + parent = args.shift + + @time_begin = args.shift + @time_end = args.shift + @items = args.shift + + if args[0].kind_of?(Fixnum) + @text_width = args.shift + else + @text_width = None + end + + if parent.kind_of?(TkCanvas) + @path = parent.path + else + super(parent, *args) # create canvas widget + end + end + + @chart = _create_chart + end + + def _create_chart + p self.class::TkCommandNames[1] if $DEBUG + tk_call_without_enc(self.class::TkCommandNames[1], @path, + @time_begin, @time_end, @items, @text_width) + end + private :_create_chart + + def task(txt, time_begin, time_end, completed=0.0) + list(tk_call_without_enc(@chart, 'task', txt, time_begin, time_end, + completed)).collect!{|id| + TkcItem.id2obj(self, id) + } + end + + def milestone(txt, time, col=None) + tk_call_without_enc(@chart, 'milestone', txt, time, col) + self + end + + def vertline(txt, time) + tk_call_without_enc(@chart, 'vertline', txt, time) + self + end + + def connect(from_task, to_task) + from_task = array2tk_list(from_task) if from_task.kind_of?(Array) + to_task = array2tk_list(to_task) if to_task.kind_of?(Array) + + tk_call_without_enc(@chart, 'connect', from_task, to_task) + self + end + + def summary(txt, tasks) + tasks = array2tk_list(tasks) if tasks.kind_of?(Array) + tk_call_without_enc(@chart, 'summary', tasks) + self + end + + def color_of_part(keyword, newcolor) + tk_call_without_enc(@chart, 'color', keyword, newcolor) + self + end + + def font_of_part(keyword, newfont) + tk_call_without_enc(@chart, 'font', keyword, newfont) + self + end + end + ############################ class PlotSeries < TkObject SeriesID_TBL = TkCore::INTERP.create_table diff --git a/ext/tk/lib/tkextlib/tcllib/ruler.rb b/ext/tk/lib/tkextlib/tcllib/ruler.rb new file mode 100644 index 0000000000..88ffb2c912 --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/ruler.rb @@ -0,0 +1,65 @@ +# +# tkextlib/tcllib/ruler.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * ruler widget +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('widget::ruler', '1.0') +TkPackage.require('widget::ruler') + +module Tk::Tcllib + module Widget + class Ruler < TkWindow + PACKAGE_NAME = 'widget::ruler'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('widget::ruler') + rescue + '' + end + end + end + end +end + +class Tk::Tcllib::Widget::Ruler + TkCommandNames = ['::widget::ruler'.freeze].freeze + + def __boolval_optkeys + ['showvalues', 'outline', 'grid'] + end + private :__boolval_optkeys + + def __numlistval_optkeys + ['interval', 'sizes'] + end + private :__numlistval_optkeys + + def create_self(keys) + if keys and keys != None + tk_call_without_enc(self.class::TkCommandNames[0], @path, + *hash_kv(keys, true)) + else + tk_call_without_enc(self.class::TkCommandNames[0], @path) + end + end + private :create_self + + def redraw + tk_send('redraw') + self + end + + def shade(org, dest, frac) + tk_send('shade', org, dest, frac) + end +end diff --git a/ext/tk/lib/tkextlib/tcllib/screenruler.rb b/ext/tk/lib/tkextlib/tcllib/screenruler.rb new file mode 100644 index 0000000000..1b4067e2f0 --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/screenruler.rb @@ -0,0 +1,68 @@ +# +# tkextlib/tcllib/screenruler.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * screenruler dialog +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('widget::screenruler', '1.1') +TkPackage.require('widget::screenruler') + +module Tk::Tcllib + module Widget + class ScreenRuler < TkWindow + PACKAGE_NAME = 'widget::ruler'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('widget::screenruler') + rescue + '' + end + end + end + Screenruler = ScreenRuler + end +end + +class Tk::Tcllib::Widget::ScreenRuler + TkCommandNames = ['::widget::screenruler'.freeze].freeze + + def __boolval_optkeys + ['topmost', 'reflect'] + end + private :__boolval_optkeys + + def __numlistval_optkeys + ['alpha'] + end + private :__numlistval_optkeys + + def create_self(keys) + if keys and keys != None + tk_call_without_enc(self.class::TkCommandNames[0], @path, + *hash_kv(keys, true)) + else + tk_call_without_enc(self.class::TkCommandNames[0], @path) + end + end + private :create_self + + def display + tk_send('display') + self + end + alias show display + + def hide + tk_send('hide') + self + end +end diff --git a/ext/tk/lib/tkextlib/tcllib/scrollwin.rb b/ext/tk/lib/tkextlib/tcllib/scrollwin.rb new file mode 100644 index 0000000000..717728e34a --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/scrollwin.rb @@ -0,0 +1,61 @@ +# +# tkextlib/tcllib/scrollwin.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * Scrolled widget +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('widget::scrolledwindow', '1.0') +TkPackage.require('widget::scrolledwindow') + +module Tk::Tcllib + module Widget + class ScrolledWindow < TkWindow + PACKAGE_NAME = 'widget::scrolledwindow'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('widget::scrolledwindow') + rescue + '' + end + end + end + Scrolledwindow = ScrolledWindow + end +end + +class Tk::Tcllib::Widget::ScrolledWindow + TkCommandNames = ['::widget::scrolledwindow'.freeze].freeze + + def __numlistval_optkeys + ['ipad'] + end + private :__numlistval_optkeys + + def create_self(keys) + if keys and keys != None + tk_call_without_enc(self.class::TkCommandNames[0], @path, + *hash_kv(keys, true)) + else + tk_call_without_enc(self.class::TkCommandNames[0], @path) + end + end + private :create_self + + def get_frame + window(tk_send('getframe')) + end + + def set_widget(widget) + tk_send('setwidget', widget) + self + end +end diff --git a/ext/tk/lib/tkextlib/tcllib/style.rb b/ext/tk/lib/tkextlib/tcllib/style.rb index 33d103a452..dac6916e46 100644 --- a/ext/tk/lib/tkextlib/tcllib/style.rb +++ b/ext/tk/lib/tkextlib/tcllib/style.rb @@ -39,6 +39,7 @@ module Tk::Tcllib end # TkPackage.require('style', '0.1') +# TkPackage.require('style', '0.3') TkPackage.require('style') module Tk::Tcllib diff --git a/ext/tk/lib/tkextlib/tcllib/superframe.rb b/ext/tk/lib/tkextlib/tcllib/superframe.rb new file mode 100644 index 0000000000..35da37efbf --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/superframe.rb @@ -0,0 +1,51 @@ +# +# tkextlib/tcllib/superframe.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * Superframe widget - enhanced labelframe widget +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('widget::superframe', '1.0') +TkPackage.require('widget::superframe') + +module Tk::Tcllib + module Widget + class SuperFrame < TkWindow + PACKAGE_NAME = 'widget::superframe'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('widget::superframe') + rescue + '' + end + end + end + Superframe = SuperlFrame + end +end + +class Tk::Tcllib::Widget::SuperFrame + TkCommandNames = ['::widget::superframe'.freeze].freeze + + def create_self(keys) + if keys and keys != None + tk_call_without_enc(self.class::TkCommandNames[0], @path, + *hash_kv(keys, true)) + else + tk_call_without_enc(self.class::TkCommandNames[0], @path) + end + end + private :create_self + + def labelwidget + window(tk_send('labelwidget')) + end +end diff --git a/ext/tk/lib/tkextlib/tcllib/swaplist.rb b/ext/tk/lib/tkextlib/tcllib/swaplist.rb new file mode 100644 index 0000000000..97de0a27c1 --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/swaplist.rb @@ -0,0 +1,147 @@ +# +# tkextlib/tcllib/swaplist.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * A dialog which allows a user to move options between two lists +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('swaplist', '0.1') +TkPackage.require('swaplist') + +module Tk::Tcllib + class Swaplist_Dialog < TkWindow + PACKAGE_NAME = 'swaplist'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('swaplist') + rescue + '' + end + end + end +end + + +class Tk::Tcllib::Swaplist_Dialog + TkCommandNames = ['::swaplist::swaplist'.freeze].freeze + WidgetClassName = 'Swaplist'.freeze + WidgetClassNames[WidgetClassName] = self + + def self.show(*args) + dialog = self.new(*args) + dialog.show + [dialog.status, dialog.value] + end + def self.display(*args) + self.show(*args) + end + + def initialize(*args) + # args = (parent=nil, complete_list=[], selected_list=[], keys=nil) + keys = args.pop + if keys.kind_of?(Hash) + @selected_list = args.pop + @complete_list = args.pop + @keys = _symbolkey2str(keys) + args.push(keys) + else + @selected_list = keys + @complete_list = args.pop + @keys = {} + end + + @selected_list = [] unless @selected_list + @complete_list = [] unless @complete_list + + @variable = TkVariable.new + @status = nil + + super(*args) + end + + def create_self(keys) + # dummy + end + private :create_self + + def show + @variable.value = '' + @status = bool(tk_call(self.class::TkCommandNames[0], + @path, @variable, + @complete_list, @selected_list, + *hash_kv(@keys))) + end + alias display show + + def status + @status + end + + def value + @variable.list + end + alias selected value + + def cget(slot) + slot = slot.to_s + if slot == 'complete_list' + @complete_list + elsif slot == 'selected_list' + @selected_list + else + @keys[slot] + end + end + + def configure(slot, value=None) + if slot.kind_of?(Hash) + slot.each{|k, v| configure(k, v)} + else + slot = slot.to_s + value = _symbolkey2str(value) if value.kind_of?(Hash) + if value && value != None + if slot == 'complete_list' + @complete_list = value + elsif slot == 'selected_list' + @selected_list = value + else + @keys[slot] = value + end + else + if slot == 'complete_list' + @complete_list = [] + elsif slot == 'selected_list' + @selected_list = [] + else + @keys.delete(slot) + end + end + end + self + end + + def configinfo(slot = nil) + if slot + slot = slot.to_s + if slot == 'complete_list' + [ slot, nil, nil, nil, @complete_list ] + elsif slot == 'selected_list' + [ slot, nil, nil, nil, @selected_list ] + else + [ slot, nil, nil, nil, @keys[slot] ] + end + else + @keys.collect{|k, v| [ k, nil, nil, nil, v ] } \ + << [ 'complete_list', nil, nil, nil, @complete_list ] \ + << [ 'selected_list', nil, nil, nil, @selected_list ] + end + end +end diff --git a/ext/tk/lib/tkextlib/tcllib/tablelist.rb b/ext/tk/lib/tkextlib/tcllib/tablelist.rb new file mode 100644 index 0000000000..42435a1971 --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/tablelist.rb @@ -0,0 +1,27 @@ +# +# tkextlib/tcllib/tablelist.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * A multi-column listbox + +require 'tk' +require 'tkextlib/tcllib.rb' + +# check Tile extension :: If already loaded, use tablelist_tile. +unless defined? Tk::Tcllib::Tablelist_usingTile + Tk::Tcllib::Tablelist_usingTile = TkPackage.provide('tile') +end + +if Tk::Tcllib::Tablelist_usingTile + # with Tile + require 'tkextlib/tcllib/tablelist_tile' + +else + # without Tile + + # TkPackage.require('Tablelist', '4.2') + TkPackage.require('Tablelist') + + requrie 'tkextlib/tcllib/tablelist_core' +end diff --git a/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb b/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb new file mode 100644 index 0000000000..a939a58331 --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb @@ -0,0 +1,770 @@ +# +# tkextlib/tcllib/tablelist_core.rb +# +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * This file is required by 'tkextlib/tcllib/tablelist.rb' or +# 'tkextlib/tcllib/tablelist_tile.rb'. +# + +module Tk + module Tcllib + class Tablelist < TkWindow + if Tk::Tcllib::Tablelist_usingTile + PACKAGE_NAME = 'Tablelist_tile'.freeze + else + PACKAGE_NAME = 'Tablelist'.freeze + end + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require(self.package_name) + rescue + '' + end + end + + def self.use_Tile? + (Tk::Tcllib::Tablelist_usingTile)? true: false + end + end + TableList = Tablelist + end +end + +module Tk::Tcllib::TablelistItemConfig + include TkItemConfigMethod + + def _to_idx(idx) + if idx.kind_of?(Array) + idx.collect{|elem| _get_eval_string(elem)}.join(',') + else + idx + end + end + def _from_idx(idx) + return idx unless idx.kind_of?(String) + + if idx[0] == ?@ # '@x,y' + idx + elsif idx =~ /([^,]+),([^,]+)/ + row = $1, column = $2 + [num_or_str(row), num_or_str(column)] + else + num_or_str(idx) + end + end + private :_to_idx, :_from_idx + + def __item_cget_cmd(mixed_id) + [self.path, mixed_id[0] + 'cget', _to_idx(mixed_id[1])] + end + def __item_config_cmd(mixed_id) + [self.path, mixed_id[0] + 'configure', _to_idx(mixed_id[1])] + end + + def cell_cget(tagOrId, option) + itemcget(['cell', tagOrId], option) + end + def cell_configure(tagOrId, slot, value=None) + itemconfigure(['cell', tagOrId], slot, value) + end + def cell_configinfo(tagOrId, slot=nil) + itemconfiginfo(['cell', tagOrId], slot) + end + def current_cell_configinfo(tagOrId, slot=nil) + current_itemconfiginfo(['cell', tagOrId], slot) + end + alias cellcget cell_cget + alias cellconfigure cell_configure + alias cellconfiginfo cell_configinfo + alias current_cellconfiginfo current_cell_configinfo + + def column_cget(tagOrId, option) + itemcget(['column', tagOrId], option) + end + def column_configure(tagOrId, slot, value=None) + itemconfigure(['column', tagOrId], slot, value) + end + def column_configinfo(tagOrId, slot=nil) + itemconfiginfo(['column', tagOrId], slot) + end + def current_column_configinfo(tagOrId, slot=nil) + current_itemconfiginfo(['column', tagOrId], slot) + end + alias columncget column_cget + alias columnconfigure column_configure + alias columnconfiginfo column_configinfo + alias current_columnconfiginfo current_column_configinfo + + def row_cget(tagOrId, option) + itemcget(['row', tagOrId], option) + end + def row_configure(tagOrId, slot, value=None) + itemconfigure(['row', tagOrId], slot, value) + end + def row_configinfo(tagOrId, slot=nil) + itemconfiginfo(['row', tagOrId], slot) + end + def current_row_configinfo(tagOrId, slot=nil) + current_itemconfiginfo(['row', tagOrId], slot) + end + alias rowcget row_cget + alias rowconfigure row_configure + alias rowconfiginfo row_configinfo + alias current_rowconfiginfo current_row_configinfo + + private :itemcget, :itemconfigure + private :itemconfiginfo, :current_itemconfiginfo +end + +class Tk::Tcllib::Tablelist + include Tk::Tcllib::TablelistItemConfig + include Scrollable + + TkCommandNames = ['::tablelist::tablelist'.freeze].freeze + WidgetClassName = 'Tablelist'.freeze + WidgetClassNames[WidgetClassName] = self + + def create_self(keys) + if keys and keys != None + tk_call_without_enc(self.class::TkCommandNames[0], @path, + *hash_kv(keys, true)) + else + tk_call_without_enc(self.class::TkCommandNames[0], @path) + end + end + private :create_self + + ########################## + + def __numval_optkeys + super() + ['titlecolumns'] + end + private :__numval_optkeys + + def __strval_optkeys + super() + ['snipstring'] + end + private :__strval_optkeys + + def __boolval_optkeys + super() + [ + 'forceeditendcommand', 'movablecolumns', 'movablerows', + 'protecttitlecolumns', 'resizablecolumns', + 'showarrow', 'showlabels', 'showseparators' + ] + end + private :__boolval_optkeys + + def __listval_optkeys + super() + ['columns'] + end + private :__listval_optkeys + + def __tkvariable_optkeys + super() + ['listvariable'] + end + private :__tkvariable_optkeys + + def __val2ruby_optkeys # { key=>proc, ... } + # The method is used to convert a opt-value to a ruby's object. + # When get the value of the option "key", "proc.call(value)" is called. + super().update('stretch'=>proc{|v| (v == 'all')? v: simplelist(v)}) + end + private :__val2ruby_optkeys + + def __ruby2val_optkeys # { key=>proc, ... } + # The method is used to convert a ruby's object to a opt-value. + # When set the value of the option "key", "proc.call(value)" is called. + # That is, "-#{key} #{proc.call(value)}". + super().update('stretch'=>proc{|v| + (v.kind_of?(Array))? v.collect{|e| _to_idx(e)}: v + }) + end + private :__ruby2val_optkeys + + def __font_optkeys + super() + ['labelfont'] + end + private :__font_optkeys + + ########################## + + def __item_strval_optkeys(id) + if id[0] == 'cell' + super(id) + ['title'] + else + super(id) - ['text'] + ['title'] + end + end + private :__item_strval_optkeys + + def __item_boolval_optkeys(id) + super(id) + [ + 'editable', 'hide', 'resizable', 'showarrow', 'stretchable', + ] + end + private :__item_boolval_optkeys + + def __item_listval_optkeys(id) + if id[0] == 'cell' + super(id) + else + super(id) + ['text'] + end + end + private :__item_listval_optkeys + + def __item_font_optkeys(id) + # maybe need to override + super(id) + ['labelfont'] + end + private :__item_font_optkeys + + ########################## + + def activate(index) + tk_send('activate', _to_idx(index)) + self + end + + def activate_cell(index) + tk_send('activatecell', _to_idx(index)) + self + end + alias activatecell activate_cell + + def get_attrib(name=nil) + if name && name != None + tk_send('attrib', name) + else + ret = [] + lst = simplelist(tk_send('attrib')) + until lst.empty? + ret << ( [lst.shift] << lst.shift ) + end + ret + end + end + def set_attrib(*args) + tk_send('attrib', *(args.flatten)) + self + end + + def bbox(index) + list(tk_send('bbox', _to_idx(index))) + end + + def bodypath + window(tk_send('bodypath')) + end + + def bodytag + TkBindTag.new_by_name(tk_send('bodytag')) + end + + def cancel_editing + tk_send('cancelediting') + self + end + alias cancelediting cancel_editing + + def cellindex(idx) + _from_idx(tk_send('cellindex', _to_idx(idx))) + end + + def cellselection_anchor(idx) + tk_send('cellselection', 'anchor', _to_idx(idx)) + self + end + + def cellselection_clear(first, last=nil) + if first.kind_of?(Array) + tk_send('cellselection', 'clear', first.collect{|idx| _to_idx(idx)}) + else + first = _to_idx(first) + last = (last)? _to_idx(last): first + tk_send('cellselection', 'clear', first, last) + end + self + end + + def cellselection_includes(idx) + bool(tk_send('cellselection', 'includes', _to_idx(idx))) + end + + def cellselection_set(first, last=nil) + if first.kind_of?(Array) + tk_send('cellselection', 'set', first.collect{|idx| _to_idx(idx)}) + else + first = _to_idx(first) + last = (last)? _to_idx(last): first + tk_send('cellselection', 'set', first, last) + end + self + end + + def columncount + number(tk_send('columncount')) + end + + def columnindex(idx) + number(tk_send('columnindex', _to_idx(idx))) + end + + def containing(y) + idx = num_or_str(tk_send('containing', y)) + (idx.kind_of?(Fixnum) && idx < 0)? nil: idx + end + + def containing_cell(x, y) + idx = _from_idx(tk_send('containingcell', x, y)) + if idx.kind_of?(Array) + [ + ((idx[0].kind_of?(Fixnum) && idx[0] < 0)? nil: idx[0]), + ((idx[1].kind_of?(Fixnum) && idx[1] < 0)? nil: idx[1]) + ] + else + idx + end + end + alias containingcell containing_cell + + def containing_column(x) + idx = num_or_str(tk_send('containingcolumn', x)) + (idx.kind_of?(Fixnum) && idx < 0)? nil: idx + end + alias containingcolumn containing_column + + def curcellselection + simplelist(tk_send('curcellselection')).collect!{|idx| _from_idx(idx)} + end + + def curselection + list(tk_send('curselection')) + end + + def delete_items(first, last=nil) + if first.kind_of?(Array) + tk_send('delete', first.collect{|idx| _to_idx(idx)}) + else + first = _to_idx(first) + last = (last)? _to_idx(last): first + tk_send('delete', first, last) + end + self + end + alias delete delete_items + alias deleteitems delete_items + + def delete_columns(first, last=nil) + if first.kind_of?(Array) + tk_send('deletecolumns', first.collect{|idx| _to_idx(idx)}) + else + first = _to_idx(first) + last = (last)? _to_idx(last): first + tk_send('deletecolumns', first, last) + end + self + end + alias deletecolumns delete_columns + + def edit_cell(idx) + tk_send('editcell', _to_idx(idx)) + self + end + alias editcell edit_cell + + def editwinpath + window(tk_send('editwinpath')) + end + + def entrypath + window(tk_send('entrypath')) + end + + def fill_column(idx, txt) + tk_send('fillcolumn', _to_idx(idx), txt) + self + end + alias fillcolumn fill_column + + def finish_editing + tk_send('finishediting') + self + end + alias finishediting finish_editing + + def get(first, last=nil) + if first.kind_of?(Array) + simplelist(tk_send('get', first.collect{|idx| _to_idx(idx)})).collect!{|elem| simplelist(elem) } + else + first = _to_idx(first) + last = (last)? _to_idx(last): first + simplelist(tk_send('get', first, last)) + end + end + + def get_cells(first, last=nil) + if first.kind_of?(Array) + simplelist(tk_send('getcells', first.collect{|idx| _to_idx(idx)})).collect!{|elem| simplelist(elem) } + else + first = _to_idx(first) + last = (last)? _to_idx(last): first + simplelist(tk_send('getcells', first, last)) + end + end + alias getcells get_cells + + def get_columns(first, last=nil) + if first.kind_of?(Array) + simplelist(tk_send('getcolumns', first.collect{|idx| _to_idx(idx)})).collect!{|elem| simplelist(elem) } + else + first = _to_idx(first) + last = (last)? _to_idx(last): first + simplelist(tk_send('getcolumns', first, last)) + end + end + alias getcolumns get_columns + + def get_keys(first, last=nil) + if first.kind_of?(Array) + simplelist(tk_send('getkeys', first.collect{|idx| _to_idx(idx)})).collect!{|elem| simplelist(elem) } + else + first = _to_idx(first) + last = (last)? _to_idx(last): first + simplelist(tk_send('getkeys', first, last)) + end + end + alias getkeys get_keys + + def imagelabelpath(idx) + window(tk_send('imagelabelpath', _to_idx(idx))) + end + + def index(idx) + number(tk_send('index', _to_idx(idx))) + end + + def insert(idx, *items) + tk_send('insert', _to_idx(idx), *items) + self + end + + def insert_columnlist(idx, columnlist) + tk_send('insertcolumnlist', _to_idx(idx), columnlist) + self + end + alias insertcolumnlist insert_columnlist + + def insert_columns(idx, *args) + tk_send('insertcolums', _to_idx(idx), *args) + self + end + alias insertcolumns insert_columns + + def insert_list(idx, list) + tk_send('insertlist', _to_idx(idx), list) + self + end + alias insertlist insert_list + + def itemlistvar + TkVarAccess.new(tk_send('itemlistvar')) + end + + def labelpath(idx) + window(tk_send('labelpath', _to_idx(idx))) + end + + def labels + simplelist(tk_send('labels')) + end + + def move(src, target) + tk_send('move', _to_idx(src), _to_idx(target)) + self + end + + def move_column(src, target) + tk_send('movecolumn', _to_idx(src), _to_idx(target)) + self + end + alias movecolumn move_column + + def nearest(y) + _from_idx(tk_send('nearest', y)) + end + + def nearest_cell(x, y) + _from_idx(tk_send('nearestcell', x, y)) + end + alias nearestcell nearest_cell + + def nearest_column(x) + _from_idx(tk_send('nearestcolumn', x)) + end + alias nearestcolumn nearest_column + + def reject_input + tk_send('rejectinput') + self + end + alias rejectinput reject_input + + def reset_sortinfo + tk_send('resetsortinfo') + self + end + alias resetsortinfo reset_sortinfo + + def scan_mark(x, y) + tk_send('scan', 'mark', x, y) + self + end + + def scan_dragto(x, y) + tk_send('scan', 'dragto', x, y) + self + end + + def see(idx) + tk_send('see', _to_idx(idx)) + self + end + + def see_cell(idx) + tk_send('seecell', _to_idx(idx)) + self + end + alias seecell see_cell + + def see_column(idx) + tk_send('seecolumn', _to_idx(idx)) + self + end + alias seecolumn see_column + + def selection_anchor(idx) + tk_send('selection', 'anchor', _to_idx(idx)) + self + end + + def selection_clear(first, last=nil) + if first.kind_of?(Array) + tk_send('selection', 'clear', first.collect{|idx| _to_idx(idx)}) + else + first = _to_idx(first) + last = (last)? _to_idx(last): first + tk_send('selection', 'clear', first, last) + end + self + end + + def selection_includes(idx) + bool(tk_send('selection', 'includes', _to_idx(idx))) + end + + def selection_set(first, last=nil) + if first.kind_of?(Array) + tk_send('selection', 'set', first.collect{|idx| _to_idx(idx)}) + else + first = _to_idx(first) + last = (last)? _to_idx(last): first + tk_send('selection', 'set', first, last) + end + self + end + + def separatorpath(idx=nil) + if idx + window(tk_send('separatorpath', _to_idx(idx))) + else + window(tk_send('separatorpath')) + end + end + + def separators + simplelist(tk_send('separators')).collect!{|w| window(w)} + end + + def size + number(tk_send('size')) + end + + def sort(order=nil) + if order + order = order.to_s + order = '-' << order if order[0] != ?- + if order.length < 2 + order = nil + end + end + if order + tk_send('sort', order) + else + tk_send('sort') + end + self + end + def sort_increasing + tk_send('sort', '-increasing') + self + end + def sort_decreasing + tk_send('sort', '-decreasing') + self + end + + DEFAULT_sortByColumn_cmd = '::tablelist::sortByColumn' + + def sort_by_column(idx, order=nil) + if order + order = order.to_s + order = '-' << order if order[0] != ?- + if order.length < 2 + order = nil + end + end + if order + tk_send('sortbycolumn', _to_idx(idx), order) + else + tk_send('sortbycolumn', _to_idx(idx)) + end + self + end + def sort_by_column_increasing(idx) + tk_send('sortbycolumn', _to_idx(idx), '-increasing') + self + end + def sort_by_column_decreasing(idx) + tk_send('sortbycolumn', _to_idx(idx), '-decreasing') + self + end + + def sortcolumn + idx = num_or_str(tk_send('sortcolum')) + (idx.kind_of?(Fixnum) && idx < 0)? nil: idx + end + + def sortorder + tk_send('sortorder') + end + + def toggle_visibility(first, last=nil) + if first.kind_of?(Array) + tk_send('togglevisibility', first.collect{|idx| _to_idx(idx)}) + else + first = _to_idx(first) + last = (last)? _to_idx(last): first + tk_send('togglevisibility', first, last) + end + self + end + alias togglevisibility toggle_visibility + + def windowpath(idx) + window(tk_send('windowpath', _to_idx(idx))) + end +end + +class << Tk::Tcllib::Tablelist + ############################################################ + # helper commands + def getTablelistPath(descendant) + window(Tk.tk_call('::tablelist::getTablelistPath', descendant)) + end + + def convEventFields(descendant, x, y) + window(Tk.tk_call('::tablelist::convEventFields', descendant, x, y)) + end + + + ############################################################ + # with the BWidget package + def addBWidgetEntry(name=None) + Tk.tk_call('::tablelist::addBWidgetEntry', name) + end + + def addBWidgetSpinBox(name=None) + Tk.tk_call('::tablelist::addBWidgetSpinBox', name) + end + + def addBWidgetComboBox(name=None) + Tk.tk_call('::tablelist::addBWidgetComboBox', name) + end + + + ############################################################ + # with the Iwidgets ([incr Widgets]) package + def addIncrEntryfield(name=None) + Tk.tk_call('::tablelist::addIncrEntry', name) + end + + def addIncrDateTimeWidget(type, seconds=false, name=None) + # type := 'datefield'|'dateentry'|timefield'|'timeentry' + if seconds && seconds != None + seconds = '-seconds' + else + seconds = None + end + Tk.tk_call('::tablelist::addDateTimeWidget', type, seconds, name) + end + + def addIncrSpinner(name=None) + Tk.tk_call('::tablelist::addIncrSpinner', name) + end + + def addIncrSpinint(name=None) + Tk.tk_call('::tablelist::addIncrSpinint', name) + end + + def addIncrCombobox(name=None) + Tk.tk_call('::tablelist::addIncrCombobox', name) + end + + + ############################################################ + # with Bryan Oakley's combobox package + def addOakleyCombobox(name=None) + Tk.tk_call('::tablelist::addOakleyCombobox', name) + end + + ############################################################ + # with the multi-entry package Mentry is a library extension + def addDateMentry(format, separator, gmt=false, name=None) + if gmt && gmt != None + gmt = '-gmt' + else + gmt = None + end + Tk.tk_call('::tablelist::addDateMentry', format, separator, gmt, name) + end + + def addTimeMentry(format, separator, gmt=false, name=None) + if gmt && gmt != None + gmt = '-gmt' + else + gmt = None + end + Tk.tk_call('::tablelist::addTimeMentry', format, separator, gmt, name) + end + + def addFixedPointMentry(count1, count2, comma=false, name=None) + if comma && comma != None + comma = '-comma' + else + comma = None + end + Tk.tk_call('::tablelist::addFixedPoingMentry', count1, count2, comma, name) + end + + def addIPAddrMentry(name=None) + Tk.tk_call('::tablelist::addIPAddrMentry', name) + end +end diff --git a/ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb b/ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb new file mode 100644 index 0000000000..0cb4eb735d --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb @@ -0,0 +1,25 @@ +# +# tkextlib/tcllib/tablelist_tlie.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * A multi-column listbox + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('tablelist_tile', '4.2') +TkPackage.require('Tablelist_tile') + +unless defined? Tk::Tcllib::Tablelist_usingTile + Tk::Tcllib::Tablelist_usingTile = true +end + +requrie 'tkextlib/tcllib/tablelist_core' + +module Tk + module Tcllib + Tablelist_Tile = Tablelist + TableList_Tile = Tablelist + end +end diff --git a/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb b/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb index 5fb89dd734..92dde65ce7 100644 --- a/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb +++ b/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb @@ -56,6 +56,22 @@ module Tk::Tcllib::Tkpiechart :default_value=>1, :current_value=>2} end private :__configinfo_struct + + def __boolval_optkeys + super() << 'select' << 'autoupdate' << 'selectable' + end + private :__boolval_optkeys + + def __strval_optkeys + super() << 'bordercolor' << 'textbackground' << + 'widestvaluetext' << 'title' + end + private :__strval_optkeys + + def __listval_optkeys + super() << 'colors' + end + private :__listval_optkeys end #################################### diff --git a/ext/tk/lib/tkextlib/tcllib/tooltip.rb b/ext/tk/lib/tkextlib/tcllib/tooltip.rb new file mode 100644 index 0000000000..4301b39fd3 --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/tooltip.rb @@ -0,0 +1,95 @@ +# +# tkextlib/tcllib/tooltip.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * Provides tooltips, a small text message that is displayed when the +# mouse hovers over a widget. +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('tooltip', '1.1') +TkPackage.require('tooltip') + +module Tk::Tcllib + module Tooltip + PACKAGE_NAME = 'tooltip'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('tooltip') + rescue + '' + end + end + end +end + +module Tk::Tcllib::Tooltip + extend TkCore + + WidgetClassName = 'Tooltip'.freeze + def self.database_classname + self::WidgetClassName + end + def self.database_class + WidgetClassNames[self::WidgetClassName] + end + + def self.clear(glob_path_pat = None) + self.clear_glob(glob_path_pat) + end + + def self.clear_glob(glob_path_pat) + tk_call_without_enc('::tooltip::tooltip', 'clear', glob_path_pat) + end + + def self.clear_widgets(*args) + self.clear_glob("{#{args.collect{|w| _get_eval_string(w)}.join(',')}}") + end + + def self.clear_children(*args) + self.clear_glob("{#{args.collect{|w| s = _get_eval_string(w); "#{s},#{s}.*"}.join(',')}}") + end + + def self.delay(millisecs=None) + number(tk_call_without_enc('::tooltip::tooltip', 'delay', millisecs)) + end + def self.delay=(millisecs) + self.delay(millisecs) + end + + def self.disable + tk_call_without_enc('::tooltip::tooltip', 'disable') + false + end + def self.off + self.disable + end + + def self.enable + tk_call_without_enc('::tooltip::tooltip', 'enable') + true + end + def self.on + self.enable + end + + def self.register(widget, msg, keys=nil) + if keys.kind_of?(Hash) + args = hash_kv(keys) << msg + else + args = msg + end + tk_call_without_enc('::tooltip::tooltip', widget.path, *args) + end + + def self.erase(widget) + tk_call_without_enc('::tooltip::tooltip', widget.path, '') + end +end diff --git a/ext/tk/lib/tkextlib/tcllib/widget.rb b/ext/tk/lib/tkextlib/tcllib/widget.rb new file mode 100644 index 0000000000..ed69f67ce6 --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/widget.rb @@ -0,0 +1,48 @@ +# +# tkextlib/tcllib/widget.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * megawidget package that uses snit as the object system (snidgets) +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('widget', '3.0') +TkPackage.require('widget') + +module Tk::Tcllib + module Widget + PACKAGE_NAME = 'widget'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('widget') + rescue + '' + end + end + end +end + +module Tk::Tcllib::Widget + autoload :Dialog, 'tkextlib/tcllib/dialog' + + autoload :Panelframe, 'tkextlib/tcllib/panelframe' + autoload :PanelFrame, 'tkextlib/tcllib/panelframe' + + autoload :Ruler, 'tkextlib/tcllib/ruler' + + autoload :Screenruler, 'tkextlib/tcllib/screenruler' + autoload :ScreenRuler, 'tkextlib/tcllib/screenruler' + + autoload :Scrolledwindow, 'tkextlib/tcllib/scrollwin' + autoload :ScrolledWindow, 'tkextlib/tcllib/scrollwin' + + autoload :Superframe, 'tkextlib/tcllib/superframe' + autoload :SuperFrame, 'tkextlib/tcllib/superframe' +end diff --git a/ext/tk/lib/tkextlib/tile.rb b/ext/tk/lib/tkextlib/tile.rb index 3296b62517..de079ca53d 100644 --- a/ext/tk/lib/tkextlib/tile.rb +++ b/ext/tk/lib/tkextlib/tile.rb @@ -20,14 +20,24 @@ if ver[0].to_i == 0 && ver[1].to_i <= 4 # version 0.4 or former module Tk module Tile - USE_TTK_NAMESPACE = false + USE_TILE_NAMESPACE = true + TILE_SPEC_VERSION_ID = 0 + end + end +elsif ver[0].to_i == 0 && ver[1].to_i <= 6 + # version 0.5 -- version 0.6 + module Tk + module Tile + USE_TILE_NAMESPACE = true + TILE_SPEC_VERSION_ID = 5 end end else - # version 0.5 or later + # version 0.7 or later module Tk module Tile - USE_TTK_NAMESPACE = true + USE_TILE_NAMESPACE = false + TILE_SPEC_VERSION_ID = 7 end end end @@ -50,6 +60,10 @@ module Tk end end + def self.__Import_Tile_Widgets__! + Tk.tk_call('namespace', 'import', 'ttk::*') + end + def self.load_images(imgdir, pat=TkComm::None) images = Hash[*TkComm.simplelist(Tk.tk_call('::tile::LoadImages', imgdir, pat))] @@ -87,7 +101,42 @@ module Tk Icon = 'TkIconFont' end + module ParseStyleLayout + def _style_layout(lst) + ret = [] + until lst.empty? + sub = [lst.shift] + keys = {} + + until lst.empty? + if lst[0][0] == ?- + k = lst.shift[1..-1] + children = lst.shift + children = _style_layout(children) if children.kind_of?(Array) + keys[k] = children + else + break + end + end + + sub << keys unless keys.empty? + ret << sub + end + ret + end + private :_style_layout + end + module TileWidget + include Tk::Tile::ParseStyleLayout + + def __val2ruby_optkeys # { key=>proc, ... } + # The method is used to convert a opt-value to a ruby's object. + # When get the value of the option "key", "proc.call(value)" is called. + super().update('style'=>proc{|v| _style_layout(list(v))}) + end + private :__val2ruby_optkeys + def instate(state, script=nil, &b) if script tk_send('instate', state, script) @@ -117,6 +166,8 @@ module Tk autoload :TCheckbutton, 'tkextlib/tile/tcheckbutton' autoload :Checkbutton, 'tkextlib/tile/tcheckbutton' + autoload :Dialog, 'tkextlib/tile/dialog' + autoload :TEntry, 'tkextlib/tile/tentry' autoload :Entry, 'tkextlib/tile/tentry' diff --git a/ext/tk/lib/tkextlib/tile/dialog.rb b/ext/tk/lib/tkextlib/tile/dialog.rb new file mode 100644 index 0000000000..f8ddf62598 --- /dev/null +++ b/ext/tk/lib/tkextlib/tile/dialog.rb @@ -0,0 +1,84 @@ +# +# ttk::dialog (tile-0.7+) +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +require 'tk' +require 'tkextlib/tile.rb' + +module Tk + module Tile + class Dialog < TkWindow + end + end +end + +class Tk::Tile::Dialog + TkCommandNames = ['::ttk::dialog'.freeze].freeze + + def self.show(*args) + dialog = self.new(*args) + dialog.show + [dialog.status, dialog.value] + end + def self.display(*args) + self.show(*args) + end + + def self.define_dialog_type(name, keys) + Tk.tk_call('::ttk::dialog::define', name, keys) + name + end + + def self.style(*args) + ['Dialog', *(args.map!{|a| _get_eval_string(a)})].join('.') + end + + ######################### + + def initialize(keys={}) + @keys = _symbolkey2str(keys) + super(*args) + end + + def create_self(keys) + # dummy + end + private :create_self + + def show + tk_call(self.class::TkCommandNames[0], @path, *hash_kv(@keys)) + end + alias display show + + def client_frame + window(tk_call_without_enc('::ttk::dialog::clientframe')) + end + + def cget(slot) + @keys[slot] + end + + def configure(slot, value=None) + if slot.kind_of?(Hash) + slot.each{|k, v| configure(k, v)} + else + slot = slot.to_s + value = _symbolkey2str(value) if value.kind_of?(Hash) + if value && value != None + @keys[slot] = value + else + @keys.delete(slot) + end + end + self + end + + def configinfo(slot = nil) + if slot + slot = slot.to_s + [ slot, nil, nil, nil, @keys[slot] ] + else + @keys.collect{|k, v| [ k, nil, nil, nil, v ] } + end + end +end diff --git a/ext/tk/lib/tkextlib/tile/style.rb b/ext/tk/lib/tkextlib/tile/style.rb index 4245d315f8..485a36d7d6 100644 --- a/ext/tk/lib/tkextlib/tile/style.rb +++ b/ext/tk/lib/tkextlib/tile/style.rb @@ -17,19 +17,26 @@ module Tk::Tile::Style end class << Tk::Tile::Style - def default(style=nil, keys=nil) + def configure(style=nil, keys=nil) if style.kind_of?(Hash) keys = style style = nil end style = '.' unless style + if Tk::Tile::TILE_SPEC_VERSION_ID < 7 + sub_cmd = 'default' + else + sub_cmd = 'configure' + end + if keys && keys != None - tk_call('style', 'default', style, *hash_kv(keys)) + tk_call('style', sub_cmd, style, *hash_kv(keys)) else - tk_call('style', 'default', style) + tk_call('style', sub_cmd, style) end end + alias default configure def map(style=nil, keys=nil) if style.kind_of?(Hash) @@ -45,6 +52,8 @@ class << Tk::Tile::Style end end + include Tk::Tile::ParseStyleLayout + def layout(style=nil, spec=nil) if style.kind_of?(Hash) spec = style @@ -55,7 +64,7 @@ class << Tk::Tile::Style if spec tk_call('style', 'layout', style, spec) else - tk_call('style', 'layout', style) + _style_layout(list(tk_call('style', 'layout', style))) end end diff --git a/ext/tk/lib/tkextlib/tile/tcombobox.rb b/ext/tk/lib/tkextlib/tile/tcombobox.rb index ac67089bbb..c63ab94dbe 100644 --- a/ext/tk/lib/tkextlib/tile/tcombobox.rb +++ b/ext/tk/lib/tkextlib/tile/tcombobox.rb @@ -24,6 +24,16 @@ class Tk::Tile::TCombobox < Tk::Tile::TEntry WidgetClassName = 'TCombobox'.freeze WidgetClassNames[WidgetClassName] = self + def __boolval_optkeys + super() << 'exportselection' + end + private :__boolval_optkeys + + def __listval_optkeys + super() << 'values' + end + private :__listval_optkeys + def self.style(*args) [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') end diff --git a/ext/tk/lib/tkextlib/tile/tentry.rb b/ext/tk/lib/tkextlib/tile/tentry.rb index be7054b851..4d57ce7756 100644 --- a/ext/tk/lib/tkextlib/tile/tentry.rb +++ b/ext/tk/lib/tkextlib/tile/tentry.rb @@ -24,6 +24,16 @@ class Tk::Tile::TEntry < TkEntry WidgetClassName = 'TEntry'.freeze WidgetClassNames[WidgetClassName] = self + def __boolval_optkeys + super() << 'exportselection' + end + private :__boolval_optkeys + + def __strval_optkeys + super() << 'show' + end + private :__strval_optkeys + def self.style(*args) [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') end diff --git a/ext/tk/lib/tkextlib/tile/tnotebook.rb b/ext/tk/lib/tkextlib/tile/tnotebook.rb index 09b27fc2cd..da4fa203c7 100644 --- a/ext/tk/lib/tkextlib/tile/tnotebook.rb +++ b/ext/tk/lib/tkextlib/tile/tnotebook.rb @@ -18,16 +18,15 @@ class Tk::Tile::TNotebook < TkWindow include TkItemConfigMethod def __item_cget_cmd(id) - [self.path, 'tabcget', id] + [self.path, 'tab', id] end private :__item_cget_cmd def __item_config_cmd(id) - [self.path, 'tabconfigure', id] + [self.path, 'tab', id] end private :__item_config_cmd - def __item_listval_optkeys [] end @@ -38,10 +37,14 @@ class Tk::Tile::TNotebook < TkWindow end private :__item_listval_optkeys - alias tabcget itemcget + #alias tabcget itemcget alias tabconfigure itemconfigure alias tabconfiginfo itemconfiginfo alias current_tabconfiginfo current_itemconfiginfo + + def tabcget(tagOrId, option) + tabconfigure(tagOrId, option)[-1] + end ################################ include Tk::Tile::TileWidget @@ -59,7 +62,13 @@ class Tk::Tile::TNotebook < TkWindow end def enable_traversal() - tk_call_without_enc('::tile::notebook::enableTraversal', @path) + if Tk::Tile::TILE_SPEC_VERSION_ID < 5 + tk_call_without_enc('::tile::enableNotebookTraversal', @path) + elsif Tk::Tile::TILE_SPEC_VERSION_ID < 7 + tk_call_without_enc('::tile::notebook::enableTraversal', @path) + else + tk_call_without_enc('::ttk::notebook::enableTraversal', @path) + end self end diff --git a/ext/tk/lib/tkextlib/tile/tprogressbar.rb b/ext/tk/lib/tkextlib/tile/tprogressbar.rb index 3f98660c83..36c1c75c23 100644 --- a/ext/tk/lib/tkextlib/tile/tprogressbar.rb +++ b/ext/tk/lib/tkextlib/tile/tprogressbar.rb @@ -28,18 +28,26 @@ class Tk::Tile::TProgressbar [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') end - def step - tk_send_without_enc('step').to_f - end - def step=(amount) - tk_send_without_enc('step', amount) + def step(amount=None) + tk_send_without_enc('step', amount).to_f end + #def step=(amount) + # tk_send_without_enc('step', amount) + #end def start(interval=None) - tk_call_without_enc('::tile::progressbar::start', @path, interval) + if Tk::Tile::TILE_SPEC_VERSION_ID < 5 + tk_call_without_enc('::tile::progressbar::start', @path, interval) + else + tk_send_without_enc('start', interval) + end end - def stop - tk_call_without_enc('::tile::progressbar::stop', @path) + def stop(amount=None) + if Tk::Tile::TILE_SPEC_VERSION_ID < 5 + tk_call_without_enc('::tile::progressbar::stop', @path) + else + tk_send_without_enc('stop', amount) + end end end diff --git a/ext/tk/lib/tkextlib/tile/treeview.rb b/ext/tk/lib/tkextlib/tile/treeview.rb index 46e3499f21..d3ffbbfa6b 100644 --- a/ext/tk/lib/tkextlib/tile/treeview.rb +++ b/ext/tk/lib/tkextlib/tile/treeview.rb @@ -259,6 +259,17 @@ class Tk::Tile::Treeview < TkWindow self end + def get_directory(item) + # tile-0.7+ + ret = [] + lst = simplelist(tk_send('set', item)) + until lst.empty? + col = lst.shift + val = lst.shift + ret << [col, val] + end + ret + end def get(item, col) tk_send('set', item, col) end diff --git a/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb b/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb index 818a659664..8527f61df1 100644 --- a/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb +++ b/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb @@ -104,6 +104,11 @@ class Tk::HTML_Widget end private :create_self + def __strval_optkeys + super() << 'base' << 'selectioncolor' << 'unvisitedcolor' << 'visitedcolor' + end + private :__strval_optkeys + ################################### # class methods ################################### diff --git a/ext/tk/lib/tkextlib/tktable/tktable.rb b/ext/tk/lib/tkextlib/tktable/tktable.rb index 59328a8f6e..4edaabc847 100644 --- a/ext/tk/lib/tkextlib/tktable/tktable.rb +++ b/ext/tk/lib/tkextlib/tktable/tktable.rb @@ -59,6 +59,21 @@ module Tk::TkTable::ConfigMethod end private :__item_pathname + def __item_boolval_optkeys(id) + super(id) << 'multiline' << 'showtext' << 'wrap' + end + private :__item_boolval_optkeys + + def __item_strval_optkeys(id) + super(id) << 'ellipsis' + end + private :__item_strval_optkeys + + def __item_val2ruby_optkeys(id) # { key=>method, ... } + super(id).update('window'=>proc{|v| window(v)}) + end + private :__item_val2ruby_optkeys + def tag_cget(tagOrId, option) itemcget(['tag', tagid(tagOrId)], option) end @@ -208,6 +223,18 @@ class Tk::TkTable Tk::TkTable::CelTag::CellTagID_TBL.delete(@path) end + def __boolval_optkeys + super() << 'autoclear' << 'flashmode' << 'invertselected' << + 'multiline' << 'selecttitle' << 'wrap' + end + private :__boolval_optkeys + + def __strval_optkeys + super() << 'colseparator' << 'ellipsis' << 'rowseparator' << 'sparsearray' + end + private :__strval_optkeys + + ################################# class BrowseCommand < TkValidateCommand diff --git a/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb b/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb index 69244eae7c..12f7cffabf 100644 --- a/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb +++ b/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb @@ -216,6 +216,10 @@ module Tk::TreeCtrl::ConfigMethod end def __item_cget_cmd(mixed_id) + if mixed_id[0] == 'column' && mixed_id[1] == 'drag' + return [self.path, 'column', 'dragcget'] + end + if mixed_id[1].kind_of?(Array) id = mixed_id[1] else @@ -231,6 +235,10 @@ module Tk::TreeCtrl::ConfigMethod private :__item_cget_cmd def __item_config_cmd(mixed_id) + if mixed_id[0] == 'column' && mixed_id[1] == 'drag' + return [self.path, 'column', 'dragconfigure'] + end + if mixed_id[1].kind_of?(Array) id = mixed_id[1] else @@ -306,9 +314,14 @@ module Tk::TreeCtrl::ConfigMethod when 'item' ['button', 'visible'] when 'column' - ['button', 'expand', 'squeeze', 'sunken', 'visible', 'widthhack'] + if id[1] == 'drag' + ['enable'] + else + ['button', 'expand', 'resize', 'squeeze', 'sunken', + 'visible', 'widthhack'] + end when 'element' - ['filled', 'showfocus'] + ['draw', 'filled', 'showfocus', 'destroy'] when 'notify' ['active'] when 'style' @@ -329,6 +342,19 @@ module Tk::TreeCtrl::ConfigMethod def __item_strval_optkeys(id) if id == 'debug' ['erasecolor'] + elsif id.kind_of?(Array) + case id[0] + when 'column' + if id[1] == 'drag' + ['indicatorcolor'] + else + super(id) << 'textcolor' + end + when 'element' + super(id) << 'fill' << 'outline' << 'format' + else + super(id) + end else super(id) end @@ -383,6 +409,19 @@ module Tk::TreeCtrl::ConfigMethod current_itemconfiginfo(['column', tagOrId], slot) end + def column_dragcget(option) + itemcget(['column', 'drag'], option) + end + def column_dragconfigure(slot, value=None) + itemconfigure(['column', 'drag'], slot, value) + end + def column_dragconfiginfo(slot=nil) + itemconfiginfo(['column', 'drag'], slot) + end + def current_column_dragconfiginfo(slot=nil) + current_itemconfiginfo(['column', 'drag'], slot) + end + def debug_cget(option) itemcget('debug', option) end @@ -513,8 +552,16 @@ class Tk::TreeCtrl ######################### + def __strval_optkeys + super() + [ + 'buttoncolor', 'columnprefix', 'itemprefix', 'linecolor' + ] + end + private :__strval_optkeys + def __boolval_optkeys [ + 'itemwidthequal', 'usetheme', 'showbuttons', 'showheader', 'showlines', 'showroot', 'showrootbutton', 'showrootlines', ] @@ -574,6 +621,14 @@ class Tk::TreeCtrl list(tk_send('column', 'bbox', idx)) end + def column_compare(column1, op, column2) + bool(tk_send('column', 'compare', column1, op, column2)) + end + + def column_count + num_or_str(tk_send('column', 'count')) + end + def column_create(keys=nil) if keys && keys.kind_of?(Hash) num_or_str(tk_send('column', 'create', *hash_kv(keys))) @@ -594,6 +649,21 @@ class Tk::TreeCtrl num_or_str(tk_send('column', 'index', idx)) end + def column_id(idx) + tk_send('column', 'id', idx) + end + + def column_list(visible=false) + if visible + simplelist(tk_send('column', 'list', '-visible')) + else + simplelist(tk_send('column', 'list')) + end + end + def column_visible_list + column_list(true) + end + def column_move(idx, before) tk_send('column', 'move', idx, before) self @@ -604,6 +674,17 @@ class Tk::TreeCtrl end alias column_neededwidth column_needed_width + def column_order(column, visible=false) + if visible + num_or_str(tk_send('column', 'order', column, '-visible')) + else + num_or_str(tk_send('column', 'order', column)) + end + end + def column_visible_order(column) + column_order(column, true) + end + def column_width(idx) num_or_str(tk_send('column', 'width', idx)) end @@ -684,6 +765,22 @@ class Tk::TreeCtrl } end + def _conv_element_perstate_val(opt, val) + case opt + when 'background', 'foreground', 'fill', 'outline', 'format' + val + when 'draw', 'filled', 'showfocus', 'destroy' + bool(val) + else + tk_tcl2ruby(val) + end + end + private :_conv_element_perstate_val + + def element_perstate(elem, opt, st_list) + tk_send('element', 'perstate', elem, "-{opt}", st_list) + end + def element_type(elem) tk_send('element', 'type', elem) end @@ -767,6 +864,10 @@ class Tk::TreeCtrl self end + def item_compare(item1, op, item2) + bool(tk_send('item', 'compare', item1, op, item2)) + end + def item_complex(item, *args) tk_send_without_enc('item', 'complex', _get_eval_string(item, true), @@ -774,6 +875,10 @@ class Tk::TreeCtrl self end + def item_count + num_or_str(tk_send('item', 'count')) + end + def item_create(keys={}) num_or_str(tk_send_without_enc('item', 'create', *hash_kv(keys, true))) end @@ -812,6 +917,10 @@ class Tk::TreeCtrl tk_send('item', 'element', 'actual', item, column, elem, "-#{key}") end + def item_element_perstate(elem, opt, st_list) + tk_send('item', 'element', 'perstate', elem, "-{opt}", st_list) + end + def item_expand(item) tk_send('item', 'expand', item) self @@ -854,6 +963,32 @@ class Tk::TreeCtrl end alias item_has_button? item_hasbutton? + def item_id(item) + tk_send('item', 'id', item) + end + + def item_image(item, column=nil, *args) + if args.empty? + if column + img = tk_send('item', 'image', item, column) + TkImage::Tk_IMGTBL[img]? TkImage::Tk_IMGTBL[img] : img + else + simplelist(tk_send('item', 'image', item)).collect!{|img| + TkImage::Tk_IMGTBL[img]? TkImage::Tk_IMGTBL[img] : img + } + end + else + tk_send('item', 'image', item, column, *args) + self + end + end + def get_item_image(item, column=nil) + item_image(item, column) + end + def set_item_image(item, col, img, *args) + item_image(item, col, img, *args) + end + def item_index(item) list(tk_send('item', 'index', item)) end @@ -906,6 +1041,19 @@ class Tk::TreeCtrl alias item_num_children item_numchildren alias item_children_size item_numchildren + def item_order(item, visible=false) + if visible + ret = num_or_str(tk_send('item', 'order', item, '-visible')) + else + ret = num_or_str(tk_send('item', 'order', item)) + end + + (ret.kind_of?(Fixnum) && ret < 0)? nil: ret + end + def item_visible_order(item) + item_order(item, true) + end + def item_parent(item) id = num_or_str(tk_send('item', 'parent', item)) Tk::TreeCtrl::Item.id2obj(self, id) @@ -922,6 +1070,10 @@ class Tk::TreeCtrl end alias item_prev_sibling item_prevsibling + def item_range(first, last) + simplelist(tk_send('item', 'range', first, last)) + end + def item_remove(item) tk_send('item', 'remove', item) self @@ -994,6 +1146,25 @@ class Tk::TreeCtrl _item_sort_core(false, item, *opts) end + def item_span(item, column=nil, *args) + if args.empty? + if column + list(tk_send('item', 'span', item, column)) + else + simplelist(tk_send('item', 'span', item)).collect!{|elem| list(elem)} + end + else + tk_send('item', 'span', item, column, *args) + self + end + end + def get_item_span(item, column=nil) + item_span(item, column) + end + def set_item_span(item, col, num, *args) + item_span(item, col, num, *args) + end + def item_state_forcolumn(item, column, *args) tk_send('item', 'state', 'forcolumn', item, column, *args) end @@ -1234,6 +1405,15 @@ class Tk::TreeCtrl end end + def notify_unbind(pattern=nil) + if pattern + tk_send('notify', 'unbind', "<#{pattern}>") + else + tk_send('notify', 'unbind') + end + self + end + def notify_uninstall(pattern) pattern = "<#{pattern}>" tk_send('notify', 'uninstall', pattern) @@ -1365,7 +1545,7 @@ class Tk::TreeCtrl when 'padx', 'pady', 'ipadx', 'ipady' lst = list(val) (lst.size == 1)? lst[0]: lst - when 'detach' + when 'detach', 'indent' bool(val) when 'union' simplelist(val).collect!{|elem| @@ -1396,6 +1576,16 @@ class Tk::TreeCtrl ret end end + def get_style_layout(style, elem, opt=None) + style_layout(style, elem, opt) + end + def set_style_layout(style, elem, slot, value=None) + if slot.kind_of?(Hash) + style_layout(style, elem, slot) + else + style_layout(style, elem, {slot=>value}) + end + end def style_names() list(tk_send('style', 'names')).collect!{|id| diff --git a/ext/tk/lib/tkextlib/trofs.rb b/ext/tk/lib/tkextlib/trofs.rb new file mode 100644 index 0000000000..5914e5165f --- /dev/null +++ b/ext/tk/lib/tkextlib/trofs.rb @@ -0,0 +1,13 @@ +# +# trofs support +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# + +# call setup script for general 'tkextlib' libraries +require 'tkextlib/setup.rb' + +# call setup script +require 'tkextlib/trofs/setup.rb' + +# load library +require 'tkextlib/trofs/trofs.rb' diff --git a/ext/tk/lib/tkextlib/trofs/setup.rb b/ext/tk/lib/tkextlib/trofs/setup.rb new file mode 100644 index 0000000000..ce0f0bd4d4 --- /dev/null +++ b/ext/tk/lib/tkextlib/trofs/setup.rb @@ -0,0 +1,8 @@ +# +# setup.rb -- setup script before calling TkPackage.require() +# +# If you need some setup operations (for example, add a library path +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup +# operations in this file. +# diff --git a/ext/tk/lib/tkextlib/trofs/trofs.rb b/ext/tk/lib/tkextlib/trofs/trofs.rb new file mode 100644 index 0000000000..7a2606a275 --- /dev/null +++ b/ext/tk/lib/tkextlib/trofs/trofs.rb @@ -0,0 +1,51 @@ +# +# tkextlib/trofs/trofs.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# + +require 'tk' + +# call setup script for general 'tkextlib' libraries +require 'tkextlib/setup.rb' + +# call setup script +require 'tkextlib/trofs/setup.rb' + +# TkPackage.require('trofs', '0.4') +TkPackage.require('trofs') + +module Tk + module Trofs + extend TkCore + + PACKAGE_NAME = 'trofs'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('trofs') + rescue + '' + end + end + + ############################################## + + def self.create_archive(dir, archive) + tk_call('::trofs::archive', dir, archive) + archive + end + + def self.mount(archive, mountpoint=None) + # returns the normalized path to mountpoint + tk_call('::trofs::mount', archive, mountpoint) + end + + def self.umount(mountpoint) + tk_call('::trofs::umount', mountpoint) + mountpoint + end + end +end diff --git a/ext/tk/lib/tkextlib/vu/bargraph.rb b/ext/tk/lib/tkextlib/vu/bargraph.rb index 3ac08a26a5..27ff3c7cd0 100644 --- a/ext/tk/lib/tkextlib/vu/bargraph.rb +++ b/ext/tk/lib/tkextlib/vu/bargraph.rb @@ -28,6 +28,16 @@ class Tk::Vu::Bargraph < TkWindow end private :__boolval_optkeys + def __strval_optkeys + super() + [ + 'title', + 'barbackground', 'barcolor', 'barcolour', + 'tickcolor', 'tickcolour', + 'textcolor', 'textcolour', + ] + end + private :__strval_optkeys + def __listval_optkeys ['alabels', 'blabels'] end diff --git a/ext/tk/lib/tkextlib/vu/charts.rb b/ext/tk/lib/tkextlib/vu/charts.rb index a578c6979b..ee4298fa1c 100644 --- a/ext/tk/lib/tkextlib/vu/charts.rb +++ b/ext/tk/lib/tkextlib/vu/charts.rb @@ -17,6 +17,12 @@ module Tk end private :__item_boolval_optkeys + def __item_strval_optkeys(id) + super(id) << 'bar' << 'color' << 'outline' << + 'fill' << 'scaleline' << 'stripline' + end + private :__item_strval_optkeys + def __item_listval_optkeys(id) super(id) << 'values' << 'tags' end diff --git a/ext/tk/lib/tkextlib/winico/winico.rb b/ext/tk/lib/tkextlib/winico/winico.rb index a9fef3ac7e..c53a3ff48c 100644 --- a/ext/tk/lib/tkextlib/winico/winico.rb +++ b/ext/tk/lib/tkextlib/winico/winico.rb @@ -12,6 +12,7 @@ require 'tkextlib/setup.rb' require 'tkextlib/winico/setup.rb' # TkPackage.require('winico', '0.5') +# TkPackage.require('winico', '0.6') TkPackage.require('winico') module Tk -- cgit v1.2.3