From 438e33e3d29d098ba8fb3f243ca93a6367c15322 Mon Sep 17 00:00:00 2001 From: nagai Date: Wed, 4 Oct 2006 09:52:54 +0000 Subject: * ext/tk/lib/tkextlib/tile.rb, lib/tkextlib/tile/* : support Tile 0.7.6. * ext/tk/lib/tkextlib/SUPPORT_STATUS: [ruby-talk:211939] check links of extensions. * ext/tk/lib/tkextlib/blt/container.rb: define instance methods properly. * ext/tk/lib/tkextlib/tile/tcombobox.rb: bug fix [ruby-talk:213003]. * ext/tk/lib/tkextlib/tile/tnotebook.rb: ditto. * ext/tk/lib/tkextlib/tile/treeview.rb: ditto. * ext/tk/lib/tkextlib/tile/sizegrip.rb: [new] add 'ttk::sizegrip' widget. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 ++++ ext/tk/ChangeLog.tkextlib | 19 +++++++++++++ ext/tk/lib/tkextlib/SUPPORT_STATUS | 42 +++++++++++++-------------- ext/tk/lib/tkextlib/blt/container.rb | 20 ++++++------- ext/tk/lib/tkextlib/tile.rb | 5 ++++ ext/tk/lib/tkextlib/tile/sizegrip.rb | 25 +++++++++++++++++ ext/tk/lib/tkextlib/tile/style.rb | 4 +++ ext/tk/lib/tkextlib/tile/tcombobox.rb | 6 +--- ext/tk/lib/tkextlib/tile/tnotebook.rb | 10 +++++-- ext/tk/lib/tkextlib/tile/treeview.rb | 53 +++++++++++++++++++++++++++++++++-- 10 files changed, 147 insertions(+), 42 deletions(-) create mode 100644 ext/tk/lib/tkextlib/tile/sizegrip.rb diff --git a/ChangeLog b/ChangeLog index 59e676e7c3..fb4a8e59aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Oct 4 18:47:25 2006 Hidetoshi NAGAI + + * ext/tk/lib/tkextlib/*: bugfix and update + (see ext/tk/ChangeLog.tkextlib). + Wed Oct 4 17:25:14 2006 Yukihiro Matsumoto * eval.c (rb_call): check protected visibility based on real self, diff --git a/ext/tk/ChangeLog.tkextlib b/ext/tk/ChangeLog.tkextlib index fad15e8822..557abe44a5 100644 --- a/ext/tk/ChangeLog.tkextlib +++ b/ext/tk/ChangeLog.tkextlib @@ -1,3 +1,22 @@ +2006-10-04 Hidetoshi NAGAI + + * lib/tkextlib/tile.rb, lib/tkextlib/tile/* : support Tile 0.7.6. + +2006-10-03 Hidetoshi NAGAI + + * lib/tkextlib/SUPPORT_STATUS: [ruby-talk:211939] check links + of extensions. + + * lib/tkextlib/blt/container.rb: define instance methods properly. + + * lib/tkextlib/tile/tcombobox.rb: bug fix [ruby-talk:213003]. + + * lib/tkextlib/tile/tnotebook.rb: ditto. + + * lib/tkextlib/tile/treeview.rb: ditto. + + * lib/tkextlib/tile/sizegrip.rb: [new] add 'ttk::sizegrip' widget. + 2006-08-31 Hidetoshi NAGAI * lib/tkextlib/blt.rb: double dashes (--) option doesn't work diff --git a/ext/tk/lib/tkextlib/SUPPORT_STATUS b/ext/tk/lib/tkextlib/SUPPORT_STATUS index 8d7b6fc44a..3d6b6116ca 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/12/11 >>>******* + *******<<< RELEASE_DATE of the libraries : 2006/10/04 >>>******* 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 @@ -56,23 +56,23 @@ script may give you some hints about that. ===< support with some examples (may be beta quality) >======================= Tcllib 1.8 -Tklib 0.4.1 http://sf.net/projects/tcllib ==> tcllib +Tklib 0.4.1 http://sourceforge.net/projects/tcllib ==> tcllib -IWidgets 4.0.2 http://sf.net/projects/incrTcl ==> iwidgets +IWidgets 4.0.2 http://sourceforge.net/projects/incrtcl ==> iwidgets -BWidgets 1.7 http://sf.net/projects/tcllib ==> bwidget +BWidgets 1.7 http://sourceforge.net/projects/tcllib ==> bwidget -TkTable 2.9 http://sf.net/projects/tktable ==> tktable +TkTable 2.9 http://sourceforge.net/projects/tktable ==> tktable * see also written by Ferenc Engard (ferenc@engard.hu) -vu 2.3.0 http://tktable.sourceforge.net ==> vu +vu 2.3.0 http://sourceforge.net/projects/tktable ==> vu -TkHTML 2.0 http://www.hwaci.com/sw/tkhtml/index.html ==> tkHTML +TkHTML 2.0 http://www.hwaci.com/sw/tkhtml/ ==> tkHTML ICONS 1.0 http://www.satisoft.com/tcltk/icons/ ==> ICONS -TkImg 1.3 http://sf.net/projects/tkimg ==> tkimg +TkImg 1.3 http://sourceforge.net/projects/tkimg ==> tkimg BLT 2.4z http://sourceforge.net/projects/blt @@ -81,20 +81,20 @@ BLT 2.4z http://sourceforge.net/projects/blt ==> blt TkTreeCtrl CVS/Hd(2005-12-02) - http://tktreectrl.sourceforge.net/ ==> treectrl + http://sourceforge.net/projects/tktreectrl ==> treectrl -Tile CVS/Hd(2005-12-07) - http://tktable.sourceforge.net/tile/ ==> tile +Tile CVS/Hd(2006-10-01) + http://sourceforge.net/projects/tktable ==> tile ===< support (may be alpha or beta quality) >================================= IncrTcl CVS/Hd(2005-02-14) - http://sf.net/projects/incrTcl ==> itcl, itk + http://sourceforge.net/projects/incrtcl ==> itcl, itk TclX CVS/Hd(2005-02-07) - http://sf.net/projects/tclx + http://sourceforge.net/projects/tclx ==> tclx (partial support; infox command and XPG/3 message catalogs only) @@ -105,7 +105,7 @@ Trofs 0.4.3 http://math.nist.gov/~DPorter/tcltk/trofs/ ===< possibly available (not tested; alpha quality) >========================= winico 0.6 - http://tktable.sourceforge.net + http://sourceforge.net/projects/tktable ==> winico (win32 only) TkTrans latest(2004-10-11) @@ -160,17 +160,17 @@ QuickTimeTcl *** http://hem.fyristorg.com/matben/qt/ ===< may not support (already exist, out of Ruby/Tk scope, and so on) >======= -TkCon *** http://sf.net/projects/tkcon +TkCon *** http://sourceforge.net/projects/tkcon -Expect *** http://sf.net/projects/expect +Expect *** http://sourceforge.net/projects/expect -TclXML *** http://sf.net/projects/tclxml +TclXML *** http://sourceforge.net/projects/tclxml -TclXSLT *** http://sf.net/projects/tclxml +TclXSLT *** http://sourceforge.net/projects/tclxml -TclDOM *** http://sf.net/projects/tclxml +TclDOM *** http://sourceforge.net/projects/tclxml -TclSOAP *** http://sf.net/projects/tclsoap +TclSOAP *** http://sourceforge.net/projects/tclsoap Snack *** http://www.speech.kth.se/~kare/snack2.2.tar.gz * use Snack for Ruby @@ -182,7 +182,7 @@ tDOM *** http://www.tdom.org Mk4tcl *** http://www.equi4.com/metakit/tcl.html -Memchan *** http://memchan.sourceforge.net/ +Memchan *** http://sourceforge.net/projects/memchan XOTcl *** http://www.xotcl.org/ diff --git a/ext/tk/lib/tkextlib/blt/container.rb b/ext/tk/lib/tkextlib/blt/container.rb index 60ba1dec1e..cdbec21f25 100644 --- a/ext/tk/lib/tkextlib/blt/container.rb +++ b/ext/tk/lib/tkextlib/blt/container.rb @@ -11,18 +11,18 @@ module Tk::BLT TkCommandNames = ['::blt::container'.freeze].freeze WidgetClassName = 'Container'.freeze WidgetClassNames[WidgetClassName] = self - end - def __strval_optkeys - super() << 'name' - end - private :__strval_optkeys + 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 + def find_command(pat) + Hash[*simplelist(tk_send_without_enc('find', '-command', pat))] + end - def find_name(pat) - list(tk_send_without_enc(tk_call(self.path, 'find', '-name', pat))) + def find_name(pat) + Hash[*simplelist(tk_send_without_enc('find', '-name', pat))] + end end end diff --git a/ext/tk/lib/tkextlib/tile.rb b/ext/tk/lib/tkextlib/tile.rb index 690f93f029..acc7bebe4e 100644 --- a/ext/tk/lib/tkextlib/tile.rb +++ b/ext/tk/lib/tkextlib/tile.rb @@ -158,6 +158,11 @@ module Tk list(tk_send('state')) end end + + def identify(x, y) + ret = tk_send_without_enc('identify', x, y) + (ret.empty?)? nil: ret + end end ###################################### diff --git a/ext/tk/lib/tkextlib/tile/sizegrip.rb b/ext/tk/lib/tkextlib/tile/sizegrip.rb new file mode 100644 index 0000000000..ea796583b0 --- /dev/null +++ b/ext/tk/lib/tkextlib/tile/sizegrip.rb @@ -0,0 +1,25 @@ +# +# ttk::sizegrip widget +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +require 'tk' +require 'tkextlib/tile.rb' + +module Tk + module Tile + class SizeGrip < TkWindow + end + end +end + +class Tk::Tile::SizeGrip < TkWindow + include Tk::Tile::TileWidget + + TkCommandNames = ['::ttk::sizegrip'.freeze].freeze + WidgetClassName = 'TSizegrip'.freeze + WidgetClassNames[WidgetClassName] = self + + def self.style(*args) + [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') + end +end diff --git a/ext/tk/lib/tkextlib/tile/style.rb b/ext/tk/lib/tkextlib/tile/style.rb index 485a36d7d6..59bc4b0d78 100644 --- a/ext/tk/lib/tkextlib/tile/style.rb +++ b/ext/tk/lib/tkextlib/tile/style.rb @@ -52,6 +52,10 @@ class << Tk::Tile::Style end end + def lookup(style, opt, state=None, fallback_value=None) + tk_call('style', 'lookup', style, '-' << opt.to_s, state, fallback_value) + end + include Tk::Tile::ParseStyleLayout def layout(style=nil, spec=nil) diff --git a/ext/tk/lib/tkextlib/tile/tcombobox.rb b/ext/tk/lib/tkextlib/tile/tcombobox.rb index c63ab94dbe..e8e042fbd9 100644 --- a/ext/tk/lib/tkextlib/tile/tcombobox.rb +++ b/ext/tk/lib/tkextlib/tile/tcombobox.rb @@ -39,16 +39,12 @@ class Tk::Tile::TCombobox < Tk::Tile::TEntry end def current - number(tk_send_without_enc('current', idx)) + number(tk_send_without_enc('current')) end def current=(idx) tk_send_without_enc('current', idx) end - def identify(x, y) - tk_send_without_enc('identify', x, y) - end - def set(val) tk_send('set', val) end diff --git a/ext/tk/lib/tkextlib/tile/tnotebook.rb b/ext/tk/lib/tkextlib/tile/tnotebook.rb index abaed8ee9c..a928e64b61 100644 --- a/ext/tk/lib/tkextlib/tile/tnotebook.rb +++ b/ext/tk/lib/tkextlib/tile/tnotebook.rb @@ -27,15 +27,15 @@ class Tk::Tile::TNotebook < TkWindow end private :__item_config_cmd - def __item_listval_optkeys + def __item_listval_optkeys(id) [] end private :__item_listval_optkeys - def __item_methodcall_optkeys # { key=>method, ... } + def __item_methodcall_optkeys(id) # { key=>method, ... } {} end - private :__item_listval_optkeys + private :__item_methodcall_optkeys #alias tabcget itemcget alias tabconfigure itemconfigure @@ -104,6 +104,10 @@ class Tk::Tile::TNotebook < TkWindow self end + def selected + window(tk_send_without_enc('select')) + end + def tabs list(tk_send('tabs')) end diff --git a/ext/tk/lib/tkextlib/tile/treeview.rb b/ext/tk/lib/tkextlib/tile/treeview.rb index d3ffbbfa6b..6d6074b800 100644 --- a/ext/tk/lib/tkextlib/tile/treeview.rb +++ b/ext/tk/lib/tkextlib/tile/treeview.rb @@ -158,6 +158,10 @@ class Tk::Tile::Treeview < TkWindow end end + def bbox(item, column=None) + list(tk_send('item', 'bbox', item, column)) + end + def children(item) simplelist(tk_send_without_enc('children', item)) end @@ -186,6 +190,7 @@ class Tk::Tile::Treeview < TkWindow end def identify(x, y) + # tile-0.7.2 or previous ret = simplelist(tk_send('identify', x, y)) case ret[0] when 'heading', 'separator', 'cell' @@ -193,6 +198,14 @@ class Tk::Tile::Treeview < TkWindow end end + def row_identify(x, y) + tk_send('identify', 'row', x, y) + end + + def column_identify(x, y) + tk_send('identify', 'column', x, y) + end + def index(item) number(tk_send('index', item)) end @@ -201,11 +214,10 @@ class Tk::Tile::Treeview < TkWindow keys = _symbolkey2str(keys) id = keys.delete('id') if id - tk_send('insert', parent, idx, '-id', id, *hash_kv(keys)) + num_or_str(tk_send('insert', parent, idx, '-id', id, *hash_kv(keys))) else - tk_send('insert', parent, idx, *hash_kv(keys)) + num_or_str(tk_send('insert', parent, idx, *hash_kv(keys))) end - self end def instate(spec, cmd=Proc.new) @@ -270,6 +282,8 @@ class Tk::Tile::Treeview < TkWindow end ret end + alias get_dictionary get_directory + def get(item, col) tk_send('set', item, col) end @@ -277,4 +291,37 @@ class Tk::Tile::Treeview < TkWindow tk_send('set', item, col, value) self end + + def tag_bind(tag, seq, *args) + if TkComm._callback_entry?(args[0]) || !block_given? + cmd = args.shift + else + cmd = Proc.new + end + _bind([@path, 'tag', 'bind', tag], seq, cmd, *args) + self + end + alias tagbind tag_bind + + def tag_bind_append(tag, seq, *args) + if TkComm._callback_entry?(args[0]) || !block_given? + cmd = args.shift + else + cmd = Proc.new + end + _bind_append([@path, 'tag', 'bind', tag], seq, cmd, *args) + self + end + alias tagbind_append tag_bind_append + + def tag_bind_remove(tag, seq) + _bind_remove([@path, 'tag', 'bind', tag], seq) + self + end + alias tagbind_remove tag_bind_remove + + def tag_bindinfo(tag, context=nil) + _bindinfo([@path, 'tag', 'bind', tag], context) + end + alias tagbindinfo tag_bindinfo end -- cgit v1.2.3