diff options
author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-20 05:10:59 +0000 |
---|---|---|
committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-20 05:10:59 +0000 |
commit | 8a73532bd86d237cc6314015821a84523b0e2bbf (patch) | |
tree | 10a1470f37a79aff08d1c0e0459b4b46b06d91da /ext/tk/lib/tk | |
parent | fd71f860a1f73a244964673003092424f670bea9 (diff) |
* ext/tk/lib/multi-tk.rb: supports new features of Tcl/Tk8.5a2
* ext/tk/lib/tk/clock.rb: ditto
* ext/tk/lib/tk/text.rb: ditto
* ext/tk/lib/tk/panedwindow.rb: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tk')
-rw-r--r-- | ext/tk/lib/tk/clock.rb | 10 | ||||
-rw-r--r-- | ext/tk/lib/tk/panedwindow.rb | 24 | ||||
-rw-r--r-- | ext/tk/lib/tk/text.rb | 27 |
3 files changed, 57 insertions, 4 deletions
diff --git a/ext/tk/lib/tk/clock.rb b/ext/tk/lib/tk/clock.rb index 823b8a6341..3581152c8b 100644 --- a/ext/tk/lib/tk/clock.rb +++ b/ext/tk/lib/tk/clock.rb @@ -5,6 +5,10 @@ require 'tk' module Tk module Clock + def self.add(clk, *args) + tk_call_without_enc('clock','add', clk, *args).to_i + end + def self.clicks(ms=nil) case ms when nil @@ -53,5 +57,11 @@ module Tk def self.seconds tk_call_without_enc('clock','seconds').to_i end + def self.milliseconds + tk_call_without_enc('clock','milliseconds').to_i + end + def self.microseconds + tk_call_without_enc('clock','microseconds').to_i + end end end diff --git a/ext/tk/lib/tk/panedwindow.rb b/ext/tk/lib/tk/panedwindow.rb index 37be77508f..4932478ba0 100644 --- a/ext/tk/lib/tk/panedwindow.rb +++ b/ext/tk/lib/tk/panedwindow.rb @@ -110,6 +110,10 @@ class TkPanedWindow<TkWindow conf = tk_split_list(tk_send_without_enc('paneconfigure', win, "-#{key}")) conf[0] = conf[0][1..-1] + if conf[0] == 'hide' + conf[3] = bool(conf[3]) unless conf[3].empty? + conf[4] = bool(conf[4]) unless conf[4].empty? + end conf else tk_split_simplelist(tk_send_without_enc('paneconfigure', @@ -117,14 +121,18 @@ class TkPanedWindow<TkWindow conf = tk_split_simplelist(conflist) conf[0] = conf[0][1..-1] if conf[3] - if conf[3].index('{') + if conf[0] == 'hide' + conf[3] = bool(conf[3]) unless conf[3].empty? + elsif conf[3].index('{') conf[3] = tk_split_list(conf[3]) else conf[3] = tk_tcl2ruby(conf[3]) end end if conf[4] - if conf[4].index('{') + if conf[0] == 'hide' + conf[4] = bool(conf[4]) unless conf[4].empty? + elsif conf[4].index('{') conf[4] = tk_split_list(conf[4]) else conf[4] = tk_tcl2ruby(conf[4]) @@ -141,6 +149,10 @@ class TkPanedWindow<TkWindow conf = tk_split_list(tk_send_without_enc('paneconfigure', win, "-#{key}")) key = conf.shift[1..-1] + if key == 'hide' + conf[2] = bool(conf[2]) unless conf[2].empty? + conf[3] = bool(conf[3]) unless conf[3].empty? + end { key => conf } else ret = {} @@ -149,14 +161,18 @@ class TkPanedWindow<TkWindow conf = tk_split_simplelist(conflist) key = conf.shift[1..-1] if key - if conf[2].index('{') + if key == 'hide' + conf[2] = bool(conf[2]) unless conf[2].empty? + elsif conf[2].index('{') conf[2] = tk_split_list(conf[2]) else conf[2] = tk_tcl2ruby(conf[2]) end end if conf[3] - if conf[3].index('{') + if key == 'hide' + conf[3] = bool(conf[3]) unless conf[3].empty? + elsif conf[3].index('{') conf[3] = tk_split_list(conf[3]) else conf[3] = tk_tcl2ruby(conf[3]) diff --git a/ext/tk/lib/tk/text.rb b/ext/tk/lib/tk/text.rb index f99337b3e9..8069adc57a 100644 --- a/ext/tk/lib/tk/text.rb +++ b/ext/tk/lib/tk/text.rb @@ -477,6 +477,11 @@ class TkText<TkTextWin info end + def peer_names() + # Tk8.5 feature + list(tk_send_without_enc('peer', 'names')) + end + def replace(idx1, idx2, *opts) tk_send('replace', idx1, idx2, *opts) self @@ -1373,3 +1378,25 @@ class TkText<TkTextWin dump(['image'], *index, &block) end end + +####################################### + +class TkText::Peer < TkText + # Tk8.5 feature + def initialize(text, parent=nil, keys={}) + unless text.kind_of?(TkText) + fail ArgumentError, "TkText is expected for 1st argument" + end + @src_text = text + super(parent, keys) + end + + def create_self(keys) + if keys and keys != None + tk_call_without_enc(@src_text.path, 'peer', 'create', @path) + else + tk_call_without_enc(@src_text.path, 'peer', 'create', @path) + end + end + private :create_self +end |