/usr/lib/ruby/1.9.1/tk/place.rb is in libtcltk-ruby1.9.1 1.9.3.0-1ubuntu1.
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 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | #
# tk/place.rb : control place geometry manager
#
require 'tk'
module TkPlace
include Tk
extend Tk
TkCommandNames = ['place'.freeze].freeze
def configure(win, slot, value=None)
# for >= Tk8.4a2 ?
# win = win.epath if win.kind_of?(TkObject)
win = _epath(win)
if slot.kind_of? Hash
params = []
slot.each{|k, v|
params.push("-#{k}")
# params.push((v.kind_of?(TkObject))? v.epath: v)
params.push(_epath(v))
}
tk_call_without_enc('place', 'configure', win, *params)
else
# value = value.epath if value.kind_of?(TkObject)
value = _epath(value)
tk_call_without_enc('place', 'configure', win, "-#{slot}", value)
end
end
alias place configure
def configinfo(win, slot = nil)
# for >= Tk8.4a2 ?
if TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
# win = win.epath if win.kind_of?(TkObject)
win = _epath(win)
if slot
#conf = tk_split_list(tk_call_without_enc('place', 'configure',
# win, "-#{slot}") )
conf = tk_split_simplelist(tk_call_without_enc('place', 'configure',
win, "-#{slot}") )
conf[0] = conf[0][1..-1]
conf[1] = tk_tcl2ruby(conf[1])
conf[2] = tk_tcl2ruby(conf[1])
conf[3] = tk_tcl2ruby(conf[1])
conf[4] = tk_tcl2ruby(conf[1])
conf
else
tk_split_simplelist(tk_call_without_enc('place', 'configure',
win)).collect{|conflist|
#conf = list(conflist)
conf = simplelist(conflist).collect!{|inf| tk_tcl2ruby(inf)}
conf[0] = conf[0][1..-1]
conf
}
end
else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
current_configinfo(win, slot)
end
end
def current_configinfo(win, slot = nil)
# win = win.epath if win.kind_of?(TkObject)
win = _epath(win)
if slot
#conf = tk_split_list(tk_call_without_enc('place', 'configure',
# win, "-#{slot}") )
conf = tk_split_simplelist(tk_call_without_enc('place', 'configure',
win, "-#{slot}") )
# { conf[0][1..-1] => conf[1] }
{ conf[0][1..-1] => tk_tcl2ruby(conf[4]) }
else
ret = {}
#tk_split_list(tk_call_without_enc('place','configure',win)).each{|conf|
tk_split_simplelist(tk_call_without_enc('place', 'configure',
win)).each{|conf_list|
#ret[conf[0][1..-1]] = conf[1]
conf = simplelist(conf_list)
ret[conf[0][1..-1]] = tk_tcl2ruby(conf[4])
}
ret
end
end
def forget(win)
# win = win.epath if win.kind_of?(TkObject)
win = _epath(win)
tk_call_without_enc('place', 'forget', win)
end
def info(win)
# win = win.epath if win.kind_of?(TkObject)
win = _epath(win)
#ilist = list(tk_call_without_enc('place', 'info', win))
ilist = simplelist(tk_call_without_enc('place', 'info', win))
info = {}
while key = ilist.shift
#info[key[1..-1]] = ilist.shift
info[key[1..-1]] = tk_tcl2ruby(ilist.shift)
end
return info
end
def slaves(master)
# master = master.epath if master.kind_of?(TkObject)
master = _epath(master)
list(tk_call('place', 'slaves', master))
end
module_function :place, :configure, :configinfo, :current_configinfo
module_function :forget, :info, :slaves
end
=begin
def TkPlace(win, slot, value=None)
win = win.epath if win.kind_of?(TkObject)
if slot.kind_of? Hash
params = []
slot.each{|k, v|
params.push("-#{k}")
params.push((v.kind_of?(TkObject))? v.epath: v)
}
tk_call_without_enc('place', win, *params)
else
value = value.epath if value.kind_of?(TkObject)
tk_call_without_enc('place', win, "-#{slot}", value)
end
end
=end
|