diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-11-27 09:23:38 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-11-27 09:23:38 +0000 |
commit | f54418b71f57e00d4a50bd86bf7d18b8b5195287 (patch) | |
tree | d5bd57142a0d4736fdfd1f35dcd864ac40cfb045 /ext/tk/lib/tkcanvas.rb | |
parent | 1f297b8bfc0fdacb8cfb19736cf224b2550281b3 (diff) | |
download | ruby-f54418b71f57e00d4a50bd86bf7d18b8b5195287.tar.gz |
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tkcanvas.rb')
-rw-r--r-- | ext/tk/lib/tkcanvas.rb | 68 |
1 files changed, 64 insertions, 4 deletions
diff --git a/ext/tk/lib/tkcanvas.rb b/ext/tk/lib/tkcanvas.rb index 88a91ae5d2..ff06e9305a 100644 --- a/ext/tk/lib/tkcanvas.rb +++ b/ext/tk/lib/tkcanvas.rb @@ -274,7 +274,19 @@ class TkCanvas<TkWindow end def itemcget(tagOrId, option) - tk_tcl2ruby tk_send 'itemcget', tagid(tagOrId), "-#{option}" + case option + when 'dash', 'activedash', 'disableddash' + conf = tk_send('itemcget', tagid(tagOrId), "-#{option}") + if conf =~ /^[0-9]/ + list(conf) + else + conf + end + when 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile' + tk_send 'itemcget', tagid(tagOrId), "-#{option}" + else + tk_tcl2ruby tk_send 'itemcget', tagid(tagOrId), "-#{option}" + end end def itemconfigure(tagOrId, key, value=None) @@ -308,12 +320,55 @@ class TkCanvas<TkWindow def itemconfiginfo(tagOrId, key=nil) if key - conf = tk_split_list(tk_send 'itemconfigure', tagid(tagOrId), "-#{key}") + case key + when 'dash', 'activedash', 'disableddash' + conf = tk_split_simplelist(tk_send 'itemconfigure', + tagid(tagOrId), "-#{key}") + if conf[3] && conf[3] =~ /^[0-9]/ + conf[3] = list(conf[3]) + end + if conf[4] && conf[4] =~ /^[0-9]/ + conf[4] = list(conf[4]) + end + when 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile' + conf = tk_split_simplelist(tk_send 'itemconfigure', + tagid(tagOrId), "-#{key}") + else + conf = tk_split_list(tk_send 'itemconfigure', + tagid(tagOrId), "-#{key}") + end conf[0] = conf[0][1..-1] conf else - tk_split_list(tk_send 'itemconfigure', tagid(tagOrId)).collect{|conf| + tk_split_simplelist(tk_send 'itemconfigure', + tagid(tagOrId)).collect{|conflist| + conf = tk_split_simplelist(conflist) conf[0] = conf[0][1..-1] + case conf[0] + when 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile' + when 'dash', 'activedash', 'disableddash' + if conf[3] && conf[3] =~ /^[0-9]/ + conf[3] = list(conf[3]) + end + if conf[4] && conf[4] =~ /^[0-9]/ + conf[4] = list(conf[4]) + end + else + if conf[3] + if 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('{') + conf[4] = tk_split_list(conf[4]) + else + conf[4] = tk_tcl2ruby(conf[4]) + end + end + end conf } end @@ -820,7 +875,12 @@ class TkPhotoImage<TkImage end def cget(option) - tk_tcl2ruby tk_send 'cget', option + case option + when 'data', 'flie' + tk_send 'cget', option + else + tk_tcl2ruby tk_send 'cget', option + end end def copy(source, *opts) |