summaryrefslogtreecommitdiff
path: root/ext/tk/lib/tk/timer.rb
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-16 07:13:14 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-16 07:13:14 +0000
commit805bd6fb8cf8627101c048572334873dfefda0cd (patch)
treea70ebaa1952de781f07b1113f6b4cb8e1e9073be /ext/tk/lib/tk/timer.rb
parent23565f4a489ddbe0b3939478c8fd842919185059 (diff)
* 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/branches/ruby_1_8@7574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tk/timer.rb')
-rw-r--r--ext/tk/lib/tk/timer.rb33
1 files changed, 21 insertions, 12 deletions
diff --git a/ext/tk/lib/tk/timer.rb b/ext/tk/lib/tk/timer.rb
index f3b6465f78..a1f43fa864 100644
--- a/ext/tk/lib/tk/timer.rb
+++ b/ext/tk/lib/tk/timer.rb
@@ -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