aboutsummaryrefslogtreecommitdiffstats
path: root/ext/tk/lib/tk.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tk/lib/tk.rb')
-rw-r--r--ext/tk/lib/tk.rb97
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