1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/tk/tk.rb: support "tk inactive" sub-command. [for Tcl/Tk8.5a3]

* ext/tk/tk/namespace.rb: support "namespace path" sub-command and
  'namespace ensemble' sub-command. [for Tcl/Tk8.5a3]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagai 2005-06-15 09:30:54 +00:00
parent 9d49297a74
commit 082393fe39
3 changed files with 124 additions and 1 deletions

View file

@ -1,3 +1,10 @@
Wed Jun 15 18:26:39 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk.rb: support "tk inactive" sub-command [for Tcl/Tk8.5a3]
* ext/tk/lib/tk/namespace.rb: support "namespace path" sub-command and
'namespace ensemble' sub-command [for Tcl/Tk8.5a3]
Tue Jun 14 02:02:43 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/tkutil/tkutil.c: add TkUtil::CallbackSubst.subst_arg(m, ...)

View file

@ -1351,6 +1351,19 @@ module TkCore
end
end
def inactive
Integer(tk_call_without_enc('tk', 'inactive'))
end
def inactive_displayof(win)
Integer(tk_call_without_enc('tk', 'inactive', '-displayof', win))
end
def reset_inactive
tk_call_without_enc('tk', 'inactive', 'reset')
end
def reset_inactive_displayof(win)
tk_call_without_enc('tk', 'inactive', '-displayof', win, 'reset')
end
def appname(name=None)
tk_call('tk', 'appname', name)
end
@ -4130,7 +4143,7 @@ end
#Tk.freeze
module Tk
RELEASE_DATE = '2005-06-03'.freeze
RELEASE_DATE = '2005-06-15'.freeze
autoload :AUTO_PATH, 'tk/variable'
autoload :TCL_PACKAGE_PATH, 'tk/variable'

View file

@ -14,6 +14,99 @@ class TkNamespace < TkObject
Tk_Namespace_ID_TBL = TkCore::INTERP.create_table
Tk_Namespace_ID = ["ns".freeze, "00000".taint].freeze
class Ensemble < TkObject
def __cget_cmd
['namespace', 'ensemble', 'configure', self.path]
end
private :__cget_cmd
def __config_cmd
['namespace', 'ensemble', 'configure', self.path]
end
private :__config_cmd
def __configinfo_struct
{:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil,
:default_value=>nil, :current_value=>2}
end
private :__configinfo_struct
def __boolval_optkeys
['prefixes']
end
private :__boolval_optkeys
def __listval_optkeys
['map', 'subcommands', 'unknown']
end
private :__listval_optkeys
def self.exist?(ensemble)
bool(tk_call('namespace', 'ensemble', 'exists', ensemble))
end
def initialize(keys = {})
@ensemble = @path = tk_call('namespace', 'ensemble', 'create', keys)
end
def cget(slot)
if slot == :namespace || slot == 'namespace'
ns = super(slot)
if TkNamespace::Tk_Namespace_ID_TBL.key?(ns)
TkNamespace::Tk_Namespace_ID_TBL[ns]
else
ns
end
else
super(slot)
end
end
def configinfo(slot = nil)
if slot
if slot == :namespace || slot == 'namespace'
val = super(slot)
if TkNamespace::Tk_Namespace_ID_TBL.key?(val)
val = TkNamespace::Tk_Namespace_ID_TBL[val]
end
else
val = super(slot)
end
if TkComm::GET_CONFIGINFO_AS_ARRAY
[slot.to_s, val]
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
{slot.to_s => val}
end
else
info = super()
if TkComm::GET_CONFIGINFO_AS_ARRAY
info.map!{|inf|
if inf[0] == 'namespace' &&
TkNamespace::Tk_Namespace_ID_TBL.key?(inf[-1])
[inf[0], TkNamespace::Tk_Namespace_ID_TBL[inf[-1]]]
else
inf
end
}
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
val = info['namespace']
if TkNamespace::Tk_Namespace_ID_TBL.key?(val)
info['namespace'] = TkNamespace::Tk_Namespace_ID_TBL[val]
end
end
info
end
end
def exists?
bool(tk_call('namespace', 'ensemble', 'exists', @path))
end
end
class ScopeArgs < Array
include Tk
@ -275,6 +368,16 @@ class TkNamespace < TkObject
tk_call('namespace', 'parent', @fullname)
end
def self.get_path
tk_call('namespace', 'path')
end
def self.set_path(*namespace_list)
tk_call('namespace', 'path', array2tk_list(namespace_list))
end
def set_path
tk_call('namespace', 'path', @fullname)
end
def self.qualifiers(str)
tk_call('namespace', 'qualifiers', str)
end