string with Tcl's encoding
freeze core modules
TclTkLib.freeze TclTkIp.freeze TkUtil.freeze TkKernel.freeze TkComm.freeze TkComm::Event.freeze TkCore.freeze Tk.freeze
sub-module of Tk
string with Tcl's encoding
autoload
tkextlib/tcllib/tablelist_core.rb
by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) * Part of tcllib extension * This file is required by 'tkextlib/tcllib/tablelist.rb' or 'tkextlib/tcllib/tablelist_tile.rb'.
version 0.4 or former
version 0.5 – version 0.6
version 0.7 or later
autoload
release date of tkextlib
autoload
create module/class
create module/class
create module/class
AUTO_OLDPATH = tk_split_simplelist(INTERP._invoke('set', 'auto_oldpath')) AUTO_OLDPATH.each{|s| s.freeze} AUTO_OLDPATH.freeze
# File tk/lib/tk/autoload.rb, line 192
def Tk.BinaryString(str); Tk::BinaryString.new(str); end
# File tk/lib/tk/autoload.rb, line 189
def Tk.EncodedString(str, enc = nil); Tk::EncodedString.new(str, enc); end
# File tk/lib/tk/autoload.rb, line 195
def Tk.UTF8_String(str); Tk::UTF8_String.new(str); end
# File tk/lib/tk.rb, line 2151
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 2000
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 2009
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 1823
def Tk.const_missing(sym)
case(sym)
when :TCL_LIBRARY
INTERP._invoke_without_enc('global', 'tcl_library')
INTERP._invoke("set", "tcl_library").freeze
when :TK_LIBRARY
INTERP._invoke_without_enc('global', 'tk_library')
INTERP._invoke("set", "tk_library").freeze
when :LIBRARY
INTERP._invoke("info", "library").freeze
#when :PKG_PATH, :PACKAGE_PATH, :TCL_PACKAGE_PATH
# INTERP._invoke_without_enc('global', 'tcl_pkgPath')
# tk_split_simplelist(INTERP._invoke('set', 'tcl_pkgPath'))
#when :LIB_PATH, :LIBRARY_PATH, :TCL_LIBRARY_PATH
# INTERP._invoke_without_enc('global', 'tcl_libPath')
# 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
INTERP._invoke_without_enc('global', 'tcl_platform')
Hash[*tk_split_simplelist(INTERP._invoke_without_enc('array', 'get',
'tcl_platform'))]
when :ENV
INTERP._invoke_without_enc('global', '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
INTERP._invoke_without_enc('global', '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
INTERP._invoke_without_enc('global', var_nam)
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 2103
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/tkextlib/tcllib/cursor.rb, line 46
def self.cursor_display(parent=None)
# Pops up a dialog with a listbox containing all the cursor names.
# Selecting a cursor name will display it in that dialog.
# This is simply for viewing any available cursors on the platform .
#tk_call_without_enc('::cursor::display', parent)
Tk::Tcllib::Cursor.cursor_display(parent)
end
# File tk/lib/tk.rb, line 2163
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 2018
def Tk.destroy(*wins)
#tk_call_without_enc('destroy', *wins)
tk_call_without_enc('destroy', *(wins.collect{|win|
if win.kind_of?(TkWindow)
win.epath
else
win
end
}))
end
# File tk/lib/tk.rb, line 1898
def Tk.errorCode
INTERP._invoke_without_enc('global', 'errorCode')
code = tk_split_simplelist(INTERP._invoke_without_enc('set', 'errorCode'))
case code[0]
when 'CHILDKILLED', 'CHILDSTATUS', 'CHILDSUSP'
begin
pid = Integer(code[1])
code[1] = pid
rescue
end
end
code
end
# File tk/lib/tk.rb, line 1893
def Tk.errorInfo
INTERP._invoke_without_enc('global', 'errorInfo')
INTERP._invoke_without_enc('set', 'errorInfo')
end
# File tk/lib/tk.rb, line 2029
def Tk.exit
tk_call_without_enc('destroy', '.')
end
# File tk/lib/tk.rb, line 2111
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 2127
def Tk.focus_lastfor(win)
window(tk_call_without_enc('focus', '-lastfor', win))
end
# File tk/lib/tk.rb, line 2131
def Tk.focus_next(win)
TkManageFocus.next(win)
end
# File tk/lib/tk.rb, line 2135
def Tk.focus_prev(win)
TkManageFocus.prev(win)
end
# File tk/lib/tk.rb, line 2119
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 2177
def Tk.fromUTF8(str, encoding = nil)
_fromUTF8(str, encoding)
end
# File tk/lib/tk.rb, line 2043
def Tk.grid(*args)
TkGrid.configure(*args)
end
# File tk/lib/tk.rb, line 2046
def Tk.grid_forget(*args)
TkGrid.forget(*args)
end
# File tk/lib/tk.rb, line 1912
def Tk.has_mainwindow?
INTERP.has_mainwindow?
end
# File tk/lib/tk.rb, line 1929
def Tk.load_tcllibrary(file, pkg_name=None, interp=None)
tk_call('load', file, pkg_name, interp)
end
# File tk/lib/tk.rb, line 1920
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 2094
def Tk.lower_window(win, below=None)
tk_call('lower', _epath(win), _epath(below))
nil
end
# File tk/lib/tk.rb, line 2033
def Tk.pack(*args)
TkPack.configure(*args)
end
# File tk/lib/tk.rb, line 2036
def Tk.pack_forget(*args)
TkPack.forget(*args)
end
# File tk/lib/tk.rb, line 1963
def Tk.pkgconfig_get(mod, key)
# Tk8.5 feature
if mod.kind_of?(Module)
if mod.respond_to?(:package_name)
pkgname = mod.package_name
else
fail NotImplementedError, 'may not be a module for a Tcl extension'
end
else
pkgname = mod.to_s
end
pkgname = '::' << pkgname unless pkgname =~ /^::/
tk_call(pkgname + '::pkgconfig', 'get', key)
end
# File tk/lib/tk.rb, line 1944
def Tk.pkgconfig_list(mod)
# Tk8.5 feature
if mod.kind_of?(Module)
if mod.respond_to?(:package_name)
pkgname = mod.package_name
elsif mod.const_defined?(:PACKAGE_NAME)
pkgname = mod::PACKAGE_NAME
else
fail NotImplementedError, 'may not be a module for a Tcl extension'
end
else
pkgname = mod.to_s
end
pkgname = '::' << pkgname unless pkgname =~ /^::/
tk_split_list(tk_call(pkgname + '::pkgconfig', 'list'))
end
# File tk/lib/tk.rb, line 2053
def Tk.place(*args)
TkPlace.configure(*args)
end
# File tk/lib/tk.rb, line 2056
def Tk.place_forget(*args)
TkPlace.forget(*args)
end
# File tk/lib/tk.rb, line 2098
def Tk.raise_window(win, above=None)
tk_call('raise', _epath(win), _epath(above))
nil
end
# File tk/lib/tk.rb, line 2143
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 2139
def Tk.strictMotif(mode=None)
bool(tk_call_without_enc('set', 'tk_strictMotif', mode))
end
# File tk/lib/tk.rb, line 2189
def Tk.subst_tk_backslash(str)
Tk::EncodedString.subst_tk_backslash(str)
end
# File tk/lib/tk.rb, line 2186
def Tk.subst_utf_backslash(str)
Tk::EncodedString.subst_utf_backslash(str)
end
# File tk/lib/tk.rb, line 1985
def Tk.tcl_pkgconfig_get(key)
# Tk8.5 feature
Tk.pkgconfig_get('::tcl', key)
end
# File tk/lib/tk.rb, line 1980
def Tk.tcl_pkgconfig_list
# Tk8.5 feature
Tk.pkgconfig_list('::tcl')
end
If no eventloop-thread is running, “thread_update” method is same to “update” method. Else, “thread_update” method waits to complete idletask operation on the eventloop-thread.
# File tk/lib/tk.rb, line 2083
def Tk.thread_update(idle=nil)
if idle
tk_call_without_enc('thread_update', 'idletasks')
else
tk_call_without_enc('thread_update')
end
end
# File tk/lib/tk.rb, line 2090
def Tk.thread_update_idletasks
thread_update(true)
end
# File tk/lib/tk.rb, line 1995
def Tk.tk_pkgconfig_get(key)
# Tk8.5 feature
Tk.pkgconfig_get('::tk', key)
end
# File tk/lib/tk.rb, line 1990
def Tk.tk_pkgconfig_list
# Tk8.5 feature
Tk.pkgconfig_list('::tk')
end
# File tk/lib/tk.rb, line 2173
def Tk.toUTF8(str, encoding = nil)
_toUTF8(str, encoding)
end
# File tk/lib/tk.rb, line 2198
def Tk.to_backslash_sequence(str)
Tk::EncodedString.to_backslash_sequence(str)
end
# File tk/lib/tk.rb, line 2049
def Tk.ungrid(*args)
TkGrid.forget(*args)
end
# File tk/lib/tk.rb, line 1933
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 2039
def Tk.unpack(*args)
TkPack.forget(*args)
end
# File tk/lib/tk.rb, line 2059
def Tk.unplace(*args)
TkPlace.forget(*args)
end
# File tk/lib/tk.rb, line 2063
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 2070
def Tk.update_idletasks
update(true)
end