1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/tk/lib/tk/bindtag.rb: bug fix [ruby-talk: 123667]

* ext/tk/lib/tk/timer.rb: accept :idle for the interval argument
* ext/tk/lib/tk.rb: add TkComm._callback_entry?()
* ext/tk/lib/multi-tk.rb: add MultiTkIp.cb_entry_class
* ext/tk/lib/tk/canvas.rb: use TkComm._callback_entry?()
* ext/tk/lib/tk/canvastag.rb: ditto
* ext/tk/lib/tk/dialog.rb: ditto
* ext/tk/lib/tk/optiondb.rb: ditto
* ext/tk/lib/tk/text.rb: ditto
* ext/tk/lib/tk/texttag.rb: ditto
* ext/tk/lib/tk/textwindow.rb: ditto
* ext/tk/lib/tk/timer.rb: ditto
* ext/tk/lib/tk/validation.rb: ditto
* ext/tk/lib/tkextlib/*: ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagai 2004-12-16 07:13:14 +00:00
parent c89c302d3f
commit 9e51ec666b
24 changed files with 187 additions and 100 deletions

View file

@ -1,3 +1,27 @@
2004-12-16 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* bwidget/labelentry.rb: use TkCore.callback_obj?()
* bwidget/listbox.rb: ditto
* bwidget/notebook.rb: ditto
* bwidget/spinbox.rb: ditto
* itk/incr_tk.rb: ditto
* iwidgets/scrolledcanvas.rb: ditto
* tkDND/tkdnd.rb: ditto
* treectrl/tktreectrl.rb: ditto
* winico/winico.rb: ditto
2004-12-10 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* tile/style.rb: 'theme_use' method bug fix
2004-12-08 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* bwidget/notebook.rb: raise method cannot return the raised page.

View file

@ -1256,6 +1256,9 @@ end
# for callback operation
class MultiTkIp
def self.cb_entry_class
@@CB_ENTRY_CLASS
end
def self.get_cb_entry(cmd)
@@CB_ENTRY_CLASS.new(__getip, cmd).freeze
end

View file

@ -574,6 +574,12 @@ end
private :_toUTF8, :_fromUTF8
module_function :_toUTF8, :_fromUTF8
def _callback_entry?(obj)
obj.kind_of?(Proc) || obj.kind_of?(Method) || obj.kind_of?(TkCallbackEntry)
end
private :_callback_entry?
module_function :_callback_entry?
=begin
### --> definition is moved to TkUtil module
def _get_eval_string(str, enc_mode = nil)
@ -906,7 +912,8 @@ module TkComm
# tagOrClass
#end
def bind(tagOrClass, context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -920,7 +927,8 @@ module TkComm
# tagOrClass
#end
def bind_append(tagOrClass, context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -943,7 +951,8 @@ module TkComm
# TkBindTag::ALL
#end
def bind_all(context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -957,7 +966,8 @@ module TkComm
# TkBindTag::ALL
#end
def bind_append_all(context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -2107,7 +2117,8 @@ module TkBindCore
# Tk.bind(self, context, cmd, *args)
#end
def bind(context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -2119,7 +2130,8 @@ module TkBindCore
# Tk.bind_append(self, context, cmd, *args)
#end
def bind_append(context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new

View file

@ -18,10 +18,11 @@ class TkBindTag
def TkBindTag.new_by_name(name, *args, &b)
return BTagID_TBL[name] if BTagID_TBL[name]
self.new(*args, &b).instance_eval{
self.new.instance_eval{
BTagID_TBL.delete @id
@id = name
BTagID_TBL[@id] = self
bind(*args, &b) if args != []
}
end

View file

@ -99,7 +99,8 @@ class TkCanvas<TkWindow
# self
#end
def itembind(tag, context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -113,7 +114,8 @@ class TkCanvas<TkWindow
# self
#end
def itembind_append(tag, context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new

View file

@ -26,7 +26,8 @@ module TkcTagAccess
# self
#end
def bind(seq, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -40,7 +41,8 @@ module TkcTagAccess
# self
#end
def bind_append(seq, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new

View file

@ -30,21 +30,21 @@ class TkDialogObj < TkWindow
case configs
when Proc
@buttons.each_index{|i|
if (c = configs.call(i)).kind_of? Hash
if (c = configs.call(i)).kind_of?(Hash)
set_config.call(c,i)
end
}
when Array
@buttons.each_index{|i|
if (c = configs[i]).kind_of? Hash
if (c = configs[i]).kind_of?(Hash)
set_config.call(c,i)
end
}
when Hash
@buttons.each_with_index{|s,i|
if (c = configs[s]).kind_of? Hash
if (c = configs[s]).kind_of?(Hash)
set_config.call(c,i)
end
}
@ -78,7 +78,7 @@ class TkDialogObj < TkWindow
@command = prev_command
if keys.kind_of? Hash
if keys.kind_of?(Hash)
@title = keys['title'] if keys.key? 'title'
@message = keys['message'] if keys.key? 'message'
@bitmap = keys['bitmap'] if keys.key? 'bitmap'
@ -99,18 +99,18 @@ class TkDialogObj < TkWindow
@title = '{' + @title + '}'
end
if @buttons.kind_of? Array
if @buttons.kind_of?(Array)
_set_button_config(@buttons.collect{|cfg|
(cfg.kind_of? Array)? cfg[1]: nil})
@buttons = @buttons.collect{|cfg| (cfg.kind_of? Array)? cfg[0]: cfg}
end
if @buttons.kind_of? Hash
if @buttons.kind_of?(Hash)
_set_button_config(@buttons)
@buttons = @buttons.keys
end
@buttons = tk_split_simplelist(@buttons) if @buttons.kind_of? String
@buttons = tk_split_simplelist(@buttons) if @buttons.kind_of?(String)
@buttons = @buttons.collect{|s|
if s.kind_of? Array
if s.kind_of?(Array)
s = s.join(' ')
end
if s.include? ?\s
@ -120,7 +120,7 @@ class TkDialogObj < TkWindow
end
}
if @message_config.kind_of? Hash
if @message_config.kind_of?(Hash)
# @config << Kernel.format("%s.msg configure %s;",
# @path, hash_kv(@message_config).join(' '))
# @config << @path+'.msg configure '+hash_kv(@message_config).join(' ')+';'
@ -128,7 +128,7 @@ class TkDialogObj < TkWindow
array2tk_list(hash_kv(@message_config))+';'
end
if @msgframe_config.kind_of? Hash
if @msgframe_config.kind_of?(Hash)
# @config << Kernel.format("%s.top configure %s;",
# @path, hash_kv(@msgframe_config).join(' '))
# @config << @path+'.top configure '+hash_kv(@msgframe_config).join(' ')+';'
@ -136,7 +136,7 @@ class TkDialogObj < TkWindow
array2tk_list(hash_kv(@msgframe_config))+';'
end
if @btnframe_config.kind_of? Hash
if @btnframe_config.kind_of?(Hash)
# @config << Kernel.format("%s.bot configure %s;",
# @path, hash_kv(@btnframe_config).join(' '))
# @config << @path+'.bot configure '+hash_kv(@btnframe_config).join(' ')+';'
@ -144,7 +144,7 @@ class TkDialogObj < TkWindow
array2tk_list(hash_kv(@btnframe_config))+';'
end
if @bitmap_config.kind_of? Hash
if @bitmap_config.kind_of?(Hash)
# @config << Kernel.format("%s.bitmap configure %s;",
# @path, hash_kv(@bitmap_config).join(' '))
# @config << @path+'.bitmap configure '+hash_kv(@bitmap_config).join(' ')+';'
@ -157,11 +157,12 @@ class TkDialogObj < TkWindow
private :create_self
def show
if @command.kind_of? Proc
# if @command.kind_of?(Proc)
if TkComm._callback_entry?(@command)
@command.call(self)
end
if @default_button.kind_of? String
if @default_button.kind_of?(String)
default_button = @buttons.index(@default_button)
else
default_button = @default_button
@ -265,7 +266,7 @@ end
class TkWarningObj < TkDialogObj
def initialize(parent = nil, mes = nil)
if !mes
if parent.kind_of? TkWindow
if parent.kind_of?(TkWindow)
mes = ""
else
mes = parent.to_s

View file

@ -178,7 +178,8 @@ module TkOptionDB
proc_source = TkOptionDB.get(self::CARRIER, id.id2name, '').strip
res_proc = nil if proc_str != proc_source # resource is changed
unless res_proc.kind_of? Proc
# unless res_proc.kind_of?(Proc)
unless TkComm._callback_entry?(res_proc)
#if id == :new || !(self::METHOD_TBL.has_key?(id) || self::ADD_METHOD)
if id == :new || !(@method_tbl.has_key?(id) || @add_method)
raise NoMethodError,
@ -253,7 +254,7 @@ module TkOptionDB
CmdClassID[1].succ!
parent = nil # ignore parent
else
klass = klass.to_s if klass.kind_of? Symbol
klass = klass.to_s if klass.kind_of?(Symbol)
unless (?A..?Z) === klass[0]
fail ArgumentError, "bad string '#{klass}' for class name"
end
@ -269,7 +270,7 @@ module TkOptionDB
carrier = Tk.tk_call_without_enc('frame', @path, '-class', klass)
end
unless func.kind_of? Array
unless func.kind_of?(Array)
fail ArgumentError, "method-list must be Array"
end
func_str = func.join(' ')

View file

@ -215,7 +215,7 @@ class TkText<TkTextWin
end
def image_configure(index, slot, value=None)
if slot.kind_of? Hash
if slot.kind_of?(Hash)
_fromUTF8(tk_send_without_enc('image', 'configure',
_get_eval_enc_str(index),
*hash_kv(slot, true)))
@ -347,7 +347,7 @@ class TkText<TkTextWin
end
def insert(index, chars, *tags)
if tags[0].kind_of? Array
if tags[0].kind_of?(Array)
# multiple chars-taglist argument :: str, [tag,...], str, [tag,...], ...
args = [chars]
while tags.size > 0
@ -507,7 +507,7 @@ class TkText<TkTextWin
*(tags.collect{|tag| _get_eval_enc_str(tag)}))
if TkTextTag::TTagID_TBL[@path]
tags.each{|tag|
if tag.kind_of? TkTextTag
if tag.kind_of?(TkTextTag)
TkTextTag::TTagID_TBL[@path].delete(tag.id)
else
TkTextTag::TTagID_TBL[@path].delete(tag)
@ -524,7 +524,8 @@ class TkText<TkTextWin
# self
#end
def tag_bind(tag, seq, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -538,7 +539,8 @@ class TkText<TkTextWin
# self
#end
def tag_bind_append(tag, seq, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -580,7 +582,7 @@ class TkText<TkTextWin
end
def tag_configure(tag, key, val=None)
if key.kind_of? Hash
if key.kind_of?(Hash)
key = _symbolkey2str(key)
if ( key['font'] || key['kanjifont'] \
|| key['latinfont'] || key['asciifont'] )
@ -798,17 +800,17 @@ class TkText<TkTextWin
end
def window_configure(index, slot, value=None)
if index.kind_of? TkTextWindow
if index.kind_of?(TkTextWindow)
index.configure(slot, value)
else
if slot.kind_of? Hash
if slot.kind_of?(Hash)
slot = _symbolkey2str(slot)
win = slot['window']
# slot['window'] = win.epath if win.kind_of?(TkWindow)
slot['window'] = _epath(win) if win
if slot['create']
p_create = slot['create']
if p_create.kind_of? Proc
if p_create.kind_of?(Proc)
#=begin
slot['create'] = install_cmd(proc{
id = p_create.call
@ -833,7 +835,7 @@ class TkText<TkTextWin
end
if slot == 'create' || slot == :create
p_create = value
if p_create.kind_of? Proc
if p_create.kind_of?(Proc)
#=begin
value = install_cmd(proc{
id = p_create.call
@ -1054,7 +1056,7 @@ class TkText<TkTextWin
end
def search_with_length(pat,start,stop=None)
pat = pat.chr if pat.kind_of? Integer
pat = pat.chr if pat.kind_of?(Integer)
if stop != None
return ["", 0] if compare(start,'>=',stop)
txt = get(start,stop)
@ -1062,7 +1064,7 @@ class TkText<TkTextWin
match = $&
#pos = txt[0..(pos-1)].split('').length if pos > 0
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
if pat.kind_of? String
if pat.kind_of?(String)
#return [index(start + " + #{pos} chars"), pat.split('').length]
return [index(start + " + #{pos} chars"),
_ktext_length(pat), pat.dup]
@ -1080,7 +1082,7 @@ class TkText<TkTextWin
match = $&
#pos = txt[0..(pos-1)].split('').length if pos > 0
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
if pat.kind_of? String
if pat.kind_of?(String)
#return [index(start + " + #{pos} chars"), pat.split('').length]
return [index(start + " + #{pos} chars"),
_ktext_length(pat), pat.dup]
@ -1095,7 +1097,7 @@ class TkText<TkTextWin
match = $&
#pos = txt[0..(pos-1)].split('').length if pos > 0
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
if pat.kind_of? String
if pat.kind_of?(String)
#return [index("1.0 + #{pos} chars"), pat.split('').length]
return [index("1.0 + #{pos} chars"),
_ktext_length(pat), pat.dup]
@ -1115,7 +1117,7 @@ class TkText<TkTextWin
end
def rsearch_with_length(pat,start,stop=None)
pat = pat.chr if pat.kind_of? Integer
pat = pat.chr if pat.kind_of?(Integer)
if stop != None
return ["", 0] if compare(start,'<=',stop)
txt = get(stop,start)
@ -1123,7 +1125,7 @@ class TkText<TkTextWin
match = $&
#pos = txt[0..(pos-1)].split('').length if pos > 0
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
if pat.kind_of? String
if pat.kind_of?(String)
#return [index(stop + " + #{pos} chars"), pat.split('').length]
return [index(stop + " + #{pos} chars"), _ktext_length(pat), pat.dup]
else
@ -1139,7 +1141,7 @@ class TkText<TkTextWin
match = $&
#pos = txt[0..(pos-1)].split('').length if pos > 0
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
if pat.kind_of? String
if pat.kind_of?(String)
#return [index("1.0 + #{pos} chars"), pat.split('').length]
return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup]
else
@ -1152,7 +1154,7 @@ class TkText<TkTextWin
match = $&
#pos = txt[0..(pos-1)].split('').length if pos > 0
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
if pat.kind_of? String
if pat.kind_of?(String)
#return [index("1.0 + #{pos} chars"), pat.split('').length]
return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup]
else

View file

@ -32,9 +32,9 @@ class TkTextTag<TkObject
TTagID_TBL[@tpath][@id] = self
Tk_TextTag_ID[1].succ!
#tk_call @t.path, "tag", "configure", @id, *hash_kv(keys)
if args != [] then
if args != []
keys = args.pop
if keys.kind_of? Hash then
if keys.kind_of?(Hash)
add(*args) if args != []
configure(keys)
else
@ -139,7 +139,7 @@ class TkTextTag<TkObject
@t.tag_configure @id, key, val
end
# def configure(key, val=None)
# if key.kind_of? Hash
# if key.kind_of?(Hash)
# tk_call @t.path, 'tag', 'configure', @id, *hash_kv(key)
# else
# tk_call @t.path, 'tag', 'configure', @id, "-#{key}", val
@ -148,7 +148,7 @@ class TkTextTag<TkObject
# def configure(key, value)
# if value == FALSE
# value = "0"
# elsif value.kind_of? Proc
# elsif value.kind_of?(Proc)
# value = install_cmd(value)
# end
# tk_call @t.path, 'tag', 'configure', @id, "-#{key}", value
@ -167,7 +167,8 @@ class TkTextTag<TkObject
# self
#end
def bind(seq, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -181,7 +182,8 @@ class TkTextTag<TkObject
# self
#end
def bind_append(seq, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -222,9 +224,9 @@ class TkTextNamedTag<TkTextTag
def self.new(parent, name, *args)
if TTagID_TBL[parent.path] && TTagID_TBL[parent.path][name]
tagobj = TTagID_TBL[parent.path][name]
if args != [] then
if args != []
keys = args.pop
if keys.kind_of? Hash then
if keys.kind_of?(Hash)
tagobj.add(*args) if args != []
tagobj.configure(keys)
else
@ -250,9 +252,9 @@ class TkTextNamedTag<TkTextTag
#if mode
# tk_call @t.path, "addtag", @id, *args
#end
if args != [] then
if args != []
keys = args.pop
if keys.kind_of? Hash then
if keys.kind_of?(Hash)
add(*args) if args != []
configure(keys)
else

View file

@ -13,7 +13,7 @@ class TkTextWindow<TkObject
if index == 'end'
@path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index',
'end - 1 chars'))
elsif index.kind_of? TkTextMark
elsif index.kind_of?(TkTextMark)
if tk_call_without_enc(@t.path,'index',index.path) == tk_call_without_enc(@t.path,'index','end')
@path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index',
'end - 1 chars'))
@ -32,7 +32,8 @@ class TkTextWindow<TkObject
keys['window'] = _epath(@id) if @id
if keys['create']
@p_create = keys['create']
if @p_create.kind_of? Proc
# if @p_create.kind_of?(Proc)
if TkComm._callback_entry?(@p_create)
=begin
keys['create'] = install_cmd(proc{
@id = @p_create.call
@ -63,7 +64,7 @@ class TkTextWindow<TkObject
end
def configure(slot, value=None)
if slot.kind_of? Hash
if slot.kind_of?(Hash)
slot = _symbolkey2str(slot)
if slot['window']
@id = slot['window']
@ -120,7 +121,8 @@ class TkTextWindow<TkObject
def create=(value)
@p_create = value
if @p_create.kind_of? Proc
# if @p_create.kind_of?(Proc)
if TkComm._callback_entry?(@p_create)
value = install_cmd(proc{
@id = @p_create.call
if @id.kind_of?(TkWindow)

View file

@ -122,7 +122,8 @@ class TkTimer
@current_args = args
if @sleep_time.kind_of? Proc
# if @sleep_time.kind_of?(Proc)
if TkComm._callback_entry?(@sleep_time)
sleep = @sleep_time.call(self)
else
sleep = @sleep_time
@ -244,23 +245,28 @@ class TkTimer
end
def set_interval(interval)
if interval != 'idle' \
&& !interval.kind_of?(Integer) && !interval.kind_of?(Proc)
#if interval != 'idle' && interval != :idle \
# && !interval.kind_of?(Integer) && !interval.kind_of?(Proc)
if interval != 'idle' && interval != :idle \
&& !interval.kind_of?(Integer) && !TkComm._callback_entry?(interval)
fail ArguemntError, "expect Integer or Proc"
end
@sleep_time = interval
end
def set_procs(interval, loop_exec, *procs)
if interval != 'idle' \
&& !interval.kind_of?(Integer) && !interval.kind_of?(Proc)
#if interval != 'idle' && interval != :idle \
# && !interval.kind_of?(Integer) && !interval.kind_of?(Proc)
if interval != 'idle' && interval != :idle \
&& !interval.kind_of?(Integer) && !TkComm._callback_entry?(interval)
fail ArguemntError, "expect Integer or Proc for 1st argument"
end
@sleep_time = interval
@loop_proc = []
procs.each{|e|
if e.kind_of? Proc
# if e.kind_of?(Proc)
if TkComm._callback_entry?(e)
@loop_proc.push([e])
else
@loop_proc.push(e)
@ -288,7 +294,8 @@ class TkTimer
def add_procs(*procs)
procs.each{|e|
if e.kind_of? Proc
# if e.kind_of?(Proc)
if TkComm._callback_entry?(e)
@loop_proc.push([e])
else
@loop_proc.push(e)
@ -301,7 +308,8 @@ class TkTimer
def delete_procs(*procs)
procs.each{|e|
if e.kind_of? Proc
# if e.kind_of?(Proc)
if TkComm._callback_entry?(e)
@loop_proc.delete([e])
else
@loop_proc.delete(e)
@ -325,7 +333,7 @@ class TkTimer
# set parameters for 'restart'
sleep = @init_sleep unless sleep
if !sleep == 'idle' && !sleep.kind_of?(Integer)
if sleep != 'idle' && sleep != :idle && !sleep.kind_of?(Integer)
fail ArguemntError, "expect Integer or 'idle' for 1st argument"
end
@ -354,7 +362,7 @@ class TkTimer
argc = init_args.size
if argc > 0
sleep = init_args.shift
if !sleep == 'idle' && !sleep.kind_of?(Integer)
if sleep != 'idle' && sleep != :idle && !sleep.kind_of?(Integer)
fail ArguemntError, "expect Integer or 'idle' for 1st argument"
end
@init_sleep = sleep
@ -368,7 +376,8 @@ class TkTimer
@current_sleep = @init_sleep
@running = true
if @init_proc
if not @init_proc.kind_of? Proc
# if not @init_proc.kind_of?(Proc)
if !TkComm._callback_entry?(@init_proc)
fail ArgumentError, "Argument '#{@init_proc}' need to be Proc"
end
@current_proc = @init_proc
@ -421,7 +430,7 @@ class TkTimer
sleep, cmd = @current_script
fail RuntimeError, "no procedure to continue" unless cmd
if wait
unless wait.kind_of? Integer
unless wait.kind_of?(Integer)
fail ArguemntError, "expect Integer for 1st argument"
end
sleep = wait

View file

@ -51,7 +51,8 @@ module Tk
if keys[key].kind_of?(Array)
cmd, *args = keys[key]
keys[key] = klass.new(cmd, args.join(' '))
elsif keys[key].kind_of?(Proc) || keys[key].kind_of?(Method)
# elsif keys[key].kind_of?(Proc) || keys[key].kind_of?(Method)
elsif TkComm._callback_entry?(keys[key])
keys[key] = klass.new(keys[key])
end
}
@ -151,7 +152,8 @@ module Tk
if keys[key].kind_of?(Array)
cmd, *args = keys[key]
keys[key] = klass.new(cmd, args.join(' '))
elsif keys[key].kind_of?(Proc) || keys[key].kind_of?(Method)
# elsif keys[key].kind_of?(Proc) || keys[key].kind_of?(Method)
elsif TkComm._callback_entry?(keys[key])
keys[key] = klass.new(keys[key])
end
}

View file

@ -28,7 +28,8 @@ class Tk::BWidget::LabelEntry
# self
#end
def entrybind(context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -42,7 +43,8 @@ class Tk::BWidget::LabelEntry
# self
#end
def entrybind_append(context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new

View file

@ -49,7 +49,8 @@ class Tk::BWidget::ListBox
# self
#end
def imagebind(context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -64,7 +65,8 @@ class Tk::BWidget::ListBox
# self
#end
def imagebind_append(context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -88,7 +90,8 @@ class Tk::BWidget::ListBox
# self
#end
def textbind(context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -103,7 +106,8 @@ class Tk::BWidget::ListBox
# self
#end
def textbind_append(context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new

View file

@ -46,7 +46,8 @@ class Tk::BWidget::NoteBook
# self
#end
def tabbind(context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -61,7 +62,8 @@ class Tk::BWidget::NoteBook
# self
#end
def tabbind_append(context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new

View file

@ -27,7 +27,8 @@ class Tk::BWidget::SpinBox
# self
#end
def entrybind(context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -41,7 +42,8 @@ class Tk::BWidget::SpinBox
# self
#end
def entrybind_append(context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new

View file

@ -46,7 +46,8 @@ class Tk::BWidget::Tree
# self
#end
def imagebind(context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -61,7 +62,8 @@ class Tk::BWidget::Tree
# self
#end
def imagebind_append(context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -85,7 +87,8 @@ class Tk::BWidget::Tree
# self
#end
def textbind(context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -100,7 +103,8 @@ class Tk::BWidget::Tree
# self
#end
def textbind_append(context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new

View file

@ -350,7 +350,8 @@ module Tk
fail RuntimeError, 'component is not assigned to a widget'
end
end
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -378,7 +379,8 @@ module Tk
fail RuntimeError, 'component is not assigned to a widget'
end
end
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new

View file

@ -102,7 +102,8 @@ class Tk::Iwidgets::Scrolledcanvas
# self
#end
def itembind(tag, context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -116,7 +117,8 @@ class Tk::Iwidgets::Scrolledcanvas
# self
#end
def itembind_append(tag, context, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new

View file

@ -67,6 +67,6 @@ class << Tk::Tile::Style
end
def theme_use(name)
tk_call('style', 'use', name)
tk_call('style', 'theme', 'use', name)
end
end

View file

@ -88,7 +88,8 @@ module Tk
# self
#end
def dnd_bindtarget(type, event, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -127,7 +128,8 @@ module Tk
# self
#end
def dnd_bindsource(type, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new

View file

@ -748,7 +748,8 @@ class Tk::TreeCtrl
# self
#end
def notify_bind(obj, event, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@ -762,7 +763,8 @@ class Tk::TreeCtrl
# self
#end
def notify_bind_append(obj, event, *args)
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new

View file

@ -149,7 +149,8 @@ class Tk::Winico
if keys[k].kind_of?(Array)
cmd, *args = keys[k]
keys[k] = Winico_callback.new(cmd, args.join(' '))
elsif keys[k].kind_of?(Proc)
# elsif keys[k].kind_of?(Proc)
elsif TkComm._callback_entry?(keys[k])
keys[k] = Winico_callback.new(keys[k])
end
}
@ -164,7 +165,8 @@ class Tk::Winico
if keys[k].kind_of?(Array)
cmd, *args = keys[k]
keys[k] = Winico_callback.new(cmd, args.join(' '))
elsif keys[k].kind_of?(Proc)
# elsif keys[k].kind_of?(Proc)
elsif TkComm._callback_entry?(keys[k])
keys[k] = Winico_callback.new(keys[k])
end
}