summaryrefslogtreecommitdiffstats
path: root/ext/tk/lib
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tk/lib')
-rw-r--r--ext/tk/lib/multi-tk.rb150
-rw-r--r--ext/tk/lib/remote-tk.rb4
-rw-r--r--ext/tk/lib/tk.rb254
-rw-r--r--ext/tk/lib/tk/canvas.rb9
-rw-r--r--ext/tk/lib/tk/canvastag.rb3
-rw-r--r--ext/tk/lib/tk/composite.rb52
-rw-r--r--ext/tk/lib/tk/event.rb14
-rw-r--r--ext/tk/lib/tk/font.rb8
-rw-r--r--ext/tk/lib/tk/grid.rb49
-rw-r--r--ext/tk/lib/tk/image.rb19
-rw-r--r--ext/tk/lib/tk/itemconfig.rb69
-rw-r--r--ext/tk/lib/tk/itemfont.rb33
-rw-r--r--ext/tk/lib/tk/menu.rb13
-rw-r--r--ext/tk/lib/tk/menuspec.rb14
-rw-r--r--ext/tk/lib/tk/namespace.rb14
-rw-r--r--ext/tk/lib/tk/pack.rb17
-rw-r--r--ext/tk/lib/tk/palette.rb2
-rw-r--r--ext/tk/lib/tk/panedwindow.rb23
-rw-r--r--ext/tk/lib/tk/scale.rb13
-rw-r--r--ext/tk/lib/tk/scrollbar.rb13
-rw-r--r--ext/tk/lib/tk/spinbox.rb2
-rw-r--r--ext/tk/lib/tk/text.rb42
-rw-r--r--ext/tk/lib/tk/textimage.rb4
-rw-r--r--ext/tk/lib/tk/texttag.rb3
-rw-r--r--ext/tk/lib/tk/textwindow.rb3
-rw-r--r--ext/tk/lib/tk/timer.rb38
-rw-r--r--ext/tk/lib/tk/toplevel.rb2
-rw-r--r--ext/tk/lib/tk/validation.rb9
-rw-r--r--ext/tk/lib/tk/wm.rb4
-rw-r--r--ext/tk/lib/tkextlib/blt/component.rb101
-rw-r--r--ext/tk/lib/tkextlib/blt/dragdrop.rb6
-rw-r--r--ext/tk/lib/tkextlib/blt/htext.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/table.rb17
-rw-r--r--ext/tk/lib/tkextlib/blt/tabset.rb4
-rw-r--r--ext/tk/lib/tkextlib/blt/ted.rb9
-rw-r--r--ext/tk/lib/tkextlib/blt/treeview.rb31
-rw-r--r--ext/tk/lib/tkextlib/blt/unix_dnd.rb16
-rw-r--r--ext/tk/lib/tkextlib/blt/watch.rb19
-rw-r--r--ext/tk/lib/tkextlib/bwidget/dialog.rb7
-rw-r--r--ext/tk/lib/tkextlib/bwidget/dynamichelp.rb7
-rw-r--r--ext/tk/lib/tkextlib/bwidget/listbox.rb3
-rw-r--r--ext/tk/lib/tkextlib/bwidget/messagedlg.rb11
-rw-r--r--ext/tk/lib/tkextlib/bwidget/tree.rb3
-rw-r--r--ext/tk/lib/tkextlib/bwidget/widget.rb12
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/buttonbox.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/calendar.rb2
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/checkbox.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/dialogshell.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/entryfield.rb2
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/hierarchy.rb6
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/menubar.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/messagebox.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/notebook.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/panedwindow.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/radiobox.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb2
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb2
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb25
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/spinner.rb2
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/tabset.rb5
-rw-r--r--ext/tk/lib/tkextlib/tcllib/getstring.rb5
-rw-r--r--ext/tk/lib/tkextlib/tcllib/swaplist.rb5
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tablelist_core.rb16
-rw-r--r--ext/tk/lib/tkextlib/tile.rb42
-rw-r--r--ext/tk/lib/tkextlib/tile/dialog.rb14
-rw-r--r--ext/tk/lib/tkextlib/tile/style.rb58
-rw-r--r--ext/tk/lib/tkextlib/tile/tentry.rb5
-rw-r--r--ext/tk/lib/tkextlib/tile/tnotebook.rb28
-rw-r--r--ext/tk/lib/tkextlib/tile/tpaned.rb43
-rw-r--r--ext/tk/lib/tkextlib/tile/treeview.rb60
-rw-r--r--ext/tk/lib/tkextlib/tkDND/shape.rb32
-rw-r--r--ext/tk/lib/tkextlib/tkDND/tkdnd.rb2
-rw-r--r--ext/tk/lib/tkextlib/tktable/tktable.rb21
-rw-r--r--ext/tk/lib/tkextlib/treectrl/tktreectrl.rb67
-rw-r--r--ext/tk/lib/tkextlib/version.rb2
-rw-r--r--ext/tk/lib/tkextlib/vu/pie.rb4
-rw-r--r--ext/tk/lib/tkextlib/winico/winico.rb8
78 files changed, 1437 insertions, 193 deletions
diff --git a/ext/tk/lib/multi-tk.rb b/ext/tk/lib/multi-tk.rb
index fd9a86388..4f39874d3 100644
--- a/ext/tk/lib/multi-tk.rb
+++ b/ext/tk/lib/multi-tk.rb
@@ -28,7 +28,13 @@ class << TclTkIp
if Thread.current.group != ThreadGroup::Default
raise SecurityError, 'only ThreadGroup::Default can call TclTkIp.new'
end
- __new__(*args)
+ obj = __new__(*args)
+ obj.instance_eval{
+ @force_default_encoding ||= [false].taint
+ @encoding ||= [nil].taint
+ def @encoding.to_s; self.join(nil); end
+ }
+ obj
end
end
@@ -115,7 +121,8 @@ class MultiTkIp
BASE_DIR = File.dirname(__FILE__)
WITH_RUBY_VM = Object.const_defined?(:VM) && ::VM.class == Class
- WITH_ENCODING = Object.const_defined?(:Encoding) && ::Encoding.class == Class
+ WITH_ENCODING = defined?(::Encoding.default_external)
+ #WITH_ENCODING = Object.const_defined?(:Encoding) && ::Encoding.class == Class
(@@SLAVE_IP_ID = ['slave'.freeze, '0'.taint]).instance_eval{
@mutex = Mutex.new
@@ -226,8 +233,8 @@ class MultiTkIp
def call(*args)
unless @ip.deleted?
current = Thread.current
- backup_ip = current['callback_ip']
- current['callback_ip'] = @ip
+ backup_ip = current[:callback_ip]
+ current[:callback_ip] = @ip
begin
ret = @ip.cb_eval(@cmd, *args)
fail ret if ret.kind_of?(Exception)
@@ -260,7 +267,7 @@ class MultiTkIp
fail e
end
ensure
- current['callback_ip'] = backup_ip
+ current[:callback_ip] = backup_ip
end
end
end
@@ -753,14 +760,23 @@ class MultiTkIp
current[:mutex] = mutex = Mutex.new
current[:root_check] = cond_var = ConditionVariable.new
+ status = [nil]
+ def status.value
+ self[0]
+ end
+ def status.value=(val)
+ self[0] = val
+ end
+ current[:status] = status
+
begin
- current[:status] = interp.mainloop(true)
+ current[:status].value = interp.mainloop(true)
rescue Exception=>e
- current[:status] = e
+ current[:status].value = e
ensure
mutex.synchronize{ cond_var.broadcast }
end
- current[:status] = interp.mainloop(false)
+ current[:status].value = interp.mainloop(false)
}
until @interp_thread[:interp]
Thread.pass
@@ -778,6 +794,12 @@ class MultiTkIp
end
end
+ @interp.instance_eval{
+ @force_default_encoding ||= [false].taint
+ @encoding ||= [nil].taint
+ def @encoding.to_s; self.join(nil); end
+ }
+
@ip_name = nil
@callback_status = [].taint
@@ -951,8 +973,9 @@ class MultiTkIp
begin
class << subclass
self.methods.each{|m|
+ name = m.to_s
begin
- unless m == '__id__' || m == '__send__' || m == 'freeze'
+ unless name == '__id__' || name == '__send__' || name == 'freeze'
undef_method(m)
end
rescue Exception
@@ -1157,6 +1180,11 @@ class MultiTkIp
# safe interpreter
ip_name = _create_slave_ip_name
slave_ip = @interp.create_slave(ip_name, true)
+ slave_ip.instance_eval{
+ @force_default_encoding ||= [false].taint
+ @encoding ||= [nil].taint
+ def @encoding.to_s; self.join(nil); end
+ }
@slave_ip_tbl[ip_name] = slave_ip
def slave_ip.safe_base?
true
@@ -1199,6 +1227,11 @@ class MultiTkIp
ip_name = _create_slave_ip_name
slave_ip = @interp.create_slave(ip_name, false)
+ slave_ip.instance_eval{
+ @force_default_encoding ||= [false].taint
+ @encoding ||= [nil].taint
+ def @encoding.to_s; self.join(nil); end
+ }
slave_ip._invoke('set', 'argv0', name) if name.kind_of?(String)
slave_ip._invoke('set', 'argv', _keys2opts(keys))
@interp._invoke('load', '', 'Tk', ip_name)
@@ -1268,9 +1301,21 @@ class MultiTkIp
# create master-ip
unless WITH_RUBY_VM
@interp = TclTkIp.new(name, _keys2opts(tk_opts))
+ @interp.instance_eval{
+ @force_default_encoding ||= [false].taint
+ @encoding ||= [nil].taint
+ def @encoding.to_s; self.join(nil); end
+ }
+
else ### Ruby 1.9 !!!!!!!!!!!
@interp_thread = Thread.new{
Thread.current[:interp] = interp = TclTkIp.new(name, _keys2opts(tk_opts))
+ interp.instance_eval{
+ @force_default_encoding ||= [false].taint
+ @encoding ||= [nil].taint
+ def @encoding.to_s; self.join(nil); end
+ }
+
#sleep
TclTkLib.mainloop(true)
}
@@ -1400,8 +1445,8 @@ class MultiTkIp
def self.__getip
current = Thread.current
- if TclTkLib.mainloop_thread? != false && current['callback_ip']
- return current['callback_ip']
+ if TclTkLib.mainloop_thread? != false && current[:callback_ip]
+ return current[:callback_ip]
end
if current.group == ThreadGroup::Default
@@DEFAULT_MASTER
@@ -1993,12 +2038,12 @@ class MultiTkIp
cmd = args.shift
end
current = Thread.current
- backup_ip = current['callback_ip']
- current['callback_ip'] = self
+ backup_ip = current[:callback_ip]
+ current[:callback_ip] = self
begin
eval_proc_core(false, cmd, *args)
ensure
- current['callback_ip'] = backup_ip
+ current[:callback_ip] = backup_ip
end
end
@@ -2016,8 +2061,8 @@ class MultiTkIp
if TclTkLib.mainloop_thread? == true
# call from eventloop
current = Thread.current
- backup_ip = current['callback_ip']
- current['callback_ip'] = self
+ backup_ip = current[:callback_ip]
+ current[:callback_ip] = self
begin
eval_proc_core(false,
proc{|safe, *params|
@@ -2025,7 +2070,7 @@ class MultiTkIp
cmd.call(*params)
}, *args)
ensure
- current['callback_ip'] = backup_ip
+ current[:callback_ip] = backup_ip
end
else
eval_proc_core(true,
@@ -2170,6 +2215,10 @@ end
# event loop
# all master/slave IPs are controled by only one event-loop
class << MultiTkIp
+ def default_master?
+ __getip == @@DEFAULT_MASTER
+ end
+
def mainloop(check_root = true)
__getip.mainloop(check_root)
end
@@ -2431,7 +2480,7 @@ class MultiTkIp
def mainloop(check_root = true, restart_on_dead = true)
raise SecurityError, "no permission to manipulate" unless self.manipulable?
- unless WITH_RUBY_VM ### Ruby 1.9 !!!!!!!!!!!
+ if WITH_RUBY_VM ### Ruby 1.9 !!!!!!!!!!!
return @interp_thread.value if @interp_thread
end
@@ -3289,6 +3338,42 @@ class << MultiTkIp
def encoding_table
__getip.encoding_table
end
+
+ def force_default_encoding=(mode)
+ __getip.force_default_encoding=(mode)
+ end
+
+ def force_default_encoding?
+ __getip.force_default_encoding?
+ end
+
+ def default_encoding=(enc)
+ __getip.default_encoding=(enc)
+ end
+
+ def encoding=(enc)
+ __getip.encoding=(enc)
+ end
+
+ def encoding_name
+ __getip.encoding_name
+ end
+
+ def encoding_obj
+ __getip.encoding_obj
+ end
+ alias encoding encoding_name
+ alias default_encoding encoding_name
+
+ def encoding_convertfrom(str, enc=None)
+ __getip.encoding_convertfrom(str, enc)
+ end
+ alias encoding_convert_from encoding_convertfrom
+
+ def encoding_convertto(str, enc=None)
+ __getip.encoding_convertto(str, enc)
+ end
+ alias encoding_convert_to encoding_convertto
end
class MultiTkIp
def encoding_table
@@ -3339,6 +3424,7 @@ end
# remove methods for security
+=begin
class MultiTkIp
INTERP_THREAD = @@DEFAULT_MASTER.instance_variable_get('@interp_thread')
INTERP_MUTEX = INTERP_THREAD[:mutex]
@@ -3362,6 +3448,34 @@ class MultiTkIp
remove_const(:INTERP_MUTEX)
remove_const(:INTERP_ROOT_CHECK)
end
+=end
+if MultiTkIp::WITH_RUBY_VM &&
+ ! MultiTkIp::RUN_EVENTLOOP_ON_MAIN_THREAD ### check Ruby 1.9 !!!!!!!
+ class MultiTkIp
+ INTERP_THREAD = @@DEFAULT_MASTER.instance_variable_get('@interp_thread')
+ INTERP_THREAD_STATUS = INTERP_THREAD[:status]
+ INTERP_MUTEX = INTERP_THREAD[:mutex]
+ INTERP_ROOT_CHECK = INTERP_THREAD[:root_check]
+ end
+ module TkCore
+ INTERP_THREAD = MultiTkIp::INTERP_THREAD
+ INTERP_THREAD_STATUS = MultiTkIp::INTERP_THREAD_STATUS
+ INTERP_MUTEX = MultiTkIp::INTERP_MUTEX
+ INTERP_ROOT_CHECK = MultiTkIp::INTERP_ROOT_CHECK
+ end
+ class MultiTkIp
+ remove_const(:INTERP_THREAD)
+ remove_const(:INTERP_THREAD_STATUS)
+ remove_const(:INTERP_MUTEX)
+ remove_const(:INTERP_ROOT_CHECK)
+ end
+end
+
+class MultiTkIp
+ # undef_method :instance_eval
+ undef_method :instance_variable_get
+ undef_method :instance_variable_set
+end
# end of MultiTkIp definition
# defend against modification
diff --git a/ext/tk/lib/remote-tk.rb b/ext/tk/lib/remote-tk.rb
index 70115a60a..f267900d5 100644
--- a/ext/tk/lib/remote-tk.rb
+++ b/ext/tk/lib/remote-tk.rb
@@ -88,6 +88,10 @@ class RemoteTkIp
@slave_ip_tbl = {}
@slave_ip_top = {}
+ @force_default_encoding ||= [false].taint
+ @encoding ||= [nil].taint
+ def @encoding.to_s; self.join(nil); end
+
@tk_windows.taint unless @tk_windows.tainted?
@tk_table_list.taint unless @tk_table_list.tainted?
@slave_ip_tbl.taint unless @slave_ip_tbl.tainted?
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb
index 0d00ecf20..88e47626f 100644
--- a/ext/tk/lib/tk.rb
+++ b/ext/tk/lib/tk.rb
@@ -21,6 +21,17 @@ class TclTkIp
# for RemoteTkIp
''
end
+
+ alias __initialize__ initialize
+ private :__initialize__
+
+ def initialize(*args)
+ __initialize__(*args)
+
+ @force_default_encoding ||= [false].taint
+ @encoding ||= [nil].taint
+ def @encoding.to_s; self.join(nil); end
+ end
end
# define TkComm module (step 1: basic functions)
@@ -775,7 +786,7 @@ end
private :_curr_cmd_id, :_next_cmd_id
module_function :_curr_cmd_id, :_next_cmd_id
- def install_cmd(cmd)
+ def TkComm.install_cmd(cmd, local_cmdtbl=nil)
return '' if cmd == ''
begin
ns = TkCore::INTERP._invoke_without_enc('namespace', 'current')
@@ -794,6 +805,15 @@ end
@cmdtbl = [] unless defined? @cmdtbl
@cmdtbl.taint unless @cmdtbl.tainted?
@cmdtbl.push id
+
+ if local_cmdtbl && local_cmdtbl.kind_of?(Array)
+ begin
+ local_cmdtbl << id
+ rescue Exception
+ # ignore
+ end
+ end
+
#return Kernel.format("rb_out %s", id);
if ns
'rb_out' << TkCore::INTERP._ip_id_ << ' ' << ns << ' ' << id
@@ -801,14 +821,30 @@ end
'rb_out' << TkCore::INTERP._ip_id_ << ' ' << id
end
end
- def uninstall_cmd(id)
+ def TkComm.uninstall_cmd(id, local_cmdtbl=nil)
#id = $1 if /rb_out\S* (c(_\d+_)?\d+)/ =~ id
id = $4 if id =~ /rb_out\S*(?:\s+(::\S*|[{](::.*)[}]|["](::.*)["]))? (c(_\d+_)?(\d+))/
+
+ if local_cmdtbl && local_cmdtbl.kind_of?(Array)
+ begin
+ local_cmdtbl.delete(id)
+ rescue Exception
+ # ignore
+ end
+ end
+ @cmdtbl.delete(id)
+
#Tk_CMDTBL.delete(id)
TkCore::INTERP.tk_cmd_tbl.delete(id)
end
# private :install_cmd, :uninstall_cmd
- module_function :install_cmd, :uninstall_cmd
+ # module_function :install_cmd, :uninstall_cmd
+ def install_cmd(cmd)
+ TkComm.install_cmd(cmd, @cmdtbl)
+ end
+ def uninstall_cmd(id)
+ TkComm.uninstall_cmd(id, @cmdtbl)
+ end
=begin
def install_win(ppath,name=nil)
@@ -1074,7 +1110,8 @@ module TkCore
extend TkComm
WITH_RUBY_VM = Object.const_defined?(:VM) && ::VM.class == Class
- WITH_ENCODING = Object.const_defined?(:Encoding) && ::Encoding.class == Class
+ WITH_ENCODING = defined?(::Encoding.default_external)
+ #WITH_ENCODING = Object.const_defined?(:Encoding) && ::Encoding.class == Class
unless self.const_defined? :RUN_EVENTLOOP_ON_MAIN_THREAD
### Ruby 1.9 !!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -1110,17 +1147,26 @@ module TkCore
Thread.current[:interp] = e
raise e
end
- Thread.current[:status] = nil
+
+ status = [nil]
+ def status.value
+ self[0]
+ end
+ def status.value=(val)
+ self[0] = val
+ end
+
+ Thread.current[:status] = status
#sleep
begin
- Thread.current[:status] = TclTkLib.mainloop(true)
+ Thread.current[:status].value = TclTkLib.mainloop(true)
rescue Exception=>e
- Thread.current[:status] = e
+ Thread.current[:status].value = e
ensure
INTERP_MUTEX.synchronize{ INTERP_ROOT_CHECK.broadcast }
end
- Thread.current[:status] = TclTkLib.mainloop(false)
+ Thread.current[:status].value = TclTkLib.mainloop(false)
}
until INTERP_THREAD[:interp]
@@ -1130,11 +1176,15 @@ module TkCore
raise INTERP_THREAD[:interp] if INTERP_THREAD[:interp].kind_of? Exception
INTERP = INTERP_THREAD[:interp]
+ INTERP_THREAD_STATUS = INTERP_THREAD[:status]
end
def INTERP.__getip
self
end
+ def INTERP.default_master?
+ true
+ end
INTERP.instance_eval{
# @tk_cmd_tbl = {}.taint
@@ -1155,6 +1205,10 @@ module TkCore
@init_ip_env = [].taint # table of Procs
@add_tk_procs = [].taint # table of [name, args, body]
+ @force_default_encoding ||= [false].taint
+ @encoding ||= [nil].taint
+ def @encoding.to_s; self.join(nil); end
+
@cb_entry_class = Class.new(TkCallbackEntry){
class << self
def inspect
@@ -1273,7 +1327,7 @@ module TkCore
}) << ' %W')
INTERP.add_tk_procs(TclTkLib::FINALIZE_PROC_NAME, '',
- "bind all <#{WIDGET_DESTROY_HOOK}> {}")
+ "catch { bind all <#{WIDGET_DESTROY_HOOK}> {} }")
INTERP.add_tk_procs('rb_out', 'ns args', <<-'EOL')
if [regexp {^::} $ns] {
@@ -1441,7 +1495,9 @@ module TkCore
def after(ms, cmd=Proc.new)
cmdid = install_cmd(proc{ret = cmd.call;uninstall_cmd(cmdid); ret})
- tk_call_without_enc("after",ms,cmdid) # return id
+ after_id = tk_call_without_enc("after",ms,cmdid)
+ after_id.instance_variable_set('@cmdid', cmdid)
+ after_id
end
=begin
def after(ms, cmd=Proc.new)
@@ -1471,7 +1527,9 @@ module TkCore
def after_idle(cmd=Proc.new)
cmdid = install_cmd(proc{ret = cmd.call;uninstall_cmd(cmdid); ret})
- tk_call_without_enc('after','idle',cmdid)
+ after_id = tk_call_without_enc('after','idle',cmdid)
+ after_id.instance_variable_set('@cmdid', cmdid)
+ after_id
end
=begin
def after_idle(cmd=Proc.new)
@@ -1489,6 +1547,11 @@ module TkCore
def after_cancel(afterId)
tk_call_without_enc('after','cancel',afterId)
+ if (cmdid = afterId.instance_variable_get('@cmdid'))
+ afterId.instance_variable_set('@cmdid', nil)
+ uninstall_cmd(cmdid)
+ end
+ afterId
end
def windowingsystem
@@ -1611,14 +1674,19 @@ module TkCore
if !TkCore::WITH_RUBY_VM || TkCore::RUN_EVENTLOOP_ON_MAIN_THREAD
TclTkLib.mainloop(check_root)
else ### Ruby 1.9 !!!!!
+ unless TkCore::INTERP.default_master?
+ # [MultiTkIp] slave interp ?
+ return TkCore::INTERP._thread_tkwait('window', '.') if check_root
+ end
+
begin
TclTkLib.set_eventloop_window_mode(true)
if check_root
INTERP_MUTEX.synchronize{
INTERP_ROOT_CHECK.wait(INTERP_MUTEX)
- status = INTERP_THREAD[:status]
- if status
- INTERP_THREAD[:status] = nil
+ status = INTERP_THREAD_STATUS.value
+ if status && TkCore::INTERP.default_master?
+ INTERP_THREAD_STATUS.value = nil if $SAFE < 4
raise status if status.kind_of?(Exception)
end
}
@@ -2458,7 +2526,8 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK)
alias default_encoding encoding_name
def tk_encoding_names
- TkComm.simplelist(TkCore::INTERP._invoke_without_enc(Tk::Encoding::ENCNAMES_CMD[0], Tk::Encoding::ENCNAMES_CMD[1]))
+ #TkComm.simplelist(TkCore::INTERP._invoke_without_enc(Tk::Encoding::ENCNAMES_CMD[0], Tk::Encoding::ENCNAMES_CMD[1]))
+ TkComm.simplelist(TkCore::INTERP._invoke_without_enc('encoding', 'names'))
end
def encoding_names
self.tk_encoding_names.find_all{|name|
@@ -2592,16 +2661,16 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK)
class TclTkIp
def force_default_encoding=(mode)
- @force_default_encoding = (mode)? true: false
+ @force_default_encoding[0] = (mode)? true: false
end
def force_default_encoding?
- @force_default_encoding ||= false
+ @force_default_encoding[0] ||= false
end
def default_encoding=(name)
- name = name.name if name.kind_of?(::Encoding) if Tk::WITH_ENCODING
- @encoding = name
+ name = name.name if Tk::WITH_ENCODING && name.kind_of?(::Encoding)
+ @encoding[0] = name.to_s.dup
end
# from tkencoding.rb by ttate@jaist.ac.jp
@@ -2612,16 +2681,16 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK)
end
def encoding_name
- (@encoding)? @encoding.dup: nil
+ (@encoding[0])? @encoding[0].dup: nil
end
alias encoding encoding_name
alias default_encoding encoding_name
def encoding_obj
if Tk::WITH_ENCODING
- Tk::Encoding.tcl2rb_encoding(@encoding)
+ Tk::Encoding.tcl2rb_encoding(@encoding[0])
else
- (@encoding)? @encoding.dup: nil
+ (@encoding[0])? @encoding[0].dup: nil
end
end
@@ -3211,7 +3280,15 @@ module TkTreatFont
next
else
fnt = hash_kv(fnt) if fnt.kind_of?(Hash)
- tk_call(*(__config_cmd << "-#{optkey}" << fnt))
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ tk_call(*(__config_cmd << "-#{optkey}" << fnt))
+ else
+ begin
+ tk_call(*(__config_cmd << "-#{optkey}" << fnt))
+ rescue
+ # ignore
+ end
+ end
end
end
next
@@ -3265,7 +3342,15 @@ module TkTreatFont
fobj = fontobj # create a new TkFont object
else
ltn = hash_kv(ltn) if ltn.kind_of?(Hash)
- tk_call(*(__config_cmd << "-#{optkey}" << ltn))
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ tk_call(*(__config_cmd << "-#{optkey}" << ltn))
+ else
+ begin
+ tk_call(*(__config_cmd << "-#{optkey}" << ltn))
+ rescue => e
+ # ignore
+ end
+ end
next
end
@@ -3317,7 +3402,15 @@ module TkTreatFont
fobj = fontobj # create a new TkFont object
else
knj = hash_kv(knj) if knj.kind_of?(Hash)
- tk_call(*(__config_cmd << "-#{optkey}" << knj))
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ tk_call(*(__config_cmd << "-#{optkey}" << knj))
+ else
+ begin
+ tk_call(*(__config_cmd << "-#{optkey}" << knj))
+ rescue => e
+ # ignore
+ end
+ end
next
end
@@ -3447,6 +3540,11 @@ module TkConfigMethod
end
private :__configinfo_struct
+ def __optkey_aliases
+ {}
+ end
+ private :__optkey_aliases
+
def __numval_optkeys
[]
end
@@ -3561,6 +3659,11 @@ module TkConfigMethod
fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
end
+ alias_name, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
if ( method = _symbolkey2str(__val2ruby_optkeys())[slot] )
optval = tk_call_without_enc(*(__cget_cmd << "-#{slot}"))
begin
@@ -3635,14 +3738,35 @@ module TkConfigMethod
unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
__cget_core(slot)
else
- __cget_core(slot) rescue nil
+ begin
+ __cget_core(slot)
+ rescue => e
+ if current_configinfo.has_key?(slot.to_s)
+ # error on known option
+ fail e
+ else
+ # unknown option
+ nil
+ end
+ end
end
end
+ def cget_strict(slot)
+ # never use TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ __cget_core(slot)
+ end
def __configure_core(slot, value=None)
if slot.kind_of? Hash
slot = _symbolkey2str(slot)
+ __optkey_aliases.each{|alias_name, real_name|
+ alias_name = alias_name.to_s
+ if slot.has_key?(alias_name)
+ slot[real_name.to_s] = slot.delete(alias_name)
+ end
+ }
+
__methodcall_optkeys.each{|key, method|
value = slot.delete(key.to_s)
self.__send__(method, value) if value
@@ -3679,6 +3803,11 @@ module TkConfigMethod
fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
end
+ alias_name, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
if ( conf = __keyonly_optkeys.find{|k, v| k.to_s == slot} )
defkey, undefkey = conf
if value
@@ -3730,7 +3859,17 @@ module TkConfigMethod
__configure_core(slot) unless slot.empty?
end
else
- __configure_core(slot, value) rescue nil
+ begin
+ __configure_core(slot, value)
+ rescue => e
+ if current_configinfo.has_key?(slot.to_s)
+ # error on known option
+ fail e
+ else
+ # unknown option
+ nil
+ end
+ end
end
end
self
@@ -3766,6 +3905,12 @@ module TkConfigMethod
else
if slot
slot = slot.to_s
+
+ alias_name, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
case slot
when /^(#{__val2ruby_optkeys().keys.join('|')})$/
method = _symbolkey2str(__val2ruby_optkeys())[slot]
@@ -4139,6 +4284,12 @@ module TkConfigMethod
else
if slot
slot = slot.to_s
+
+ alias_name, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
case slot
when /^(#{__val2ruby_optkeys().keys.join('|')})$/
method = _symbolkey2str(__val2ruby_optkeys())[slot]
@@ -4734,6 +4885,13 @@ class TkWindow<TkObject
fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
}
+ __optkey_aliases.each{|alias_name, real_name|
+ alias_name = alias_name.to_s
+ if keys.has_key?(alias_name)
+ keys[real_name.to_s] = keys.delete(alias_name)
+ end
+ }
+
__methodcall_optkeys.each{|key|
key = key.to_s
methodkeys[key] = keys.delete(key) if keys.key?(key)
@@ -4771,12 +4929,25 @@ class TkWindow<TkObject
else
begin
tk_call_without_enc(cmd, @path, *hash_kv(keys, true))
- rescue
+ rescue => e
tk_call_without_enc(cmd, @path)
keys = __check_available_configure_options(keys)
unless keys.empty?
- tk_call_without_enc('destroy', @path)
- tk_call_without_enc(cmd, @path, *hash_kv(keys, true))
+ begin
+ # try to configure
+ configure(keys)
+ rescue
+ # fail => includes options adaptable when creattion only?
+ begin
+ tk_call_without_enc('destroy', @path)
+ rescue
+ # cannot rescue options error
+ fail e
+ else
+ # re-create widget
+ tk_call_without_enc(cmd, @path, *hash_kv(keys, true))
+ end
+ end
end
end
end
@@ -4916,6 +5087,15 @@ class TkWindow<TkObject
self
end
+ def grid_anchor(anchor=None)
+ if anchor == None
+ TkGrid.anchor(self)
+ else
+ TkGrid.anchor(self, anchor)
+ self
+ end
+ end
+
def grid_forget
#tk_call('grid', 'forget', epath)
TkGrid.forget(self)
@@ -4947,12 +5127,14 @@ class TkWindow<TkObject
TkGrid.columnconfigure(self, index, keys)
end
alias grid_columnconfigure grid_columnconfig
+ alias grid_column grid_columnconfig
def grid_rowconfig(index, keys)
#tk_call('grid', 'rowconfigure', epath, index, *hash_kv(keys))
TkGrid.rowconfigure(self, index, keys)
end
alias grid_rowconfigure grid_rowconfig
+ alias grid_row grid_rowconfig
def grid_columnconfiginfo(index, slot=nil)
#if slot
@@ -5195,11 +5377,13 @@ class TkWindow<TkObject
end
children.each{|path, obj|
- if defined?(@cmdtbl)
- for id in @cmdtbl
- uninstall_cmd id
+ obj.instance_eval{
+ if defined?(@cmdtbl)
+ for id in @cmdtbl
+ uninstall_cmd id
+ end
end
- end
+ }
TkCore::INTERP.tk_windows.delete(path)
}
@@ -5317,7 +5501,7 @@ TkWidget = TkWindow
#Tk.freeze
module Tk
- RELEASE_DATE = '2008-03-29'.freeze
+ RELEASE_DATE = '2008-06-11'.freeze
autoload :AUTO_PATH, 'tk/variable'
autoload :TCL_PACKAGE_PATH, 'tk/variable'
diff --git a/ext/tk/lib/tk/canvas.rb b/ext/tk/lib/tk/canvas.rb
index fceadd5e9..36ea008a1 100644
--- a/ext/tk/lib/tk/canvas.rb
+++ b/ext/tk/lib/tk/canvas.rb
@@ -168,6 +168,8 @@ class Tk::Canvas<TkWindow
#tk_tcl2ruby(tk_send_without_enc('canvasy', screen_y, *args))
number(tk_send_without_enc('canvasy', screen_y, *args))
end
+ alias canvas_x canvasx
+ alias canvas_y canvasy
def coords(tag, *args)
if args == []
@@ -642,6 +644,13 @@ class TkcItem<TkObject
fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
}
+ __item_optkey_aliases(nil).each{|alias_name, real_name|
+ alias_name = alias_name.to_s
+ if keys.has_key?(alias_name)
+ keys[real_name.to_s] = keys.delete(alias_name)
+ end
+ }
+
__item_methodcall_optkeys(nil).each{|key|
key = key.to_s
methodkeys[key] = keys.delete(key) if keys.key?(key)
diff --git a/ext/tk/lib/tk/canvastag.rb b/ext/tk/lib/tk/canvastag.rb
index 7feea1575..49796d80b 100644
--- a/ext/tk/lib/tk/canvastag.rb
+++ b/ext/tk/lib/tk/canvastag.rb
@@ -63,6 +63,9 @@ module TkcTagAccess
def cget(option)
@c.itemcget(@id, option)
end
+ def cget_strict(option)
+ @c.itemcget_strict(@id, option)
+ end
def configure(key, value=None)
@c.itemconfigure(@id, key, value)
diff --git a/ext/tk/lib/tk/composite.rb b/ext/tk/lib/tk/composite.rb
index 728b02f60..883d43c3e 100644
--- a/ext/tk/lib/tk/composite.rb
+++ b/ext/tk/lib/tk/composite.rb
@@ -181,6 +181,57 @@ module TkComposite
delegate_alias(option, option, *wins)
end
+ def __cget_delegates(slot)
+ slot = slot.to_s
+
+ if @option_methods.include?(slot)
+ if @option_methods[slot][:cget]
+ return self.__send__(@option_methods[slot][:cget])
+ else
+ if @option_setting[slot]
+ return @option_setting[slot]
+ else
+ return ''
+ end
+ end
+ end
+
+ tbl = @delegates[slot]
+ tbl = @delegates['DEFAULT'] unless tbl
+
+ begin
+ if tbl
+ opt, wins = tbl[-1]
+ opt = slot if opt == 'DEFAULT'
+ if wins && wins[-1]
+ # return wins[-1].cget(opt)
+ return wins[-1].cget_strict(opt)
+ end
+ end
+ rescue
+ end
+
+ return None
+ end
+ private :__cget_delegates
+
+ def cget(slot)
+ if (ret = __cget_delegates(slot)) == None
+ super(slot)
+ else
+ ret
+ end
+ end
+
+ def cget_strict(slot)
+ if (ret = __cget_delegates(slot)) == None
+ super(slot)
+ else
+ ret
+ end
+ end
+
+=begin
def cget(slot)
slot = slot.to_s
@@ -212,6 +263,7 @@ module TkComposite
super(slot)
end
+=end
def configure(slot, value=None)
if slot.kind_of? Hash
diff --git a/ext/tk/lib/tk/event.rb b/ext/tk/lib/tk/event.rb
index 0042fcaa6..d8aad6248 100644
--- a/ext/tk/lib/tk/event.rb
+++ b/ext/tk/lib/tk/event.rb
@@ -352,6 +352,14 @@ module TkEvent
nil
]
+ # [ <'%' subst-key str>, <proc type char>, <instance var (accessor) name>]
+ # the subst-key string will be converted to a bytecode (128+idx).
+ LONGKEY_TBL = [
+ # for example, for %CTT and %CST subst-key on tkdnd-2.0
+ # ['CTT', ?l, :drop_target_type],
+ # ['CST', ?l, :drop_source_type],
+ ]
+
# [ <proc type char>, <proc/method to convert tcl-str to ruby-obj>]
PROC_TBL = [
[ ?n, TkComm.method(:num_or_str) ],
@@ -371,6 +379,7 @@ module TkEvent
nil
]
+=begin
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
KEY_TBL.map!{|inf|
if inf.kind_of?(Array)
@@ -386,6 +395,7 @@ module TkEvent
end
inf
}
+=end
# setup tables to be used by scan_args, _get_subst_key, _get_all_subst_keys
#
@@ -399,7 +409,8 @@ module TkEvent
# ( which are Tcl strings ) to ruby objects based on the key string
# that is generated by _get_subst_key() or _get_all_subst_keys().
#
- _setup_subst_table(KEY_TBL, PROC_TBL);
+ _setup_subst_table(KEY_TBL, PROC_TBL)
+ # _setup_subst_table(KEY_TBL, LONGKEY_TBL, PROC_TBL) # if use longname-keys
#
# NOTE: The order of parameters which passed to callback procedure is
@@ -447,6 +458,7 @@ module TkEvent
extra_args_tbl = klass._get_extra_args_tbl
if args.compact.size > 0
+ args.map!{|arg| klass._sym2subst(arg)}
args = args.join(' ')
keys = klass._get_subst_key(args)
diff --git a/ext/tk/lib/tk/font.rb b/ext/tk/lib/tk/font.rb
index 4641d8a64..62d628c13 100644
--- a/ext/tk/lib/tk/font.rb
+++ b/ext/tk/lib/tk/font.rb
@@ -1056,7 +1056,13 @@ class TkFont
keys = _symbolkey2str(args.pop).update(fontslot)
args.concat(hash_kv(keys))
- tk_call(*args)
+ begin
+ tk_call(*args)
+ rescue => e
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ fail e
+ end
+ end
Tk_FontUseTBL.mutex.synchronize{
Tk_FontUseTBL[[win, tag, optkey].join(';')] = self
}
diff --git a/ext/tk/lib/tk/grid.rb b/ext/tk/lib/tk/grid.rb
index 10fdf3569..0dfd7263a 100644
--- a/ext/tk/lib/tk/grid.rb
+++ b/ext/tk/lib/tk/grid.rb
@@ -22,6 +22,7 @@ module TkGrid
list(tk_call_without_enc('grid', 'bbox', *args))
end
+=begin
def configure(win, *args)
if args[-1].kind_of?(Hash)
opts = args.pop
@@ -53,6 +54,48 @@ module TkGrid
tk_call_without_enc('grid', 'configure', *params)
end
end
+=end
+ def configure(*args)
+ if args[-1].kind_of?(Hash)
+ opts = args.pop
+ else
+ opts = {}
+ end
+ fail ArgumentError, 'no widget is given' if args.empty?
+ params = []
+ args.flatten(1).each{|win|
+ case win
+ when '-', ?- # RELATIVE PLACEMENT (increase columnspan)
+ params.push('-')
+ when /^-+$/ # RELATIVE PLACEMENT (increase columnspan)
+ params.concat(win.to_s.split(//))
+ when '^', ?^ # RELATIVE PLACEMENT (increase rowspan)
+ params.push('^')
+ when /^\^+$/ # RELATIVE PLACEMENT (increase rowspan)
+ params.concat(win.to_s.split(//))
+ when 'x', :x, ?x, nil, '' # RELATIVE PLACEMENT (empty column)
+ params.push('x')
+ when /^x+$/ # RELATIVE PLACEMENT (empty column)
+ params.concat(win.to_s.split(//))
+ else
+ params.push(_epath(win))
+ end
+ }
+ opts.each{|k, v|
+ params.push("-#{k}")
+ params.push(_epath(v)) # have to use 'epath' (hash_kv() is unavailable)
+ }
+ if Tk::TCL_MAJOR_VERSION < 8 ||
+ (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION <= 3)
+ if params[0] == '-' || params[0] == 'x' || params[0] == '^'
+ tk_call_without_enc('grid', *params)
+ else
+ tk_call_without_enc('grid', 'configure', *params)
+ end
+ else
+ tk_call_without_enc('grid', 'configure', *params)
+ end
+ end
alias grid configure
def columnconfigure(master, index, args)
@@ -61,12 +104,14 @@ module TkGrid
tk_call_without_enc("grid", 'columnconfigure',
master, index, *hash_kv(args))
end
+ alias column columnconfigure
def rowconfigure(master, index, args)
# master = master.epath if master.kind_of?(TkObject)
master = _epath(master)
tk_call_without_enc("grid", 'rowconfigure', master, index, *hash_kv(args))
end
+ alias row rowconfigure
def columnconfiginfo(master, index, slot=nil)
# master = master.epath if master.kind_of?(TkObject)
@@ -189,10 +234,10 @@ module TkGrid
list(tk_call_without_enc('grid', 'slaves', master, *hash_kv(args)))
end
- module_function :bbox, :forget, :propagate, :info
+ module_function :anchor, :bbox, :add, :forget, :propagate, :info
module_function :remove, :size, :slaves, :location
module_function :grid, :configure, :columnconfigure, :rowconfigure
- module_function :columnconfiginfo, :rowconfiginfo
+ module_function :column, :row, :columnconfiginfo, :rowconfiginfo
end
=begin
def TkGrid(win, *args)
diff --git a/ext/tk/lib/tk/image.rb b/ext/tk/lib/tk/image.rb
index 57f82cb81..dffdc1964 100644
--- a/ext/tk/lib/tk/image.rb
+++ b/ext/tk/lib/tk/image.rb
@@ -156,7 +156,7 @@ class TkPhotoImage<TkImage
self
end
- def cget(option)
+ def cget_strict(option)
case option.to_s
when 'data', 'file'
tk_send 'cget', '-' << option.to_s
@@ -164,6 +164,23 @@ class TkPhotoImage<TkImage
tk_tcl2ruby(tk_send('cget', '-' << option.to_s))
end
end
+ def cget(option)
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ cget_strict(option)
+ else
+ begin
+ cget_strict(option)
+ rescue => e
+ if current_configinfo.has_key?(option.to_s)
+ # error on known option
+ fail e
+ else
+ # unknown option
+ nil
+ end
+ end
+ end
+ end
def copy(src, *opts)
if opts.size == 0
diff --git a/ext/tk/lib/tk/itemconfig.rb b/ext/tk/lib/tk/itemconfig.rb
index dbc45a9e7..9c6a98d0f 100644
--- a/ext/tk/lib/tk/itemconfig.rb
+++ b/ext/tk/lib/tk/itemconfig.rb
@@ -8,6 +8,11 @@ require 'tk/itemfont.rb'
module TkItemConfigOptkeys
include TkUtil
+ def __item_optkey_aliases(id)
+ {}
+ end
+ private :__item_optkey_aliases
+
def __item_numval_optkeys(id)
[]
end
@@ -165,6 +170,11 @@ module TkItemConfigMethod
fail ArgumentError, "Invalid option `#{orig_opt.inspect}'"
end
+ alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == option}
+ if real_name
+ option = real_name.to_s
+ end
+
if ( method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[option] )
optval = tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}"))
begin
@@ -242,20 +252,35 @@ module TkItemConfigMethod
__itemcget_core(tagOrId, option)
rescue => e
begin
- __itemconfiginfo_core(tagOrId)
- # not tag error -> option is unknown
- nil
+ if __current_itemconfiginfo(tagOrId).has_key?(option.to_s)
+ # not tag error & option is known -> error on known option
+ fail e
+ else
+ # not tag error & option is unknown
+ nil
+ end
rescue
fail e # tag error
end
end
end
end
+ def itemcget_strict(tagOrId, option)
+ # never use TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ __itemcget_core(tagOrId, option)
+ end
def __itemconfigure_core(tagOrId, slot, value=None)
if slot.kind_of? Hash
slot = _symbolkey2str(slot)
+ __item_optkey_aliases(tagid(tagOrId)).each{|alias_name, real_name|
+ alias_name = alias_name.to_s
+ if slot.has_key?(alias_name)
+ slot[real_name.to_s] = slot.delete(alias_name)
+ end
+ }
+
__item_methodcall_optkeys(tagid(tagOrId)).each{|key, method|
value = slot.delete(key.to_s)
self.__send__(method, tagOrId, value) if value
@@ -292,6 +317,11 @@ module TkItemConfigMethod
fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
end
+ alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
if ( conf = __item_keyonly_optkeys(tagid(tagOrId)).find{|k, v| k.to_s == slot } )
defkey, undefkey = conf
if value
@@ -319,7 +349,8 @@ module TkItemConfigMethod
def __check_available_itemconfigure_options(tagOrId, keys)
id = tagid(tagOrId)
- availables = self.current_itemconfiginfo(id).keys
+
+ availables = self.__current_itemconfiginfo(id).keys
# add non-standard keys
availables |= __font_optkeys.map{|k|
@@ -329,6 +360,7 @@ module TkItemConfigMethod
availables |= __item_keyonly_optkeys(id).keys.map{|k| k.to_s}
keys = _symbolkey2str(keys)
+
keys.delete_if{|k, v| !(availables.include?(k))}
end
@@ -340,7 +372,7 @@ module TkItemConfigMethod
begin
__itemconfigure_core(tagOrId, slot)
rescue
- slot = __check_available_configure_options(tagOrId, slot)
+ slot = __check_available_itemconfigure_options(tagOrId, slot)
__itemconfigure_core(tagOrId, slot) unless slot.empty?
end
else
@@ -348,7 +380,13 @@ module TkItemConfigMethod
__itemconfigure_core(tagOrId, slot, value)
rescue => e
begin
- __itemconfiginfo_core(tagOrId)
+ if __current_itemconfiginfo(tagOrId).has_key?(slot.to_s)
+ # not tag error & option is known -> error on known option
+ fail e
+ else
+ # not tag error & option is unknown
+ nil
+ end
rescue
fail e # tag error
end
@@ -383,6 +421,12 @@ module TkItemConfigMethod
else
if slot
slot = slot.to_s
+
+ alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
case slot
when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[slot]
@@ -754,6 +798,12 @@ module TkItemConfigMethod
else
if slot
slot = slot.to_s
+
+ alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
case slot
when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[slot]
@@ -1125,7 +1175,7 @@ module TkItemConfigMethod
end
end
- def current_itemconfiginfo(tagOrId, slot = nil)
+ def __current_itemconfiginfo(tagOrId, slot = nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if slot
org_slot = slot
@@ -1147,6 +1197,7 @@ module TkItemConfigMethod
ret[conf[0]] = conf[-1]
end
}
+
ret
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
@@ -1157,4 +1208,8 @@ module TkItemConfigMethod
ret
end
end
+
+ def current_itemconfiginfo(tagOrId, slot = nil)
+ __current_itemconfiginfo(tagOrId, slot)
+ end
end
diff --git a/ext/tk/lib/tk/itemfont.rb b/ext/tk/lib/tk/itemfont.rb
index ab9e3ff6c..4c5c917c5 100644
--- a/ext/tk/lib/tk/itemfont.rb
+++ b/ext/tk/lib/tk/itemfont.rb
@@ -94,7 +94,16 @@ module TkTreatItemFont
*(__item_config_cmd(tagid(tagOrId)) << {}))
next
else
- tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << fnt))
+ fnt = hash_kv(fnt) if fnt.kind_of?(Hash)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << fnt))
+ else
+ begin
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << fnt))
+ rescue => e
+ # ignore
+ end
+ end
end
end
next
@@ -147,7 +156,16 @@ module TkTreatItemFont
elsif Tk::JAPANIZED_TK
fobj = fontobj # create a new TkFont object
else
- tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << ltn))
+ ltn = hash_kv(ltn) if ltn.kind_of?(Hash)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << ltn))
+ else
+ begin
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << ltn))
+ rescue => e
+ # ignore
+ end
+ end
next
end
@@ -198,7 +216,16 @@ module TkTreatItemFont
elsif Tk::JAPANIZED_TK
fobj = fontobj # create a new TkFont object
else
- tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << knj))
+ knj = hash_kv(knj) if knj.kind_of?(Hash)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << knj))
+ else
+ begin
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << knj))
+ rescue => e
+ # ignore
+ end
+ end
next
end
diff --git a/ext/tk/lib/tk/menu.rb b/ext/tk/lib/tk/menu.rb
index 8ba315629..3ae0548dd 100644
--- a/ext/tk/lib/tk/menu.rb
+++ b/ext/tk/lib/tk/menu.rb
@@ -34,12 +34,13 @@ module TkMenuEntryConfig
private :__item_val2ruby_optkeys
alias entrycget itemcget
+ alias entrycget_strict itemcget_strict
alias entryconfigure itemconfigure
alias entryconfiginfo itemconfiginfo
alias current_entryconfiginfo current_itemconfiginfo
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
end
class Tk::Menu<TkWindow
@@ -518,7 +519,7 @@ class Tk::Menubutton<Tk::Label
tk_call_without_enc(self.class::TkCommandNames[0], @path)
keys = __check_available_configure_options(keys)
unless keys.empty?
- tk_call_without_enc('destroy', @path)
+ tk_call_without_enc('destroy', @path) rescue nil
tk_call_without_enc(self.class::TkCommandNames[0], @path,
*hash_kv(keys, true))
end
@@ -642,6 +643,9 @@ class Tk::OptionMenubutton<Tk::Menubutton
def menucget(key)
@menu.cget(key)
end
+ def menucget_strict(key)
+ @menu.cget_strict(key)
+ end
def menuconfigure(key, val=None)
@menu.configure(key, val)
self
@@ -655,6 +659,9 @@ class Tk::OptionMenubutton<Tk::Menubutton
def entrycget(index, key)
@menu.entrycget(index, key)
end
+ def entrycget_strict(index, key)
+ @menu.entrycget_strict(index, key)
+ end
def entryconfigure(index, key, val=None)
@menu.entryconfigure(index, key, val)
self
diff --git a/ext/tk/lib/tk/menuspec.rb b/ext/tk/lib/tk/menuspec.rb
index d9322c998..2a2eb9ba3 100644
--- a/ext/tk/lib/tk/menuspec.rb
+++ b/ext/tk/lib/tk/menuspec.rb
@@ -155,15 +155,12 @@ module TkMenuSpec
def _use_menubar?(parent)
use_menubar = false
if parent.kind_of?(Tk::Root) || parent.kind_of?(Tk::Toplevel)
- return true
+ true
+ elsif parent.current_configinfo.has_key?('menu')
+ true
else
- begin
- parent.cget('menu')
- return true
- rescue
- end
+ false
end
- false
end
private :_use_menubar?
@@ -171,7 +168,7 @@ module TkMenuSpec
#unless (mbar = parent.menu).kind_of?(TkMenu)
# --> use current TkMenu class
mbar = parent.menu
- unless parent.menu.kind_of?(Tk::Menu) || parent.menu.kind_of?(TkMenu)
+ unless mbar.kind_of?(Tk::Menu) || mbar.kind_of?(TkMenu)
#mbar = Tk::Menu.new(parent, :tearoff=>false)
mbar = TkMenu.new(parent, :tearoff=>false)
parent.menu(mbar)
@@ -198,7 +195,6 @@ module TkMenuSpec
if _use_menubar?(parent)
# menubar by menu entries
-
mbar = _create_menu_for_menubar(parent)
menu_name = nil
diff --git a/ext/tk/lib/tk/namespace.rb b/ext/tk/lib/tk/namespace.rb
index 9d2213ff5..20a8d6521 100644
--- a/ext/tk/lib/tk/namespace.rb
+++ b/ext/tk/lib/tk/namespace.rb
@@ -83,6 +83,20 @@ class TkNamespace < TkObject
super(slot)
end
end
+ def cget_strict(slot)
+ if slot == :namespace || slot == 'namespace'
+ ns = super(slot)
+ Tk_Namespace_ID_TBL.mutex.synchronize{
+ 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
diff --git a/ext/tk/lib/tk/pack.rb b/ext/tk/lib/tk/pack.rb
index 8fab36312..220a38e52 100644
--- a/ext/tk/lib/tk/pack.rb
+++ b/ext/tk/lib/tk/pack.rb
@@ -9,6 +9,7 @@ module TkPack
TkCommandNames = ['pack'.freeze].freeze
+=begin
def configure(win, *args)
if args[-1].kind_of?(Hash)
opts = args.pop
@@ -29,6 +30,22 @@ module TkPack
}
tk_call_without_enc("pack", 'configure', *params)
end
+=end
+ def configure(*args)
+ if args[-1].kind_of?(Hash)
+ opts = args.pop
+ else
+ opts = {}
+ end
+ fail ArgumentError, 'no widget is given' if args.empty?
+ params = []
+ args.flatten(1).each{|win| params.push(_epath(win))}
+ opts.each{|k, v|
+ params.push("-#{k}")
+ params.push(_epath(v)) # have to use 'epath' (hash_kv() is unavailable)
+ }
+ tk_call_without_enc("pack", 'configure', *params)
+ end
alias pack configure
def forget(*args)
diff --git a/ext/tk/lib/tk/palette.rb b/ext/tk/lib/tk/palette.rb
index 2b6fdf5d9..2d08d50f6 100644
--- a/ext/tk/lib/tk/palette.rb
+++ b/ext/tk/lib/tk/palette.rb
@@ -15,7 +15,7 @@ module TkPalette
].freeze
def TkPalette.set(*args)
- args = args.to_a.flatten if args.kind_of? Hash
+ args = args[0].to_a.flatten if args[0].kind_of? Hash
tk_call('tk_setPalette', *args)
end
def TkPalette.setPalette(*args)
diff --git a/ext/tk/lib/tk/panedwindow.rb b/ext/tk/lib/tk/panedwindow.rb
index ba8a7e974..030144e67 100644
--- a/ext/tk/lib/tk/panedwindow.rb
+++ b/ext/tk/lib/tk/panedwindow.rb
@@ -76,11 +76,32 @@ class Tk::PanedWindow<TkWindow
self
end
- def panecget(win, key)
+ def panecget_strict(win, key)
# win = win.epath if win.kind_of?(TkObject)
win = _epath(win)
tk_tcl2ruby(tk_send_without_enc('panecget', win, "-#{key}"))
end
+ def panecget(win, key)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ panecget_strict(win, key)
+ else
+ begin
+ panecget_strict(win, key)
+ rescue => e
+ begin
+ if current_paneconfiginfo(win).has_key?(option.to_s)
+ # not tag error & option is known -> error on known option
+ fail e
+ else
+ # not tag error & option is unknown
+ nil
+ end
+ rescue
+ fail e # tag error
+ end
+ end
+ end
+ end
def paneconfigure(win, key, value=nil)
# win = win.epath if win.kind_of?(TkObject)
diff --git a/ext/tk/lib/tk/scale.rb b/ext/tk/lib/tk/scale.rb
index bf2791ec5..7e758d92f 100644
--- a/ext/tk/lib/tk/scale.rb
+++ b/ext/tk/lib/tk/scale.rb
@@ -26,9 +26,16 @@ class Tk::Scale<TkWindow
tk_call_without_enc(self.class::TkCommandNames[0], @path)
keys = __check_available_configure_options(keys)
unless keys.empty?
- tk_call_without_enc('destroy', @path)
- tk_call_without_enc(self.class::TkCommandNames[0], @path,
- *hash_kv(keys, true))
+ begin
+ tk_call_without_enc('destroy', @path)
+ rescue
+ # cannot destroy
+ configure(keys)
+ else
+ # re-create widget
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
+ end
end
end
end
diff --git a/ext/tk/lib/tk/scrollbar.rb b/ext/tk/lib/tk/scrollbar.rb
index 521fc7e40..87db46a9f 100644
--- a/ext/tk/lib/tk/scrollbar.rb
+++ b/ext/tk/lib/tk/scrollbar.rb
@@ -31,9 +31,16 @@ class Tk::Scrollbar<TkWindow
tk_call_without_enc(self.class::TkCommandNames[0], @path)
keys = __check_available_configure_options(keys)
unless keys.empty?
- tk_call_without_enc('destroy', @path)
- tk_call_without_enc(self.class::TkCommandNames[0], @path,
- *hash_kv(keys, true))
+ begin
+ tk_call_without_enc('destroy', @path)
+ rescue
+ # cannot destroy
+ configure(keys)
+ else
+ # re-create widget
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
+ end
end
end
end
diff --git a/ext/tk/lib/tk/spinbox.rb b/ext/tk/lib/tk/spinbox.rb
index e372c5800..34dc1904f 100644
--- a/ext/tk/lib/tk/spinbox.rb
+++ b/ext/tk/lib/tk/spinbox.rb
@@ -37,6 +37,7 @@ class Tk::Spinbox<Tk::Entry
nil
]
+=begin
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
KEY_TBL.map!{|inf|
if inf.kind_of?(Array)
@@ -52,6 +53,7 @@ class Tk::Spinbox<Tk::Entry
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL);
diff --git a/ext/tk/lib/tk/text.rb b/ext/tk/lib/tk/text.rb
index 14b9be23f..4ec82bed1 100644
--- a/ext/tk/lib/tk/text.rb
+++ b/ext/tk/lib/tk/text.rb
@@ -32,31 +32,37 @@ module TkTextTagConfig
def tag_cget(tagOrId, option)
itemcget(['tag', tagOrId], option)
end
+ def tag_cget_strict(tagOrId, option)
+ itemcget_strict(['tag', tagOrId], option)
+ end
def tag_configure(tagOrId, slot, value=None)
itemconfigure(['tag', tagOrId], slot, value)
end
def tag_configinfo(tagOrId, slot=nil)
- itemconfigure(['tag', tagOrId], slot)
+ itemconfiginfo(['tag', tagOrId], slot)
end
def current_tag_configinfo(tagOrId, slot=nil)
- itemconfigure(['tag', tagOrId], slot)
+ current_itemconfiginfo(['tag', tagOrId], slot)
end
def window_cget(tagOrId, option)
itemcget(['window', tagOrId], option)
end
+ def window_cget_strict(tagOrId, option)
+ itemcget_strict(['window', tagOrId], option)
+ end
def window_configure(tagOrId, slot, value=None)
itemconfigure(['window', tagOrId], slot, value)
end
def window_configinfo(tagOrId, slot=nil)
- itemconfigure(['window', tagOrId], slot)
+ itemconfiginfo(['window', tagOrId], slot)
end
def current_window_configinfo(tagOrId, slot=nil)
- itemconfigure(['window', tagOrId], slot)
+ current_itemconfiginfo(['window', tagOrId], slot)
end
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
end
class Tk::Text<TkTextWin
@@ -403,7 +409,7 @@ class Tk::Text<TkTextWin
end
alias previous_mark mark_previous
- def image_cget(index, slot)
+ def image_cget_strict(index, slot)
case slot.to_s
when 'text', 'label', 'show', 'data', 'file'
_fromUTF8(tk_send_without_enc('image', 'cget',
@@ -415,6 +421,28 @@ class Tk::Text<TkTextWin
end
end
+ def image_cget(index, slot)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ image_cget_strict(index, slot)
+ else
+ begin
+ image_cget_strict(index, slot)
+ rescue => e
+ begin
+ if current_image_configinfo(index).has_key?(slot.to_s)
+ # not tag error & option is known -> error on known option
+ fail e
+ else
+ # not tag error & option is unknown
+ nil
+ end
+ rescue
+ fail e # tag error
+ end
+ end
+ end
+ end
+
def image_configure(index, slot, value=None)
if slot.kind_of?(Hash)
_fromUTF8(tk_send_without_enc('image', 'configure',
diff --git a/ext/tk/lib/tk/textimage.rb b/ext/tk/lib/tk/textimage.rb
index d4c973213..fb306a9c1 100644
--- a/ext/tk/lib/tk/textimage.rb
+++ b/ext/tk/lib/tk/textimage.rb
@@ -52,6 +52,10 @@ class TkTextImage<TkObject
@t.image_cget(@index, slot)
end
+ def cget_strict(slot)
+ @t.image_cget_strict(@index, slot)
+ end
+
def configure(slot, value=None)
@t.image_configure(@index, slot, value)
self
diff --git a/ext/tk/lib/tk/texttag.rb b/ext/tk/lib/tk/texttag.rb
index 792d544fe..b08d923ea 100644
--- a/ext/tk/lib/tk/texttag.rb
+++ b/ext/tk/lib/tk/texttag.rb
@@ -132,6 +132,9 @@ class TkTextTag<TkObject
def cget(key)
@t.tag_cget @id, key
end
+ def cget_strict(key)
+ @t.tag_cget_strict @id, key
+ end
=begin
def cget(key)
case key.to_s
diff --git a/ext/tk/lib/tk/textwindow.rb b/ext/tk/lib/tk/textwindow.rb
index a57732935..004422e4f 100644
--- a/ext/tk/lib/tk/textwindow.rb
+++ b/ext/tk/lib/tk/textwindow.rb
@@ -72,6 +72,9 @@ class TkTextWindow<TkObject
def cget(slot)
@t.window_cget(@index, slot)
end
+ def cget_strict(slot)
+ @t.window_cget_strict(@index, slot)
+ end
def configure(slot, value=None)
if slot.kind_of?(Hash)
diff --git a/ext/tk/lib/tk/timer.rb b/ext/tk/lib/tk/timer.rb
index 3588f0c48..91840d057 100644
--- a/ext/tk/lib/tk/timer.rb
+++ b/ext/tk/lib/tk/timer.rb
@@ -111,7 +111,8 @@ class TkTimer
if @running == false || @proc_max == 0 || @do_loop == 0
Tk_CBTBL.delete(@id) ;# for GC
@running = false
- @wait_var.value = 0
+ # @wait_var.value = 0
+ __at_end__
return
end
if @current_pos >= @proc_max
@@ -120,7 +121,8 @@ class TkTimer
else
Tk_CBTBL.delete(@id) ;# for GC
@running = false
- @wait_var.value = 0
+ # @wait_var.value = 0
+ __at_end__
return
end
end
@@ -151,6 +153,8 @@ class TkTimer
@wait_var = TkVariable.new(0)
+ @at_end_proc = nil
+
@cb_cmd = TkCore::INTERP.get_cb_entry(self.method(:do_callback))
@set_next = true
@@ -210,6 +214,12 @@ class TkTimer
attr_accessor :loop_exec
+ def __at_end__
+ @at_end_proc.call(self) if @at_end_proc
+ @wait_var.value = 0 # for wait
+ end
+ private :__at_end__
+
def cb_call
@cb_cmd.call
end
@@ -427,7 +437,8 @@ class TkTimer
def cancel
@running = false
- @wait_var.value = 0
+ # @wait_var.value = 0
+ __at_end__
tk_call 'after', 'cancel', @after_id if @after_id
@after_id = nil
@@ -471,6 +482,21 @@ class TkTimer
end
end
+ def at_end(*arg, &b)
+ if arg.empty?
+ if b
+ @at_end_proc = b
+ else
+ # no proc
+ return @at_end_proc
+ end
+ else
+ fail ArgumentError, "wrong number of arguments" if arg.length != 1 || b
+ @at_end_proc = arg[0]
+ end
+ self
+ end
+
def wait(on_thread = true, check_root = false)
if $SAFE >= 4
fail SecurityError, "can't wait timer at $SAFE >= 4"
@@ -569,7 +595,8 @@ class TkRTTimer < TkTimer
if @running == false || @proc_max == 0 || @do_loop == 0
Tk_CBTBL.delete(@id) ;# for GC
@running = false
- @wait_var.value = 0
+ # @wait_var.value = 0
+ __at_end__
return
end
if @current_pos >= @proc_max
@@ -578,7 +605,8 @@ class TkRTTimer < TkTimer
else
Tk_CBTBL.delete(@id) ;# for GC
@running = false
- @wait_var.value = 0
+ # @wait_var.value = 0
+ __at_end__
return
end
end
diff --git a/ext/tk/lib/tk/toplevel.rb b/ext/tk/lib/tk/toplevel.rb
index 2d99eda44..bd6e8307f 100644
--- a/ext/tk/lib/tk/toplevel.rb
+++ b/ext/tk/lib/tk/toplevel.rb
@@ -72,7 +72,7 @@ class Tk::Toplevel<TkWindow
conf_methods = _symbolkey2str(__methodcall_optkeys())
- keys.each{|k,v|
+ keys.each{|k,v| # k is a String
if conf_methods.key?(k)
wm_cmds[conf_methods[k]] = v
elsif Wm.method_defined?(k)
diff --git a/ext/tk/lib/tk/validation.rb b/ext/tk/lib/tk/validation.rb
index 1da38c776..60bd433cd 100644
--- a/ext/tk/lib/tk/validation.rb
+++ b/ext/tk/lib/tk/validation.rb
@@ -50,7 +50,8 @@ module Tk
key2class.each{|key, klass|
if keys[key].kind_of?(Array)
cmd, *args = keys[key]
- keys[key] = klass.new(cmd, args.join(' '))
+ #keys[key] = klass.new(cmd, args.join(' '))
+ keys[key] = klass.new(cmd, *args)
# elsif keys[key].kind_of?(Proc) || keys[key].kind_of?(Method)
elsif TkComm._callback_entry?(keys[key])
keys[key] = klass.new(keys[key])
@@ -151,7 +152,8 @@ module Tk
key2class.each{|key, klass|
if keys[key].kind_of?(Array)
cmd, *args = keys[key]
- keys[key] = klass.new(cmd, args.join(' '))
+ #keys[key] = klass.new(cmd, args.join(' '))
+ keys[key] = klass.new(cmd, *args)
# elsif keys[key].kind_of?(Proc) || keys[key].kind_of?(Method)
elsif TkComm._callback_entry?(keys[key])
keys[key] = klass.new(keys[key])
@@ -249,6 +251,7 @@ class TkValidateCommand
nil
]
+=begin
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
KEY_TBL.map!{|inf|
if inf.kind_of?(Array)
@@ -264,6 +267,7 @@ class TkValidateCommand
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL);
@@ -293,6 +297,7 @@ class TkValidateCommand
extra_args_tbl = klass._get_extra_args_tbl
if args.compact.size > 0
+ args.map!{|arg| klass._sym2subst(arg)}
args = args.join(' ')
keys = klass._get_subst_key(args)
if cmd.kind_of?(String)
diff --git a/ext/tk/lib/tk/wm.rb b/ext/tk/lib/tk/wm.rb
index 49dd4d73c..039429618 100644
--- a/ext/tk/lib/tk/wm.rb
+++ b/ext/tk/lib/tk/wm.rb
@@ -362,7 +362,7 @@ module Tk
end
end
def overrideredirect(mode=TkComm::None)
- Wm.overrideredirect(self, mode=TkComm::None)
+ Wm.overrideredirect(self, mode)
end
alias wm_overrideredirect overrideredirect
TOPLEVEL_METHODCALL_OPTKEYS['overrideredirect'] = 'overrideredirect'
@@ -545,7 +545,7 @@ module Tk
module Wm_for_General
Wm.instance_methods.each{|m|
if (m = m.to_s) =~ /^wm_(.*)$/
- eval "def #{m}(*args); Tk::Wm.#{$1}(self, *args); end"
+ eval "def #{m}(*args, &b); Tk::Wm.#{$1}(self, *args, &b); end"
end
}
end
diff --git a/ext/tk/lib/tkextlib/blt/component.rb b/ext/tk/lib/tkextlib/blt/component.rb
index dd387634e..b2005b2f2 100644
--- a/ext/tk/lib/tkextlib/blt/component.rb
+++ b/ext/tk/lib/tkextlib/blt/component.rb
@@ -85,6 +85,9 @@ module Tk::BLT
def axis_cget(id, option)
ret = itemcget(['axis', tagid(id)], option)
end
+ def axis_cget_strict(id, option)
+ ret = itemcget_strict(['axis', tagid(id)], option)
+ end
def axis_configure(*args)
slot = args.pop
if slot.kind_of?(Hash)
@@ -118,6 +121,9 @@ module Tk::BLT
def crosshairs_cget(option)
itemcget('crosshairs', option)
end
+ def crosshairs_cget_strict(option)
+ itemcget_strict('crosshairs', option)
+ end
def crosshairs_configure(slot, value=None)
itemconfigure('crosshairs', slot, value)
end
@@ -131,6 +137,9 @@ module Tk::BLT
def element_cget(id, option)
itemcget(['element', tagid(id)], option)
end
+ def element_cget_strict(id, option)
+ itemcget_strict(['element', tagid(id)], option)
+ end
def element_configure(*args)
slot = args.pop
if slot.kind_of?(Hash)
@@ -152,6 +161,9 @@ module Tk::BLT
def bar_cget(id, option)
itemcget(['bar', tagid(id)], option)
end
+ def bar_cget_strict(id, option)
+ itemcget_strict(['bar', tagid(id)], option)
+ end
def bar_configure(*args)
slot = args.pop
if slot.kind_of?(Hash)
@@ -173,6 +185,9 @@ module Tk::BLT
def line_cget(id, option)
itemcget(['line', tagid(id)], option)
end
+ def line_cget_strict(id, option)
+ itemcget_strict(['line', tagid(id)], option)
+ end
def line_configure(*args)
slot = args.pop
if slot.kind_of?(Hash)
@@ -194,6 +209,9 @@ module Tk::BLT
def gridline_cget(option)
itemcget('grid', option)
end
+ def gridline_cget_strict(option)
+ itemcget_strict('grid', option)
+ end
def gridline_configure(slot, value=None)
itemconfigure('grid', slot, value)
end
@@ -207,6 +225,9 @@ module Tk::BLT
def legend_cget(option)
itemcget('legend', option)
end
+ def legend_cget_strict(option)
+ itemcget_strict('legend', option)
+ end
def legend_configure(slot, value=None)
itemconfigure('legend', slot, value)
end
@@ -220,6 +241,9 @@ module Tk::BLT
def pen_cget(id, option)
itemcget(['pen', tagid(id)], option)
end
+ def pen_cget_strict(id, option)
+ itemcget_strict(['pen', tagid(id)], option)
+ end
def pen_configure(*args)
slot = args.pop
if slot.kind_of?(Hash)
@@ -241,6 +265,9 @@ module Tk::BLT
def postscript_cget(option)
itemcget('postscript', option)
end
+ def postscript_cget_strict(option)
+ itemcget_strict('postscript', option)
+ end
def postscript_configure(slot, value=None)
itemconfigure('postscript', slot, value)
end
@@ -254,6 +281,9 @@ module Tk::BLT
def marker_cget(id, option)
itemcget(['marker', tagid(id)], option)
end
+ def marker_cget_strict(id, option)
+ itemcget_strict(['marker', tagid(id)], option)
+ end
def marker_configure(*args)
slot = args.pop
if slot.kind_of?(Hash)
@@ -273,11 +303,12 @@ module Tk::BLT
end
alias __itemcget itemcget
+ alias __itemcget_strict itemcget_strict
alias __itemconfiginfo itemconfiginfo
alias __current_itemconfiginfo current_itemconfiginfo
private :__itemcget, :__itemconfiginfo, :__current_itemconfiginfo
- def itemcget(tagOrId, option)
+ def itemcget_strict(tagOrId, option)
ret = __itemcget(tagid(tagOrId), option)
if option == 'bindtags' || option == :bindtags
ret.collect{|tag| TkBindTag.id2obj(tag)}
@@ -285,6 +316,27 @@ module Tk::BLT
ret
end
end
+ def itemcget(tagOrId, option)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ itemcget_strict(tagOrId, option)
+ else
+ begin
+ itemcget_strict(tagOrId, option)
+ rescue => e
+ begin
+ if current_itemconfiginfo(tagOrId).has_key?(option.to_s)
+ # error on known option
+ fail e
+ else
+ # unknown option
+ nil
+ end
+ rescue
+ fail e # tag error
+ end
+ end
+ end
+ end
def itemconfiginfo(tagOrId, slot = nil)
ret = __itemconfiginfo(tagid(tagOrId), slot)
@@ -321,8 +373,8 @@ module Tk::BLT
ret
end
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
#################
@@ -428,6 +480,9 @@ module Tk::BLT
def cget(option)
@chart.axis_cget(@id, option)
end
+ def cget_strict(option)
+ @chart.axis_cget_strict(@id, option)
+ end
def configure(key, value=None)
@chart.axis_configure(@id, key, value)
self
@@ -530,6 +585,9 @@ module Tk::BLT
def cget(option)
@chart.crosshair_cget(option)
end
+ def cget_strict(option)
+ @chart.crosshair_cget_strict(option)
+ end
def configure(key, value=None)
@chart.crosshair_configure(key, value)
self
@@ -675,6 +733,9 @@ module Tk::BLT
# @chart.element_cget(@id, option)
@chart.__send__(@typename + '_cget', @id, option)
end
+ def cget_strict(option)
+ @chart.__send__(@typename + '_cget_strict', @id, option)
+ end
def configure(key, value=None)
# @chart.element_configure(@id, key, value)
@chart.__send__(@typename + '_configure', @id, key, value)
@@ -775,6 +836,9 @@ module Tk::BLT
def cget(option)
@chart.gridline_cget(option)
end
+ def cget_strict(option)
+ @chart.gridline_cget_strict(option)
+ end
def configure(key, value=None)
@chart.gridline_configure(key, value)
self
@@ -846,6 +910,9 @@ module Tk::BLT
def cget(option)
@chart.legend_cget(option)
end
+ def cget_strict(option)
+ @chart.legend_cget_strict(option)
+ end
def configure(key, value=None)
@chart.legend_configure(key, value)
self
@@ -972,6 +1039,9 @@ module Tk::BLT
def cget(option)
@chart.pen_cget(@id, option)
end
+ def cget_strict(option)
+ @chart.pen_cget_strict(@id, option)
+ end
def configure(key, value=None)
@chart.pen_configure(@id, key, value)
self
@@ -1039,6 +1109,9 @@ module Tk::BLT
def cget(option)
@chart.postscript_cget(option)
end
+ def cget_strict(option)
+ @chart.postscript_cget_strict(option)
+ end
def configure(key, value=None)
@chart.postscript_configure(key, value)
self
@@ -1117,6 +1190,13 @@ module Tk::BLT
fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
}
+ __item_optkey_aliases(nil).each{|alias_name, real_name|
+ alias_name = alias_name.to_s
+ if keys.has_key?(alias_name)
+ keys[real_name.to_s] = keys.delete(alias_name)
+ end
+ }
+
__item_methodcall_optkeys(nil).each{|key|
key = key.to_s
methodkeys[key] = keys.delete(key) if keys.key?(key)
@@ -1192,6 +1272,9 @@ module Tk::BLT
def cget(option)
@chart.marker_cget(@id, option)
end
+ def cget_strict(option)
+ @chart.marker_cget_strict(@id, option)
+ end
def configure(key, value=None)
@chart.marker_configure(@id, key, value)
self
@@ -1774,6 +1857,9 @@ module Tk::BLT
def xaxis_cget(option)
itemcget('xaxis', option)
end
+ def xaxis_cget_strict(option)
+ itemcget_strict('xaxis', option)
+ end
def xaxis_configure(slot, value=None)
if slot.kind_of?(Hash)
slot = _symbolkey2str(slot)
@@ -1843,6 +1929,9 @@ module Tk::BLT
def x2axis_cget(option)
itemcget('x2axis', option)
end
+ def x2axis_cget_strict(option)
+ itemcget_strict('x2axis', option)
+ end
def x2axis_configure(slot, value=None)
if slot.kind_of?(Hash)
slot = _symbolkey2str(slot)
@@ -1912,6 +2001,9 @@ module Tk::BLT
def yaxis_cget(option)
itemcget('yaxis', option)
end
+ def yaxis_cget_strict(option)
+ itemcget_strict('yaxis', option)
+ end
def yaxis_configure(slot, value=None)
if slot.kind_of?(Hash)
slot = _symbolkey2str(slot)
@@ -1981,6 +2073,9 @@ module Tk::BLT
def y2axis_cget(option)
itemcget('y2axis', option)
end
+ def y2axis_cget_strict(option)
+ itemcget_strict('y2axis', option)
+ end
def y2axis_configure(slot, value=None)
if slot.kind_of?(Hash)
slot = _symbolkey2str(slot)
diff --git a/ext/tk/lib/tkextlib/blt/dragdrop.rb b/ext/tk/lib/tkextlib/blt/dragdrop.rb
index 98b1a4832..201548504 100644
--- a/ext/tk/lib/tkextlib/blt/dragdrop.rb
+++ b/ext/tk/lib/tkextlib/blt/dragdrop.rb
@@ -81,6 +81,7 @@ module Tk::BLT
nil
]
+=begin
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
KEY_TBL.map!{|inf|
if inf.kind_of?(Array)
@@ -96,6 +97,7 @@ module Tk::BLT
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL)
@@ -123,6 +125,7 @@ module Tk::BLT
nil
]
+=begin
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
KEY_TBL.map!{|inf|
if inf.kind_of?(Array)
@@ -138,6 +141,7 @@ module Tk::BLT
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL)
@@ -177,6 +181,7 @@ module Tk::BLT
nil
]
+=begin
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
KEY_TBL.map!{|inf|
if inf.kind_of?(Array)
@@ -192,6 +197,7 @@ module Tk::BLT
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL)
end
diff --git a/ext/tk/lib/tkextlib/blt/htext.rb b/ext/tk/lib/tkextlib/blt/htext.rb
index a0cf3dc03..0d9cb3018 100644
--- a/ext/tk/lib/tkextlib/blt/htext.rb
+++ b/ext/tk/lib/tkextlib/blt/htext.rb
@@ -22,6 +22,7 @@ module Tk::BLT
WidgetClassNames[WidgetClassName] = self
alias window_cget itemcget
+ alias window_cget_strict itemcget_strict
alias window_configure itemconfigure
alias window_configuinfo itemconfiginfo
alias current_window_configuinfo current_itemconfiginfo
diff --git a/ext/tk/lib/tkextlib/blt/table.rb b/ext/tk/lib/tkextlib/blt/table.rb
index 0be9d8d42..dfa10269e 100644
--- a/ext/tk/lib/tkextlib/blt/table.rb
+++ b/ext/tk/lib/tkextlib/blt/table.rb
@@ -29,6 +29,9 @@ module Tk::BLT
def blt_table_cget(*args)
Tk::BLT::Table.cget(self, *args)
end
+ def blt_table_cget_strict(*args)
+ Tk::BLT::Table.cget_strict(self, *args)
+ end
def blt_table_configure(*args)
Tk::BLT::Table.configure(self, *args)
@@ -92,6 +95,9 @@ module Tk::BLT
def blt_table_itemcget(*args)
Tk::BLT::Table.itemcget(self, *args)
end
+ def blt_table_itemcget_strict(*args)
+ Tk::BLT::Table.itemcget_strict(self, *args)
+ end
def blt_table_itemconfigure(*args)
Tk::BLT::Table.itemconfigure(self, *args)
@@ -136,12 +142,13 @@ class << Tk::BLT::Table
private :__item_pathname
alias __itemcget itemcget
+ alias __itemcget_strict itemcget_strict
alias __itemconfigure itemconfigure
alias __itemconfiginfo itemconfiginfo
alias __current_itemconfiginfo current_itemconfiginfo
- private :__itemcget, :__itemconfigure
- private :__itemconfiginfo, :__current_itemconfiginfo
+ private :__itemcget, :__itemcget_strict
+ private :__itemconfigure, :__itemconfiginfo, :__current_itemconfiginfo
def __boolval_optkeys
super() << 'propagate'
@@ -176,6 +183,9 @@ class << Tk::BLT::Table
def cget(container, option)
__itemcget([container], option)
end
+ def cget_strict(container, option)
+ __itemcget_strict([container], option)
+ end
def configure(container, *args)
__itemconfigure([container], *args)
@@ -192,6 +202,9 @@ class << Tk::BLT::Table
def itemcget(container, item, option)
__itemcget([container, tagid(item)], option)
end
+ def itemcget_strict(container, item, option)
+ __itemcget_strict([container, tagid(item)], option)
+ end
def itemconfigure(container, *args)
if args[-1].kind_of?(Hash)
diff --git a/ext/tk/lib/tkextlib/blt/tabset.rb b/ext/tk/lib/tkextlib/blt/tabset.rb
index 1a0f312c4..ca81ad8f9 100644
--- a/ext/tk/lib/tkextlib/blt/tabset.rb
+++ b/ext/tk/lib/tkextlib/blt/tabset.rb
@@ -128,6 +128,9 @@ module Tk::BLT
def cget(*args)
@t.tab_cget(@id, *args)
end
+ def cget_strict(*args)
+ @t.tab_cget_strict(@id, *args)
+ end
def configure(*args)
@t.tab_configure(@id, *args)
end
@@ -240,6 +243,7 @@ module Tk::BLT
private :__item_pathname
alias tab_cget itemcget
+ alias tab_cget_strict itemcget_strict
alias tab_configure itemconfigure
alias tab_configinfo itemconfiginfo
alias current_tab_configinfo current_itemconfiginfo
diff --git a/ext/tk/lib/tkextlib/blt/ted.rb b/ext/tk/lib/tkextlib/blt/ted.rb
index 39495842b..670265fc7 100644
--- a/ext/tk/lib/tkextlib/blt/ted.rb
+++ b/ext/tk/lib/tkextlib/blt/ted.rb
@@ -30,11 +30,14 @@ module Tk::BLT
end
private :__item_config_cmd
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
def cget(master, option)
- itemconfigure(master, slot, value)
+ itemcget(master, option)
+ end
+ def cget_strict(master, option)
+ itemcget_strict(master, option)
end
def configure(master, slot, value=None)
itemconfigure(master, slot, value)
diff --git a/ext/tk/lib/tkextlib/blt/treeview.rb b/ext/tk/lib/tkextlib/blt/treeview.rb
index fc890614b..c5a569718 100644
--- a/ext/tk/lib/tkextlib/blt/treeview.rb
+++ b/ext/tk/lib/tkextlib/blt/treeview.rb
@@ -98,6 +98,9 @@ module Tk::BLT::Treeview::ConfigMethod
def column_cget(name, option)
itemcget(['column', name], option)
end
+ def column_cget_strict(name, option)
+ itemcget_strict(['column', name], option)
+ end
def column_configure(name, slot, value=None)
itemconfigure(['column', name], slot, value)
end
@@ -111,6 +114,9 @@ module Tk::BLT::Treeview::ConfigMethod
def button_cget(option)
itemcget('button', option)
end
+ def button_cget_strict(option)
+ itemcget_strict('button', option)
+ end
def button_configure(slot, value=None)
itemconfigure('button', slot, value)
end
@@ -129,6 +135,14 @@ module Tk::BLT::Treeview::ConfigMethod
ret
end
end
+ def entry_cget_strict(option)
+ ret = itemcget_strict('entry', option)
+ if option == 'bindtags' || option == :bindtags
+ ret.collect{|tag| TkBindTag.id2obj(tag)}
+ else
+ ret
+ end
+ end
def entry_configure(slot, value=None)
itemconfigure('entry', slot, value)
end
@@ -170,6 +184,9 @@ module Tk::BLT::Treeview::ConfigMethod
def sort_cget(option)
itemcget('sort', option)
end
+ def sort_cget_strict(option)
+ itemcget_strict('sort', option)
+ end
def sort_configure(slot, value=None)
itemconfigure('sort', slot, value)
end
@@ -183,6 +200,9 @@ module Tk::BLT::Treeview::ConfigMethod
def text_cget(option)
itemcget('text', option)
end
+ def text_cget_strict(option)
+ itemcget_strict('text', option)
+ end
def text_configure(slot, value=None)
itemconfigure('text', slot, value)
end
@@ -193,8 +213,8 @@ module Tk::BLT::Treeview::ConfigMethod
current_itemconfiginfo('text', slot)
end
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
end
class Tk::BLT::Treeview
@@ -239,6 +259,7 @@ class Tk::BLT::Treeview
nil
]
+=begin
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
KEY_TBL.map!{|inf|
if inf.kind_of?(Array)
@@ -254,6 +275,7 @@ class Tk::BLT::Treeview
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL);
@@ -492,6 +514,7 @@ class Tk::BLT::Treeview
nil
]
+=begin
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
KEY_TBL.map!{|inf|
if inf.kind_of?(Array)
@@ -507,6 +530,7 @@ class Tk::BLT::Treeview
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL);
@@ -523,7 +547,8 @@ class Tk::BLT::Treeview
def _find_exec_flag_value(val)
if val.kind_of?(Array)
cmd, *args = val
- FindExecFlagValue.new(cmd, args.join(' '))
+ #FindExecFlagValue.new(cmd, args.join(' '))
+ FindExecFlagValue.new(cmd, *args)
elsif TkComm._callback_entry?(val)
FindExecFlagValue.new(val)
else
diff --git a/ext/tk/lib/tkextlib/blt/unix_dnd.rb b/ext/tk/lib/tkextlib/blt/unix_dnd.rb
index 3130c1e56..445002d7a 100644
--- a/ext/tk/lib/tkextlib/blt/unix_dnd.rb
+++ b/ext/tk/lib/tkextlib/blt/unix_dnd.rb
@@ -30,11 +30,14 @@ module Tk::BLT
end
private :__item_config_cmd
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
def cget(win, option)
- itemconfigure(['cget', win], slot, value)
+ itemcget(['cget', win], option)
+ end
+ def cget_strict(win, option)
+ itemcget_strict(['cget', win], option)
end
def configure(win, slot, value=None)
itemconfigure(['configure', win], slot, value)
@@ -46,8 +49,11 @@ module Tk::BLT
current_itemconfiginfo(['configure', win], slot)
end
- def tokwn_cget(win, option)
- itemconfigure(['token', 'cget', win], slot, value)
+ def token_cget(win, option)
+ itemcget(['token', 'cget', win], option)
+ end
+ def token_cget_strict(win, option)
+ itemcget_strict(['token', 'cget', win], option)
end
def token_configure(win, slot, value=None)
itemconfigure(['token', 'configure', win], slot, value)
diff --git a/ext/tk/lib/tkextlib/blt/watch.rb b/ext/tk/lib/tkextlib/blt/watch.rb
index 2daf417e0..219ff78e9 100644
--- a/ext/tk/lib/tkextlib/blt/watch.rb
+++ b/ext/tk/lib/tkextlib/blt/watch.rb
@@ -146,7 +146,7 @@ module Tk::BLT
end
end
end
- def cget(key)
+ def cget_strict(key)
key = key.to_s
begin
info.assoc(key)[1]
@@ -154,5 +154,22 @@ module Tk::BLT
fail ArgumentError, "unknown option '#{key}'"
end
end
+ def cget(key)
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ cget_strict(key)
+ else
+ begin
+ cget_strict(key)
+ rescue => e
+ if current_configinfo.has_key?(key.to_s)
+ # error on known option
+ fail e
+ else
+ # unknown option
+ nil
+ end
+ end
+ end
+ end
end
end
diff --git a/ext/tk/lib/tkextlib/bwidget/dialog.rb b/ext/tk/lib/tkextlib/bwidget/dialog.rb
index 0ddee21d0..291ca4a96 100644
--- a/ext/tk/lib/tkextlib/bwidget/dialog.rb
+++ b/ext/tk/lib/tkextlib/bwidget/dialog.rb
@@ -59,6 +59,13 @@ class Tk::BWidget::Dialog
end
end
+ def cget_strict(slot)
+ if slot.to_s == 'relative'
+ super('parent')
+ else
+ super(slot)
+ end
+ end
def cget(slot)
if slot.to_s == 'relative'
super('parent')
diff --git a/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb b/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb
index 224304f2a..846e58062 100644
--- a/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb
+++ b/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb
@@ -34,6 +34,13 @@ module Tk::BWidget::DynamicHelp
['DynamicHelp::configure']
end
+ def self.cget_strict(slot)
+ slot = slot.to_s
+ info = {}
+ self.current_configinfo.each{|k,v| info[k.to_s] = v if k.to_s == slot}
+ fail RuntimeError, "unknown option \"-#{slot}\"" if info.empty?
+ info.values[0]
+ end
def self.cget(slot)
self.current_configinfo(slot).values[0]
end
diff --git a/ext/tk/lib/tkextlib/bwidget/listbox.rb b/ext/tk/lib/tkextlib/bwidget/listbox.rb
index d8cd72fec..093fcb6fb 100644
--- a/ext/tk/lib/tkextlib/bwidget/listbox.rb
+++ b/ext/tk/lib/tkextlib/bwidget/listbox.rb
@@ -297,6 +297,9 @@ class Tk::BWidget::ListBox::Item
def cget(key)
@listbox.itemcget(@id, key)
end
+ def cget_strict(key)
+ @listbox.itemcget_strict(@id, key)
+ end
def configure(key, val=None)
@listbox.itemconfigure(@id, key, val)
diff --git a/ext/tk/lib/tkextlib/bwidget/messagedlg.rb b/ext/tk/lib/tkextlib/bwidget/messagedlg.rb
index cc8a996f4..b88461baf 100644
--- a/ext/tk/lib/tkextlib/bwidget/messagedlg.rb
+++ b/ext/tk/lib/tkextlib/bwidget/messagedlg.rb
@@ -65,6 +65,17 @@ class Tk::BWidget::MessageDlg
end
@keys[slot]
end
+ def cget_strict(slot)
+ slot = slot.to_s
+ if slot == 'relative'
+ slot = 'parent'
+ end
+ if winfo_exist?
+ val = super(slot)
+ @keys[slot] = val
+ end
+ @keys[slot]
+ end
def configure(slot, value=None)
if winfo_exist?
diff --git a/ext/tk/lib/tkextlib/bwidget/tree.rb b/ext/tk/lib/tkextlib/bwidget/tree.rb
index 7a46db575..aed4512a7 100644
--- a/ext/tk/lib/tkextlib/bwidget/tree.rb
+++ b/ext/tk/lib/tkextlib/bwidget/tree.rb
@@ -358,6 +358,9 @@ class Tk::BWidget::Tree::Node
def cget(key)
@tree.itemcget(@id, key)
end
+ def cget_strict(key)
+ @tree.itemcget_strict(@id, key)
+ end
def configure(key, val=None)
@tree.itemconfigure(@id, key, val)
diff --git a/ext/tk/lib/tkextlib/bwidget/widget.rb b/ext/tk/lib/tkextlib/bwidget/widget.rb
index 34e51308a..a93364b56 100644
--- a/ext/tk/lib/tkextlib/bwidget/widget.rb
+++ b/ext/tk/lib/tkextlib/bwidget/widget.rb
@@ -29,6 +29,13 @@ module Tk::BWidget::Widget
['Widget::configure']
end
+ def self.cget_strict(slot)
+ slot = slot.to_s
+ info = {}
+ self.current_configinfo.each{|k,v| info[k.to_s] = v if k.to_s == slot}
+ fail RuntimeError, "unknown option \"-#{slot}\"" if info.empty?
+ info.values[0]
+ end
def self.cget(slot)
self.current_configinfo(slot).values[0]
end
@@ -105,9 +112,12 @@ module Tk::BWidget::Widget
tk_call('Widget::setoption', win, option, value)
end
- def self.sub_cget(win, subwidget)
+ def self.sub_cget_strict(win, subwidget)
tk_call('Widget::subcget', win, subwidget)
end
+ def self.sub_cget(win, subwidget)
+ self.sub_cget_strict(win, subwidget)
+ end
def self.sync_options(klass, subclass, subpath, options)
tk_call('Widget::syncoptions', klass, subclass, subpath, options)
diff --git a/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb b/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb
index a055e07ac..05d58c386 100644
--- a/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb
@@ -47,12 +47,13 @@ class Tk::Iwidgets::Buttonbox
end
alias buttoncget itemcget
+ alias buttoncget_strict itemcget_strict
alias buttonconfigure itemconfigure
alias buttonconfiginfo itemconfiginfo
alias current_buttonconfiginfo current_itemconfiginfo
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
####################################
diff --git a/ext/tk/lib/tkextlib/iwidgets/calendar.rb b/ext/tk/lib/tkextlib/iwidgets/calendar.rb
index 236ca96f0..8495f0e29 100644
--- a/ext/tk/lib/tkextlib/iwidgets/calendar.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/calendar.rb
@@ -46,6 +46,7 @@ class Tk::Iwidgets::Calendar
KEY_TBL = [ [?d, ?s, :date], nil ]
PROC_TBL = [ [?s, TkComm.method(:string) ], nil ]
+=begin
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
KEY_TBL.map!{|inf|
if inf.kind_of?(Array)
@@ -61,6 +62,7 @@ class Tk::Iwidgets::Calendar
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL);
diff --git a/ext/tk/lib/tkextlib/iwidgets/checkbox.rb b/ext/tk/lib/tkextlib/iwidgets/checkbox.rb
index 7d2b41f80..c85d356c5 100644
--- a/ext/tk/lib/tkextlib/iwidgets/checkbox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/checkbox.rb
@@ -47,12 +47,13 @@ class Tk::Iwidgets::Checkbox
end
alias buttoncget itemcget
+ alias buttoncget_strict itemcget_strict
alias buttonconfigure itemconfigure
alias buttonconfiginfo itemconfiginfo
alias current_buttonconfiginfo current_itemconfiginfo
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
####################################
diff --git a/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb b/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb
index d6c668621..8d43cc07a 100644
--- a/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb
@@ -47,12 +47,13 @@ class Tk::Iwidgets::Dialogshell
end
alias buttoncget itemcget
+ alias buttoncget_strict itemcget_strict
alias buttonconfigure itemconfigure
alias buttonconfiginfo itemconfiginfo
alias current_buttonconfiginfo current_itemconfiginfo
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
####################################
diff --git a/ext/tk/lib/tkextlib/iwidgets/entryfield.rb b/ext/tk/lib/tkextlib/iwidgets/entryfield.rb
index 1f9effb46..d53df216b 100644
--- a/ext/tk/lib/tkextlib/iwidgets/entryfield.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/entryfield.rb
@@ -43,6 +43,7 @@ class Tk::Iwidgets::Entryfield
nil
]
+=begin
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
KEY_TBL.map!{|inf|
if inf.kind_of?(Array)
@@ -58,6 +59,7 @@ class Tk::Iwidgets::Entryfield
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL);
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb b/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb
index 4e7d8f857..d9220fecb 100644
--- a/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb
@@ -31,6 +31,7 @@ class Tk::Iwidgets::Hierarchy
KEY_TBL = [ [?n, ?s, :node], nil ]
PROC_TBL = [ [?s, TkComm.method(:string) ], nil ]
+=begin
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
KEY_TBL.map!{|inf|
if inf.kind_of?(Array)
@@ -46,6 +47,7 @@ class Tk::Iwidgets::Hierarchy
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL);
@@ -74,6 +76,7 @@ class Tk::Iwidgets::Hierarchy
nil
]
+=begin
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
KEY_TBL.map!{|inf|
if inf.kind_of?(Array)
@@ -89,6 +92,7 @@ class Tk::Iwidgets::Hierarchy
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL);
@@ -112,6 +116,7 @@ class Tk::Iwidgets::Hierarchy
]
PROC_TBL = [ [ ?s, TkComm.method(:string) ], nil ]
+=begin
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
KEY_TBL.map!{|inf|
if inf.kind_of?(Array)
@@ -127,6 +132,7 @@ class Tk::Iwidgets::Hierarchy
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL);
diff --git a/ext/tk/lib/tkextlib/iwidgets/menubar.rb b/ext/tk/lib/tkextlib/iwidgets/menubar.rb
index dea3d34c2..5aaefbe50 100644
--- a/ext/tk/lib/tkextlib/iwidgets/menubar.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/menubar.rb
@@ -62,12 +62,13 @@ class Tk::Iwidgets::Menubar
end
alias menucget itemcget
+ alias menucget_strict itemcget_strict
alias menuconfigure itemconfigure
alias menuconfiginfo itemconfiginfo
alias current_menuconfiginfo current_itemconfiginfo
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
####################################
diff --git a/ext/tk/lib/tkextlib/iwidgets/messagebox.rb b/ext/tk/lib/tkextlib/iwidgets/messagebox.rb
index 2bbbec766..98ac32900 100644
--- a/ext/tk/lib/tkextlib/iwidgets/messagebox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/messagebox.rb
@@ -47,12 +47,13 @@ class Tk::Iwidgets::Messagebox
private :__item_boolval_optkeys
alias typecget itemcget
+ alias typecget_strict itemcget_strict
alias typeconfigure itemconfigure
alias typeconfiginfo itemconfiginfo
alias current_typeconfiginfo current_itemconfiginfo
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
####################################
diff --git a/ext/tk/lib/tkextlib/iwidgets/notebook.rb b/ext/tk/lib/tkextlib/iwidgets/notebook.rb
index 268452afe..03b50633d 100644
--- a/ext/tk/lib/tkextlib/iwidgets/notebook.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/notebook.rb
@@ -42,12 +42,13 @@ class Tk::Iwidgets::Notebook
end
alias pagecget itemcget
+ alias pagecget_strict itemcget_strict
alias pageconfigure itemconfigure
alias pageconfiginfo itemconfiginfo
alias current_pageconfiginfo current_itemconfiginfo
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
####################################
diff --git a/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb b/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb
index 035df0a5b..3bf73d69f 100644
--- a/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb
@@ -42,12 +42,13 @@ class Tk::Iwidgets::Panedwindow
end
alias panecget itemcget
+ alias panecget_strict itemcget_strict
alias paneconfigure itemconfigure
alias paneconfiginfo itemconfiginfo
alias current_paneconfiginfo current_itemconfiginfo
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
####################################
diff --git a/ext/tk/lib/tkextlib/iwidgets/radiobox.rb b/ext/tk/lib/tkextlib/iwidgets/radiobox.rb
index cfcbca1aa..e9d952125 100644
--- a/ext/tk/lib/tkextlib/iwidgets/radiobox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/radiobox.rb
@@ -47,12 +47,13 @@ class Tk::Iwidgets::Radiobox
end
alias buttoncget itemcget
+ alias buttoncget_strict itemcget_strict
alias buttonconfigure itemconfigure
alias buttonconfiginfo itemconfiginfo
alias current_buttonconfiginfo current_itemconfiginfo
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
####################################
diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb
index b07602e34..67ad67d07 100644
--- a/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb
@@ -37,7 +37,7 @@ class Tk::Iwidgets::Scrolledcanvas
end
def method_missing(id, *args)
- if @canvas.methods.include?(id.id2name)
+ if @canvas.respond_to?(id)
@canvas.__send__(id, *args)
else
super(id, *args)
diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb
index cd1f6f0f7..7543d557e 100644
--- a/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb
@@ -42,7 +42,7 @@ class Tk::Iwidgets::Scrolledlistbox
end
def method_missing(id, *args)
- if @listbox.methods.include?(id.id2name)
+ if @listbox.respond_to?(id)
@listbox.__send__(id, *args)
else
super(id, *args)
diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb
index 2887b6081..d6436d202 100644
--- a/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb
@@ -37,7 +37,7 @@ class Tk::Iwidgets::Scrolledtext
end
def method_missing(id, *args)
- if @text.methods.include?(id.id2name)
+ if @text.respond_to?(id)
@text.__send__(id, *args)
else
super(id, *args)
@@ -116,7 +116,7 @@ class Tk::Iwidgets::Scrolledtext
get('-displaychars', *index)
end
- def image_cget(index, slot)
+ def image_cget_strict(index, slot)
case slot.to_s
when 'text', 'label', 'show', 'data', 'file'
_fromUTF8(tk_send_without_enc('image', 'cget',
@@ -127,6 +127,27 @@ class Tk::Iwidgets::Scrolledtext
"-#{slot}")))
end
end
+ def image_cget(index, slot)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ image_cget_strict(index, slot)
+ else
+ begin
+ image_cget_strict(index, slot)
+ rescue => e
+ begin
+ if current_image_configinfo.has_key?(slot.to_s)
+ # error on known option
+ fail e
+ else
+ # unknown option
+ nil
+ end
+ rescue
+ fail e # tag error
+ end
+ end
+ end
+ end
def image_configure(index, slot, value=None)
if slot.kind_of? Hash
diff --git a/ext/tk/lib/tkextlib/iwidgets/spinner.rb b/ext/tk/lib/tkextlib/iwidgets/spinner.rb
index 126cfe7c9..aeee5c903 100644
--- a/ext/tk/lib/tkextlib/iwidgets/spinner.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/spinner.rb
@@ -38,6 +38,7 @@ class Tk::Iwidgets::Spinner
nil
]
+=begin
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
KEY_TBL.map!{|inf|
if inf.kind_of?(Array)
@@ -53,6 +54,7 @@ class Tk::Iwidgets::Spinner
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL);
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb b/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb
index 382604102..dbb90e510 100644
--- a/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb
@@ -47,12 +47,13 @@ class Tk::Iwidgets::Tabnotebook
end
alias pagecget itemcget
+ alias pagecget_strict itemcget_strict
alias pageconfigure itemconfigure
alias pageconfiginfo itemconfiginfo
alias current_pageconfiginfo current_itemconfiginfo
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
####################################
diff --git a/ext/tk/lib/tkextlib/iwidgets/tabset.rb b/ext/tk/lib/tkextlib/iwidgets/tabset.rb
index 618260e8e..300ba9dee 100644
--- a/ext/tk/lib/tkextlib/iwidgets/tabset.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/tabset.rb
@@ -42,12 +42,13 @@ class Tk::Iwidgets::Tabset
end
alias tabcget itemcget
+ alias tabcget_strict itemcget_strict
alias tabconfigure itemconfigure
alias tabconfiginfo itemconfiginfo
alias current_tabconfiginfo current_itemconfiginfo
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
####################################
diff --git a/ext/tk/lib/tkextlib/tcllib/getstring.rb b/ext/tk/lib/tkextlib/tcllib/getstring.rb
index bf5e54e8c..fc5d8b26d 100644
--- a/ext/tk/lib/tkextlib/tcllib/getstring.rb
+++ b/ext/tk/lib/tkextlib/tcllib/getstring.rb
@@ -87,7 +87,7 @@ class Tk::Tcllib::GetString_Dialog
@variable.value
end
- def cget(slot)
+ def cget_strict(slot)
slot = slot.to_s
if slot == 'text'
@text
@@ -95,6 +95,9 @@ class Tk::Tcllib::GetString_Dialog
@keys[slot]
end
end
+ def cget(slot)
+ cget_strict(slot)
+ end
def configure(slot, value=None)
if slot.kind_of?(Hash)
diff --git a/ext/tk/lib/tkextlib/tcllib/swaplist.rb b/ext/tk/lib/tkextlib/tcllib/swaplist.rb
index 97de0a27c..1c813e36d 100644
--- a/ext/tk/lib/tkextlib/tcllib/swaplist.rb
+++ b/ext/tk/lib/tkextlib/tcllib/swaplist.rb
@@ -90,7 +90,7 @@ class Tk::Tcllib::Swaplist_Dialog
end
alias selected value
- def cget(slot)
+ def cget_strict(slot)
slot = slot.to_s
if slot == 'complete_list'
@complete_list
@@ -100,6 +100,9 @@ class Tk::Tcllib::Swaplist_Dialog
@keys[slot]
end
end
+ def cget(slot)
+ cget_strict(slot)
+ end
def configure(slot, value=None)
if slot.kind_of?(Hash)
diff --git a/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb b/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb
index a939a5833..d7a6c9721 100644
--- a/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb
+++ b/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb
@@ -70,6 +70,9 @@ module Tk::Tcllib::TablelistItemConfig
def cell_cget(tagOrId, option)
itemcget(['cell', tagOrId], option)
end
+ def cell_cget_strict(tagOrId, option)
+ itemcget_strict(['cell', tagOrId], option)
+ end
def cell_configure(tagOrId, slot, value=None)
itemconfigure(['cell', tagOrId], slot, value)
end
@@ -80,6 +83,7 @@ module Tk::Tcllib::TablelistItemConfig
current_itemconfiginfo(['cell', tagOrId], slot)
end
alias cellcget cell_cget
+ alias cellcget_strict cell_cget_strict
alias cellconfigure cell_configure
alias cellconfiginfo cell_configinfo
alias current_cellconfiginfo current_cell_configinfo
@@ -87,6 +91,9 @@ module Tk::Tcllib::TablelistItemConfig
def column_cget(tagOrId, option)
itemcget(['column', tagOrId], option)
end
+ def column_cget_strict(tagOrId, option)
+ itemcget_strict(['column', tagOrId], option)
+ end
def column_configure(tagOrId, slot, value=None)
itemconfigure(['column', tagOrId], slot, value)
end
@@ -97,6 +104,7 @@ module Tk::Tcllib::TablelistItemConfig
current_itemconfiginfo(['column', tagOrId], slot)
end
alias columncget column_cget
+ alias columncget_strict column_cget_strict
alias columnconfigure column_configure
alias columnconfiginfo column_configinfo
alias current_columnconfiginfo current_column_configinfo
@@ -104,6 +112,9 @@ module Tk::Tcllib::TablelistItemConfig
def row_cget(tagOrId, option)
itemcget(['row', tagOrId], option)
end
+ def row_cget_strict(tagOrId, option)
+ itemcget_strict(['row', tagOrId], option)
+ end
def row_configure(tagOrId, slot, value=None)
itemconfigure(['row', tagOrId], slot, value)
end
@@ -114,12 +125,13 @@ module Tk::Tcllib::TablelistItemConfig
current_itemconfiginfo(['row', tagOrId], slot)
end
alias rowcget row_cget
+ alias rowcget_strict row_cget_strict
alias rowconfigure row_configure
alias rowconfiginfo row_configinfo
alias current_rowconfiginfo current_row_configinfo
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
end
class Tk::Tcllib::Tablelist
diff --git a/ext/tk/lib/tkextlib/tile.rb b/ext/tk/lib/tkextlib/tile.rb
index 02473d57a..60ea012cc 100644
--- a/ext/tk/lib/tkextlib/tile.rb
+++ b/ext/tk/lib/tkextlib/tile.rb
@@ -133,7 +133,11 @@ module Tk
ns_list.each{|ns|
cmd = "#{ns}::#{proc_name}"
unless Tk.info(:commands, cmd).empty?
- fail RuntimeError, "can't define '#{cmd}' command (already exist)"
+ #fail RuntimeError, "can't define '#{cmd}' command (already exist)"
+
+ # do nothing !!!
+ warn "Warning: can't define '#{cmd}' command (already exist)" if $DEBUG
+ next
end
TkNamespace.eval(ns){
TkCore::INTERP.add_tk_procs(proc_name, 'imgdir {patterns {*.gif}}',
@@ -197,6 +201,38 @@ module Tk
args.map!{|arg| TkComm._get_eval_string(arg)}.join('.')
end
+ def self.themes(glob_ptn = nil)
+ if TILE_SPEC_VERSION_ID < 8 && Tk.info(:commands, '::ttk::themes').empty?
+ fail RuntimeError, 'not support glob option' if glob_ptn
+ cmd = ['::tile::availableThemes']
+ else
+ glob_ptn = '*' unless glob_ptn
+ cmd = ['::ttk::themes', glob_ptn]
+ end
+
+ begin
+ TkComm.simplelist(Tk.tk_call_without_enc(*cmd))
+ rescue
+ TkComm.simplelist(Tk.tk_call('lsearch', '-all', '-inline',
+ Tk::Tile::Style.theme_names,
+ glob_ptn))
+ end
+ end
+
+ def self.set_theme(theme)
+ if TILE_SPEC_VERSION_ID < 8 && Tk.info(:commands, '::ttk::setTheme').empty?
+ cmd = '::tile::setTheme'
+ else
+ cmd = '::ttk::setTheme'
+ end
+
+ begin
+ Tk.tk_call_without_enc(cmd, theme)
+ rescue
+ Tk::Tile::Style.theme_use(theme)
+ end
+ end
+
module KeyNav
if Tk::Tile::TILE_SPEC_VERSION_ID < 8
def self.enableMnemonics(w)
@@ -328,12 +364,16 @@ module Tk
autoload :TLabelframe, 'tkextlib/tile/tlabelframe'
autoload :Labelframe, 'tkextlib/tile/tlabelframe'
+ autoload :TLabelFrame, 'tkextlib/tile/tlabelframe'
+ autoload :LabelFrame, 'tkextlib/tile/tlabelframe'
autoload :TLabel, 'tkextlib/tile/tlabel'
autoload :Label, 'tkextlib/tile/tlabel'
autoload :TMenubutton, 'tkextlib/tile/tmenubutton'
autoload :Menubutton, 'tkextlib/tile/tmenubutton'
+ autoload :TMenuButton, 'tkextlib/tile/tmenubutton'
+ autoload :MenuButton, 'tkextlib/tile/tmenubutton'
autoload :TNotebook, 'tkextlib/tile/tnotebook'
autoload :Notebook, 'tkextlib/tile/tnotebook'
diff --git a/ext/tk/lib/tkextlib/tile/dialog.rb b/ext/tk/lib/tkextlib/tile/dialog.rb
index b10378d7d..ef2d1fe57 100644
--- a/ext/tk/lib/tkextlib/tile/dialog.rb
+++ b/ext/tk/lib/tkextlib/tile/dialog.rb
@@ -54,9 +54,21 @@ class Tk::Tile::Dialog
window(tk_call_without_enc('::ttk::dialog::clientframe', @path))
end
+ def cget_strict(slot)
+ @keys[slot.to_s]
+ end
+ def cget(slot)
+ @keys[slot.to_s]
+ end
+=begin
def cget(slot)
- @keys[slot]
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ cget_strict(slot)
+ else
+ cget_strict(slot) rescue nil
+ end
end
+=end
def configure(slot, value=None)
if slot.kind_of?(Hash)
diff --git a/ext/tk/lib/tkextlib/tile/style.rb b/ext/tk/lib/tkextlib/tile/style.rb
index bf8acb34b..ca7ee99c3 100644
--- a/ext/tk/lib/tkextlib/tile/style.rb
+++ b/ext/tk/lib/tkextlib/tile/style.rb
@@ -33,9 +33,15 @@ class << Tk::Tile::Style
# conflict with some definitions on Tcl/Tk scripts.
if Tk::Tile::TILE_SPEC_VERSION_ID < 7
def __define_wrapper_proc_for_compatibility__!
+ __define_themes_and_setTheme_proc__!
+
unless Tk.info(:commands, '::ttk::style').empty?
- fail RuntimeError,
- "can't define ':ttk::style' command (already exist)"
+ # fail RuntimeError,
+ # "can't define '::ttk::style' command (already exist)"
+
+ # do nothing !!!
+ warn "Warning: can't define '::ttk::style' command (already exist)" if $DEBUG
+ return
end
TkCore::INTERP.add_tk_procs('::ttk::style', 'args', <<-'EOS')
if [string equal [lrange $args 0 1] {element create}] {
@@ -55,9 +61,15 @@ class << Tk::Tile::Style
end
else ### TILE_SPEC_VERSION_ID == 7
def __define_wrapper_proc_for_compatibility__!
+ __define_themes_and_setTheme_proc__!
+
unless Tk.info(:commands, '::ttk::style').empty?
- fail RuntimeError,
- "can't define ':ttk::style' command (already exist)"
+ # fail RuntimeError,
+ # "can't define '::ttk::style' command (already exist)"
+
+ # do nothing !!!
+ warn "Warning: can't define '::ttk::style' command (already exist)" if $DEBUG
+ return
end
TkCore::INTERP.add_tk_procs('::ttk::style', 'args', <<-'EOS')
if [string equal [lrange $args 0 1] {element create}] {
@@ -83,8 +95,14 @@ class << Tk::Tile::Style
TkCommandNames = ['::ttk::style'.freeze].freeze
def __define_wrapper_proc_for_compatibility__!
+ __define_themes_and_setTheme_proc__!
+
unless Tk.info(:commands, '::style').empty?
- fail RuntimeError, "can't define '::style' command (already exist)"
+ # fail RuntimeError, "can't define '::style' command (already exist)"
+
+ # do nothing !!!
+ warn "Warning: can't define '::style' command (already exist)" if $DEBUG
+ return
end
TkCore::INTERP.add_tk_procs('::style', 'args', <<-'EOS')
if [string equal [lrange $args 0 1] {element create}] {
@@ -108,6 +126,36 @@ class << Tk::Tile::Style
end
end
+ def __define_themes_and_setTheme_proc__!
+ TkCore::INTERP.add_tk_procs('::ttk::themes', '{ptn *}', <<-'EOS')
+ #set themes [list]
+ set themes [::ttk::style theme names]
+ foreach pkg [lsearch -inline -all -glob [package names] ttk::theme::$ptn] {
+ set theme [namespace tail $pkg]
+ if {[lsearch -exact $themes $theme] < 0} {
+ lappend themes $theme
+ }
+ }
+ foreach pkg [lsearch -inline -all -glob [package names] tile::theme::$ptn] {
+ set theme [namespace tail $pkg]
+ if {[lsearch -exact $themes $theme] < 0} {
+ lappend themes $theme
+ }
+ }
+ return $themes
+ EOS
+ #########################
+ TkCore::INTERP.add_tk_procs('::ttk::setTheme', 'theme', <<-'EOS')
+ variable currentTheme
+ if {[lsearch -exact [::ttk::style theme names] $theme] < 0} {
+ package require [lsearch -inline -regexp [package names] (ttk|tile)::theme::$theme]
+ }
+ ::ttk::style theme use $theme
+ set currentTheme $theme
+ EOS
+ end
+ private :__define_themes_and_setTheme_proc__!
+
def configure(style=nil, keys=nil)
if style.kind_of?(Hash)
keys = style
diff --git a/ext/tk/lib/tkextlib/tile/tentry.rb b/ext/tk/lib/tkextlib/tile/tentry.rb
index 4b221fcb8..0bea98dcd 100644
--- a/ext/tk/lib/tkextlib/tile/tentry.rb
+++ b/ext/tk/lib/tkextlib/tile/tentry.rb
@@ -27,6 +27,11 @@ class Tk::Tile::TEntry < Tk::Entry
WidgetClassName = 'TEntry'.freeze
WidgetClassNames[WidgetClassName] = self
+ def __optkey_aliases
+ {:vcmd=>:validatecommand, :invcmd=>:invalidcommand}
+ end
+ private :__optkey_aliases
+
def __boolval_optkeys
super() << 'exportselection'
end
diff --git a/ext/tk/lib/tkextlib/tile/tnotebook.rb b/ext/tk/lib/tkextlib/tile/tnotebook.rb
index 76f225c57..4d65e363d 100644
--- a/ext/tk/lib/tkextlib/tile/tnotebook.rb
+++ b/ext/tk/lib/tkextlib/tile/tnotebook.rb
@@ -41,13 +41,35 @@ class Tk::Tile::TNotebook < TkWindow
private :__item_methodcall_optkeys
#alias tabcget itemcget
+ #alias tabcget_strict itemcget_strict
alias tabconfigure itemconfigure
alias tabconfiginfo itemconfiginfo
alias current_tabconfiginfo current_itemconfiginfo
- def tabcget(tagOrId, option)
+ def tabcget_strict(tagOrId, option)
tabconfigure(tagOrId, option)[-1]
end
+ def tabcget(tagOrId, option)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ tabcget_strict(tagOrId, option)
+ else
+ begin
+ tabcget_strict(tagOrId, option)
+ rescue => e
+ begin
+ if current_tabconfiginfo(tagOrId).has_key?(option.to_s)
+ # not tag error & option is known -> error on known option
+ fail e
+ else
+ # not tag error & option is unknown
+ nil
+ end
+ rescue
+ fail e # tag error
+ end
+ end
+ end
+ end
################################
include Tk::Tile::TileWidget
@@ -77,9 +99,9 @@ class Tk::Tile::TNotebook < TkWindow
def add(child, keys=nil)
if keys && keys != None
- tk_send_without_enc('add', _epath(child), *hash_kv(keys))
+ tk_send('add', _epath(child), *hash_kv(keys))
else
- tk_send_without_enc('add', _epath(child))
+ tk_send('add', _epath(child))
end
self
end
diff --git a/ext/tk/lib/tkextlib/tile/tpaned.rb b/ext/tk/lib/tkextlib/tile/tpaned.rb
index 342b54d25..d96ff4397 100644
--- a/ext/tk/lib/tkextlib/tile/tpaned.rb
+++ b/ext/tk/lib/tkextlib/tile/tpaned.rb
@@ -36,9 +36,21 @@ class Tk::Tile::TPaned < TkWindow
[self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
end
- def add(win, keys)
- win = _epath(win)
- tk_send_without_enc('add', win, *hash_kv(keys))
+ def add(*args)
+ keys = args.pop
+ fail ArgumentError, "no window in arguments" unless keys
+
+ if keys && keys.kind_of?(Hash)
+ fail ArgumentError, "no window in arguments" if args == []
+ opts = hash_kv(keys)
+ else
+ args.push(keys) if keys
+ opts = []
+ end
+
+ args.each{|win|
+ tk_send_without_enc('add', _epath(win), *opts)
+ }
self
end
@@ -54,10 +66,33 @@ class Tk::Tile::TPaned < TkWindow
self
end
- def panecget(pane, slot)
+ def panecget_strict(pane, slot)
pane = _epath(pane)
tk_tcl2ruby(tk_send_without_enc('pane', pane, "-#{slot}"))
end
+ alias pane_cget_strict panecget_strict
+
+ def panecget(pane, slot)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ panecget_strict(pane, slot)
+ else
+ begin
+ panecget_strict(pane, slot)
+ rescue => e
+ begin
+ if current_paneconfiginfo(pane).has_key?(slot.to_s)
+ # not tag error & option is known -> error on known option
+ fail e
+ else
+ # not tag error & option is unknown
+ nil
+ end
+ rescue
+ fail e # tag error
+ end
+ end
+ end
+ end
alias pane_cget panecget
def paneconfigure(pane, key, value=nil)
diff --git a/ext/tk/lib/tkextlib/tile/treeview.rb b/ext/tk/lib/tkextlib/tile/treeview.rb
index 7f31b9c23..c978a1a07 100644
--- a/ext/tk/lib/tkextlib/tile/treeview.rb
+++ b/ext/tk/lib/tkextlib/tile/treeview.rb
@@ -33,6 +33,12 @@ module Tk::Tile::TreeviewConfig
else
if slot
slot = slot.to_s
+
+ alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
case slot
when /^(#{__tile_specific_item_optkeys(tagid(tagOrId)).join('|')})$/
begin
@@ -198,6 +204,12 @@ module Tk::Tile::TreeviewConfig
else
if slot
slot = slot.to_s
+
+ alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
case slot
when /^(#{__tile_specific_item_optkeys(tagid(tagOrId)).join('|')})$/
begin
@@ -508,17 +520,21 @@ module Tk::Tile::TreeviewConfig
end
alias __itemcget itemcget
+ alias __itemcget_strict itemcget_strict
alias __itemconfigure itemconfigure
alias __itemconfiginfo itemconfiginfo
alias __current_itemconfiginfo current_itemconfiginfo
- private :__itemcget, :__itemconfigure
- private :__itemconfiginfo, :__current_itemconfiginfo
+ private :__itemcget, :__itemcget_strict
+ private :__itemconfigure, :__itemconfiginfo, :__current_itemconfiginfo
# Treeview Item
def itemcget(tagOrId, option)
__itemcget([:item, tagOrId], option)
end
+ def itemcget_strict(tagOrId, option)
+ __itemcget_strict([:item, tagOrId], option)
+ end
def itemconfigure(tagOrId, slot, value=None)
__itemconfigure([:item, tagOrId], slot, value)
end
@@ -533,6 +549,9 @@ module Tk::Tile::TreeviewConfig
def columncget(tagOrId, option)
__itemcget([:column, tagOrId], option)
end
+ def columncget_strict(tagOrId, option)
+ __itemcget_strict([:column, tagOrId], option)
+ end
def columnconfigure(tagOrId, slot, value=None)
__itemconfigure([:column, tagOrId], slot, value)
end
@@ -543,12 +562,13 @@ module Tk::Tile::TreeviewConfig
__current_itemconfiginfo([:column, tagOrId], slot)
end
alias column_cget columncget
+ alias column_cget_strict columncget_strict
alias column_configure columnconfigure
alias column_configinfo columnconfiginfo
alias current_column_configinfo current_columnconfiginfo
# Treeview Heading
- def headingcget(tagOrId, option)
+ def headingcget_strict(tagOrId, option)
if __tile_specific_item_optkeys([:heading, tagOrId]).index(option.to_s)
begin
# On tile-0.7.{2-8}, 'state' options has no '-' at its head.
@@ -558,7 +578,28 @@ module Tk::Tile::TreeviewConfig
tk_call(*(__item_cget_cmd([:heading, tagOrId]) << "-#{option}"))
end
else
- __itemcget([:heading, tagOrId], option)
+ __itemcget_strict([:heading, tagOrId], option)
+ end
+ end
+ def headingcget(tagOrId, option)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ headingcget_strict(tagOrId, option)
+ else
+ begin
+ headingcget_strict(tagOrId, option)
+ rescue => e
+ begin
+ if current_headingconfiginfo(tagOrId).has_key?(option.to_s)
+ # not tag error & option is known -> error on known option
+ fail e
+ else
+ # not tag error & option is unknown
+ nil
+ end
+ rescue
+ fail e # tag error
+ end
+ end
end
end
def headingconfigure(tagOrId, slot, value=None)
@@ -590,6 +631,7 @@ module Tk::Tile::TreeviewConfig
__current_itemconfiginfo([:heading, tagOrId], slot)
end
alias heading_cget headingcget
+ alias heading_cget_strict headingcget_strict
alias heading_configure headingconfigure
alias heading_configinfo headingconfiginfo
alias current_heading_configinfo current_headingconfiginfo
@@ -598,6 +640,9 @@ module Tk::Tile::TreeviewConfig
def tagcget(tagOrId, option)
__itemcget([:tag, tagOrId], option)
end
+ def tagcget_strict(tagOrId, option)
+ __itemcget_strict([:tag, tagOrId], option)
+ end
def tagconfigure(tagOrId, slot, value=None)
__itemconfigure([:tag, tagOrId], slot, value)
end
@@ -608,6 +653,7 @@ module Tk::Tile::TreeviewConfig
__current_itemconfiginfo([:tag, tagOrId], slot)
end
alias tag_cget tagcget
+ alias tag_cget_strict tagcget_strict
alias tag_configure tagconfigure
alias tag_configinfo tagconfiginfo
alias current_tag_configinfo current_tagconfiginfo
@@ -694,6 +740,9 @@ class Tk::Tile::Treeview::Item < TkObject
def cget(option)
@t.itemcget(@id, option)
end
+ def cget_strict(option)
+ @t.itemcget_strict(@id, option)
+ end
def configure(key, value=None)
@t.itemconfigure(@id, key, value)
@@ -933,6 +982,9 @@ class Tk::Tile::Treeview::Tag < TkObject
def cget(option)
@t.tagcget(@id, option)
end
+ def cget_strict(option)
+ @t.tagcget_strict(@id, option)
+ end
def configure(key, value=None)
@t.tagconfigure(@id, key, value)
diff --git a/ext/tk/lib/tkextlib/tkDND/shape.rb b/ext/tk/lib/tkextlib/tkDND/shape.rb
index 570c93b0d..d44068ed3 100644
--- a/ext/tk/lib/tkextlib/tkDND/shape.rb
+++ b/ext/tk/lib/tkextlib/tkDND/shape.rb
@@ -11,15 +11,15 @@ require 'tkextlib/setup.rb'
# call setup script
require 'tkextlib/tkDND/setup.rb'
-# TkPackage.require('shape', '0.3')
-TkPackage.require('shape')
+# TkPackage.require('Shape', '0.3')
+TkPackage.require('Shape')
module Tk
module TkDND
module Shape
extend TkCore
- PACKAGE_NAME = 'shape'.freeze
+ PACKAGE_NAME = 'Shape'.freeze
def self.package_name
PACKAGE_NAME
end
@@ -27,26 +27,28 @@ module Tk
=begin
def self.package_version
begin
- TkPackage.require('shape')
+ TkPackage.require('Shape')
rescue
''
end
end
=end
- def self.package_version
- Tk.tk_call('set', 'shape_version')
- end
- alias shape_version package_version
+ class << self
+ def package_version
+ Tk.tk_call('set', 'shape_version')
+ end
+ alias shape_version package_version
- def self.package_patchlevel
- Tk.tk_call('set', 'shape_patchlevel')
- end
- alias shape_patchlevel package_patchlevel
+ def package_patchlevel
+ Tk.tk_call('set', 'shape_patchLevel')
+ end
+ alias shape_patchlevel package_patchlevel
- def self.version
- tk_call('shape', 'version')
+ def version
+ tk_call('shape', 'version')
+ end
+ alias xshape_version version
end
- alias xshape_version version
############################
diff --git a/ext/tk/lib/tkextlib/tkDND/tkdnd.rb b/ext/tk/lib/tkextlib/tkDND/tkdnd.rb
index ea91d3d1f..9a9b2dc42 100644
--- a/ext/tk/lib/tkextlib/tkDND/tkdnd.rb
+++ b/ext/tk/lib/tkextlib/tkDND/tkdnd.rb
@@ -57,6 +57,7 @@ module Tk
nil
]
+=begin
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
KEY_TBL.map!{|inf|
if inf.kind_of?(Array)
@@ -72,6 +73,7 @@ module Tk
end
inf
}
+=end
# setup tables
_setup_subst_table(KEY_TBL, PROC_TBL);
diff --git a/ext/tk/lib/tkextlib/tktable/tktable.rb b/ext/tk/lib/tkextlib/tktable/tktable.rb
index fb8a8b0f7..f6cf24b40 100644
--- a/ext/tk/lib/tkextlib/tktable/tktable.rb
+++ b/ext/tk/lib/tkextlib/tktable/tktable.rb
@@ -77,6 +77,9 @@ module Tk::TkTable::ConfigMethod
def tag_cget(tagOrId, option)
itemcget(['tag', tagid(tagOrId)], option)
end
+ def tag_cget_strict(tagOrId, option)
+ itemcget_strict(['tag', tagid(tagOrId)], option)
+ end
def tag_configure(tagOrId, slot, value=None)
itemconfigure(['tag', tagid(tagOrId)], slot, value)
end
@@ -90,6 +93,9 @@ module Tk::TkTable::ConfigMethod
def window_cget(tagOrId, option)
itemcget(['window', tagid(tagOrId)], option)
end
+ def window_cget_strict(tagOrId, option)
+ itemcget_strict(['window', tagid(tagOrId)], option)
+ end
def window_configure(tagOrId, slot, value=None)
if slot == :window || slot == 'window'
value = _epath(value)
@@ -108,8 +114,8 @@ module Tk::TkTable::ConfigMethod
current_itemconfiginfo(['window', tagid(tagOrId)], slot)
end
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
end
#####################################################
@@ -194,6 +200,9 @@ class Tk::TkTable::CellTag
def cget(key)
@t.tag_cget(@id, key)
end
+ def cget_strict(key)
+ @t.tag_cget_strict(@id, key)
+ end
def configure(key, val=None)
@t.tag_configure(@id, key, val)
end
@@ -291,6 +300,7 @@ class Tk::TkTable
nil
]
+=begin
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
KEY_TBL.map!{|inf|
if inf.kind_of?(Array)
@@ -306,6 +316,7 @@ class Tk::TkTable
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL);
@@ -340,6 +351,7 @@ class Tk::TkTable
nil
]
+=begin
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
KEY_TBL.map!{|inf|
if inf.kind_of?(Array)
@@ -355,6 +367,7 @@ class Tk::TkTable
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL);
@@ -387,6 +400,7 @@ class Tk::TkTable
nil
]
+=begin
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
KEY_TBL.map!{|inf|
if inf.kind_of?(Array)
@@ -402,6 +416,7 @@ class Tk::TkTable
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL);
@@ -437,6 +452,7 @@ class Tk::TkTable
nil
]
+=begin
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
KEY_TBL.map!{|inf|
if inf.kind_of?(Array)
@@ -452,6 +468,7 @@ class Tk::TkTable
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL);
end
diff --git a/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb b/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb
index b72b157dc..e10e6e299 100644
--- a/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb
+++ b/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb
@@ -137,6 +137,7 @@ class Tk::TreeCtrl::NotifyEvent
nil
]
+=begin
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
KEY_TBL.map!{|inf|
if inf.kind_of?(Array)
@@ -152,6 +153,7 @@ class Tk::TreeCtrl::NotifyEvent
end
inf
}
+=end
# setup tables to be used by scan_args, _get_subst_key, _get_all_subst_keys
#
@@ -415,6 +417,9 @@ module Tk::TreeCtrl::ConfigMethod
def column_cget(tagOrId, option)
itemcget(['column', tagOrId], option)
end
+ def column_cget_strict(tagOrId, option)
+ itemcget_strict(['column', tagOrId], option)
+ end
def column_configure(tagOrId, slot, value=None)
itemconfigure(['column', tagOrId], slot, value)
end
@@ -428,6 +433,9 @@ module Tk::TreeCtrl::ConfigMethod
def column_dragcget(option)
itemcget(['column', 'drag'], option)
end
+ def column_dragcget_strict(option)
+ itemcget_strict(['column', 'drag'], option)
+ end
def column_dragconfigure(slot, value=None)
itemconfigure(['column', 'drag'], slot, value)
end
@@ -441,6 +449,9 @@ module Tk::TreeCtrl::ConfigMethod
def debug_cget(option)
itemcget('debug', option)
end
+ def debug_cget_strict(option)
+ itemcget_strict('debug', option)
+ end
def debug_configure(slot, value=None)
itemconfigure('debug', slot, value)
end
@@ -454,6 +465,9 @@ module Tk::TreeCtrl::ConfigMethod
def dragimage_cget(option)
itemcget('dragimage', option)
end
+ def dragimage_cget_strict(option)
+ itemcget_strict('dragimage', option)
+ end
def dragimage_configure(slot, value=None)
itemconfigure('dragimage', slot, value)
end
@@ -467,6 +481,9 @@ module Tk::TreeCtrl::ConfigMethod
def element_cget(tagOrId, option)
itemcget(['element', tagOrId], option)
end
+ def element_cget_strict(tagOrId, option)
+ itemcget_strict(['element', tagOrId], option)
+ end
def element_configure(tagOrId, slot, value=None)
itemconfigure(['element', tagOrId], slot, value)
end
@@ -480,6 +497,9 @@ module Tk::TreeCtrl::ConfigMethod
def item_cget(tagOrId, option)
itemcget(['item', tagOrId], option)
end
+ def item_cget_strict(tagOrId, option)
+ itemcget_strict(['item', tagOrId], option)
+ end
def item_configure(tagOrId, slot, value=None)
itemconfigure(['item', tagOrId], slot, value)
end
@@ -493,6 +513,9 @@ module Tk::TreeCtrl::ConfigMethod
def item_element_cget(item, column, elem, option)
itemcget([['item', 'element'], [item, column, elem]], option)
end
+ def item_element_cget_strict(item, column, elem, option)
+ itemcget_strict([['item', 'element'], [item, column, elem]], option)
+ end
def item_element_configure(item, column, elem, slot, value=None)
itemconfigure([['item', 'element'], [item, column, elem]], slot, value)
end
@@ -506,6 +529,9 @@ module Tk::TreeCtrl::ConfigMethod
def marquee_cget(option)
itemcget('marquee', option)
end
+ def marquee_cget_strict(option)
+ itemcget_strict('marquee', option)
+ end
def marquee_configure(slot, value=None)
itemconfigure('marquee', slot, value)
end
@@ -518,7 +544,19 @@ module Tk::TreeCtrl::ConfigMethod
def notify_cget(win, pattern, option)
pattern = "<#{pattern}>"
- itemconfigure(['notify', [win, pattern]], option)
+ # "notify" doesn't have cget subcommand.
+ current_itemconfiginfo(['notify', [win, pattern]])[option.to_s]
+ end
+ def notify_cget_strict(win, pattern, option)
+ pattern = "<#{pattern}>"
+ # "notify" doesn't have cget subcommand.
+ info = current_itemconfiginfo(['notify', [win, pattern]])
+ option = option.to_s
+ unless info.has_key?(option)
+ fail RuntimeError, "unknown option \"#{option}\""
+ else
+ info[option]
+ end
end
def notify_configure(win, pattern, slot, value=None)
pattern = "<#{pattern}>"
@@ -528,11 +566,17 @@ module Tk::TreeCtrl::ConfigMethod
pattern = "<#{pattern}>"
itemconfiginfo(['notify', [win, pattern]], slot)
end
- alias current_notify_configinfo notify_configinfo
+ def current_notify_configinfo(tagOrId, slot=nil)
+ pattern = "<#{pattern}>"
+ current_itemconfiginfo(['notify', [win, pattern]], slot)
+ end
def style_cget(tagOrId, option)
itemcget(['style', tagOrId], option)
end
+ def style_cget_strict(tagOrId, option)
+ itemcget_strict(['style', tagOrId], option)
+ end
def style_configure(tagOrId, slot, value=None)
itemconfigure(['style', tagOrId], slot, value)
end
@@ -543,8 +587,8 @@ module Tk::TreeCtrl::ConfigMethod
current_itemconfiginfo(['style', tagOrId], slot)
end
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
end
##############################################
@@ -1700,6 +1744,9 @@ class Tk::TreeCtrl::Column < TkObject
def cget(opt)
@tree.column_cget(@tree.column_index(@id), opt)
end
+ def cget_strict(opt)
+ @tree.column_cget_strict(@tree.column_index(@id), opt)
+ end
def configure(*args)
@tree.column_configure(@tree.column_index(@id), *args)
@@ -1800,6 +1847,9 @@ class Tk::TreeCtrl::Element < TkObject
def cget(opt)
@tree.element_cget(@id, opt)
end
+ def cget_strict(opt)
+ @tree.element_cget_strict(@id, opt)
+ end
def configure(*args)
@tree.element_configure(@id, *args)
@@ -1931,6 +1981,9 @@ class Tk::TreeCtrl::Item < TkObject
def cget(opt)
@tree.item_cget(@id, opt)
end
+ def cget_strict(opt)
+ @tree.item_cget_strict(@id, opt)
+ end
def configure(*args)
@tree.item_configure(@id, *args)
@@ -1964,6 +2017,9 @@ class Tk::TreeCtrl::Item < TkObject
def element_cget(opt)
@tree.item_element_cget(@id, opt)
end
+ def element_cget_strict(opt)
+ @tree.item_element_cget_strict(@id, opt)
+ end
def element_configure(*args)
@tree.item_element_configure(@id, *args)
@@ -2215,6 +2271,9 @@ class Tk::TreeCtrl::Style < TkObject
def cget(opt)
@tree.style_cget(@id, opt)
end
+ def cget_strict(opt)
+ @tree.style_cget_strict(@id, opt)
+ end
def configure(*args)
@tree.style_configure(@id, *args)
diff --git a/ext/tk/lib/tkextlib/version.rb b/ext/tk/lib/tkextlib/version.rb
index 3542c79db..434ed11a2 100644
--- a/ext/tk/lib/tkextlib/version.rb
+++ b/ext/tk/lib/tkextlib/version.rb
@@ -2,5 +2,5 @@
# release date of tkextlib
#
module Tk
- Tkextlib_RELEASE_DATE = '2008-03-29'.freeze
+ Tkextlib_RELEASE_DATE = '2008-05-23'.freeze
end
diff --git a/ext/tk/lib/tkextlib/vu/pie.rb b/ext/tk/lib/tkextlib/vu/pie.rb
index 1975803db..c1fb6857b 100644
--- a/ext/tk/lib/tkextlib/vu/pie.rb
+++ b/ext/tk/lib/tkextlib/vu/pie.rb
@@ -177,6 +177,10 @@ class Tk::Vu::PieSlice
@pie.itemcget(@id, slot)
end
+ def cget_strict(slot)
+ @pie.itemcget_strict(@id, slot)
+ end
+
def configure(*args)
@pie.itemconfigure(@id, *args)
self
diff --git a/ext/tk/lib/tkextlib/winico/winico.rb b/ext/tk/lib/tkextlib/winico/winico.rb
index 30fb9682d..00316fd44 100644
--- a/ext/tk/lib/tkextlib/winico/winico.rb
+++ b/ext/tk/lib/tkextlib/winico/winico.rb
@@ -150,6 +150,7 @@ class Tk::Winico
nil
]
+=begin
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
KEY_TBL.map!{|inf|
if inf.kind_of?(Array)
@@ -165,6 +166,7 @@ class Tk::Winico
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL);
@@ -185,7 +187,8 @@ class Tk::Winico
Winico_callback._config_keys.each{|k|
if keys[k].kind_of?(Array)
cmd, *args = keys[k]
- keys[k] = Winico_callback.new(cmd, args.join(' '))
+ #keys[k] = Winico_callback.new(cmd, args.join(' '))
+ keys[k] = Winico_callback.new(cmd, *args)
# elsif keys[k].kind_of?(Proc)
elsif TkComm._callback_entry?(keys[k])
keys[k] = Winico_callback.new(keys[k])
@@ -201,7 +204,8 @@ class Tk::Winico
Winico_callback._config_keys.each{|k|
if keys[k].kind_of?(Array)
cmd, *args = keys[k]
- keys[k] = Winico_callback.new(cmd, args.join(' '))
+ #keys[k] = Winico_callback.new(cmd, args.join(' '))
+ keys[k] = Winico_callback.new(cmd, *args)
# elsif keys[k].kind_of?(Proc)
elsif TkComm._callback_entry?(keys[k])
keys[k] = Winico_callback.new(keys[k])