diff options
author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-11-18 22:37:53 +0000 |
---|---|---|
committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-11-18 22:37:53 +0000 |
commit | cd30677dab443c79750b46c29c69e5b865f9240b (patch) | |
tree | fe0d91b955fc034d76297380f5a152d05531ee5d /ext/tk/lib/tkextlib/ICONS/icons.rb | |
parent | 63fe6ca5a08c371bac75d5a40ad008b61d99c6b5 (diff) |
* ext/tk/lib/tk/font.rb: remove dependency on Ruby's version (1.8 or 1.9).
* ext/tk/lib/tkextlib/ICONS/icons.rb: ditto.
* ext/tk/sample/tkextlib/treectrl/demo.rb: ditto.
* ext/tk/lib/tk.rb: update RELEASE_DATE
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tkextlib/ICONS/icons.rb')
-rw-r--r-- | ext/tk/lib/tkextlib/ICONS/icons.rb | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/ext/tk/lib/tkextlib/ICONS/icons.rb b/ext/tk/lib/tkextlib/ICONS/icons.rb index 8a37e35ebf..b430bae55d 100644 --- a/ext/tk/lib/tkextlib/ICONS/icons.rb +++ b/ext/tk/lib/tkextlib/ICONS/icons.rb @@ -75,14 +75,26 @@ module Tk ########################################## - def self.new(name, keys=nil) - unless obj = Tk_IMGTBL["::icon::#{name}"] - obj = allocate() - obj.instance_eval{initialize(name, keys)} + class << self + alias _new new + + def new(name, keys=nil) + if obj = Tk_IMGTBL["::icon::#{name}"] + if keys + keys = _symbolkey2str(keys) + unless keys.delete('without_creating') + tk_call('::icons::icons', 'create', *(hash_kv(keys) << obj.name)) + end + end + else + obj = _new(name, keys) + end + obj end - obj end + ########################################## + def initialize(name, keys=nil) if name.kind_of?(String) && name =~ /^::icon::(.+)$/ @name = $1 |