mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
389 lines
11 KiB
Ruby
389 lines
11 KiB
Ruby
|
# tof
|
|||
|
|
|||
|
#### tcltk <20>饤<EFBFBD>֥<EFBFBD><D6A5><EFBFBD>
|
|||
|
#### Sep. 5, 1997 Y. Shigehiro
|
|||
|
|
|||
|
require "tcltklib"
|
|||
|
|
|||
|
################
|
|||
|
|
|||
|
# module TclTk: tcl/tk <20>Υ饤<CEA5>֥<EFBFBD><D6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Τ<EFBFBD>ɬ<EFBFBD>פˤʤ<CBA4><CAA4><EFBFBD><EFBFBD>Τ<F2BDB8A4><E1A4BF><EFBFBD><EFBFBD>
|
|||
|
# (<28><><EFBFBD><EFBFBD>, ̾<><CCBE><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> module <20>ˤ<EFBFBD><CBA4><EFBFBD><EFBFBD>Ȥ<EFBFBD>.)
|
|||
|
module TclTk
|
|||
|
|
|||
|
# ñ<>ˤ<EFBFBD><CBA4><EFBFBD><EFBFBD>˽кǽ<D0BA><C7BD><EFBFBD> 1 <20>ټ¹Ԥ<C2B9><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Τ<EFBFBD>??
|
|||
|
|
|||
|
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>դ<EFBFBD>̾<EFBFBD><CCBE><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
@namecnt = {}
|
|||
|
|
|||
|
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Хå<D0A5><C3A5><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
@callback = {}
|
|||
|
end
|
|||
|
|
|||
|
# TclTk.mainloop(): TclTkLib.mainloop() <20><><EFBFBD>Ƥ<EFBFBD>.
|
|||
|
def TclTk.mainloop()
|
|||
|
print("mainloop: start\n") if $DEBUG
|
|||
|
TclTkLib.mainloop()
|
|||
|
print("mainloop: end\n") if $DEBUG
|
|||
|
end
|
|||
|
|
|||
|
# TclTk.deletecallbackkey(ca): <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Хå<D0A5><C3A5><EFBFBD> TclTk module <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
# tcl/tk <20><><EFBFBD>ץ<D7A5>ˤ<EFBFBD><CBA4><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Хå<D0A5><C3A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ä<EFBFBD><C3A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>櫓<EFBFBD>ǤϤʤ<CFA4>.
|
|||
|
# <20><><EFBFBD><EFBFBD><EFBFBD>ʤ<F2A4B7A4><CAA4><EFBFBD>, <20>Ǹ<EFBFBD><C7B8><EFBFBD> TclTkInterpreter <20><> GC <20>Ǥ<EFBFBD><C7A4>ʤ<EFBFBD>.
|
|||
|
# (GC <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʤ<EFBFBD><CAA4><EFBFBD><EFBFBD><EFBFBD>, <20>̤<EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD>ʤ<F2A4B7A4><CAA4>Ƥ<EFBFBD><C6A4>ɤ<EFBFBD>.)
|
|||
|
# ca: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Хå<D0A5>(TclTkCallback)
|
|||
|
def TclTk.deletecallbackkey(ca)
|
|||
|
print("deletecallbackkey: ", ca.to_s(), "\n") if $DEBUG
|
|||
|
@callback.delete(ca.to_s)
|
|||
|
end
|
|||
|
|
|||
|
# TclTk.dcb(ca, wid, W): <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>äƤ<C3A4><C6A4><EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD>Υ<EFBFBD><CEA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Хå<D0A5><C3A5><EFBFBD><EFBFBD>Ф<EFBFBD><D0A4><EFBFBD>
|
|||
|
# TclTk.deletecallbackkey() <20><><EFBFBD>Ƥ<EFBFBD>.
|
|||
|
# <20>ȥåץ<C3A5><D7A5>٥<EFBFBD><D9A5><EFBFBD> <Destroy> <20><><EFBFBD>٥<EFBFBD><D9A5>ȤΥ<C8A4><CEA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Хå<D0A5><C3A5>Ȥ<EFBFBD><C8A4>ƸƤ֤<C6A4><D6A4><EFBFBD><EFBFBD>Τ<EFBFBD><CEA4><EFBFBD>.
|
|||
|
# ca: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Хå<D0A5>(TclTkCallback) <20><> Array
|
|||
|
# wid: <20>ȥåץ<C3A5><D7A5>٥<EFBFBD><D9A5>Υ<EFBFBD><CEA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>å<EFBFBD>(TclTkWidget)
|
|||
|
# w: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Хå<D0A5><C3A5><EFBFBD> %W <20><>Ϳ<EFBFBD><CDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɥ<EFBFBD><C9A5>˴ؤ<CBB4><D8A4><EFBFBD><EFBFBD>ѥ<EFBFBD><D1A5><EFBFBD><E1A1BC>(String)
|
|||
|
def TclTk.dcb(ca, wid, w)
|
|||
|
if wid.to_s() == w
|
|||
|
ca.each{|i|
|
|||
|
TclTk.deletecallbackkey(i)
|
|||
|
}
|
|||
|
end
|
|||
|
end
|
|||
|
|
|||
|
# TclTk._addcallback(ca): <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Хå<D0A5><C3A5><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>.
|
|||
|
# ca: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Хå<D0A5>(TclTkCallback)
|
|||
|
def TclTk._addcallback(ca)
|
|||
|
print("_addcallback: ", ca.to_s(), "\n") if $DEBUG
|
|||
|
@callback[ca.to_s()] = ca
|
|||
|
end
|
|||
|
|
|||
|
# TclTk._callcallback(key, arg): <20><>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Хå<D0A5><C3A5><EFBFBD><EFBFBD>ƤӽФ<D3BD>.
|
|||
|
# key: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Хå<D0A5><C3A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>륭<F2A4B9A4><EBA5AD> (TclTkCallback <20><> to_s() <20><><EFBFBD>֤<EFBFBD><D6A4><EFBFBD>)
|
|||
|
# arg: tcl/tk <20><><EFBFBD>ץ<D7A5><EAA5BF><EFBFBD><EFBFBD><EFBFBD>Υѥ<CEA5><D1A5><EFBFBD><E1A1BC>
|
|||
|
def TclTk._callcallback(key, arg)
|
|||
|
print("_callcallback: ", @callback[key].inspect, "\n") if $DEBUG
|
|||
|
@callback[key]._call(arg)
|
|||
|
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Хå<D0A5><C3A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><D6A4>ͤϤɤ<CFA4><C9A4><EFBFBD><EFBFBD>ΤƤ<CEA4><C6A4><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
# String <20><><EFBFBD>֤<EFBFBD><D6A4>ʤ<EFBFBD><CAA4><EFBFBD>, rb_eval_string() <20><><EFBFBD><EFBFBD><EFBFBD>顼<EFBFBD>ˤʤ<CBA4>.
|
|||
|
return ""
|
|||
|
end
|
|||
|
|
|||
|
# TclTk._newname(prefix): <20><><EFBFBD>դ<EFBFBD>̾<EFBFBD><CCBE>(String)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD>.
|
|||
|
# prefix: ̾<><CCBE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><C6AC>
|
|||
|
def TclTk._newname(prefix)
|
|||
|
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̾<EFBFBD><CCBE><EFBFBD>Υ<EFBFBD><CEA5><EFBFBD><EFBFBD><EFBFBD> @namecnt <20><><EFBFBD><EFBFBD><EFBFBD>äƤ<C3A4><C6A4><EFBFBD><EFBFBD>Τ<EFBFBD>, Ĵ<>٤<EFBFBD>.
|
|||
|
if !@namecnt.key?(prefix)
|
|||
|
# <20><><EFBFBD><EFBFBD><EFBFBD>ƻȤ<C6BB><C8A4><EFBFBD>Ƭ<EFBFBD><C6AC><EFBFBD>ʤΤǽ<CEA4><C7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
@namecnt[prefix] = 1
|
|||
|
else
|
|||
|
# <20>Ȥä<C8A4><C3A4><EFBFBD><EFBFBD>ȤΤ<C8A4><CEA4><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><C6AC><EFBFBD>ʤΤ<CAA4>, <20><><EFBFBD><EFBFBD>̾<EFBFBD><CCBE><EFBFBD>ˤ<EFBFBD><CBA4><EFBFBD>.
|
|||
|
@namecnt[prefix] += 1
|
|||
|
end
|
|||
|
return "#{prefix}#{@namecnt[prefix]}"
|
|||
|
end
|
|||
|
|
|||
|
################
|
|||
|
|
|||
|
# class TclTkInterpreter: tcl/tk <20>Υ<EFBFBD><CEA5>ץ
|
|||
|
class TclTkInterpreter
|
|||
|
|
|||
|
# initialize(): <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
def initialize()
|
|||
|
# <20><><EFBFBD>ץ<D7A5><EAA5BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
@ip = TclTkIp.new()
|
|||
|
|
|||
|
# <20><><EFBFBD>ץ<D7A5><EAA5BF> ruby_fmt <20><><EFBFBD>ޥ<EFBFBD><DEA5>ɤ<EFBFBD><C9A4>ɲä<C9B2><C3A4><EFBFBD>.
|
|||
|
# ruby_fmt <20><><EFBFBD>ޥ<EFBFBD><DEA5>ɤȤ<C9A4>, <20><><EFBFBD><EFBFBD><EFBFBD>ΰ<EFBFBD><CEB0><EFBFBD><EFBFBD><EFBFBD> format <20><><EFBFBD>ޥ<EFBFBD><DEA5>ɤǽ<C9A4><C7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
# ruby <20><><EFBFBD>ޥ<EFBFBD><DEA5>ɤ<EFBFBD><C9A4>Ϥ<EFBFBD><CFA4><EFBFBD><EFBFBD>ΤǤ<CEA4><C7A4><EFBFBD>.
|
|||
|
# (<28>ʤ<EFBFBD>, ruby <20><><EFBFBD>ޥ<EFBFBD><DEA5>ɤ<EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 <20>Ĥ<EFBFBD><C4A4><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4>ʤ<EFBFBD>.)
|
|||
|
if $DEBUG
|
|||
|
@ip._eval("proc ruby_fmt {fmt args} { puts \"ruby_fmt: $fmt $args\" ; ruby [format $fmt $args] }")
|
|||
|
else
|
|||
|
@ip._eval("proc ruby_fmt {fmt args} { ruby [format $fmt $args] }")
|
|||
|
end
|
|||
|
|
|||
|
# @ip._get_eval_string(*args): tcl/tk <20><><EFBFBD>ץ<D7A5><EAA5BF>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
# ʸ<><CAB8><EFBFBD><EFBFBD>(String)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD>.
|
|||
|
# *args: tcl/tk <20><>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD>륹<EFBFBD><EBA5B9><EFBFBD><EFBFBD><EFBFBD>ץ<EFBFBD>(<28><><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD>륪<EFBFBD>֥<EFBFBD><D6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|||
|
def @ip._get_eval_string(*args)
|
|||
|
argstr = ""
|
|||
|
args.each{|arg|
|
|||
|
argstr += " " if argstr != ""
|
|||
|
# <20>⤷ to_eval() <20><EFBFBD>åɤ<C3A5>
|
|||
|
if (arg.respond_to?(:to_eval))
|
|||
|
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4><EFBFBD><EFBFBD>Ф<EFBFBD><D0A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD>.
|
|||
|
argstr += arg.to_eval()
|
|||
|
else
|
|||
|
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4>ʤ<EFBFBD><CAA4><EFBFBD><EFBFBD><EFBFBD> to_s() <20><><EFBFBD>Ƥ<EFBFBD>.
|
|||
|
argstr += arg.to_s()
|
|||
|
end
|
|||
|
}
|
|||
|
return argstr
|
|||
|
end
|
|||
|
|
|||
|
# @ip._eval_args(*args): tcl/tk <20><><EFBFBD>ץ<D7A5><EAA5BF>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>,
|
|||
|
# <20><><EFBFBD>η<EFBFBD><CEB7><EFBFBD>(String)<29><><EFBFBD>֤<EFBFBD>.
|
|||
|
# *args: tcl/tk <20><>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD>륹<EFBFBD><EBA5B9><EFBFBD><EFBFBD><EFBFBD>ץ<EFBFBD>(<28><><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD>륪<EFBFBD>֥<EFBFBD><D6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|||
|
def @ip._eval_args(*args)
|
|||
|
# <20><><EFBFBD>ץ<D7A5><EAA5BF>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
argstr = _get_eval_string(*args)
|
|||
|
|
|||
|
# <20><><EFBFBD>ץ<D7A5><EAA5BF>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
print("_eval: \"", argstr, "\"") if $DEBUG
|
|||
|
res = _eval(argstr)
|
|||
|
if $DEBUG
|
|||
|
print(" -> \"", res, "\"\n")
|
|||
|
elsif _return_value() != 0
|
|||
|
print(res, "\n")
|
|||
|
end
|
|||
|
fail(%Q/can't eval "#{argstr}"/) if _return_value() != 0
|
|||
|
return res
|
|||
|
end
|
|||
|
|
|||
|
# tcl/tk <20>Υ<EFBFBD><CEA5>ޥ<EFBFBD><DEA5>ɤ<EFBFBD><C9A4>б<EFBFBD><D0B1><EFBFBD><EFBFBD>륪<EFBFBD>֥<EFBFBD><D6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, Ϣ<><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4><EFBFBD>.
|
|||
|
@commands = {}
|
|||
|
# tcl/tk <20><><EFBFBD>ץ<D7A5><EAA5BF><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4>뤹<EFBFBD>٤ƤΥ<C6A4><CEA5>ޥ<EFBFBD><DEA5>ɤ<EFBFBD><C9A4>Ф<EFBFBD><D0A4><EFBFBD>,
|
|||
|
@ip._eval("info command").split(/ /).each{|comname|
|
|||
|
if comname =~ /^[.]/
|
|||
|
# <20><><EFBFBD>ޥ<EFBFBD><DEA5>ɤ<EFBFBD><C9A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>å<EFBFBD>(<28>Υѥ<CEA5>̾)<29>ξ<EFBFBD><CEBE><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
# TclTkWidget <20>Υ<EFBFBD><CEA5><EFBFBD><F3A5B9A5><EFBFBD><F3A5B9A4><EFBFBD><EFBFBD>ä<EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
@commands[comname] = TclTkWidget.new(@ip, comname)
|
|||
|
else
|
|||
|
# <20><><EFBFBD><EFBFBD><EFBFBD>Ǥʤ<C7A4><CAA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
# TclTkCommand <20>Υ<EFBFBD><CEA5><EFBFBD><F3A5B9A5><EFBFBD><F3A5B9A4><EFBFBD><EFBFBD>ä<EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
@commands[comname] = TclTkCommand.new(@ip, comname)
|
|||
|
end
|
|||
|
}
|
|||
|
end
|
|||
|
|
|||
|
# commands(): tcl/tk <20>Υ<EFBFBD><CEA5>ޥ<EFBFBD><DEA5>ɤ<EFBFBD><C9A4>б<EFBFBD><D0B1><EFBFBD><EFBFBD>륪<EFBFBD>֥<EFBFBD><D6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD> Hash <20><>
|
|||
|
# <20><><EFBFBD>줿<EFBFBD><ECA4BF><EFBFBD>Τ<EFBFBD><CEA4>֤<EFBFBD>.
|
|||
|
def commands()
|
|||
|
return @commands
|
|||
|
end
|
|||
|
|
|||
|
# rootwidget(): <20>롼<EFBFBD>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>å<EFBFBD>(TclTkWidget)<29><><EFBFBD>֤<EFBFBD>.
|
|||
|
def rootwidget()
|
|||
|
return @commands["."]
|
|||
|
end
|
|||
|
|
|||
|
# _tcltkip(): @ip(TclTkIp) <20><><EFBFBD>֤<EFBFBD>.
|
|||
|
def _tcltkip()
|
|||
|
return @ip
|
|||
|
end
|
|||
|
|
|||
|
# method_missing(id, *args): ̤<><CCA4><EFBFBD><EFBFBD><EFBFBD>Υ<CEA5>åɤ<C3A5> tcl/tk <20>Υ<EFBFBD><CEA5>ޥ<EFBFBD><DEA5>ɤȤߤʤ<DFA4><CAA4><EFBFBD>
|
|||
|
# <20>¹Ԥ<C2B9>, <20><><EFBFBD>η<EFBFBD><CEB7><EFBFBD>(String)<29><><EFBFBD>֤<EFBFBD>.
|
|||
|
# id: <20><EFBFBD>åɤΥ<C9A4><CEA5><EFBFBD><EFBFBD>ܥ<EFBFBD>
|
|||
|
# *args: <20><><EFBFBD>ޥ<EFBFBD><DEA5>ɤΰ<C9A4><CEB0><EFBFBD>
|
|||
|
def method_missing(id, *args)
|
|||
|
# <20>⤷, <20><EFBFBD>åɤ<C3A5> tcl/tk <20><><EFBFBD>ޥ<EFBFBD><DEA5>ɤ<EFBFBD>
|
|||
|
if @commands.key?(id.id2name)
|
|||
|
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20>¹Ԥ<C2B9><D4A4>Ʒ<EFBFBD><C6B7>̤<EFBFBD><CCA4>֤<EFBFBD>.
|
|||
|
return @commands[id.id2name].e(*args)
|
|||
|
else
|
|||
|
# ̵<><CCB5><EFBFBD><EFBFBD><EFBFBD>Ф<EFBFBD><D0A4>Ȥ<EFBFBD><C8A4>Ȥν<C8A4><CEBD><EFBFBD>.
|
|||
|
super
|
|||
|
end
|
|||
|
end
|
|||
|
end
|
|||
|
|
|||
|
# class TclTkObject: tcl/tk <20>Υ<EFBFBD><CEA5>֥<EFBFBD><D6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
# (<28><><EFBFBD>쥯<EFBFBD>饹<EFBFBD>Ȥ<EFBFBD><C8A4>ƻȤ<C6BB>.
|
|||
|
# tcltk <20>饤<EFBFBD>֥<EFBFBD><D6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4>ͤ<EFBFBD> TclTkObject.new() <20><><EFBFBD>뤳<EFBFBD>ȤϤʤ<CFA4><CAA4>Ϥ<EFBFBD>.)
|
|||
|
class TclTkObject
|
|||
|
|
|||
|
# initialize(ip, exp): <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
# ip: <20><><EFBFBD>ץ(TclTkIp)
|
|||
|
# exp: tcl/tk <20>Ǥ<EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD>
|
|||
|
def initialize(ip, exp)
|
|||
|
fail("type is not TclTkIp") if !ip.kind_of?(TclTkIp)
|
|||
|
@ip = ip
|
|||
|
@exp = exp
|
|||
|
end
|
|||
|
|
|||
|
# to_s(): tcl/tk <20>Ǥ<EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD>(String)<29><><EFBFBD>֤<EFBFBD>.
|
|||
|
def to_s()
|
|||
|
return @exp
|
|||
|
end
|
|||
|
end
|
|||
|
|
|||
|
# class TclTkCommand: tcl/tk <20>Υ<EFBFBD><CEA5>ޥ<EFBFBD><DEA5><EFBFBD>
|
|||
|
# (tcltk <20>饤<EFBFBD>֥<EFBFBD><D6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4>ͤ<EFBFBD> TclTkCommand.new() <20><><EFBFBD>뤳<EFBFBD>ȤϤʤ<CFA4><CAA4>Ϥ<EFBFBD>.
|
|||
|
# TclTkInterpreter:initialize() <20><><EFBFBD><EFBFBD> new() <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.)
|
|||
|
class TclTkCommand < TclTkObject
|
|||
|
|
|||
|
# e(*args): <20><><EFBFBD>ޥ<EFBFBD><DEA5>ɤ<EFBFBD><C9A4>¹Ԥ<C2B9>, <20><><EFBFBD>η<EFBFBD><CEB7><EFBFBD>(String)<29><><EFBFBD>֤<EFBFBD>.
|
|||
|
# (e <20><> exec <20>ޤ<EFBFBD><DEA4><EFBFBD> eval <20><> e.)
|
|||
|
# *args: <20><><EFBFBD>ޥ<EFBFBD><DEA5>ɤΰ<C9A4><CEB0><EFBFBD>
|
|||
|
def e(*args)
|
|||
|
return @ip._eval_args(to_s(), *args)
|
|||
|
end
|
|||
|
end
|
|||
|
|
|||
|
# class TclTkLibCommand: tcl/tk <20>Υ<EFBFBD><CEA5>ޥ<EFBFBD><DEA5><EFBFBD>
|
|||
|
# (<28>饤<EFBFBD>֥<EFBFBD><D6A5><EFBFBD><EFBFBD>ˤ<EFBFBD><CBA4><EFBFBD><EFBFBD>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>륳<EFBFBD>ޥ<EFBFBD><DEA5>ɤ<EFBFBD>, tcl/tk <20><><EFBFBD>ץ<D7A5>˺ǽ餫<C7BD><E9A4AB>
|
|||
|
# ¸<>ߤ<EFBFBD><DFA4>ʤ<EFBFBD><CAA4><EFBFBD><EFBFBD>Τ<EFBFBD>, <20><><EFBFBD>ץ<D7A5><EAA5BF> commands() <20>Ǥ<EFBFBD><C7A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǥ<EFBFBD><C7A4>ʤ<EFBFBD>.
|
|||
|
# <20><><EFBFBD>Τ褦<CEA4>ʤ<EFBFBD><CAA4>Τ<EFBFBD><CEA4>Ф<EFBFBD>, <20><><EFBFBD>ޥ<EFBFBD><DEA5>ɤ<EFBFBD>̾<EFBFBD><CCBE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> TclTkCommand <20><><EFBFBD>֥<EFBFBD><D6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD>
|
|||
|
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
class TclTkLibCommand < TclTkCommand
|
|||
|
|
|||
|
# initialize(ip, name): <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
# ip: <20><><EFBFBD>ץ(TclTkInterpreter)
|
|||
|
# name: <20><><EFBFBD>ޥ<EFBFBD><DEA5><EFBFBD>̾ (String)
|
|||
|
def initialize(ip, name)
|
|||
|
super(ip._tcltkip, name)
|
|||
|
end
|
|||
|
end
|
|||
|
|
|||
|
# class TclTkVariable: tcl/tk <20><><EFBFBD>ѿ<EFBFBD>
|
|||
|
class TclTkVariable < TclTkObject
|
|||
|
|
|||
|
# initialize(interp, dat): <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
# interp: <20><><EFBFBD>ץ(TclTkInterpreter)
|
|||
|
# dat: <20><><EFBFBD>ꤹ<EFBFBD><EAA4B9><EFBFBD><EFBFBD>(String)
|
|||
|
# nil <20>ʤ<EFBFBD>, <20><><EFBFBD>ꤷ<EFBFBD>ʤ<EFBFBD>.
|
|||
|
def initialize(interp, dat)
|
|||
|
# tcl/tk <20>Ǥ<EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD>(<28>ѿ<EFBFBD>̾)<29><><EFBFBD><EFBFBD>ư<EFBFBD><C6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
exp = TclTk._newname("v_")
|
|||
|
# TclTkObject <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
super(interp._tcltkip(), exp)
|
|||
|
# set <20><><EFBFBD>ޥ<EFBFBD><DEA5>ɤ<EFBFBD><C9A4>Ȥ<EFBFBD><C8A4>ΤǤȤäƤ<C3A4><C6A4><EFBFBD>.
|
|||
|
@set = interp.commands()["set"]
|
|||
|
# <20>ͤ<EFBFBD><CDA4><EFBFBD><EFBFBD>ꤹ<EFBFBD><EAA4B9>.
|
|||
|
set(dat) if dat
|
|||
|
end
|
|||
|
|
|||
|
# tcl/tk <20><> set <20><><EFBFBD>Ȥ<EFBFBD><C8A4><EFBFBD>, <20>ͤ<EFBFBD><CDA4><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD>ȤϤǤ<CFA4><C7A4>뤬,
|
|||
|
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǤϤʤ<CFA4><CAA4>ʤΤ<CAA4>, <20><><EFBFBD><EFBFBD>, <20><EFBFBD>åɤ֤<F2A4ABA4><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Τ<EFBFBD><CEA4>Ѱդ<D1B0><D5A4>Ƥ<EFBFBD><C6A4><EFBFBD>.
|
|||
|
|
|||
|
# set(data): tcl/tk <20><><EFBFBD>ѿ<EFBFBD><D1BF><EFBFBD> set <20><><EFBFBD>Ѥ<EFBFBD><D1A4><EFBFBD><EFBFBD>ͤ<EFBFBD><CDA4><EFBFBD><EFBFBD>ꤹ<EFBFBD><EAA4B9>.
|
|||
|
# data: <20><><EFBFBD>ꤹ<EFBFBD><EAA4B9><EFBFBD><EFBFBD>
|
|||
|
def set(data)
|
|||
|
@set.e(to_s(), data.to_s())
|
|||
|
end
|
|||
|
|
|||
|
# get(): tcl/tk <20><><EFBFBD>ѿ<EFBFBD><D1BF><EFBFBD><EFBFBD><EFBFBD>(String)<29><> set <20><><EFBFBD>Ѥ<EFBFBD><D1A4><EFBFBD><EFBFBD>ɤߤ<C9A4><DFA4><EFBFBD><EFBFBD>֤<EFBFBD>.
|
|||
|
def get()
|
|||
|
return @set.e(to_s())
|
|||
|
end
|
|||
|
end
|
|||
|
|
|||
|
# class TclTkWidget: tcl/tk <20>Υ<EFBFBD><CEA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>å<EFBFBD>
|
|||
|
class TclTkWidget < TclTkCommand
|
|||
|
|
|||
|
# initialize(*args): <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
# *args: <20>ѥ<EFBFBD><D1A5><EFBFBD><E1A1BC>
|
|||
|
def initialize(*args)
|
|||
|
if args[0].kind_of?(TclTkIp)
|
|||
|
# <20>ǽ<EFBFBD><C7BD>ΰ<EFBFBD><CEB0><EFBFBD><EFBFBD><EFBFBD> TclTkIp <20>ξ<EFBFBD><CEBE><EFBFBD>:
|
|||
|
|
|||
|
# <20><><EFBFBD><EFBFBD> tcl/tk <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4>륦<EFBFBD><EBA5A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>åȤ<C3A5> TclTkWidget <20>ι<EFBFBD>¤<EFBFBD><C2A4>
|
|||
|
# <20><><EFBFBD>֤<EFBFBD><D6A4><EFBFBD>. (TclTkInterpreter:initialize() <20><><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD>.)
|
|||
|
|
|||
|
# <20>ѥ<EFBFBD><D1A5><EFBFBD><E1A1BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2 <20>Ǥʤ<C7A4><CAA4><EFBFBD><EFBFBD>Х<EFBFBD><D0A5>顼.
|
|||
|
fail("illegal # of parameter") if args.size != 2
|
|||
|
|
|||
|
# ip: <20><><EFBFBD>ץ(TclTkIp)
|
|||
|
# exp: tcl/tk <20>Ǥ<EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD>
|
|||
|
ip, exp = args
|
|||
|
|
|||
|
# TclTkObject <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
super(ip, exp)
|
|||
|
elsif args[0].kind_of?(TclTkInterpreter)
|
|||
|
# <20>ǽ<EFBFBD><C7BD>ΰ<EFBFBD><CEB0><EFBFBD><EFBFBD><EFBFBD> TclTkInterpreter <20>ξ<EFBFBD><CEBE><EFBFBD>:
|
|||
|
|
|||
|
# <20>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>åȤ<C3A5><C8A4>鿷<EFBFBD><E9BFB7><EFBFBD>ʥ<EFBFBD><CAA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
|
|||
|
# interp: <20><><EFBFBD>ץ(TclTkInterpreter)
|
|||
|
# parent: <20>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>å<EFBFBD>
|
|||
|
# command: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>åȤ<C3A5><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>륳<EFBFBD>ޥ<EFBFBD><DEA5><EFBFBD>(label <20><>)
|
|||
|
# *args: command <20><><EFBFBD>Ϥ<EFBFBD><CFA4><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
interp, parent, command, *args = args
|
|||
|
|
|||
|
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>åȤ<C3A5>̾<EFBFBD><CCBE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
exp = parent.to_s()
|
|||
|
exp += "." if exp !~ /[.]$/
|
|||
|
exp += TclTk._newname("w_")
|
|||
|
# TclTkObject <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
super(interp._tcltkip(), exp)
|
|||
|
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>åȤ<C3A5><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
res = @ip._eval_args(command, exp, *args)
|
|||
|
# fail("can't create Widget") if res != exp
|
|||
|
# tk_optionMenu <20>Ǥ<EFBFBD>, <20>ܥ<EFBFBD><DCA5><EFBFBD>̾<EFBFBD><CCBE> exp <20>ǻ<EFBFBD><C7BB>ꤹ<EFBFBD><EAA4B9><EFBFBD><EFBFBD>
|
|||
|
# res <20>˥<EFBFBD><CBA5>˥塼̾<E5A1BC><CCBE><EFBFBD>֤<EFBFBD><D6A4>Τ<EFBFBD> res != exp <20>Ȥʤ<C8A4>.
|
|||
|
else
|
|||
|
fail("first parameter is not TclTkInterpreter")
|
|||
|
end
|
|||
|
end
|
|||
|
end
|
|||
|
|
|||
|
# class TclTkCallback: tcl/tk <20>Υ<EFBFBD><CEA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Хå<D0A5>
|
|||
|
class TclTkCallback < TclTkObject
|
|||
|
|
|||
|
# initialize(interp, pr, arg): <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
# interp: <20><><EFBFBD>ץ(TclTkInterpreter)
|
|||
|
# pr: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Хå<D0A5><C3A5><EFBFBD>³<EFBFBD><C2B3>(Proc)
|
|||
|
# arg: pr <20>Υ<EFBFBD><CEA5>ƥ졼<C6A5><ECA1BC><EFBFBD>ѿ<EFBFBD><D1BF><EFBFBD><EFBFBD>Ϥ<EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD><EFBFBD>
|
|||
|
# tcl/tk <20><> bind <20><><EFBFBD>ޥ<EFBFBD><DEA5>ɤǤϥѥ<CFA5><D1A5><EFBFBD><E1A1BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뤿<EFBFBD><EBA4BF><EFBFBD><EFBFBD> % <20>ִ<EFBFBD><D6B4><EFBFBD>
|
|||
|
# <20>Ѥ<EFBFBD><D1A4>뤬, pr <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> % <20><><EFBFBD>Ƥ⤦<C6A4>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʤ<EFBFBD>.
|
|||
|
# arg <20><>ʸ<EFBFBD><CAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<F1A4A4A4><C6A4><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD>̤<EFBFBD>, pr <20><>
|
|||
|
# <20><><EFBFBD>ƥ졼<C6A5><ECA1BC><EFBFBD>ѿ<EFBFBD><D1BF><EFBFBD><EFBFBD>̤<EFBFBD><CCA4>Ƽ<EFBFBD><C6BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뤳<EFBFBD>Ȥ<EFBFBD><C8A4>Ǥ<EFBFBD><C7A4><EFBFBD>.
|
|||
|
# scrollbar <20><><EFBFBD>ޥ<EFBFBD><DEA5>ɤ<EFBFBD> -command <20><><EFBFBD>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Τ褦<CEA4><E8A4A6>
|
|||
|
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ꤷ<EFBFBD>ʤ<EFBFBD><CAA4>Ƥ<EFBFBD><C6A4>ѥ<EFBFBD><D1A5><EFBFBD><E1A1BC><EFBFBD><EFBFBD><EFBFBD>դ<EFBFBD><D5A4><EFBFBD><EFBFBD>ޥ<EFBFBD><DEA5>ɤ<EFBFBD><C9A4>Ф<EFBFBD><D0A4>Ƥ<EFBFBD>,
|
|||
|
# arg <20><><EFBFBD><EFBFBD><EFBFBD>ꤷ<EFBFBD>ƤϤʤ<CFA4><CAA4>ʤ<EFBFBD>.
|
|||
|
def initialize(interp, pr, arg = nil)
|
|||
|
# tcl/tk <20>Ǥ<EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD>(<28>ѿ<EFBFBD>̾)<29><><EFBFBD><EFBFBD>ư<EFBFBD><C6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
exp = TclTk._newname("c_")
|
|||
|
# TclTkObject <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
super(interp._tcltkip(), exp)
|
|||
|
# <20>ѥ<EFBFBD><D1A5><EFBFBD><E1A1BC><EFBFBD><EFBFBD><EFBFBD>ȤäƤ<C3A4><C6A4><EFBFBD>.
|
|||
|
@pr = pr
|
|||
|
@arg = arg
|
|||
|
# <20>⥸<EFBFBD>塼<EFBFBD><E5A1BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD>Ƥ<EFBFBD><C6A4><EFBFBD>.
|
|||
|
TclTk._addcallback(self)
|
|||
|
end
|
|||
|
|
|||
|
# to_eval(): @ip._eval_args <20><>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD>(String)<29><><EFBFBD>֤<EFBFBD>.
|
|||
|
def to_eval()
|
|||
|
if @arg
|
|||
|
# %s <20><> ruby_fmt <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> bind <20>ˤ<EFBFBD><CBA4><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4>ޤ<EFBFBD><DEA4>Τ<EFBFBD>
|
|||
|
# %%s <20>Ȥ<EFBFBD><C8A4>Ƥ<EFBFBD><C6A4><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ä<EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> bind <20><><EFBFBD><EFBFBD>.
|
|||
|
s = %Q/{ruby_fmt {TclTk._callcallback("#{to_s()}", "%%s")} #{@arg}}/
|
|||
|
else
|
|||
|
s = %Q/{ruby_fmt {TclTk._callcallback("#{to_s()}", "%s")}}/
|
|||
|
end
|
|||
|
|
|||
|
return s
|
|||
|
end
|
|||
|
|
|||
|
# _call(arg): <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Хå<D0A5><C3A5><EFBFBD><EFBFBD>ƤӽФ<D3BD>.
|
|||
|
# arg: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Хå<D0A5><C3A5><EFBFBD><EFBFBD>Ϥ<EFBFBD><CFA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѥ<EFBFBD><D1A5><EFBFBD><E1A1BC>
|
|||
|
def _call(arg)
|
|||
|
@pr.call(arg)
|
|||
|
end
|
|||
|
end
|
|||
|
|
|||
|
# class TclTkImage: tcl/tk <20>Υ<EFBFBD><CEA5><EFBFBD><E1A1BC>
|
|||
|
class TclTkImage < TclTkCommand
|
|||
|
|
|||
|
# initialize(interp, t, *args): <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
# <20><><EFBFBD><EFBFBD><E1A1BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> TclTkImage.new() <20>ǹԤ<C7B9><D4A4><EFBFBD>,
|
|||
|
# <20>˲<EFBFBD><CBB2><EFBFBD> image delete <20>ǹԤ<C7B9>. (<28><><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɻ<EFBFBD><C9BB><EFBFBD><EFBFBD><EFBFBD>̵<EFBFBD><CCB5>.)
|
|||
|
# interp: <20><><EFBFBD>ץ(TclTkInterpreter)
|
|||
|
# t: <20><><EFBFBD><EFBFBD><E1A1BC><EFBFBD>Υ<EFBFBD><CEA5><EFBFBD><EFBFBD><EFBFBD> (photo, bitmap, etc.)
|
|||
|
# *args: <20><><EFBFBD>ޥ<EFBFBD><DEA5>ɤΰ<C9A4><CEB0><EFBFBD>
|
|||
|
def initialize(interp, t, *args)
|
|||
|
# tcl/tk <20>Ǥ<EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD>(<28>ѿ<EFBFBD>̾)<29><><EFBFBD><EFBFBD>ư<EFBFBD><C6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
exp = TclTk._newname("i_")
|
|||
|
# TclTkObject <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
super(interp._tcltkip(), exp)
|
|||
|
# <20><><EFBFBD><EFBFBD><E1A1BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
res = @ip._eval_args("image create", t, exp, *args)
|
|||
|
fail("can't create Image") if res != exp
|
|||
|
end
|
|||
|
end
|
|||
|
|
|||
|
# eof
|