/usr/lib/ruby/2.0.0/tk/selection.rb is in ruby2.0-tcltk 2.0.0.484-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | #
# tk/selection.rb : control selection
#
require 'tk'
module TkSelection
include Tk
extend Tk
TkCommandNames = ['selection'.freeze].freeze
def self.clear(sel=nil)
if sel
tk_call_without_enc('selection', 'clear', '-selection', sel)
else
tk_call_without_enc('selection', 'clear')
end
end
def self.clear_on_display(win, sel=nil)
if sel
tk_call_without_enc('selection', 'clear',
'-displayof', win, '-selection', sel)
else
tk_call_without_enc('selection', 'clear', '-displayof', win)
end
end
def clear(sel=nil)
TkSelection.clear_on_display(self, sel)
self
end
def self.get(keys=nil)
#tk_call('selection', 'get', *hash_kv(keys))
_fromUTF8(tk_call_without_enc('selection', 'get', *hash_kv(keys)))
end
def self.get_on_display(win, keys=nil)
#tk_call('selection', 'get', '-displayof', win, *hash_kv(keys))
_fromUTF8(tk_call_without_enc('selection', 'get', '-displayof',
win, *hash_kv(keys)))
end
def get(keys=nil)
TkSelection.get_on_display(self, sel)
end
def self.handle(win, func=Proc.new, keys=nil, &b)
if func.kind_of?(Hash) && keys == nil
keys = func
func = Proc.new(&b)
end
args = ['selection', 'handle']
args.concat(hash_kv(keys))
args.concat([win, func])
tk_call_without_enc(*args)
end
def handle(func=Proc.new, keys=nil, &b)
TkSelection.handle(self, func, keys, &b)
end
def self.get_owner(sel=nil)
if sel
window(tk_call_without_enc('selection', 'own', '-selection', sel))
else
window(tk_call_without_enc('selection', 'own'))
end
end
def self.get_owner_on_display(win, sel=nil)
if sel
window(tk_call_without_enc('selection', 'own',
'-displayof', win, '-selection', sel))
else
window(tk_call_without_enc('selection', 'own', '-displayof', win))
end
end
def get_owner(sel=nil)
TkSelection.get_owner_on_display(self, sel)
self
end
def self.set_owner(win, keys=nil)
tk_call_without_enc('selection', 'own', *(hash_kv(keys) << win))
end
def set_owner(keys=nil)
TkSelection.set_owner(self, keys)
self
end
end
|