1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext/tk/lib/tk/kinput.rb
nagai d2a9e77748 * ext/tk/tcltklib.c (lib_eventloop_ensure): mis-delete a timer handler
when exit from a recursive called eventloop
* ext/tk/lib/tk/timer.rb: new TkRTTimer class, which can works for a
  realtime operation
* ext/tk/sample/tkrttimer.rb: sample of TkRTTimer class
* ext/tk/lib/tk/textmark.rb: move  TkTextMark#+ and TkTextMark#- to
  TkText::IndexModMethods
* ext/tk/lib/tk/text.rb: improve TkTextMark#+ and TkTextMark#-, and
  add them to TkText::IndexModMethods module
* ext/tk/sample/tktextio.rb: add test part of "seek by text index
  modifiers"


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-03-10 10:13:30 +00:00

71 lines
1.6 KiB
Ruby

#
# 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