Skip to content

Commit 0ac67b8

Browse files
author
matz
committed
1.1c0 addendum
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent c2fa49a commit 0ac67b8

File tree

4 files changed

+112
-0
lines changed

4 files changed

+112
-0
lines changed

MANIFEST

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,14 @@ lib/thread.rb
125125
lib/thwait.rb
126126
lib/tk.rb
127127
lib/tkafter.rb
128+
lib/tkbgerror.rb
128129
lib/tkcanvas.rb
129130
lib/tkclass.rb
130131
lib/tkdialog.rb
131132
lib/tkentry.rb
132133
lib/tkfont.rb
133134
lib/tkmenubar.rb
135+
lib/tkmngfocus.rb
134136
lib/tkpalette.rb
135137
lib/tkscrollbox.rb
136138
lib/tktext.rb

lib/tkbgerror.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#
2+
# tkbgerror -- bgerror ( tkerror ) module
3+
# 1998/07/16 by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
4+
#
5+
require 'tk'
6+
7+
module TkBgError
8+
extend Tk
9+
10+
def bgerror(message)
11+
tk_call 'bgerror', message
12+
end
13+
alias tkerror bgerror
14+
alias show bgerror
15+
16+
module_function :bgerror, :tkerror, :show
17+
end

lib/tkmngfocus.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#
2+
# tkmngfocus.rb : methods for Tcl/Tk standard library 'focus.tcl'
3+
# 1998/07/16 by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
4+
#
5+
require 'tk'
6+
7+
module TkManageFocus
8+
extend Tk
9+
10+
def TkManageFocus.followsMouse
11+
tk_call 'tk_focusFollowsMouse'
12+
end
13+
14+
def TkManageFocus.next(window)
15+
tk_call 'tk_focusNext', window
16+
end
17+
def focusNext
18+
TkManageFocus.next(self)
19+
end
20+
21+
def TkManageFocus.prev(window)
22+
tk_call 'tk_focusPrev', window
23+
end
24+
def focusPrev
25+
TkManageFocus.prev(self)
26+
end
27+
end

lib/tkvirtevent.rb

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#
2+
# tkvirtevent.rb : treats virtual events
3+
# 1998/07/16 by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
4+
#
5+
require 'tk'
6+
7+
class TkVirtualEvent<TkObject
8+
extend Tk
9+
10+
TkVirturlEventID = [0]
11+
TkVirturlEventTBL = {}
12+
13+
def TkVirtualEvent.getobj(event)
14+
obj = TkVirturlEventTBL[event]
15+
obj ? obj : event
16+
end
17+
18+
def TkVirtualEvent.info
19+
tk_call('event', 'info').split(/\s+/).filter{|seq|
20+
TkVirtualEvent.getobj(seq[1..-2])
21+
}
22+
end
23+
24+
def initialize(*sequences)
25+
@path = @id = format("<VirtEvent%.4d>", TkVirturlEventID[0])
26+
TkVirturlEventID[0] += 1
27+
add(*sequences)
28+
end
29+
30+
def add(*sequences)
31+
if sequences != []
32+
tk_call('event', 'add', "<#{@id}>",
33+
*(sequences.collect{|seq| "<#{tk_event_sequence(seq)}>"}) )
34+
TkVirturlEventTBL[@id] = self
35+
end
36+
self
37+
end
38+
39+
def delete(*sequences)
40+
if sequences == []
41+
tk_call('event', 'delete', "<#{@id}>")
42+
TkVirturlEventTBL[@id] = nil
43+
else
44+
tk_call('event', 'delete', "<#{@id}>",
45+
*(sequences.collect{|seq| "<#{tk_event_sequence(seq)}>"}) )
46+
TkVirturlEventTBL[@id] = nil if info == []
47+
end
48+
self
49+
end
50+
51+
def info
52+
tk_call('event', 'info', "<#{@id}>").split(/\s+/).filter{|seq|
53+
l = seq.scan(/<*[^<>]+>*/).filter{|subseq|
54+
case (subseq)
55+
when /^<<[^<>]+>>$/
56+
TkVirtualEvent.getobj(subseq[1..-2])
57+
when /^<[^<>]+>$/
58+
subseq[1..-2]
59+
else
60+
subseq.split('')
61+
end
62+
}.flatten
63+
(l.size == 1) ? l[0] : l
64+
}
65+
end
66+
end

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy