| Module | TkComm |
| In: |
tk.rb
|
define TkComm module (step 2: event binding)
Included Modules
TkUtil
TkEvent
Constants
| 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 |
Public Instance methods
# File tk.rb, line 183
183: def _at(x,y=nil)
184: if y
185: "@#{Integer(x)},#{Integer(y)}"
186: else
187: "@#{Integer(x)}"
188: end
189: end
def bind(tagOrClass, context, cmd=Proc.new, *args)
_bind(["bind", tagOrClass], context, cmd, *args) tagOrClass
end
# File tk.rb, line 1005
1005: def bind(tagOrClass, context, *args)
1006: # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
1007: if TkComm._callback_entry?(args[0]) || !block_given?
1008: cmd = args.shift
1009: else
1010: cmd = Proc.new
1011: end
1012: _bind(["bind", tagOrClass], context, cmd, *args)
1013: tagOrClass
1014: end
def bind_all(context, cmd=Proc.new, *args)
_bind(['bind', 'all'], context, cmd, *args) TkBindTag::ALL
end
# File tk.rb, line 1044
1044: def bind_all(context, *args)
1045: # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
1046: if TkComm._callback_entry?(args[0]) || !block_given?
1047: cmd = args.shift
1048: else
1049: cmd = Proc.new
1050: end
1051: _bind(['bind', 'all'], context, cmd, *args)
1052: TkBindTag::ALL
1053: end
def bind_append(tagOrClass, context, cmd=Proc.new, *args)
_bind_append(["bind", tagOrClass], context, cmd, *args) tagOrClass
end
# File tk.rb, line 1020
1020: def bind_append(tagOrClass, context, *args)
1021: # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
1022: if TkComm._callback_entry?(args[0]) || !block_given?
1023: cmd = args.shift
1024: else
1025: cmd = Proc.new
1026: end
1027: _bind_append(["bind", tagOrClass], context, cmd, *args)
1028: tagOrClass
1029: end
def bind_append_all(context, cmd=Proc.new, *args)
_bind_append(['bind', 'all'], context, cmd, *args) TkBindTag::ALL
end
# File tk.rb, line 1059
1059: def bind_append_all(context, *args)
1060: # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
1061: if TkComm._callback_entry?(args[0]) || !block_given?
1062: cmd = args.shift
1063: else
1064: cmd = Proc.new
1065: end
1066: _bind_append(['bind', 'all'], context, cmd, *args)
1067: TkBindTag::ALL
1068: end
# File tk.rb, line 1031
1031: def bind_remove(tagOrClass, context)
1032: _bind_remove(['bind', tagOrClass], context)
1033: tagOrClass
1034: end
# File tk.rb, line 1070
1070: def bind_remove_all(context)
1071: _bind_remove(['bind', 'all'], context)
1072: TkBindTag::ALL
1073: end
# File tk.rb, line 1036
1036: def bindinfo(tagOrClass, context=nil)
1037: _bindinfo(['bind', tagOrClass], context)
1038: end
# File tk.rb, line 1075
1075: def bindinfo_all(context=nil)
1076: _bindinfo(['bind', 'all'], context)
1077: end
# File tk.rb, line 602
602: def image_obj(val)
603: if val =~ /^i(_\d+_)?\d+$/
604: TkImage::Tk_IMGTBL[val]? TkImage::Tk_IMGTBL[val] : val
605: else
606: val
607: end
608: end
# File tk.rb, line 794
794: def install_cmd(cmd)
795: return '' if cmd == ''
796: begin
797: ns = TkCore::INTERP._invoke_without_enc('namespace', 'current')
798: ns = nil if ns == '::' # for backward compatibility
799: rescue
800: # probably, Tcl7.6
801: ns = nil
802: end
803: id = _next_cmd_id
804: #Tk_CMDTBL[id] = cmd
805: if cmd.kind_of?(TkCallbackEntry)
806: TkCore::INTERP.tk_cmd_tbl[id] = cmd
807: else
808: TkCore::INTERP.tk_cmd_tbl[id] = TkCore::INTERP.get_cb_entry(cmd)
809: end
810: @cmdtbl = [] unless defined? @cmdtbl
811: @cmdtbl.taint unless @cmdtbl.tainted?
812: @cmdtbl.push id
813: #return Kernel.format("rb_out %s", id);
814: if ns
815: 'rb_out' << TkCore::INTERP._ip_id_ << ' ' << ns << ' ' << id
816: else
817: 'rb_out' << TkCore::INTERP._ip_id_ << ' ' << id
818: end
819: end
# File tk.rb, line 628
628: def subst(str, *opts)
629: # opts := :nobackslashes | :nocommands | novariables
630: tk_call('subst',
631: *(opts.collect{|opt|
632: opt = opt.to_s
633: (opt[0] == ?-)? opt: '-' << opt
634: } << str))
635: end