In: |
tk/lib/tk.rb
tk/lib/tk/wm.rb tk/lib/tk/variable.rb tk/lib/tk/scrollable.rb tk/lib/tk/macpkg.rb tk/lib/tk/encodedstr.rb tk/lib/tk/clock.rb tk/lib/tk/autoload.rb |
sub-module of Tk
TCL_VERSION | = | INTERP._invoke_without_enc("info", "tclversion").freeze |
TCL_PATCHLEVEL | = | INTERP._invoke_without_enc("info", "patchlevel").freeze |
TK_VERSION | = | INTERP._invoke_without_enc("set", "tk_version").freeze |
TK_PATCHLEVEL | = | INTERP._invoke_without_enc("set", "tk_patchLevel").freeze |
JAPANIZED_TK | = | (INTERP._invoke_without_enc("info", "commands", "kanji") != "").freeze |
AUTO_PATH | = | TkVarAccess.new('auto_path', auto_path) |
TCL_PACKAGE_PATH | = | TkVarAccess.new('tcl_pkgPath') |
PACKAGE_PATH | = | TCL_PACKAGE_PATH |
TCL_LIBRARY_PATH | = | TkVarAccess.new('tcl_libPath') |
LIBRARY_PATH | = | TCL_LIBRARY_PATH |
TCL_PRECISION | = | TkVarAccess.new('tcl_precision') |
# File tk/lib/tk/autoload.rb, line 174 def Tk.EncodedString(str, enc = nil); Tk::EncodedString.new(str, enc); end
# File tk/lib/tk.rb, line 1535 def Tk.add_kinsoku(chars, mode='both') begin if /^8\.*/ === TK_VERSION && JAPANIZED_TK tk_split_simplelist(tk_call('kinsoku', 'add', mode, *(chars.split('')))) else [] end rescue [] end end
# File tk/lib/tk.rb, line 1427 def Tk.bell(nice = false) if nice tk_call_without_enc('bell', '-nice') else tk_call_without_enc('bell') end nil end
# File tk/lib/tk.rb, line 1436 def Tk.bell_on_display(win, nice = false) if nice tk_call_without_enc('bell', '-displayof', win, '-nice') else tk_call_without_enc('bell', '-displayof', win) end nil end
# File tk/lib/tk.rb, line 1337 def Tk.const_missing(sym) case(sym) when :TCL_LIBRARY INTERP._invoke("set", "tcl_library").freeze when :TK_LIBRARY INTERP._invoke("set", "tk_library").freeze when :LIBRARY INTERP._invoke("info", "library").freeze #when :PKG_PATH, :PACKAGE_PATH, :TCL_PACKAGE_PATH # tk_split_simplelist(INTERP._invoke('set', 'tcl_pkgPath')) #when :LIB_PATH, :LIBRARY_PATH, :TCL_LIBRARY_PATH # tk_split_simplelist(INTERP._invoke('set', 'tcl_libPath')) when :PLATFORM, :TCL_PLATFORM if $SAFE >= 4 fail SecurityError, "can't get #{sym} when $SAFE >= 4" end Hash[*tk_split_simplelist(INTERP._invoke_without_enc('array', 'get', 'tcl_platform'))] when :ENV Hash[*tk_split_simplelist(INTERP._invoke('array', 'get', 'env'))] #when :AUTO_PATH #<=== # tk_split_simplelist(INTERP._invoke('set', 'auto_path')) #when :AUTO_OLDPATH # tk_split_simplelist(INTERP._invoke('set', 'auto_oldpath')) when :AUTO_INDEX Hash[*tk_split_simplelist(INTERP._invoke('array', 'get', 'auto_index'))] when :PRIV, :PRIVATE, :TK_PRIV priv = {} if INTERP._invoke_without_enc('info', 'vars', 'tk::Priv') != "" var_nam = 'tk::Priv' else var_nam = 'tkPriv' end Hash[*tk_split_simplelist(INTERP._invoke('array', 'get', var_nam))].each{|k,v| k.freeze case v when /^-?\d+$/ priv[k] = v.to_i when /^-?\d+\.?\d*(e[-+]?\d+)?$/ priv[k] = v.to_f else priv[k] = v.freeze end } priv else raise NameError, 'uninitialized constant Tk::' + sym.id2name end end
# File tk/lib/tk.rb, line 1487 def Tk.current_grabs(win = nil) if win window(tk_call_without_enc('grab', 'current', win)) else tk_split_list(tk_call_without_enc('grab', 'current')) end end
# File tk/lib/tk.rb, line 1547 def Tk.delete_kinsoku(chars, mode='both') begin if /^8\.*/ === TK_VERSION && JAPANIZED_TK tk_split_simplelist(tk_call('kinsoku', 'delete', mode, *(chars.split('')))) end rescue end end
# File tk/lib/tk.rb, line 1495 def Tk.focus(display=nil) if display == nil window(tk_call_without_enc('focus')) else window(tk_call_without_enc('focus', '-displayof', display)) end end
# File tk/lib/tk.rb, line 1511 def Tk.focus_lastfor(win) window(tk_call_without_enc('focus', '-lastfor', win)) end
# File tk/lib/tk.rb, line 1503 def Tk.focus_to(win, force=false) if force tk_call_without_enc('focus', '-force', win) else tk_call_without_enc('focus', win) end end
# File tk/lib/tk.rb, line 1412 def Tk.load_tcllibrary(file, pkg_name=None, interp=None) tk_call('load', file, pkg_name, interp) end
# File tk/lib/tk.rb, line 1403 def Tk.load_tclscript(file, enc=nil) if enc # TCL_VERSION >= 8.5 tk_call('source', '-encoding', enc, file) else tk_call('source', file) end end
# File tk/lib/tk/macpkg.rb, line 12 def Tk.load_tclscript_rsrc(resource_name, file=None) # Mac only tk_call('source', '-rsrc', resource_name, file) end
# File tk/lib/tk/macpkg.rb, line 17 def Tk.load_tclscript_rsrcid(resource_id, file=None) # Mac only tk_call('source', '-rsrcid', resource_id, file) end
# File tk/lib/tk.rb, line 1527 def Tk.show_kinsoku(mode='both') begin if /^8\.*/ === TK_VERSION && JAPANIZED_TK tk_split_simplelist(tk_call('kinsoku', 'show', mode)) end rescue end end
# File tk/lib/tk.rb, line 1523 def Tk.strictMotif(bool=None) bool(tk_call_without_enc('set', 'tk_strictMotif', bool)) end
# File tk/lib/tk.rb, line 1573 def Tk.subst_tk_backslash(str) Tk::EncodedString.subst_tk_backslash(str) end
# File tk/lib/tk.rb, line 1570 def Tk.subst_utf_backslash(str) Tk::EncodedString.subst_utf_backslash(str) end
# File tk/lib/tk.rb, line 1582 def Tk.to_backslash_sequence(str) Tk::EncodedString.to_backslash_sequence(str) end
# File tk/lib/tk.rb, line 1416 def Tk.unload_tcllibrary(*args) if args[-1].kind_of?(Hash) keys = _symbolkey2str(args.pop) nocomp = (keys['nocomplain'])? '-nocomplain': None keeplib = (keys['keeplibrary'])? '-keeplibrary': None tk_call('unload', nocomp, keeplib, '--', *args) else tk_call('unload', *args) end end
# File tk/lib/tk.rb, line 1462 def Tk.update(idle=nil) if idle tk_call_without_enc('update', 'idletasks') else tk_call_without_enc('update') end end
# File tk/lib/tk.rb, line 1579 def Tk.utf_to_backslash(str) Tk::EncodedString.utf_to_backslash_sequence(str) end
# File tk/lib/tk.rb, line 1576 def Tk.utf_to_backslash_sequence(str) Tk::EncodedString.utf_to_backslash_sequence(str) end