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 | bfab52caff4e490113779554667e20757a20467c (patch) | |
tree | 1978a2e6cddd2dc461a06656a7a40955fef1d4d1 /ext/tk/lib | |
parent | a8abed1256fe6e800d240b5ca3ddce1b4fec67a5 (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/trunk@9564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib')
-rw-r--r-- | ext/tk/lib/tk.rb | 2 | ||||
-rw-r--r-- | ext/tk/lib/tk/font.rb | 27 | ||||
-rw-r--r-- | ext/tk/lib/tkextlib/ICONS/icons.rb | 22 |
3 files changed, 32 insertions, 19 deletions
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb index 3e6c0c0a04..0d18882d8c 100644 --- a/ext/tk/lib/tk.rb +++ b/ext/tk/lib/tk.rb @@ -4499,7 +4499,7 @@ end #Tk.freeze module Tk - RELEASE_DATE = '2005-11-18'.freeze + RELEASE_DATE = '2005-11-19'.freeze autoload :AUTO_PATH, 'tk/variable' autoload :TCL_PACKAGE_PATH, 'tk/variable' diff --git a/ext/tk/lib/tk/font.rb b/ext/tk/lib/tk/font.rb index 6fd2406f5a..f7ea973a71 100644 --- a/ext/tk/lib/tk/font.rb +++ b/ext/tk/lib/tk/font.rb @@ -488,6 +488,19 @@ class TkFont create_compoundfont(ltn, knj, keys) end + def initialize_copy(font) + unless font.kind_of?(TkFont) + fail TypeError, '"initialize_copy should take same class object' + end + if TkComm::GET_CONFIGINFOwoRES_AS_ARRAY + keys = {} + font.configinfo.each{|key,value| keys[key] = value } + initialize(font.latin_font_id, font.kanji_font_id, keys) + else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY + initialize(font.latin_font_id, font.kanji_font_id, font.configinfo) + end + end + def _get_font_info_from_hash(font) font = _symbolkey2str(font) foundry = (info = font['foundry'] .to_s)? info: '*' @@ -1184,24 +1197,12 @@ class TkFont ################################### =begin def dup - src = self - obj = super() - obj.funcall(:initialize, src) - obj - end - def clone - src = self - obj = super() - obj.funcall(:initialize, src) - obj - end -=end - def dup TkFont.new(self) end def clone TkFont.new(self) end +=end end module TkFont::CoreMethods diff --git a/ext/tk/lib/tkextlib/ICONS/icons.rb b/ext/tk/lib/tkextlib/ICONS/icons.rb index f1b009cd58..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.funcall(: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 |