summaryrefslogtreecommitdiffstats
path: root/ext/tk/lib
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-06-15 09:30:54 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-06-15 09:30:54 +0000
commite24f4334ea0cea9ca3fb1f6f072a4fd6addc9183 (patch)
tree015bd32c37e8c4b753d34bd074fa59cc54179f1b /ext/tk/lib
parent90cf4b742004ba1e70522d206fc3c45f869b98fe (diff)
downloadruby-e24f4334ea0cea9ca3fb1f6f072a4fd6addc9183.tar.gz
ruby-e24f4334ea0cea9ca3fb1f6f072a4fd6addc9183.tar.xz
ruby-e24f4334ea0cea9ca3fb1f6f072a4fd6addc9183.zip
* 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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@8622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib')
-rw-r--r--ext/tk/lib/tk.rb15
-rw-r--r--ext/tk/lib/tk/namespace.rb103
2 files changed, 117 insertions, 1 deletions
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb
index 6a66a2eb2..8ac03f1a9 100644
--- a/ext/tk/lib/tk.rb
+++ b/ext/tk/lib/tk.rb
@@ -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'
diff --git a/ext/tk/lib/tk/namespace.rb b/ext/tk/lib/tk/namespace.rb
index cca784ded..e0ef7c39d 100644
--- a/ext/tk/lib/tk/namespace.rb
+++ b/ext/tk/lib/tk/namespace.rb
@@ -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