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 | 21cce8dc191d640846bf473c0b9576d6cf3844da (patch) | |
| tree | fe0d91b955fc034d76297380f5a152d05531ee5d /ext/tk/lib/tkextlib | |
| parent | 7396d7ddc72ea4d83d86b2c4565920bdd836ec3a (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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@9564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tkextlib')
| -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 8a37e35eb..b430bae55 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 |
