diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-06-13 09:57:40 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-06-13 09:57:40 +0000 |
commit | 00bd38a3b16ed222af61cf523af0c180b02c1d8c (patch) | |
tree | 09025107ec24622f53023c8ff588b62bdcff8d7a /ext/tk/lib/tk.rb | |
parent | 9ee0cafbfe7a94a7b6a9d0e7f2dbf7c7fd229757 (diff) | |
download | ruby-00bd38a3b16ed222af61cf523af0c180b02c1d8c.tar.gz |
tk font patch
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tk.rb')
-rw-r--r-- | ext/tk/lib/tk.rb | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb index a18a0e4587..a696d3b9bf 100644 --- a/ext/tk/lib/tk.rb +++ b/ext/tk/lib/tk.rb @@ -593,6 +593,36 @@ module Tk tk_tcl2ruby(tk_call('focus', '-lastfor', win)) end + def Tk.show_kinsoku(mode='both') + begin + if /^8\.*/ === TK_VERSION && JAPANIZED_TK + tk_split_simplelist(tk_call('kinsoku', 'show', mode)) + end + rescue + end + end + def Tk.add_kinsoku(chars, mode='both') + begin + if /^8\.*/ === TK_VERSION && JAPANIZED_TK + tk_split_simplelist(tk_call('kinsoku', 'add', mode, + *(chars.split('')))) + else + [] + end + rescue + [] + end + end + def Tk.delete_kinsoku(chars, mode='both') + begin + if /^8\.*/ === TK_VERSION && JAPANIZED_TK + tk_split_simplelist(tk_call('kinsoku', 'delete', mode, + *(chars.split('')))) + end + rescue + end + end + def toUTF8(str,encoding) INTERP._toUTF8(str,encoding) end @@ -1188,6 +1218,73 @@ module TkXIM include Tk extend Tk + def TkXIM.useinputmethods(window=nil, value=nil) + if window + if value + tk_call 'tk', 'useinputmethods', '-displayof', window.path, value + else + tk_call 'tk', 'useinputmethods', '-displayof', window.path + end + else + if value + tk_call 'tk', 'useinputmethods', value + else + tk_call 'tk', 'useinputmethods' + end + end + end + + def TkXIM.configure(window, slot, value=None) + begin + if /^8\.*/ === Tk::TK_VERSION && JAPANIZED_TK + if slot.kind_of? Hash + tk_call 'imconfigure', window.path, *hash_kv(slot) + else + tk_call 'imconfigure', window.path, "-#{slot}", value + end + end + rescue + end + end + + def TkXIM.configinfo(window, slot=nil) + begin + if /^8\.*/ === Tk::TK_VERSION && JAPANIZED_TK + if slot + conf = tk_split_list(tk_call('imconfigure', window.path, "-#{slot}")) + conf[0] = conf[0][1..-1] + conf + else + tk_split_list(tk_call('imconfigure', window.path)).collect{|conf| + conf[0] = conf[0][1..-1] + conf + } + end + else + [] + end + rescue + [] + end + end + + def useinputmethods(value=nil) + TkXIM.useinputmethods(self, value=nil) + end + + def imconfigure(window, slot, value=None) + TkXIM.configinfo(window, slot, value) + end + + def imconfiginfo(slot=nil) + TkXIM.configinfo(window, slot) + end +end + +module TkXIM + include Tk + extend Tk + def TkXIM.useinputmethods(window=nil,value=nil) if window if value |