summaryrefslogtreecommitdiff
path: root/ext/tk/lib
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tk/lib')
-rw-r--r--ext/tk/lib/tk.rb63
-rw-r--r--ext/tk/lib/tk/event.rb14
-rw-r--r--ext/tk/lib/tk/grid.rb49
-rw-r--r--ext/tk/lib/tk/pack.rb17
-rw-r--r--ext/tk/lib/tk/spinbox.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/dragdrop.rb6
-rw-r--r--ext/tk/lib/tkextlib/blt/treeview.rb7
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/calendar.rb2
-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/spinner.rb2
-rw-r--r--ext/tk/lib/tkextlib/tile.rb36
-rw-r--r--ext/tk/lib/tkextlib/tile/style.rb36
-rw-r--r--ext/tk/lib/tkextlib/tile/tnotebook.rb4
-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.rb8
-rw-r--r--ext/tk/lib/tkextlib/treectrl/tktreectrl.rb2
-rw-r--r--ext/tk/lib/tkextlib/version.rb2
-rw-r--r--ext/tk/lib/tkextlib/winico/winico.rb8
22 files changed, 274 insertions, 39 deletions
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb
index 2aafcfecc3..e827d71ebc 100644
--- a/ext/tk/lib/tk.rb
+++ b/ext/tk/lib/tk.rb
@@ -775,7 +775,7 @@ end
private :_curr_cmd_id, :_next_cmd_id
module_function :_curr_cmd_id, :_next_cmd_id
- def TkComm.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 +794,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,19 +810,29 @@ end
'rb_out' << TkCore::INTERP._ip_id_ << ' ' << id
end
end
- def TkComm.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
def install_cmd(cmd)
- TkComm.install_cmd(cmd)
+ TkComm.install_cmd(cmd, @cmdtbl)
end
def uninstall_cmd(id)
- TkComm.uninstall_cmd(id)
+ TkComm.uninstall_cmd(id, @cmdtbl)
end
=begin
@@ -1447,7 +1466,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)
@@ -1477,7 +1498,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)
@@ -1495,6 +1518,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
@@ -4947,6 +4975,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)
@@ -4978,12 +5015,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
@@ -5226,11 +5265,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)
}
@@ -5348,7 +5389,7 @@ TkWidget = TkWindow
#Tk.freeze
module Tk
- RELEASE_DATE = '2008-04-18'.freeze
+ RELEASE_DATE = '2008-05-16'.freeze
autoload :AUTO_PATH, 'tk/variable'
autoload :TCL_PACKAGE_PATH, 'tk/variable'
diff --git a/ext/tk/lib/tk/event.rb b/ext/tk/lib/tk/event.rb
index 0042fcaa63..d8aad6248b 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/grid.rb b/ext/tk/lib/tk/grid.rb
index 10fdf3569b..0dfd7263a7 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/pack.rb b/ext/tk/lib/tk/pack.rb
index 8fab363121..220a38e524 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/spinbox.rb b/ext/tk/lib/tk/spinbox.rb
index e372c58009..34dc1904f7 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/validation.rb b/ext/tk/lib/tk/validation.rb
index 1da38c776d..60bd433cdc 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 49dd4d73c2..0394296189 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/dragdrop.rb b/ext/tk/lib/tkextlib/blt/dragdrop.rb
index 98b1a4832f..201548504a 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/treeview.rb b/ext/tk/lib/tkextlib/blt/treeview.rb
index fc890614be..672869bfa2 100644
--- a/ext/tk/lib/tkextlib/blt/treeview.rb
+++ b/ext/tk/lib/tkextlib/blt/treeview.rb
@@ -239,6 +239,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 +255,7 @@ class Tk::BLT::Treeview
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL);
@@ -492,6 +494,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 +510,7 @@ class Tk::BLT::Treeview
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL);
@@ -523,7 +527,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/iwidgets/calendar.rb b/ext/tk/lib/tkextlib/iwidgets/calendar.rb
index 236ca96f00..8495f0e29b 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/entryfield.rb b/ext/tk/lib/tkextlib/iwidgets/entryfield.rb
index 1f9effb46e..d53df216bf 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 4e7d8f8579..d9220fecbf 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/spinner.rb b/ext/tk/lib/tkextlib/iwidgets/spinner.rb
index 126cfe7c95..aeee5c9038 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/tile.rb b/ext/tk/lib/tkextlib/tile.rb
index b6beb8a11e..60ea012cc0 100644
--- a/ext/tk/lib/tkextlib/tile.rb
+++ b/ext/tk/lib/tkextlib/tile.rb
@@ -201,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)
@@ -332,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/style.rb b/ext/tk/lib/tkextlib/tile/style.rb
index 098f4e4f72..ca7ee99c32 100644
--- a/ext/tk/lib/tkextlib/tile/style.rb
+++ b/ext/tk/lib/tkextlib/tile/style.rb
@@ -33,6 +33,8 @@ 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)"
@@ -59,6 +61,8 @@ 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)"
@@ -91,6 +95,8 @@ 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)"
@@ -120,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/tnotebook.rb b/ext/tk/lib/tkextlib/tile/tnotebook.rb
index 76f225c579..075059d5cc 100644
--- a/ext/tk/lib/tkextlib/tile/tnotebook.rb
+++ b/ext/tk/lib/tkextlib/tile/tnotebook.rb
@@ -77,9 +77,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/tkDND/shape.rb b/ext/tk/lib/tkextlib/tkDND/shape.rb
index 570c93b0d9..d44068ed33 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 ea91d3d1f4..9a9b2dc42c 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 fb8a8b0f72..b5bf4ea6c3 100644
--- a/ext/tk/lib/tkextlib/tktable/tktable.rb
+++ b/ext/tk/lib/tkextlib/tktable/tktable.rb
@@ -291,6 +291,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 +307,7 @@ class Tk::TkTable
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL);
@@ -340,6 +342,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 +358,7 @@ class Tk::TkTable
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL);
@@ -387,6 +391,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 +407,7 @@ class Tk::TkTable
end
inf
}
+=end
_setup_subst_table(KEY_TBL, PROC_TBL);
@@ -437,6 +443,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 +459,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 d025bc4086..5e86a19406 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
#
diff --git a/ext/tk/lib/tkextlib/version.rb b/ext/tk/lib/tkextlib/version.rb
index 08cccf56c2..f437dea7fd 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-04-18'.freeze
+ Tkextlib_RELEASE_DATE = '2008-05-14'.freeze
end
diff --git a/ext/tk/lib/tkextlib/winico/winico.rb b/ext/tk/lib/tkextlib/winico/winico.rb
index 30fb9682d5..00316fd441 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])