diff options
author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-04-01 17:22:02 +0000 |
---|---|---|
committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-04-01 17:22:02 +0000 |
commit | 4f8df7dcc42119a11c568a12b3e50f01553f4e4c (patch) | |
tree | a519d006d5e227821a80d455b191d30531325d4d /ext/tk/lib/tk | |
parent | 011527f455eab7e7be7e3fd90d0f6d801eeccfde (diff) |
* ext/tk/lib/tk.rb (TkWindow.initialize): accept 'without_creating'
option without 'widgetname' option to allow creating a widget object
which is used as an argument of Tcl/Tk's widget allocation commands.
* ext/tk/lib/tk/image.rb (TkImage.initialize): accept 'imagename'
option to create a image object by the given name.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tk')
-rw-r--r-- | ext/tk/lib/tk/image.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/ext/tk/lib/tk/image.rb b/ext/tk/lib/tk/image.rb index 0848eb5966..d38414d09f 100644 --- a/ext/tk/lib/tk/image.rb +++ b/ext/tk/lib/tk/image.rb @@ -15,9 +15,16 @@ class TkImage<TkObject TkCore::INTERP.init_ip_env{ Tk_IMGTBL.clear } def initialize(keys=nil) - # @path = Tk_Image_ID.join('') - @path = Tk_Image_ID.join(TkCore::INTERP._ip_id_) - Tk_Image_ID[1].succ! + @path = nil + if keys.kind_of?(Hash) + keys = _symbolkey2str(keys) + @path = keys.delete('imagename') + end + unless @path + # @path = Tk_Image_ID.join('') + @path = Tk_Image_ID.join(TkCore::INTERP._ip_id_) + Tk_Image_ID[1].succ! + end tk_call_without_enc('image', 'create', @type, @path, *hash_kv(keys, true)) Tk_IMGTBL[@path] = self end |