Module | TkComm |
In: |
tk/lib/tk.rb
|
define TkComm module (step 2: event binding)
WidgetClassNames | = | {}.taint | ||
TkExtlibAutoloadModule | = | [].taint | ||
Tk_IDs | = | ["00000".taint, "00000".taint].freeze # [0]-cmdid, [1]-winid | Tk_CMDTBL = {} Tk_WINDOWS = {} | |
Tk_CMDTBL | = | Object.new | for backward compatibility | |
Tk_WINDOWS | = | Object.new | ||
GET_CONFIGINFO_AS_ARRAY | = | true |
GET_CONFIGINFO_AS_ARRAY = false => returns a Hash { opt =>val,
… }
true => returns an Array [[opt,val], ... ] val is a list which includes resource info. |
|
GET_CONFIGINFOwoRES_AS_ARRAY | = | true |
for configinfo without resource info; list of [opt, value] pair
false => returns a Hash { opt=>val, ... } true => returns an Array [[opt,val], ... ] |
|
USE_TCLs_LIST_FUNCTIONS | = | true |
# File tk/lib/tk.rb, line 182 def _at(x,y=nil) if y "@#{Integer(x)},#{Integer(y)}" else "@#{Integer(x)}" end end
def bind(tagOrClass, context, cmd=Proc.new, *args)
_bind(["bind", tagOrClass], context, cmd, *args) tagOrClass
end
# File tk/lib/tk.rb, line 979 def bind(tagOrClass, context, *args) # if args[0].kind_of?(Proc) || args[0].kind_of?(Method) if TkComm._callback_entry?(args[0]) || !block_given? cmd = args.shift else cmd = Proc.new end _bind(["bind", tagOrClass], context, cmd, *args) tagOrClass end
def bind_all(context, cmd=Proc.new, *args)
_bind(['bind', 'all'], context, cmd, *args) TkBindTag::ALL
end
# File tk/lib/tk.rb, line 1018 def bind_all(context, *args) # if args[0].kind_of?(Proc) || args[0].kind_of?(Method) if TkComm._callback_entry?(args[0]) || !block_given? cmd = args.shift else cmd = Proc.new end _bind(['bind', 'all'], context, cmd, *args) TkBindTag::ALL end
def bind_append(tagOrClass, context, cmd=Proc.new, *args)
_bind_append(["bind", tagOrClass], context, cmd, *args) tagOrClass
end
# File tk/lib/tk.rb, line 994 def bind_append(tagOrClass, context, *args) # if args[0].kind_of?(Proc) || args[0].kind_of?(Method) if TkComm._callback_entry?(args[0]) || !block_given? cmd = args.shift else cmd = Proc.new end _bind_append(["bind", tagOrClass], context, cmd, *args) tagOrClass end
def bind_append_all(context, cmd=Proc.new, *args)
_bind_append(['bind', 'all'], context, cmd, *args) TkBindTag::ALL
end
# File tk/lib/tk.rb, line 1033 def bind_append_all(context, *args) # if args[0].kind_of?(Proc) || args[0].kind_of?(Method) if TkComm._callback_entry?(args[0]) || !block_given? cmd = args.shift else cmd = Proc.new end _bind_append(['bind', 'all'], context, cmd, *args) TkBindTag::ALL end
# File tk/lib/tk.rb, line 1005 def bind_remove(tagOrClass, context) _bind_remove(['bind', tagOrClass], context) tagOrClass end
# File tk/lib/tk.rb, line 1044 def bind_remove_all(context) _bind_remove(['bind', 'all'], context) TkBindTag::ALL end
# File tk/lib/tk.rb, line 1010 def bindinfo(tagOrClass, context=nil) _bindinfo(['bind', tagOrClass], context) end
# File tk/lib/tk.rb, line 1049 def bindinfo_all(context=nil) _bindinfo(['bind', 'all'], context) end
# File tk/lib/tk.rb, line 596 def image_obj(val) if val =~ /^i(_\d+_)?\d+$/ TkImage::Tk_IMGTBL[val]? TkImage::Tk_IMGTBL[val] : val else val end end
# File tk/lib/tk.rb, line 784 def install_cmd(cmd) return '' if cmd == '' id = _next_cmd_id #Tk_CMDTBL[id] = cmd if cmd.kind_of?(TkCallbackEntry) TkCore::INTERP.tk_cmd_tbl[id] = cmd else TkCore::INTERP.tk_cmd_tbl[id] = TkCore::INTERP.get_cb_entry(cmd) end @cmdtbl = [] unless defined? @cmdtbl @cmdtbl.taint unless @cmdtbl.tainted? @cmdtbl.push id #return Kernel.format("rb_out %s", id); return 'rb_out' + TkCore::INTERP._ip_id_ + ' ' + id end
# File tk/lib/tk.rb, line 618 def subst(str, *opts) # opts := :nobackslashes | :nocommands | novariables tk_call('subst', *(opts.collect{|opt| opt = opt.to_s (opt[0] == ?-)? opt: '-' << opt } << str)) end