summaryrefslogtreecommitdiff
path: root/ext/tk/lib/tk/virtevent.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tk/lib/tk/virtevent.rb')
-rw-r--r--ext/tk/lib/tk/virtevent.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/ext/tk/lib/tk/virtevent.rb b/ext/tk/lib/tk/virtevent.rb
index a1a94d3c55..d47e80aecd 100644
--- a/ext/tk/lib/tk/virtevent.rb
+++ b/ext/tk/lib/tk/virtevent.rb
@@ -15,6 +15,19 @@ class TkVirtualEvent<TkObject
TkCore::INTERP.init_ip_env{ TkVirtualEventTBL.clear }
class PreDefVirtEvent<self
+ def self.new(event, *sequences)
+ if event =~ /^<(<.*>)>$/
+ event = $1
+ elsif event !~ /^<.*>$/
+ event = '<' + event + '>'
+ end
+ if TkVirtualEvent::TkVirtualEventTBL.has_key?(event)
+ TkVirtualEvent::TkVirtualEventTBL[event]
+ else
+ super(event, *sequences)
+ end
+ end
+
def initialize(event, *sequences)
@path = @id = event
TkVirtualEvent::TkVirtualEventTBL[@id] = self
@@ -89,3 +102,5 @@ class TkVirtualEvent<TkObject
}
end
end
+
+TkNamedVirtualEvent = TkVirtualEvent::PreDefVirtEvent