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 | d4d182578c2a6669f144a1fea1aff63f34a42172 (patch) | |
tree | 457a3319cbdd105fb608f11eeb81968803b62552 /ext/tk/lib/tk/image.rb | |
parent | 7665899b90420776bf228a334be907eae3a37088 (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/branches/ruby_1_8@8237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tk/image.rb')
-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 |