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:
parent
c89c302d3f
commit
9e51ec666b
24 changed files with 187 additions and 100 deletions
|
@ -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>
|
2004-12-08 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
* bwidget/notebook.rb: raise method cannot return the raised page.
|
* bwidget/notebook.rb: raise method cannot return the raised page.
|
||||||
|
|
|
@ -1256,6 +1256,9 @@ end
|
||||||
|
|
||||||
# for callback operation
|
# for callback operation
|
||||||
class MultiTkIp
|
class MultiTkIp
|
||||||
|
def self.cb_entry_class
|
||||||
|
@@CB_ENTRY_CLASS
|
||||||
|
end
|
||||||
def self.get_cb_entry(cmd)
|
def self.get_cb_entry(cmd)
|
||||||
@@CB_ENTRY_CLASS.new(__getip, cmd).freeze
|
@@CB_ENTRY_CLASS.new(__getip, cmd).freeze
|
||||||
end
|
end
|
||||||
|
|
|
@ -574,6 +574,12 @@ end
|
||||||
private :_toUTF8, :_fromUTF8
|
private :_toUTF8, :_fromUTF8
|
||||||
module_function :_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
|
=begin
|
||||||
### --> definition is moved to TkUtil module
|
### --> definition is moved to TkUtil module
|
||||||
def _get_eval_string(str, enc_mode = nil)
|
def _get_eval_string(str, enc_mode = nil)
|
||||||
|
@ -906,7 +912,8 @@ module TkComm
|
||||||
# tagOrClass
|
# tagOrClass
|
||||||
#end
|
#end
|
||||||
def bind(tagOrClass, context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -920,7 +927,8 @@ module TkComm
|
||||||
# tagOrClass
|
# tagOrClass
|
||||||
#end
|
#end
|
||||||
def bind_append(tagOrClass, context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -943,7 +951,8 @@ module TkComm
|
||||||
# TkBindTag::ALL
|
# TkBindTag::ALL
|
||||||
#end
|
#end
|
||||||
def bind_all(context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -957,7 +966,8 @@ module TkComm
|
||||||
# TkBindTag::ALL
|
# TkBindTag::ALL
|
||||||
#end
|
#end
|
||||||
def bind_append_all(context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -2107,7 +2117,8 @@ module TkBindCore
|
||||||
# Tk.bind(self, context, cmd, *args)
|
# Tk.bind(self, context, cmd, *args)
|
||||||
#end
|
#end
|
||||||
def bind(context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -2119,7 +2130,8 @@ module TkBindCore
|
||||||
# Tk.bind_append(self, context, cmd, *args)
|
# Tk.bind_append(self, context, cmd, *args)
|
||||||
#end
|
#end
|
||||||
def bind_append(context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
|
|
@ -18,10 +18,11 @@ class TkBindTag
|
||||||
|
|
||||||
def TkBindTag.new_by_name(name, *args, &b)
|
def TkBindTag.new_by_name(name, *args, &b)
|
||||||
return BTagID_TBL[name] if BTagID_TBL[name]
|
return BTagID_TBL[name] if BTagID_TBL[name]
|
||||||
self.new(*args, &b).instance_eval{
|
self.new.instance_eval{
|
||||||
BTagID_TBL.delete @id
|
BTagID_TBL.delete @id
|
||||||
@id = name
|
@id = name
|
||||||
BTagID_TBL[@id] = self
|
BTagID_TBL[@id] = self
|
||||||
|
bind(*args, &b) if args != []
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,8 @@ class TkCanvas<TkWindow
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def itembind(tag, context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -113,7 +114,8 @@ class TkCanvas<TkWindow
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def itembind_append(tag, context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
|
|
@ -26,7 +26,8 @@ module TkcTagAccess
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def bind(seq, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -40,7 +41,8 @@ module TkcTagAccess
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def bind_append(seq, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
|
|
@ -30,21 +30,21 @@ class TkDialogObj < TkWindow
|
||||||
case configs
|
case configs
|
||||||
when Proc
|
when Proc
|
||||||
@buttons.each_index{|i|
|
@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)
|
set_config.call(c,i)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
when Array
|
when Array
|
||||||
@buttons.each_index{|i|
|
@buttons.each_index{|i|
|
||||||
if (c = configs[i]).kind_of? Hash
|
if (c = configs[i]).kind_of?(Hash)
|
||||||
set_config.call(c,i)
|
set_config.call(c,i)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
when Hash
|
when Hash
|
||||||
@buttons.each_with_index{|s,i|
|
@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)
|
set_config.call(c,i)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ class TkDialogObj < TkWindow
|
||||||
|
|
||||||
@command = prev_command
|
@command = prev_command
|
||||||
|
|
||||||
if keys.kind_of? Hash
|
if keys.kind_of?(Hash)
|
||||||
@title = keys['title'] if keys.key? 'title'
|
@title = keys['title'] if keys.key? 'title'
|
||||||
@message = keys['message'] if keys.key? 'message'
|
@message = keys['message'] if keys.key? 'message'
|
||||||
@bitmap = keys['bitmap'] if keys.key? 'bitmap'
|
@bitmap = keys['bitmap'] if keys.key? 'bitmap'
|
||||||
|
@ -99,18 +99,18 @@ class TkDialogObj < TkWindow
|
||||||
@title = '{' + @title + '}'
|
@title = '{' + @title + '}'
|
||||||
end
|
end
|
||||||
|
|
||||||
if @buttons.kind_of? Array
|
if @buttons.kind_of?(Array)
|
||||||
_set_button_config(@buttons.collect{|cfg|
|
_set_button_config(@buttons.collect{|cfg|
|
||||||
(cfg.kind_of? Array)? cfg[1]: nil})
|
(cfg.kind_of? Array)? cfg[1]: nil})
|
||||||
@buttons = @buttons.collect{|cfg| (cfg.kind_of? Array)? cfg[0]: cfg}
|
@buttons = @buttons.collect{|cfg| (cfg.kind_of? Array)? cfg[0]: cfg}
|
||||||
end
|
end
|
||||||
if @buttons.kind_of? Hash
|
if @buttons.kind_of?(Hash)
|
||||||
_set_button_config(@buttons)
|
_set_button_config(@buttons)
|
||||||
@buttons = @buttons.keys
|
@buttons = @buttons.keys
|
||||||
end
|
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|
|
@buttons = @buttons.collect{|s|
|
||||||
if s.kind_of? Array
|
if s.kind_of?(Array)
|
||||||
s = s.join(' ')
|
s = s.join(' ')
|
||||||
end
|
end
|
||||||
if s.include? ?\s
|
if s.include? ?\s
|
||||||
|
@ -120,7 +120,7 @@ class TkDialogObj < TkWindow
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
if @message_config.kind_of? Hash
|
if @message_config.kind_of?(Hash)
|
||||||
# @config << Kernel.format("%s.msg configure %s;",
|
# @config << Kernel.format("%s.msg configure %s;",
|
||||||
# @path, hash_kv(@message_config).join(' '))
|
# @path, hash_kv(@message_config).join(' '))
|
||||||
# @config << @path+'.msg configure '+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))+';'
|
array2tk_list(hash_kv(@message_config))+';'
|
||||||
end
|
end
|
||||||
|
|
||||||
if @msgframe_config.kind_of? Hash
|
if @msgframe_config.kind_of?(Hash)
|
||||||
# @config << Kernel.format("%s.top configure %s;",
|
# @config << Kernel.format("%s.top configure %s;",
|
||||||
# @path, hash_kv(@msgframe_config).join(' '))
|
# @path, hash_kv(@msgframe_config).join(' '))
|
||||||
# @config << @path+'.top configure '+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))+';'
|
array2tk_list(hash_kv(@msgframe_config))+';'
|
||||||
end
|
end
|
||||||
|
|
||||||
if @btnframe_config.kind_of? Hash
|
if @btnframe_config.kind_of?(Hash)
|
||||||
# @config << Kernel.format("%s.bot configure %s;",
|
# @config << Kernel.format("%s.bot configure %s;",
|
||||||
# @path, hash_kv(@btnframe_config).join(' '))
|
# @path, hash_kv(@btnframe_config).join(' '))
|
||||||
# @config << @path+'.bot configure '+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))+';'
|
array2tk_list(hash_kv(@btnframe_config))+';'
|
||||||
end
|
end
|
||||||
|
|
||||||
if @bitmap_config.kind_of? Hash
|
if @bitmap_config.kind_of?(Hash)
|
||||||
# @config << Kernel.format("%s.bitmap configure %s;",
|
# @config << Kernel.format("%s.bitmap configure %s;",
|
||||||
# @path, hash_kv(@bitmap_config).join(' '))
|
# @path, hash_kv(@bitmap_config).join(' '))
|
||||||
# @config << @path+'.bitmap configure '+hash_kv(@bitmap_config).join(' ')+';'
|
# @config << @path+'.bitmap configure '+hash_kv(@bitmap_config).join(' ')+';'
|
||||||
|
@ -157,11 +157,12 @@ class TkDialogObj < TkWindow
|
||||||
private :create_self
|
private :create_self
|
||||||
|
|
||||||
def show
|
def show
|
||||||
if @command.kind_of? Proc
|
# if @command.kind_of?(Proc)
|
||||||
|
if TkComm._callback_entry?(@command)
|
||||||
@command.call(self)
|
@command.call(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
if @default_button.kind_of? String
|
if @default_button.kind_of?(String)
|
||||||
default_button = @buttons.index(@default_button)
|
default_button = @buttons.index(@default_button)
|
||||||
else
|
else
|
||||||
default_button = @default_button
|
default_button = @default_button
|
||||||
|
@ -265,7 +266,7 @@ end
|
||||||
class TkWarningObj < TkDialogObj
|
class TkWarningObj < TkDialogObj
|
||||||
def initialize(parent = nil, mes = nil)
|
def initialize(parent = nil, mes = nil)
|
||||||
if !mes
|
if !mes
|
||||||
if parent.kind_of? TkWindow
|
if parent.kind_of?(TkWindow)
|
||||||
mes = ""
|
mes = ""
|
||||||
else
|
else
|
||||||
mes = parent.to_s
|
mes = parent.to_s
|
||||||
|
|
|
@ -178,7 +178,8 @@ module TkOptionDB
|
||||||
proc_source = TkOptionDB.get(self::CARRIER, id.id2name, '').strip
|
proc_source = TkOptionDB.get(self::CARRIER, id.id2name, '').strip
|
||||||
res_proc = nil if proc_str != proc_source # resource is changed
|
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 || !(self::METHOD_TBL.has_key?(id) || self::ADD_METHOD)
|
||||||
if id == :new || !(@method_tbl.has_key?(id) || @add_method)
|
if id == :new || !(@method_tbl.has_key?(id) || @add_method)
|
||||||
raise NoMethodError,
|
raise NoMethodError,
|
||||||
|
@ -253,7 +254,7 @@ module TkOptionDB
|
||||||
CmdClassID[1].succ!
|
CmdClassID[1].succ!
|
||||||
parent = nil # ignore parent
|
parent = nil # ignore parent
|
||||||
else
|
else
|
||||||
klass = klass.to_s if klass.kind_of? Symbol
|
klass = klass.to_s if klass.kind_of?(Symbol)
|
||||||
unless (?A..?Z) === klass[0]
|
unless (?A..?Z) === klass[0]
|
||||||
fail ArgumentError, "bad string '#{klass}' for class name"
|
fail ArgumentError, "bad string '#{klass}' for class name"
|
||||||
end
|
end
|
||||||
|
@ -269,7 +270,7 @@ module TkOptionDB
|
||||||
carrier = Tk.tk_call_without_enc('frame', @path, '-class', klass)
|
carrier = Tk.tk_call_without_enc('frame', @path, '-class', klass)
|
||||||
end
|
end
|
||||||
|
|
||||||
unless func.kind_of? Array
|
unless func.kind_of?(Array)
|
||||||
fail ArgumentError, "method-list must be Array"
|
fail ArgumentError, "method-list must be Array"
|
||||||
end
|
end
|
||||||
func_str = func.join(' ')
|
func_str = func.join(' ')
|
||||||
|
|
|
@ -215,7 +215,7 @@ class TkText<TkTextWin
|
||||||
end
|
end
|
||||||
|
|
||||||
def image_configure(index, slot, value=None)
|
def image_configure(index, slot, value=None)
|
||||||
if slot.kind_of? Hash
|
if slot.kind_of?(Hash)
|
||||||
_fromUTF8(tk_send_without_enc('image', 'configure',
|
_fromUTF8(tk_send_without_enc('image', 'configure',
|
||||||
_get_eval_enc_str(index),
|
_get_eval_enc_str(index),
|
||||||
*hash_kv(slot, true)))
|
*hash_kv(slot, true)))
|
||||||
|
@ -347,7 +347,7 @@ class TkText<TkTextWin
|
||||||
end
|
end
|
||||||
|
|
||||||
def insert(index, chars, *tags)
|
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,...], ...
|
# multiple chars-taglist argument :: str, [tag,...], str, [tag,...], ...
|
||||||
args = [chars]
|
args = [chars]
|
||||||
while tags.size > 0
|
while tags.size > 0
|
||||||
|
@ -507,7 +507,7 @@ class TkText<TkTextWin
|
||||||
*(tags.collect{|tag| _get_eval_enc_str(tag)}))
|
*(tags.collect{|tag| _get_eval_enc_str(tag)}))
|
||||||
if TkTextTag::TTagID_TBL[@path]
|
if TkTextTag::TTagID_TBL[@path]
|
||||||
tags.each{|tag|
|
tags.each{|tag|
|
||||||
if tag.kind_of? TkTextTag
|
if tag.kind_of?(TkTextTag)
|
||||||
TkTextTag::TTagID_TBL[@path].delete(tag.id)
|
TkTextTag::TTagID_TBL[@path].delete(tag.id)
|
||||||
else
|
else
|
||||||
TkTextTag::TTagID_TBL[@path].delete(tag)
|
TkTextTag::TTagID_TBL[@path].delete(tag)
|
||||||
|
@ -524,7 +524,8 @@ class TkText<TkTextWin
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def tag_bind(tag, seq, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -538,7 +539,8 @@ class TkText<TkTextWin
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def tag_bind_append(tag, seq, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -580,7 +582,7 @@ class TkText<TkTextWin
|
||||||
end
|
end
|
||||||
|
|
||||||
def tag_configure(tag, key, val=None)
|
def tag_configure(tag, key, val=None)
|
||||||
if key.kind_of? Hash
|
if key.kind_of?(Hash)
|
||||||
key = _symbolkey2str(key)
|
key = _symbolkey2str(key)
|
||||||
if ( key['font'] || key['kanjifont'] \
|
if ( key['font'] || key['kanjifont'] \
|
||||||
|| key['latinfont'] || key['asciifont'] )
|
|| key['latinfont'] || key['asciifont'] )
|
||||||
|
@ -798,17 +800,17 @@ class TkText<TkTextWin
|
||||||
end
|
end
|
||||||
|
|
||||||
def window_configure(index, slot, value=None)
|
def window_configure(index, slot, value=None)
|
||||||
if index.kind_of? TkTextWindow
|
if index.kind_of?(TkTextWindow)
|
||||||
index.configure(slot, value)
|
index.configure(slot, value)
|
||||||
else
|
else
|
||||||
if slot.kind_of? Hash
|
if slot.kind_of?(Hash)
|
||||||
slot = _symbolkey2str(slot)
|
slot = _symbolkey2str(slot)
|
||||||
win = slot['window']
|
win = slot['window']
|
||||||
# slot['window'] = win.epath if win.kind_of?(TkWindow)
|
# slot['window'] = win.epath if win.kind_of?(TkWindow)
|
||||||
slot['window'] = _epath(win) if win
|
slot['window'] = _epath(win) if win
|
||||||
if slot['create']
|
if slot['create']
|
||||||
p_create = slot['create']
|
p_create = slot['create']
|
||||||
if p_create.kind_of? Proc
|
if p_create.kind_of?(Proc)
|
||||||
#=begin
|
#=begin
|
||||||
slot['create'] = install_cmd(proc{
|
slot['create'] = install_cmd(proc{
|
||||||
id = p_create.call
|
id = p_create.call
|
||||||
|
@ -833,7 +835,7 @@ class TkText<TkTextWin
|
||||||
end
|
end
|
||||||
if slot == 'create' || slot == :create
|
if slot == 'create' || slot == :create
|
||||||
p_create = value
|
p_create = value
|
||||||
if p_create.kind_of? Proc
|
if p_create.kind_of?(Proc)
|
||||||
#=begin
|
#=begin
|
||||||
value = install_cmd(proc{
|
value = install_cmd(proc{
|
||||||
id = p_create.call
|
id = p_create.call
|
||||||
|
@ -1054,7 +1056,7 @@ class TkText<TkTextWin
|
||||||
end
|
end
|
||||||
|
|
||||||
def search_with_length(pat,start,stop=None)
|
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
|
if stop != None
|
||||||
return ["", 0] if compare(start,'>=',stop)
|
return ["", 0] if compare(start,'>=',stop)
|
||||||
txt = get(start,stop)
|
txt = get(start,stop)
|
||||||
|
@ -1062,7 +1064,7 @@ class TkText<TkTextWin
|
||||||
match = $&
|
match = $&
|
||||||
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
||||||
pos = _ktext_length(txt[0..(pos-1)]) 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"), pat.split('').length]
|
||||||
return [index(start + " + #{pos} chars"),
|
return [index(start + " + #{pos} chars"),
|
||||||
_ktext_length(pat), pat.dup]
|
_ktext_length(pat), pat.dup]
|
||||||
|
@ -1080,7 +1082,7 @@ class TkText<TkTextWin
|
||||||
match = $&
|
match = $&
|
||||||
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
||||||
pos = _ktext_length(txt[0..(pos-1)]) 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"), pat.split('').length]
|
||||||
return [index(start + " + #{pos} chars"),
|
return [index(start + " + #{pos} chars"),
|
||||||
_ktext_length(pat), pat.dup]
|
_ktext_length(pat), pat.dup]
|
||||||
|
@ -1095,7 +1097,7 @@ class TkText<TkTextWin
|
||||||
match = $&
|
match = $&
|
||||||
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
||||||
pos = _ktext_length(txt[0..(pos-1)]) 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"), pat.split('').length]
|
||||||
return [index("1.0 + #{pos} chars"),
|
return [index("1.0 + #{pos} chars"),
|
||||||
_ktext_length(pat), pat.dup]
|
_ktext_length(pat), pat.dup]
|
||||||
|
@ -1115,7 +1117,7 @@ class TkText<TkTextWin
|
||||||
end
|
end
|
||||||
|
|
||||||
def rsearch_with_length(pat,start,stop=None)
|
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
|
if stop != None
|
||||||
return ["", 0] if compare(start,'<=',stop)
|
return ["", 0] if compare(start,'<=',stop)
|
||||||
txt = get(stop,start)
|
txt = get(stop,start)
|
||||||
|
@ -1123,7 +1125,7 @@ class TkText<TkTextWin
|
||||||
match = $&
|
match = $&
|
||||||
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
||||||
pos = _ktext_length(txt[0..(pos-1)]) 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"), pat.split('').length]
|
||||||
return [index(stop + " + #{pos} chars"), _ktext_length(pat), pat.dup]
|
return [index(stop + " + #{pos} chars"), _ktext_length(pat), pat.dup]
|
||||||
else
|
else
|
||||||
|
@ -1139,7 +1141,7 @@ class TkText<TkTextWin
|
||||||
match = $&
|
match = $&
|
||||||
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
||||||
pos = _ktext_length(txt[0..(pos-1)]) 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"), pat.split('').length]
|
||||||
return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup]
|
return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup]
|
||||||
else
|
else
|
||||||
|
@ -1152,7 +1154,7 @@ class TkText<TkTextWin
|
||||||
match = $&
|
match = $&
|
||||||
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
||||||
pos = _ktext_length(txt[0..(pos-1)]) 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"), pat.split('').length]
|
||||||
return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup]
|
return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup]
|
||||||
else
|
else
|
||||||
|
|
|
@ -32,9 +32,9 @@ class TkTextTag<TkObject
|
||||||
TTagID_TBL[@tpath][@id] = self
|
TTagID_TBL[@tpath][@id] = self
|
||||||
Tk_TextTag_ID[1].succ!
|
Tk_TextTag_ID[1].succ!
|
||||||
#tk_call @t.path, "tag", "configure", @id, *hash_kv(keys)
|
#tk_call @t.path, "tag", "configure", @id, *hash_kv(keys)
|
||||||
if args != [] then
|
if args != []
|
||||||
keys = args.pop
|
keys = args.pop
|
||||||
if keys.kind_of? Hash then
|
if keys.kind_of?(Hash)
|
||||||
add(*args) if args != []
|
add(*args) if args != []
|
||||||
configure(keys)
|
configure(keys)
|
||||||
else
|
else
|
||||||
|
@ -139,7 +139,7 @@ class TkTextTag<TkObject
|
||||||
@t.tag_configure @id, key, val
|
@t.tag_configure @id, key, val
|
||||||
end
|
end
|
||||||
# def configure(key, val=None)
|
# 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)
|
# tk_call @t.path, 'tag', 'configure', @id, *hash_kv(key)
|
||||||
# else
|
# else
|
||||||
# tk_call @t.path, 'tag', 'configure', @id, "-#{key}", val
|
# tk_call @t.path, 'tag', 'configure', @id, "-#{key}", val
|
||||||
|
@ -148,7 +148,7 @@ class TkTextTag<TkObject
|
||||||
# def configure(key, value)
|
# def configure(key, value)
|
||||||
# if value == FALSE
|
# if value == FALSE
|
||||||
# value = "0"
|
# value = "0"
|
||||||
# elsif value.kind_of? Proc
|
# elsif value.kind_of?(Proc)
|
||||||
# value = install_cmd(value)
|
# value = install_cmd(value)
|
||||||
# end
|
# end
|
||||||
# tk_call @t.path, 'tag', 'configure', @id, "-#{key}", value
|
# tk_call @t.path, 'tag', 'configure', @id, "-#{key}", value
|
||||||
|
@ -167,7 +167,8 @@ class TkTextTag<TkObject
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def bind(seq, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -181,7 +182,8 @@ class TkTextTag<TkObject
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def bind_append(seq, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -222,9 +224,9 @@ class TkTextNamedTag<TkTextTag
|
||||||
def self.new(parent, name, *args)
|
def self.new(parent, name, *args)
|
||||||
if TTagID_TBL[parent.path] && TTagID_TBL[parent.path][name]
|
if TTagID_TBL[parent.path] && TTagID_TBL[parent.path][name]
|
||||||
tagobj = TTagID_TBL[parent.path][name]
|
tagobj = TTagID_TBL[parent.path][name]
|
||||||
if args != [] then
|
if args != []
|
||||||
keys = args.pop
|
keys = args.pop
|
||||||
if keys.kind_of? Hash then
|
if keys.kind_of?(Hash)
|
||||||
tagobj.add(*args) if args != []
|
tagobj.add(*args) if args != []
|
||||||
tagobj.configure(keys)
|
tagobj.configure(keys)
|
||||||
else
|
else
|
||||||
|
@ -250,9 +252,9 @@ class TkTextNamedTag<TkTextTag
|
||||||
#if mode
|
#if mode
|
||||||
# tk_call @t.path, "addtag", @id, *args
|
# tk_call @t.path, "addtag", @id, *args
|
||||||
#end
|
#end
|
||||||
if args != [] then
|
if args != []
|
||||||
keys = args.pop
|
keys = args.pop
|
||||||
if keys.kind_of? Hash then
|
if keys.kind_of?(Hash)
|
||||||
add(*args) if args != []
|
add(*args) if args != []
|
||||||
configure(keys)
|
configure(keys)
|
||||||
else
|
else
|
||||||
|
|
|
@ -13,7 +13,7 @@ class TkTextWindow<TkObject
|
||||||
if index == 'end'
|
if index == 'end'
|
||||||
@path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index',
|
@path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index',
|
||||||
'end - 1 chars'))
|
'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')
|
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',
|
@path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index',
|
||||||
'end - 1 chars'))
|
'end - 1 chars'))
|
||||||
|
@ -32,7 +32,8 @@ class TkTextWindow<TkObject
|
||||||
keys['window'] = _epath(@id) if @id
|
keys['window'] = _epath(@id) if @id
|
||||||
if keys['create']
|
if keys['create']
|
||||||
@p_create = 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
|
=begin
|
||||||
keys['create'] = install_cmd(proc{
|
keys['create'] = install_cmd(proc{
|
||||||
@id = @p_create.call
|
@id = @p_create.call
|
||||||
|
@ -63,7 +64,7 @@ class TkTextWindow<TkObject
|
||||||
end
|
end
|
||||||
|
|
||||||
def configure(slot, value=None)
|
def configure(slot, value=None)
|
||||||
if slot.kind_of? Hash
|
if slot.kind_of?(Hash)
|
||||||
slot = _symbolkey2str(slot)
|
slot = _symbolkey2str(slot)
|
||||||
if slot['window']
|
if slot['window']
|
||||||
@id = slot['window']
|
@id = slot['window']
|
||||||
|
@ -120,7 +121,8 @@ class TkTextWindow<TkObject
|
||||||
|
|
||||||
def create=(value)
|
def create=(value)
|
||||||
@p_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{
|
value = install_cmd(proc{
|
||||||
@id = @p_create.call
|
@id = @p_create.call
|
||||||
if @id.kind_of?(TkWindow)
|
if @id.kind_of?(TkWindow)
|
||||||
|
|
|
@ -122,7 +122,8 @@ class TkTimer
|
||||||
|
|
||||||
@current_args = args
|
@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)
|
sleep = @sleep_time.call(self)
|
||||||
else
|
else
|
||||||
sleep = @sleep_time
|
sleep = @sleep_time
|
||||||
|
@ -244,23 +245,28 @@ class TkTimer
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_interval(interval)
|
def set_interval(interval)
|
||||||
if interval != 'idle' \
|
#if interval != 'idle' && interval != :idle \
|
||||||
&& !interval.kind_of?(Integer) && !interval.kind_of?(Proc)
|
# && !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"
|
fail ArguemntError, "expect Integer or Proc"
|
||||||
end
|
end
|
||||||
@sleep_time = interval
|
@sleep_time = interval
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_procs(interval, loop_exec, *procs)
|
def set_procs(interval, loop_exec, *procs)
|
||||||
if interval != 'idle' \
|
#if interval != 'idle' && interval != :idle \
|
||||||
&& !interval.kind_of?(Integer) && !interval.kind_of?(Proc)
|
# && !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"
|
fail ArguemntError, "expect Integer or Proc for 1st argument"
|
||||||
end
|
end
|
||||||
@sleep_time = interval
|
@sleep_time = interval
|
||||||
|
|
||||||
@loop_proc = []
|
@loop_proc = []
|
||||||
procs.each{|e|
|
procs.each{|e|
|
||||||
if e.kind_of? Proc
|
# if e.kind_of?(Proc)
|
||||||
|
if TkComm._callback_entry?(e)
|
||||||
@loop_proc.push([e])
|
@loop_proc.push([e])
|
||||||
else
|
else
|
||||||
@loop_proc.push(e)
|
@loop_proc.push(e)
|
||||||
|
@ -288,7 +294,8 @@ class TkTimer
|
||||||
|
|
||||||
def add_procs(*procs)
|
def add_procs(*procs)
|
||||||
procs.each{|e|
|
procs.each{|e|
|
||||||
if e.kind_of? Proc
|
# if e.kind_of?(Proc)
|
||||||
|
if TkComm._callback_entry?(e)
|
||||||
@loop_proc.push([e])
|
@loop_proc.push([e])
|
||||||
else
|
else
|
||||||
@loop_proc.push(e)
|
@loop_proc.push(e)
|
||||||
|
@ -301,7 +308,8 @@ class TkTimer
|
||||||
|
|
||||||
def delete_procs(*procs)
|
def delete_procs(*procs)
|
||||||
procs.each{|e|
|
procs.each{|e|
|
||||||
if e.kind_of? Proc
|
# if e.kind_of?(Proc)
|
||||||
|
if TkComm._callback_entry?(e)
|
||||||
@loop_proc.delete([e])
|
@loop_proc.delete([e])
|
||||||
else
|
else
|
||||||
@loop_proc.delete(e)
|
@loop_proc.delete(e)
|
||||||
|
@ -325,7 +333,7 @@ class TkTimer
|
||||||
# set parameters for 'restart'
|
# set parameters for 'restart'
|
||||||
sleep = @init_sleep unless sleep
|
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"
|
fail ArguemntError, "expect Integer or 'idle' for 1st argument"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -354,7 +362,7 @@ class TkTimer
|
||||||
argc = init_args.size
|
argc = init_args.size
|
||||||
if argc > 0
|
if argc > 0
|
||||||
sleep = init_args.shift
|
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"
|
fail ArguemntError, "expect Integer or 'idle' for 1st argument"
|
||||||
end
|
end
|
||||||
@init_sleep = sleep
|
@init_sleep = sleep
|
||||||
|
@ -368,7 +376,8 @@ class TkTimer
|
||||||
@current_sleep = @init_sleep
|
@current_sleep = @init_sleep
|
||||||
@running = true
|
@running = true
|
||||||
if @init_proc
|
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"
|
fail ArgumentError, "Argument '#{@init_proc}' need to be Proc"
|
||||||
end
|
end
|
||||||
@current_proc = @init_proc
|
@current_proc = @init_proc
|
||||||
|
@ -421,7 +430,7 @@ class TkTimer
|
||||||
sleep, cmd = @current_script
|
sleep, cmd = @current_script
|
||||||
fail RuntimeError, "no procedure to continue" unless cmd
|
fail RuntimeError, "no procedure to continue" unless cmd
|
||||||
if wait
|
if wait
|
||||||
unless wait.kind_of? Integer
|
unless wait.kind_of?(Integer)
|
||||||
fail ArguemntError, "expect Integer for 1st argument"
|
fail ArguemntError, "expect Integer for 1st argument"
|
||||||
end
|
end
|
||||||
sleep = wait
|
sleep = wait
|
||||||
|
|
|
@ -51,7 +51,8 @@ module Tk
|
||||||
if keys[key].kind_of?(Array)
|
if keys[key].kind_of?(Array)
|
||||||
cmd, *args = keys[key]
|
cmd, *args = keys[key]
|
||||||
keys[key] = klass.new(cmd, args.join(' '))
|
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])
|
keys[key] = klass.new(keys[key])
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -151,7 +152,8 @@ module Tk
|
||||||
if keys[key].kind_of?(Array)
|
if keys[key].kind_of?(Array)
|
||||||
cmd, *args = keys[key]
|
cmd, *args = keys[key]
|
||||||
keys[key] = klass.new(cmd, args.join(' '))
|
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])
|
keys[key] = klass.new(keys[key])
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,8 @@ class Tk::BWidget::LabelEntry
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def entrybind(context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -42,7 +43,8 @@ class Tk::BWidget::LabelEntry
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def entrybind_append(context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
|
|
@ -49,7 +49,8 @@ class Tk::BWidget::ListBox
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def imagebind(context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -64,7 +65,8 @@ class Tk::BWidget::ListBox
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def imagebind_append(context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -88,7 +90,8 @@ class Tk::BWidget::ListBox
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def textbind(context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -103,7 +106,8 @@ class Tk::BWidget::ListBox
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def textbind_append(context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
|
|
@ -46,7 +46,8 @@ class Tk::BWidget::NoteBook
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def tabbind(context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -61,7 +62,8 @@ class Tk::BWidget::NoteBook
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def tabbind_append(context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
|
|
@ -27,7 +27,8 @@ class Tk::BWidget::SpinBox
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def entrybind(context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -41,7 +42,8 @@ class Tk::BWidget::SpinBox
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def entrybind_append(context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
|
|
@ -46,7 +46,8 @@ class Tk::BWidget::Tree
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def imagebind(context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -61,7 +62,8 @@ class Tk::BWidget::Tree
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def imagebind_append(context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -85,7 +87,8 @@ class Tk::BWidget::Tree
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def textbind(context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -100,7 +103,8 @@ class Tk::BWidget::Tree
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def textbind_append(context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
|
|
@ -350,7 +350,8 @@ module Tk
|
||||||
fail RuntimeError, 'component is not assigned to a widget'
|
fail RuntimeError, 'component is not assigned to a widget'
|
||||||
end
|
end
|
||||||
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -378,7 +379,8 @@ module Tk
|
||||||
fail RuntimeError, 'component is not assigned to a widget'
|
fail RuntimeError, 'component is not assigned to a widget'
|
||||||
end
|
end
|
||||||
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
|
|
@ -102,7 +102,8 @@ class Tk::Iwidgets::Scrolledcanvas
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def itembind(tag, context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -116,7 +117,8 @@ class Tk::Iwidgets::Scrolledcanvas
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def itembind_append(tag, context, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
|
|
@ -67,6 +67,6 @@ class << Tk::Tile::Style
|
||||||
end
|
end
|
||||||
|
|
||||||
def theme_use(name)
|
def theme_use(name)
|
||||||
tk_call('style', 'use', name)
|
tk_call('style', 'theme', 'use', name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -88,7 +88,8 @@ module Tk
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def dnd_bindtarget(type, event, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -127,7 +128,8 @@ module Tk
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def dnd_bindsource(type, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
|
|
@ -748,7 +748,8 @@ class Tk::TreeCtrl
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def notify_bind(obj, event, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
@ -762,7 +763,8 @@ class Tk::TreeCtrl
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def notify_bind_append(obj, event, *args)
|
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
|
cmd = args.shift
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
|
|
|
@ -149,7 +149,8 @@ class Tk::Winico
|
||||||
if keys[k].kind_of?(Array)
|
if keys[k].kind_of?(Array)
|
||||||
cmd, *args = keys[k]
|
cmd, *args = keys[k]
|
||||||
keys[k] = Winico_callback.new(cmd, args.join(' '))
|
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])
|
keys[k] = Winico_callback.new(keys[k])
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -164,7 +165,8 @@ class Tk::Winico
|
||||||
if keys[k].kind_of?(Array)
|
if keys[k].kind_of?(Array)
|
||||||
cmd, *args = keys[k]
|
cmd, *args = keys[k]
|
||||||
keys[k] = Winico_callback.new(cmd, args.join(' '))
|
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])
|
keys[k] = Winico_callback.new(keys[k])
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue