summaryrefslogtreecommitdiff
path: root/ruby_1_8_5/ext/tk/lib/tk/kinput.rb
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-15 19:08:43 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-15 19:08:43 +0000
commitd464704f111d211c1f1ff9ef23ef1d755054be00 (patch)
treeb58b17b645dc463322e5fca57fe282360db659c9 /ruby_1_8_5/ext/tk/lib/tk/kinput.rb
parente4f06b3f2dec4b5d6334c5e9907e1cecbf649fc4 (diff)
add tag v1_8_5_54
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_8_5_54@12952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby_1_8_5/ext/tk/lib/tk/kinput.rb')
-rw-r--r--ruby_1_8_5/ext/tk/lib/tk/kinput.rb71
1 files changed, 71 insertions, 0 deletions
diff --git a/ruby_1_8_5/ext/tk/lib/tk/kinput.rb b/ruby_1_8_5/ext/tk/lib/tk/kinput.rb
new file mode 100644
index 0000000000..a29dbcdb72
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tk/kinput.rb
@@ -0,0 +1,71 @@
+#
+# tk/kinput.rb : control kinput
+#
+require 'tk'
+
+module TkKinput
+ include Tk
+ extend Tk
+
+ TkCommandNames = [
+ 'kinput_start'.freeze,
+ 'kinput_send_spot'.freeze,
+ 'kanjiInput'.freeze
+ ].freeze
+
+ def TkKinput.start(win, style=None)
+ tk_call('kinput_start', win, style)
+ end
+ def kinput_start(style=None)
+ TkKinput.start(self, style)
+ end
+
+ def TkKinput.send_spot(win)
+ tk_call('kinput_send_spot', win)
+ end
+ def kinput_send_spot
+ TkKinput.send_spot(self)
+ end
+
+ def TkKinput.input_start(win, keys=nil)
+ tk_call('kanjiInput', 'start', win, *hash_kv(keys))
+ end
+ def kanji_input_start(keys=nil)
+ TkKinput.input_start(self, keys)
+ end
+
+ def TkKinput.attribute_config(win, slot, value=None)
+ if slot.kind_of? Hash
+ tk_call('kanjiInput', 'attribute', win, *hash_kv(slot))
+ else
+ tk_call('kanjiInput', 'attribute', win, "-#{slot}", value)
+ end
+ end
+ def kinput_attribute_config(slot, value=None)
+ TkKinput.attribute_config(self, slot, value)
+ end
+
+ def TkKinput.attribute_info(win, slot=nil)
+ if slot
+ conf = tk_split_list(tk_call('kanjiInput', 'attribute',
+ win, "-#{slot}"))
+ conf[0] = conf[0][1..-1]
+ conf
+ else
+ tk_split_list(tk_call('kanjiInput', 'attribute', win)).collect{|conf|
+ conf[0] = conf[0][1..-1]
+ conf
+ }
+ end
+ end
+ def kinput_attribute_info(slot=nil)
+ TkKinput.attribute_info(self, slot)
+ end
+
+ def TkKinput.input_end(win)
+ tk_call('kanjiInput', 'end', win)
+ end
+ def kanji_input_end
+ TkKinput.input_end(self)
+ end
+end