summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-07-08 16:50:07 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-07-08 16:50:07 +0000
commit9945dd1adf9eee1f19ea1f7a736e97f74596e9bc (patch)
tree1dfea1caef689bef9a36345bd72000ccd3eb58f8
parent1909f5f1b14167bc24bcccd1500a27a42551fa95 (diff)
* ext/tk/lib : bug fix
* ext/tk/lib/tkextlib/itcl : add [incr Tcl] support * ext/tk/lib/tkextlib/itk : add [incr Tk] support * ext/tk/lib/tkextlib/iwidgets : midway point of [incr Widgets] support * ext/tk/sample/tkextlib/iwidgets : very simple examples of [incr Widgets] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog9
-rw-r--r--ext/tk/ChangeLog.tkextlib4
-rw-r--r--ext/tk/MANIFEST12
-rw-r--r--ext/tk/lib/tk.rb4
-rw-r--r--ext/tk/lib/tk/autoload.rb2
-rw-r--r--ext/tk/lib/tk/canvas.rb3
-rw-r--r--ext/tk/lib/tk/entry.rb5
-rw-r--r--ext/tk/lib/tk/text.rb3
-rw-r--r--ext/tk/lib/tk/timer.rb13
-rw-r--r--ext/tk/lib/tk/validation.rb229
-rw-r--r--ext/tk/lib/tkextlib/SUPPORT_STATUS6
-rw-r--r--ext/tk/lib/tkextlib/itcl.rb13
-rw-r--r--ext/tk/lib/tkextlib/itcl/incr_tcl.rb167
-rw-r--r--ext/tk/lib/tkextlib/itcl/setup.rb13
-rw-r--r--ext/tk/lib/tkextlib/itk.rb13
-rw-r--r--ext/tk/lib/tkextlib/itk/incr_tk.rb376
-rw-r--r--ext/tk/lib/tkextlib/itk/setup.rb13
-rw-r--r--ext/tk/lib/tkextlib/iwidgets.rb57
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/buttonbox.rb109
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/calendar.rb85
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb43
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/canvasprintdialog.rb38
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/checkbox.rb106
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/combobox.rb98
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/dateentry.rb20
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/datefield.rb42
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/dialog.rb20
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/dialogshell.rb109
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb45
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/entryfield.rb152
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/extbutton.rb30
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb33
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/extfileselectiondialog.rb33
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/feedback.rb30
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb33
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/fileselectiondialog.rb33
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/finddialog.rb29
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/labeledframe.rb24
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb30
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/shell.rb38
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/clear.gifbin0 -> 279 bytes
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/buttonbox.rb22
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb10
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/canvasprintbox.rb8
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/canvasprintdialog.rb8
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/checkbox.rb12
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb32
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/dateentry.rb7
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/datefield.rb8
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/dialog.rb20
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb14
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb16
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb39
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb40
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb40
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb20
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb8
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/extfileselectiondialog.rb29
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/feedback.rb10
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb8
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/fileselectiondialog.rb28
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb13
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/shell.rb17
64 files changed, 2429 insertions, 110 deletions
diff --git a/ChangeLog b/ChangeLog
index a1945faf6f..351128a89c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Fri Jul 9 01:47:08 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib : bug fix
+ * ext/tk/lib/tkextlib/itcl : add [incr Tcl] support
+ * ext/tk/lib/tkextlib/itk : add [incr Tk] support
+ * ext/tk/lib/tkextlib/iwidgets : midway point of [incr Widgets] support
+ * ext/tk/sample/tkextlib/iwidgets : very simple examples of
+ [incr Widgets]
+
Thu Jul 8 22:52:19 2004 Kouhei Sutou <kou@cozmixng.org>
* lib/rss/{rss,parser,0.9,1.0,2.0}.rb: supported RSS 0.9x/2.0
diff --git a/ext/tk/ChangeLog.tkextlib b/ext/tk/ChangeLog.tkextlib
index dc71e545e2..5045ae36a4 100644
--- a/ext/tk/ChangeLog.tkextlib
+++ b/ext/tk/ChangeLog.tkextlib
@@ -1,3 +1,7 @@
+2004-07-07 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * add [incr Tck], [incr Tk] support
+
2004-07-06 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* support BWidget extension
diff --git a/ext/tk/MANIFEST b/ext/tk/MANIFEST
index f62e3da8a3..d3b7821fde 100644
--- a/ext/tk/MANIFEST
+++ b/ext/tk/MANIFEST
@@ -130,6 +130,16 @@ lib/tkextlib/bwidget/spinbox.rb
lib/tkextlib/bwidget/titleframe.rb
lib/tkextlib/bwidget/tree.rb
lib/tkextlib/bwidget/widget.rb
+lib/tkextlib/itcl.rb
+lib/tkextlib/itcl/incr_tcl.rb
+lib/tkextlib/itcl/setup.rb
+lib/tkextlib/itk.rb
+lib/tkextlib/itk/incr_tk.rb
+lib/tkextlib/itk/setup.rb
+lib/tkextlib/iwidgets.rb
+lib/tkextlib/iwidgets/buttonbox.rb
+lib/tkextlib/iwidgets/calendar.rb
+lib/tkextlib/iwidgets/setup.rb
lib/tkextlib/tcllib.rb
lib/tkextlib/tcllib/README
lib/tkextlib/tcllib/autoscroll.rb
@@ -431,6 +441,8 @@ sample/tkextlib/bwidget/select.rb
sample/tkextlib/bwidget/tmpldlg.rb
sample/tkextlib/bwidget/tree.rb
sample/tkextlib/bwidget/x1.xbm
+sample/tkextlib/iwidgets/sample/buttonbox.rb
+sample/tkextlib/iwidgets/sample/calendar.rb
sample/tkextlib/tcllib/LICENSE.orig
sample/tkextlib/tcllib/datefield.rb
sample/tkextlib/tcllib/plotdemos1.rb
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb
index 720f2060d2..cae832fc0c 100644
--- a/ext/tk/lib/tk.rb
+++ b/ext/tk/lib/tk.rb
@@ -3104,6 +3104,7 @@ class TkObject<TkKernel
end
end
+=begin
def tk_trace_variable(v)
unless v.kind_of?(TkVariable)
fail(ArgumentError, "type error (#{v.class}); must be TkVariable object")
@@ -3111,9 +3112,10 @@ class TkObject<TkKernel
v
end
private :tk_trace_variable
+=end
def destroy
- tk_call 'trace', 'vdelete', @tk_vn, 'w', @var_id if @var_id
+ #tk_call 'trace', 'vdelete', @tk_vn, 'w', @var_id if @var_id
end
end
diff --git a/ext/tk/lib/tk/autoload.rb b/ext/tk/lib/tk/autoload.rb
index e3c29e96ea..bccd6c4c61 100644
--- a/ext/tk/lib/tk/autoload.rb
+++ b/ext/tk/lib/tk/autoload.rb
@@ -89,6 +89,8 @@ autoload :TkOptionMenubutton, 'tk/menu'
autoload :TkMenubar, 'tk/menubar'
+autoload :TkMenuSpec, 'tk/menuspec'
+
autoload :TkMessage, 'tk/message'
autoload :TkManageFocus, 'tk/mngfocus'
diff --git a/ext/tk/lib/tk/canvas.rb b/ext/tk/lib/tk/canvas.rb
index 0f3a4fc482..c6799091a7 100644
--- a/ext/tk/lib/tk/canvas.rb
+++ b/ext/tk/lib/tk/canvas.rb
@@ -53,8 +53,7 @@ class TkCanvas<TkWindow
if tag.kind_of?(TkcItem) || tag.kind_of?(TkcTag)
tag.id
else
- # tag
- _get_eval_string(tag)
+ tag # maybe an Array of configure paramters
end
end
private :tagid
diff --git a/ext/tk/lib/tk/entry.rb b/ext/tk/lib/tk/entry.rb
index f125739417..0e45538c76 100644
--- a/ext/tk/lib/tk/entry.rb
+++ b/ext/tk/lib/tk/entry.rb
@@ -17,10 +17,7 @@ class TkEntry<TkLabel
WidgetClassNames[WidgetClassName] = self
#def create_self(keys)
- # tk_call_without_enc('entry', @path)
- # if keys and keys != None
- # configure(keys)
- # end
+ # super(__conv_vcmd_on_hash_kv(keys))
#end
#private :create_self
diff --git a/ext/tk/lib/tk/text.rb b/ext/tk/lib/tk/text.rb
index b992db5ff0..d2fdfd9401 100644
--- a/ext/tk/lib/tk/text.rb
+++ b/ext/tk/lib/tk/text.rb
@@ -135,8 +135,7 @@ class TkText<TkTextWin
|| tag.kind_of?(TkTextWindow)
tag.id
else
- # tag
- _get_eval_string(tag)
+ tag # maybe an Array of configure paramters
end
end
private :tagid
diff --git a/ext/tk/lib/tk/timer.rb b/ext/tk/lib/tk/timer.rb
index aa42c4ed7d..3696de168b 100644
--- a/ext/tk/lib/tk/timer.rb
+++ b/ext/tk/lib/tk/timer.rb
@@ -289,13 +289,16 @@ class TkTimer
self
end
- def set_start_proc(sleep, init_proc, *init_args)
+ def set_start_proc(sleep, init_proc=nil, *init_args)
if !sleep == 'idle' && !sleep.kind_of?(Integer)
fail ArguemntError, "expect Integer or 'idle' for 1st argument"
end
@init_sleep = sleep
@init_proc = init_proc
@init_args = init_args
+
+ @init_proc = proc{|*args| } if @init_sleep > 0 && !@init_proc
+
self
end
@@ -306,6 +309,10 @@ class TkTimer
@do_loop = @loop_exec
@current_pos = 0
+ @init_sleep = 0
+ @init_proc = nil
+ @init_args = nil
+
argc = init_args.size
if argc > 0
sleep = init_args.shift
@@ -315,7 +322,9 @@ class TkTimer
@init_sleep = sleep
end
@init_proc = init_args.shift if argc > 1
- @init_args = init_args if argc > 0
+ @init_args = init_args if argc > 2
+
+ @init_proc = proc{|*args| } if @init_sleep > 0 && !@init_proc
@current_sleep = @init_sleep
@running = true
diff --git a/ext/tk/lib/tk/validation.rb b/ext/tk/lib/tk/validation.rb
index 30111f20cc..cc205c5ef9 100644
--- a/ext/tk/lib/tk/validation.rb
+++ b/ext/tk/lib/tk/validation.rb
@@ -20,6 +20,26 @@ module Tk
k2c
end
+ def __conv_vcmd_on_hash_kv(keys)
+ key2class = __get_validate_key2class
+
+ keys = _symbolkey2str(keys)
+ key2class.each{|key, klass|
+ if keys[key].kind_of?(Array)
+ cmd, *args = keys[key]
+ keys[key] = klass.new(cmd, args.join(' '))
+ elsif keys[key].kind_of? Proc
+ keys[key] = klass.new(keys[key])
+ end
+ }
+ keys
+ end
+
+ def create_self(keys)
+ super(__conv_vcmd_on_hash_kv(keys))
+ end
+ private :create_self
+
def configure(slot, value=TkComm::None)
key2class = __get_validate_key2class
@@ -67,6 +87,21 @@ module Tk
}
end
+ def __conv_item_vcmd_on_hash_kv(keys)
+ key2class = __get_item_validate_key2class(tagid(tagOrId))
+
+ keys = _symbolkey2str(keys)
+ key2class.each{|key, klass|
+ if keys[key].kind_of?(Array)
+ cmd, *args = keys[key]
+ keys[key] = klass.new(cmd, args.join(' '))
+ elsif keys[key].kind_of? Proc
+ keys[key] = klass.new(keys[key])
+ end
+ }
+ keys
+ end
+
def itemconfigure(tagOrId, slot, value=TkComm::None)
key2class = __get_item_validate_key2class(tagid(tagOrId))
@@ -100,125 +135,127 @@ module Tk
end
end
-module TkValidation
- include Tk::ValidateConfigure
+class TkValidateCommand
+ include TkComm
+
+ class ValidateArgs < TkUtil::CallbackSubst
+ KEY_TBL = [
+ [ ?d, ?n, :action ],
+ [ ?i, ?x, :index ],
+ [ ?s, ?e, :current ],
+ [ ?v, ?s, :type ],
+ [ ?P, ?e, :value ],
+ [ ?S, ?e, :string ],
+ [ ?V, ?s, :triggered ],
+ [ ?W, ?w, :widget ],
+ nil
+ ]
+
+ PROC_TBL = [
+ [ ?n, TkComm.method(:number) ],
+ [ ?s, TkComm.method(:string) ],
+ [ ?w, TkComm.method(:window) ],
+
+ [ ?e, proc{|val|
+ enc = Tk.encoding
+ if enc
+ Tk.fromUTF8(TkComm::string(val), enc)
+ else
+ TkComm::string(val)
+ end
+ }
+ ],
+
+ [ ?x, proc{|val|
+ idx = TkComm::number(val)
+ if idx < 0
+ nil
+ else
+ idx
+ end
+ }
+ ],
- class ValidateCmd
- include TkComm
+ nil
+ ]
- module Action
- Insert = 1
- Delete = 0
- Others = -1
- Focus = -1
- Forced = -1
- Textvariable = -1
- TextVariable = -1
+ _setup_subst_table(KEY_TBL, PROC_TBL);
+
+ def self.ret_val(val)
+ (val)? '1': '0'
end
- class ValidateArgs < TkUtil::CallbackSubst
- KEY_TBL = [
- [ ?d, ?n, :action ],
- [ ?i, ?x, :index ],
- [ ?s, ?e, :current ],
- [ ?v, ?s, :type ],
- [ ?P, ?e, :value ],
- [ ?S, ?e, :string ],
- [ ?V, ?s, :triggered ],
- [ ?W, ?w, :widget ],
- nil
- ]
-
- PROC_TBL = [
- [ ?n, TkComm.method(:number) ],
- [ ?s, TkComm.method(:string) ],
- [ ?w, TkComm.method(:window) ],
-
- [ ?e, proc{|val|
- enc = Tk.encoding
- if enc
- Tk.fromUTF8(TkComm::string(val), enc)
- else
- TkComm::string(val)
- end
- }
- ],
-
- [ ?x, proc{|val|
- idx = TkComm::number(val)
- if idx < 0
- nil
- else
- idx
- end
- }
- ],
-
- nil
- ]
-
- _setup_subst_table(KEY_TBL, PROC_TBL);
-
- def self.ret_val(val)
- (val)? '1': '0'
- end
+ #def self._get_extra_args_tbl
+ # # return an array of convert procs
+ # []
+ #end
+ end
- #def self._get_extra_args_tbl
- # # return an array of convert procs
- # []
- #end
- end
+ ###############################################
- ##############################
+ def self._config_keys
+ # array of config-option key (string or symbol)
+ ['vcmd', 'validatecommand', 'invcmd', 'invalidcommand']
+ end
- def self._config_keys
- # array of config-option key (string or symbol)
- ['vcmd', 'validatecommand', 'invcmd', 'invalidcommand']
- end
+ def _initialize_for_cb_class(klass, cmd = Proc.new, *args)
+ extra_args_tbl = klass._get_extra_args_tbl
- def _initialize_for_cb_class(klass, cmd = Proc.new, *args)
- extra_args_tbl = klass._get_extra_args_tbl
-
- if args.compact.size > 0
- args = args.join(' ')
- keys = klass._get_subst_key(args)
- if cmd.kind_of?(String)
- id = cmd
- elsif cmd.kind_of?(TkCallbackEntry)
- @id = install_cmd(cmd)
- else
- @id = install_cmd(proc{|*arg|
+ if args.compact.size > 0
+ args = args.join(' ')
+ keys = klass._get_subst_key(args)
+ if cmd.kind_of?(String)
+ id = cmd
+ elsif cmd.kind_of?(TkCallbackEntry)
+ @id = install_cmd(cmd)
+ else
+ @id = install_cmd(proc{|*arg|
ex_args = []
extra_args_tbl.reverse_each{|conv| ex_args << conv.call(args.pop)}
klass.ret_val(cmd.call(
*(ex_args.concat(klass.scan_args(keys, arg)))
))
- }) + ' ' + args
- end
+ }) + ' ' + args
+ end
+ else
+ keys, args = klass._get_all_subst_keys
+ if cmd.kind_of?(String)
+ id = cmd
+ elsif cmd.kind_of?(TkCallbackEntry)
+ @id = install_cmd(cmd)
else
- keys, args = klass._get_all_subst_keys
- if cmd.kind_of?(String)
- id = cmd
- elsif cmd.kind_of?(TkCallbackEntry)
- @id = install_cmd(cmd)
- else
- @id = install_cmd(proc{|*arg|
+ @id = install_cmd(proc{|*arg|
ex_args = []
extra_args_tbl.reverse_each{|conv| ex_args << conv.call(args.pop)}
klass.ret_val(cmd.call(
*(ex_args << klass.new(*klass.scan_args(keys,arg)))
))
- }) + ' ' + args
- end
+ }) + ' ' + args
end
end
+ end
- def initialize(cmd = Proc.new, *args)
- _initialize_for_cb_class(ValidateArgs, cmd, *args)
- end
+ def initialize(cmd = Proc.new, *args)
+ _initialize_for_cb_class(self.class::ValidateArgs, cmd, *args)
+ end
- def to_eval
- @id
+ def to_eval
+ @id
+ end
+end
+
+module TkValidation
+ include Tk::ValidateConfigure
+
+ class ValidateCmd < TkValidateCommand
+ module Action
+ Insert = 1
+ Delete = 0
+ Others = -1
+ Focus = -1
+ Forced = -1
+ Textvariable = -1
+ TextVariable = -1
end
end
diff --git a/ext/tk/lib/tkextlib/SUPPORT_STATUS b/ext/tk/lib/tkextlib/SUPPORT_STATUS
index 58ac307857..4fd652a8a2 100644
--- a/ext/tk/lib/tkextlib/SUPPORT_STATUS
+++ b/ext/tk/lib/tkextlib/SUPPORT_STATUS
@@ -61,7 +61,9 @@ ICONS http://www.satisoft.com/tcltk/icons/ ==> ICONS
===< support (may be alpha or beta quality) >=================================
-TkImg http://sf.net/projects/tkimg ==> tkimg
+IncrTcl http://sf.net/projects/incrTcl ==> itcl, itk
+
+TkImg http://sf.net/projects/tkimg ==> tkimg
TkTreeCtrl http://tktreectrl.sourceforge.net/ ==> treectrl
@@ -82,8 +84,6 @@ TkDND http://sourceforge.net/projects/tkdnd ==> tkDND
TclX http://sf.net/projects/tclx * may support Tk part only
-IncrTcl http://sf.net/projects/incrTcl * may support Tk part only
-
IWidgets http://sf.net/projects/incrTcl
TkTable http://sf.net/projects/tktable
diff --git a/ext/tk/lib/tkextlib/itcl.rb b/ext/tk/lib/tkextlib/itcl.rb
new file mode 100644
index 0000000000..1d6ecf04f2
--- /dev/null
+++ b/ext/tk/lib/tkextlib/itcl.rb
@@ -0,0 +1,13 @@
+#
+# [incr Tcl] support
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require 'tkextlib/itcl/setup.rb'
+
+# load library
+require 'tkextlib/itcl/incr_tcl.rb'
diff --git a/ext/tk/lib/tkextlib/itcl/incr_tcl.rb b/ext/tk/lib/tkextlib/itcl/incr_tcl.rb
new file mode 100644
index 0000000000..9e53a9be8b
--- /dev/null
+++ b/ext/tk/lib/tkextlib/itcl/incr_tcl.rb
@@ -0,0 +1,167 @@
+#
+# tkextlib/itk/incr_tcl.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+
+# call setup script
+require 'tkextlib/itcl.rb'
+
+# TkPackage.require('Itcl', '3.2')
+TkPackage.require('Itcl')
+
+module Tk
+ module Itcl
+ include Tk
+ extend Tk
+
+ LIBRARY = TkVarAccess.new('::itcl::library')
+ PURIST = TkVarAccess.new('::itcl::purist')
+
+ VERSION = TkCore::INTERP._invoke("set", "::itcl::version").freeze
+ PATCHLEVEL = TkCore::INTERP._invoke("set", "::itcl::patchLevel").freeze
+
+ def self.package_version
+ begin
+ TkPackage.require('Itcl')
+ rescue
+ ''
+ end
+ end
+
+ ##############################################
+
+ class ItclObject < TkObject
+ ITCL_CLASSNAME = ''.freeze
+
+ ITCL_OBJ_ID = ['itclobj'.freeze, '00000'.taint].freeze
+ ITCL_OBJ_TBL = {}.taint
+
+ def initialize(*args)
+ if (@klass = self.class::ITCL_CLASSNAME).empty?
+ fail RuntimeError, 'unknown itcl class (abstract class?)'
+ end
+ @id = Tk::Itcl::ItclObject::TCL_OBJ_ID.join(TkCore::INTERP._ip_id_)
+ @path = @id
+ Tk::Itcl::ItclObject::ITCL_OBJ_ID[1].succ!
+ end
+
+ def self.call_proc(name, *args)
+ tk_call("#{ITCL_CLASSNAME}::#{cmd}", *args)
+ end
+
+ def call_method(name, *args)
+ tk_call(@path, name, *args)
+ end
+
+ def isa(klass)
+ bool(tk_call(@path, 'isa', klass))
+ end
+ alias itcl_kind_of? isa
+
+ def info_class
+ tk_call(@path, 'info', 'class')
+ end
+
+ def info_inherit
+ simplelist(tk_call(@path, 'info', 'inherit'))
+ end
+
+ def info_heritage
+ list(tk_call(@path, 'info', 'heritage'))
+ end
+
+ def info_function(*args)
+ if args[-1].kind_of?(Array)
+ params = args.pop
+ params.each{|param|
+ param = param.to_s
+ args << ( (param[0] == ?-)? param: "-#{param}" )
+ }
+ end
+ list(tk_call(@path, 'info', 'function', *args))
+ end
+
+ def info_variable(*args)
+ if args[-1].kind_of?(Array)
+ params = args.pop
+ params.each{|param|
+ param = param.to_s
+ args << ( (param[0] == ?-)? param: "-#{param}" )
+ }
+ end
+ list(tk_call(@path, 'info', 'variable', *args))
+ end
+ end
+
+ ##############################################
+
+ def self.body(klass, func, args, body)
+ tk_call('::itcl::body', "#{klass}::#{func}", args, body)
+ end
+
+ def self.code(cmd, *args)
+ tk_call('::itcl::code', cmd, *args)
+ end
+
+ def self.code_in_namespace(namespace, cmd, *args)
+ tk_call('::itcl::code', '-namespace', namespace, cmd, *args)
+ end
+
+ def self.configbody(klass, var, body)
+ tk_call('::itcl::configbody', "#{klass}::#{var}", body)
+ end
+
+ def self.create_itcl_class(name, body)
+ TkCore::INTERP._invoke('::itcl::class', name, body)
+ klass = Class.new(Tk::Itcl::ItclObject)
+ klass.const_set('ITCL_CLASSNAME', name.dup.freeze)
+ klass
+ end
+
+ def self.delete_itcl_class(*names)
+ tk_call('::itcl::delete', 'class', *names)
+ end
+
+ def self.delete_itcl_object(*names)
+ tk_call('::itcl::delete', 'object', *names)
+ end
+
+ def self.delete_namespace(*names)
+ tk_call('::itcl::delete', 'namespace', *names)
+ end
+
+ def self.ensemble(name, *args)
+ tk_call('::itcl::ensemble', name, *args)
+ end
+
+ def self.find_classes(pat=None)
+ simplelist(tk_call('::itcl::find', 'classes', pat))
+ end
+
+ def self.find_objects(*args)
+ simplelist(tk_call('::itcl::find', 'objects', *args))
+ end
+
+ def self.is_itcl_class(target)
+ bool(tk_call('::itcl::is', 'class', target))
+ end
+
+ def self.is_itcl_object(target)
+ bool(tk_call('::itcl::is', 'object', target))
+ end
+
+ def self.create_local_obj(klass, name, *args)
+ tk_call('::itcl::local', klass, name, *args)
+ end
+
+ def self.is_itcl_instance(klass, target)
+ bool(tk_call('::itcl::is', 'object', '-class', klass, target))
+ end
+
+ def self.scope(var)
+ tk_call('::itcl::scope', var)
+ end
+ end
+end
diff --git a/ext/tk/lib/tkextlib/itcl/setup.rb b/ext/tk/lib/tkextlib/itcl/setup.rb
new file mode 100644
index 0000000000..5be0588703
--- /dev/null
+++ b/ext/tk/lib/tkextlib/itcl/setup.rb
@@ -0,0 +1,13 @@
+#
+# setup.rb -- setup script before calling TkPackage.require()
+#
+# If you need some setup operations (for example, add a library path
+# to the library search path) before using Tcl/Tk library packages
+# wrapped by Ruby scripts in this directory, please write the setup
+# operations in this file.
+#
+
+
+# set [incr Tcl] library directory
+
+# ENV['ITCL_LIBRARY'] = '/usr/local/ActiveTcl/lib/itcl3.2/'
diff --git a/ext/tk/lib/tkextlib/itk.rb b/ext/tk/lib/tkextlib/itk.rb
new file mode 100644
index 0000000000..7492bd3eb4
--- /dev/null
+++ b/ext/tk/lib/tkextlib/itk.rb
@@ -0,0 +1,13 @@
+#
+# [incr Tk] support
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require 'tkextlib/itk/setup.rb'
+
+# load library
+require 'tkextlib/itk/incr_tk.rb'
diff --git a/ext/tk/lib/tkextlib/itk/incr_tk.rb b/ext/tk/lib/tkextlib/itk/incr_tk.rb
new file mode 100644
index 0000000000..1cc52c510b
--- /dev/null
+++ b/ext/tk/lib/tkextlib/itk/incr_tk.rb
@@ -0,0 +1,376 @@
+#
+# tkextlib/itk/incr_tk.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tk/menuspec'
+require 'tkextlib/itcl.rb'
+
+# call setup script
+require 'tkextlib/itk.rb'
+
+#TkPackage.require('Itk', '3.2')
+TkPackage.require('Itk')
+
+module Tk
+ module Itk
+ include Tk
+ extend Tk
+
+ LIBRARY = TkVarAccess.new('::itk::library')
+
+ def self.package_version
+ begin
+ TkPackage.require('Itk')
+ rescue
+ ''
+ end
+ end
+
+ def self.usual(arg, *args)
+ tk_call('::itk::usual', arg, *args)
+ end
+
+ def self.usual_names
+ list(tk_call('::itk::usual'))
+ end
+
+ ############################
+
+ class Archetype < TkWindow
+ TkCommandNames = [].freeze
+ # WidgetClassName = 'Archetype'.freeze
+ # WidgetClassNames[WidgetClassName] = self
+
+ def self.to_eval
+ '::itk::' << self::WidgetClassName
+ end
+
+ #### [incr Tk] public methods
+ def component
+ simplelist(tk_send('component'))
+ end
+
+ def component_path(name)
+ window(tk_send('component', name))
+ end
+
+ def component_invoke(name, cmd, *args)
+ window(tk_send('component', name, cmd, *args))
+ end
+
+ def component_obj(*names)
+ names = component if names.empty?
+ names.collect{|name| Tk::Itk::Component.new(self.path, name) }
+ end
+
+ #### [incr Tk] protected methods
+=begin
+ def itk_component_add(visibility, name, create_cmds, option_cmds=None)
+ args = []
+ visibility.each{|v| v = v.to_s; args << ( (v[0] == ?-)? v: "-#{v}" )}
+ args << '--' << name << create_cmd << option_cmds
+ tk_call('itk_component', 'add', *args)
+ end
+
+ def itk_component_delete(*names)
+ tk_call('itk_component', 'delete', *names)
+ end
+
+ def itk_initialize(keys={})
+ tk_call('itk_initialize', keys)
+ end
+
+ def itk_option_add(*args)
+ tk_call('itk_option', 'add', *args)
+ end
+
+ def itk_option_define(name, resource, klass, init, config=None)
+ tk_call('itk_option', 'define', name, resource, klass, init, config)
+ end
+
+ def itk_option_remove(*args)
+ tk_call('itk_option', 'remove', *args)
+ end
+=end
+ end
+
+ ############################
+
+ class Toplevel < Archetype
+ TkCommandNames = ['::itk::Toplevel'].freeze
+ WidgetClassName = 'Toplevel'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ include Wm
+ include TkMenuSpec
+ end
+
+ ############################
+
+ class Widget < Archetype
+ TkCommandNames = ['::itk::Widget'].freeze
+ WidgetClassName = 'Widget'.freeze
+ WidgetClassNames[WidgetClassName] = self
+ end
+
+
+ ############################
+
+ class Component < TkObject
+ def __cget_cmd
+ [self.master, 'component', self.name, 'cget']
+ end
+
+ def __config_cmd
+ [self.master, 'component', self.name, 'configure']
+ end
+
+ ComponentID_TBL = TkCore::INTERP.create_table
+ Itk_Component_ID = ['itk_component'.freeze, '00000'.taint].freeze
+
+ TkCore::INTERP.init_ip_env{ ComponentID_TBL.clear }
+
+ def self.id2obj(master, id)
+ if master.kind_of?(TkObject)
+ master = master.path
+ else
+ master = master.to_s
+ end
+ return id unless ComponentID_TBL.key?(master)
+ (ComponentID_TBL.key?(id))? ComponentID_TBL[master][id]: id
+ end
+
+ def self.new(master, component=nil)
+ if master.kind_of?(TkObject)
+ master = master.path
+ else
+ master = master.to_s
+ end
+
+ if component.kind_of?(Tk::Itk::Component)
+ component = component.name
+ elsif component
+ component = component.to_s
+ else
+ component = Itk_Component_ID.join(TkCore::INTERP._ip_id_)
+ Itk_Component_ID[1].succ!
+ end
+
+ if ComponentID_TBL.key?(master)
+ if ComponentID_TBL[master].key?(component)
+ return ComponentID_TBL[master][component]
+ end
+ else
+ ComponentID_TBL[master] = {}
+ end
+
+ super(master, component)
+ end
+
+ def initialize(master, component)
+ @master = master
+ @component = component
+
+ ComponentID_TBL[@master][@component] = self
+
+ begin
+ @widget = window(tk_call(@master, 'component', @component))
+ @path = @widget.path
+ rescue
+ @widget = nil
+ @path = nil
+ end
+ end
+
+ def path
+ unless @path
+ begin
+ @widget = window(tk_call(@master, 'component', @component))
+ @path = @widget.path
+ rescue
+ fail RuntimeError, 'component is not assigned to a widget'
+ end
+ end
+ @path
+ end
+
+ def epath
+ path()
+ end
+
+ def to_eval
+ path()
+ end
+
+ def master
+ @master
+ end
+
+ def name
+ @component
+ end
+
+ def widget
+ unless @widget
+ begin
+ @widget = window(tk_call(@master, 'component', @component))
+ @path = @widget.path
+ rescue
+ fail RuntimeError, 'component is not assigned to a widget'
+ end
+ end
+ @widget
+ end
+
+ def widget_class
+ unless @widget
+ begin
+ @widget = window(tk_call(@master, 'component', @component))
+ @path = @widget.path
+ @widget.classname
+ rescue
+ nil
+ end
+ end
+ end
+
+ def method_missing(id, *args)
+ name = id.id2name
+
+ # try 1 : component command
+ begin
+ return tk_call(@master, 'component', @component, name, *args)
+ rescue
+ end
+
+ # try 2 : component configure
+ len = args.length
+ begin
+ case len
+ when 1
+ if name[-1] == ?=
+ return configure(name[0..-2], args[0])
+ else
+ return configure(name, args[0])
+ end
+ when 0
+ return cget(name)
+ end
+ rescue
+ end
+
+ # try 3 : widget method or widget configure
+ begin
+ unless @widget
+ @widget = window(tk_call(@master, 'component', @component))
+ @path = @widget.path
+ end
+ @widget.__send__(id, *args)
+ rescue
+ end
+
+ # unknown method
+ fail RuntimeError, "unknown method '#{name}' for #{self.inspect}"
+ end
+
+ def tk_send(cmd, *rest)
+ begin
+ tk_call(@master, 'component', @component, cmd, *rest)
+ rescue
+ unless @path
+ begin
+ @widget = window(tk_call(@master, 'component', @component))
+ @path = @widget.path
+ rescue
+ fail RuntimeError, 'component is not assigned to a widget'
+ end
+ end
+ tk_call(@path, cmd, *rest)
+ end
+ end
+
+ def tk_send_without_enc(cmd, *rest)
+ begin
+ tk_call_without_enc(@master, 'component', @component, cmd, *rest)
+ rescue
+ unless @path
+ begin
+ @widget = window(tk_call(@master, 'component', @component))
+ @path = @widget.path
+ rescue
+ fail RuntimeError, 'component is not assigned to a widget'
+ end
+ end
+ tk_call_without_enc(@path, cmd, *rest)
+ end
+ end
+
+ def tk_send_with_enc(cmd, *rest)
+ begin
+ tk_call_with_enc(@master, 'component', @component, cmd, *rest)
+ rescue
+ unless @path
+ begin
+ @widget = window(tk_call(@master, 'component', @component))
+ @path = @widget.path
+ rescue
+ fail RuntimeError, 'component is not assigned to a widget'
+ end
+ end
+ tk_call_with_enc(@path, cmd, *rest)
+ end
+ end
+
+ def bind(*args)
+ unless @widget
+ begin
+ @widget = window(tk_call(@master, 'component', @component))
+ @path = @widget.path
+ rescue
+ fail RuntimeError, 'component is not assigned to a widget'
+ end
+ end
+ @widget.bind(*args)
+ end
+
+ def bind_append(*args)
+ unless @widget
+ begin
+ @widget = window(tk_call(@master, 'component', @component))
+ @path = @widget.path
+ rescue
+ fail RuntimeError, 'component is not assigned to a widget'
+ end
+ end
+ @widget.bind_append(*args)
+ end
+
+ def bind_remove(*args)
+ unless @widget
+ begin
+ @widget = window(tk_call(@master, 'component', @component))
+ @path = @widget.path
+ rescue
+ fail RuntimeError, 'component is not assigned to a widget'
+ end
+ end
+ @widget.bind_remove(*args)
+ end
+
+ def bindinfo(*args)
+ unless @widget
+ begin
+ @widget = window(tk_call(@master, 'component', @component))
+ @path = @widget.path
+ rescue
+ fail RuntimeError, 'component is not assigned to a widget'
+ end
+ end
+ @widget.bindinfo(*args)
+ end
+
+ end
+ end
+end
diff --git a/ext/tk/lib/tkextlib/itk/setup.rb b/ext/tk/lib/tkextlib/itk/setup.rb
new file mode 100644
index 0000000000..e47b64adae
--- /dev/null
+++ b/ext/tk/lib/tkextlib/itk/setup.rb
@@ -0,0 +1,13 @@
+#
+# setup.rb -- setup script before calling TkPackage.require()
+#
+# If you need some setup operations (for example, add a library path
+# to the library search path) before using Tcl/Tk library packages
+# wrapped by Ruby scripts in this directory, please write the setup
+# operations in this file.
+#
+
+
+# set [incr Tk] library directory
+
+# ENV['ITK_LIBRARY'] = '/usr/local/ActiveTcl/lib/itk3.2/'
diff --git a/ext/tk/lib/tkextlib/iwidgets.rb b/ext/tk/lib/tkextlib/iwidgets.rb
new file mode 100644
index 0000000000..7edd43346c
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets.rb
@@ -0,0 +1,57 @@
+#
+# [incr Widgets] support
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/itcl'
+require 'tkextlib/itk'
+
+# call setup script for general 'tkextlib' libraries
+#require 'tkextlib/setup.rb'
+
+# call setup script
+#require 'tkextlib/iwidgets/setup.rb'
+
+# load all image format handlers
+#TkPackage.require('Iwidgets', '4.0')
+TkPackage.require('Iwidgets')
+
+module Tk
+ module Iwidgets
+ extend TkCore
+
+ def self.package_version
+ begin
+ TkPackage.require('Iwidgets')
+ rescue
+ ''
+ end
+ end
+
+ ####################################################
+
+ autoload :Buttonbox, 'tkextlib/iwidgets/buttonbox'
+ autoload :Calendar, 'tkextlib/iwidgets/calendar'
+ autoload :Canvasprintbox, 'tkextlib/iwidgets/canvasprintbox'
+ autoload :Canvasprintdialog, 'tkextlib/iwidgets/canvasprintdialog'
+ autoload :Checkbox, 'tkextlib/iwidgets/checkbox'
+ autoload :Combobox, 'tkextlib/iwidgets/combobox'
+ autoload :Dateentry, 'tkextlib/iwidgets/dateentry'
+ autoload :Datefield, 'tkextlib/iwidgets/datefield'
+ autoload :Dialog, 'tkextlib/iwidgets/dialog'
+ autoload :Dialogshell, 'tkextlib/iwidgets/dialogshell'
+ autoload :Disjointlistbox, 'tkextlib/iwidgets/disjointlistbox'
+ autoload :Entryfield, 'tkextlib/iwidgets/entryfield'
+ autoload :Extbutton, 'tkextlib/iwidgets/extbutton'
+ autoload :Extfileselectionbox, 'tkextlib/iwidgets/extfileselectionbox'
+ autoload :Extfileselectiondialog,'tkextlib/iwidgets/extfileselectiondialog'
+ autoload :Feedback, 'tkextlib/iwidgets/feedback'
+ autoload :Fileselectionbox, 'tkextlib/iwidgets/fileselectionbox'
+ autoload :Fileselectiondialog, 'tkextlib/iwidgets/fileselectiondialog'
+ autoload :Finddialog, 'tkextlib/iwidgets/finddialog'
+ autoload :Labeledframe, 'tkextlib/iwidgets/labeledframe'
+ autoload :Labeledwidget, 'tkextlib/iwidgets/labeledwidget'
+ autoload :Shell, 'tkextlib/iwidgets/shell'
+ end
+end
diff --git a/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb b/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb
new file mode 100644
index 0000000000..fef442a769
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb
@@ -0,0 +1,109 @@
+#
+# tkextlib/iwidgets/buttonbox.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/iwidgets.rb'
+
+module Tk
+ module Iwidgets
+ class Buttonbox < Tk::Itk::Widget
+ end
+ end
+end
+
+class Tk::Iwidgets::Buttonbox
+ TkCommandNames = ['::iwidgets::buttonbox'.freeze].freeze
+ WidgetClassName = 'Buttonbox'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ ####################################
+
+ include TkItemConfigMethod
+
+ def __item_cget_cmd(id)
+ [self.path, 'buttoncget', id]
+ end
+ private :__item_cget_cmd
+
+ def __item_config_cmd(id)
+ [self.path, 'buttonconfigure', id]
+ end
+ private :__item_config_cmd
+
+ def tagid(tagOrId)
+ if tagOrId.kind_of?(Tk::Itk::Component)
+ tagOrId.name
+ else
+ _get_eval_string(tagOrId)
+ end
+ end
+
+ alias buttoncget itemcget
+ alias buttonconfigure itemconfigure
+ alias buttonconfiginfo itemconfiginfo
+ alias current_buttonconfiginfo current_itemconfiginfo
+
+ private :itemcget, :itemconfigure
+ private :itemconfiginfo, :current_itemconfiginfo
+
+ ####################################
+
+ def add(tag=nil, keys={})
+ if tag.kind_of?(Hash)
+ keys = tag
+ tag = nil
+ end
+ unless tag
+ tag = Tk::Itk::Component.new(self)
+ end
+ tk_call(@path, 'add', tagid(tag), *hash_kv(keys))
+ tag
+ end
+
+ def default(idx)
+ tk_call(@path, 'default', index(idx))
+ self
+ end
+
+ def delete(idx)
+ tk_call(@path, 'delete', index(idx))
+ self
+ end
+
+ def hide(idx)
+ tk_call(@path, 'hide', index(idx))
+ self
+ end
+
+ def index(idx)
+ number(tk_call(@path, 'index', tagid(idx)))
+ end
+
+ def insert(idx, tag=nil, keys={})
+ if tag.kind_of?(Hash)
+ keys = tag
+ tag = nil
+ end
+ unless tag
+ tag = Tk::Itk::Component.new(self)
+ end
+ tk_call(@path, 'insert', index(idx), tagid(tag), *hash_kv(keys))
+ tag
+ end
+
+ def invoke(idx=nil)
+ if idx
+ tk_call(@path, 'invoke', index(idx))
+ else
+ tk_call(@path, 'invoke')
+ end
+ self
+ end
+
+ def show(idx)
+ tk_call(@path, 'show', index(idx))
+ self
+ end
+end
diff --git a/ext/tk/lib/tkextlib/iwidgets/calendar.rb b/ext/tk/lib/tkextlib/iwidgets/calendar.rb
new file mode 100644
index 0000000000..7a9763addc
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/calendar.rb
@@ -0,0 +1,85 @@
+#
+# tkextlib/iwidgets/calendar.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/iwidgets.rb'
+
+module Tk
+ module Iwidgets
+ class Calendar < Tk::Itk::Widget
+ end
+ end
+end
+
+class Tk::Iwidgets::Calendar
+ TkCommandNames = ['::iwidgets::calendar'.freeze].freeze
+ WidgetClassName = 'Calendar'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ ####################################
+
+ include Tk::ValidateConfigure
+
+ class CalendarCommand < TkValidateCommand
+ #class CalCmdArgs < TkUtil::CallbackSubst
+ class ValidateArgs < TkUtil::CallbackSubst
+ KEY_TBL = [ [?d, ?s, :date], nil ]
+ PROC_TBL = [ [?s, TkComm.method(:string) ], nil ]
+ _setup_subst_table(KEY_TBL, PROC_TBL);
+
+ def self.ret_val(val)
+ val
+ end
+ end
+
+ def self._config_keys
+ # array of config-option key (string or symbol)
+ ['command']
+ end
+
+ #def initialize(cmd = Proc.new, *args)
+ # _initialize_for_cb_class(CalCmdArgs, cmd, *args)
+ #end
+ end
+
+ def __validation_class_list
+ super << CalendarCommand
+ end
+
+ def command(cmd = Proc.new, args = nil)
+ if cmd.kind_of?(CalendarCommand)
+ configure('command', cmd)
+ elsif args
+ configure('command', [cmd, args])
+ else
+ configure('command', cmd)
+ end
+ end
+
+ ####################################
+
+ def get_string
+ tk_call(@path, 'get', '-string')
+ end
+ alias get get_string
+
+ def get_clicks
+ number(tk_call(@path, 'get', '-clicks'))
+ end
+
+ def select(date)
+ tk_call(@path, 'select', date)
+ self
+ end
+
+ def show(date)
+ tk_call(@path, 'show', date)
+ self
+ end
+ def show_now
+ tk_call(@path, 'show', 'now')
+ self
+ end
+end
diff --git a/ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb b/ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb
new file mode 100644
index 0000000000..1e2a476591
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb
@@ -0,0 +1,43 @@
+#
+# tkextlib/iwidgets/canvasprintbox.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/iwidgets.rb'
+
+module Tk
+ module Iwidgets
+ class Canvasprintbox < Tk::Itk::Widget
+ end
+ end
+end
+
+class Tk::Iwidgets::Canvasprintbox
+ TkCommandNames = ['::iwidgets::canvasprintbox'.freeze].freeze
+ WidgetClassName = 'Canvasprintbox'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def get_output
+ tk_call(@path, 'getoutput')
+ end
+
+ def print
+ bool(tk_call(@path, 'print'))
+ end
+
+ def refresh
+ tk_call(@path, 'refresh')
+ self
+ end
+
+ def set_canvas(win)
+ tk_call(@path, 'setcanvas', win)
+ self
+ end
+
+ def stop
+ tk_call(@path, 'stop')
+ self
+ end
+end
diff --git a/ext/tk/lib/tkextlib/iwidgets/canvasprintdialog.rb b/ext/tk/lib/tkextlib/iwidgets/canvasprintdialog.rb
new file mode 100644
index 0000000000..bbf507677c
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/canvasprintdialog.rb
@@ -0,0 +1,38 @@
+#
+# tkextlib/iwidgets/canvasprintdialog.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/iwidgets.rb'
+
+module Tk
+ module Iwidgets
+ class Canvasprintdialog < Tk::Iwidgets::Dialog
+ end
+ end
+end
+
+class Tk::Iwidgets::Canvasprintdialog
+ TkCommandNames = ['::iwidgets::canvasprintdialog'.freeze].freeze
+ WidgetClassName = 'Canvasprintdialog'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def get_output
+ tk_call(@path, 'getoutput')
+ end
+
+ def print
+ bool(tk_call(@path, 'print'))
+ end
+
+ def refresh
+ tk_call(@path, 'refresh')
+ self
+ end
+
+ def set_canvas(win)
+ tk_call(@path, 'setcanvas', win)
+ self
+ end
+end
diff --git a/ext/tk/lib/tkextlib/iwidgets/checkbox.rb b/ext/tk/lib/tkextlib/iwidgets/checkbox.rb
new file mode 100644
index 0000000000..9845439ac4
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/checkbox.rb
@@ -0,0 +1,106 @@
+#
+# tkextlib/iwidgets/checkbox.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/iwidgets.rb'
+
+module Tk
+ module Iwidgets
+ class Checkbox < Tk::Iwidgets::Labeledframe
+ end
+ end
+end
+
+class Tk::Iwidgets::Checkbox
+ TkCommandNames = ['::iwidgets::checkbox'.freeze].freeze
+ WidgetClassName = 'Checkbox'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ ####################################
+
+ include TkItemConfigMethod
+
+ def __item_cget_cmd(id)
+ [self.path, 'buttoncget', id]
+ end
+ private :__item_cget_cmd
+
+ def __item_config_cmd(id)
+ [self.path, 'buttonconfigure', id]
+ end
+ private :__item_config_cmd
+
+ def tagid(tagOrId)
+ if tagOrId.kind_of?(Tk::Itk::Component)
+ tagOrId.name
+ else
+ _get_eval_string(tagOrId)
+ end
+ end
+
+ alias buttoncget itemcget
+ alias buttonconfigure itemconfigure
+ alias buttonconfiginfo itemconfiginfo
+ alias current_buttonconfiginfo current_itemconfiginfo
+
+ private :itemcget, :itemconfigure
+ private :itemconfiginfo, :current_itemconfiginfo
+
+ ####################################
+
+ def add(tag=nil, keys={})
+ if tag.kind_of?(Hash)
+ keys = tag
+ tag = nil
+ end
+ unless tag
+ tag = Tk::Itk::Component.new(self)
+ end
+ tk_call(@path, 'add', tagid(tag), *hash_kv(keys))
+ tag
+ end
+
+ def delete(idx)
+ tk_call(@path, 'delete', index(idx))
+ self
+ end
+
+ def deselect(idx)
+ tk_call(@path, 'deselect', index(idx))
+ self
+ end
+
+ def flash(idx)
+ tk_call(@path, 'flash', index(idx))
+ self
+ end
+
+ def get(idx)
+ simplelist(tk_call(@path, 'get', index(idx))).collect{|id|
+ Tk::Itk::Component.id2obj(id)
+ }
+ end
+
+ def index(idx)
+ number(tk_call(@path, 'index', tagid(idx)))
+ end
+
+ def insert(idx, tag=nil, keys={})
+ if tag.kind_of?(Hash)
+ keys = tag
+ tag = nil
+ end
+ unless tag
+ tag = Tk::Itk::Component.new(self)
+ end
+ tk_call(@path, 'insert', index(idx), tagid(tag), *hash_kv(keys))
+ tag
+ end
+
+ def select(idx)
+ tk_call(@path, 'select', index(idx))
+ self
+ end
+end
diff --git a/ext/tk/lib/tkextlib/iwidgets/combobox.rb b/ext/tk/lib/tkextlib/iwidgets/combobox.rb
new file mode 100644
index 0000000000..ca0e57c233
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/combobox.rb
@@ -0,0 +1,98 @@
+#
+# tkextlib/iwidgets/combobox.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/iwidgets.rb'
+
+module Tk
+ module Iwidgets
+ class Combobox < Tk::Iwidgets::Entryfield
+ end
+ end
+end
+
+class Tk::Iwidgets::Combobox
+ TkCommandNames = ['::iwidgets::combobox'.freeze].freeze
+ WidgetClassName = 'Combobox'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def clear(component=None)
+ tk_call(@path, 'clear', component)
+ self
+ end
+
+ def delete_list(first, last=None)
+ tk_call(@path, 'delete', 'list', first, last)
+ self
+ end
+
+ def delete_entry(first, last=None)
+ tk_call(@path, 'delete', 'entry', first, last)
+ self
+ end
+
+ def get_list_contents(index)
+ tk_call(@path, 'get', index)
+ end
+
+ def insert_list(idx, *elems)
+ tk_call(@path, 'insert', 'list', idx, *elems)
+ self
+ end
+
+ def insert_entry(idx, *elems)
+ tk_call(@path, 'insert', 'entry', idx, *elems)
+ self
+ end
+
+ # listbox methods
+ def size
+ tk_send_without_enc('size').to_i
+ end
+ def see(index)
+ tk_send_without_enc('see', index)
+ self
+ end
+ def selection_anchor(index)
+ tk_send_without_enc('selection', 'anchor', index)
+ self
+ end
+ def selection_clear(first, last=None)
+ tk_send_without_enc('selection', 'clear', first, last)
+ self
+ end
+ def selection_includes(index)
+ bool(tk_send_without_enc('selection', 'includes', index))
+ end
+ def selection_set(first, last=None)
+ tk_send_without_enc('selection', 'set', first, last)
+ self
+ end
+
+ # scrolledlistbox methods
+ def get_curselection
+ tk_call(@path, 'getcurselection')
+ end
+ def justify(dir)
+ tk_call(@path, 'justify', dir)
+ self
+ end
+ def sort(*params, &b)
+ # see 'lsort' man page about params
+ if b
+ tk_call(@path, 'sort', *params, -'command', proc(&b))
+ else
+ tk_call(@path, 'sort', *params)
+ end
+ self
+ end
+ def sort_ascending
+ tk_call(@path, 'sort', 'ascending')
+ self
+ def sort_descending
+ tk_call(@path, 'sort', 'descending')
+ self
+ end
+end
diff --git a/ext/tk/lib/tkextlib/iwidgets/dateentry.rb b/ext/tk/lib/tkextlib/iwidgets/dateentry.rb
new file mode 100644
index 0000000000..0a8897f50d
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/dateentry.rb
@@ -0,0 +1,20 @@
+#
+# tkextlib/iwidgets/dateentry.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/iwidgets.rb'
+
+module Tk
+ module Iwidgets
+ class Dateentry < Tk::Iwidgets::Datefield
+ end
+ end
+end
+
+class Tk::Iwidgets::Dateentry
+ TkCommandNames = ['::iwidgets::dateentry'.freeze].freeze
+ WidgetClassName = 'Dateentry'.freeze
+ WidgetClassNames[WidgetClassName] = self
+end
diff --git a/ext/tk/lib/tkextlib/iwidgets/datefield.rb b/ext/tk/lib/tkextlib/iwidgets/datefield.rb
new file mode 100644
index 0000000000..a757403d6e
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/datefield.rb
@@ -0,0 +1,42 @@
+#
+# tkextlib/iwidgets/datefield.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/iwidgets.rb'
+
+module Tk
+ module Iwidgets
+ class Datefield < Tk::Iwidgets::Labeledwidget
+ end
+ end
+end
+
+class Tk::Iwidgets::Datefield
+ TkCommandNames = ['::iwidgets::datefield'.freeze].freeze
+ WidgetClassName = 'Datefield'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def get_string
+ tk_call(@path, 'get', '-string')
+ end
+ alias get get_string
+
+ def get_clicks
+ number(tk_call(@path, 'get', '-clicks'))
+ end
+
+ def valid?
+ bool(tk_call(@path, 'isvalid'))
+ end
+
+ def show(date)
+ tk_call(@path, 'show', date)
+ self
+ end
+ def show_now
+ tk_call(@path, 'show', 'now')
+ self
+ end
+end
diff --git a/ext/tk/lib/tkextlib/iwidgets/dialog.rb b/ext/tk/lib/tkextlib/iwidgets/dialog.rb
new file mode 100644
index 0000000000..8540eae1b5
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/dialog.rb
@@ -0,0 +1,20 @@
+#
+# tkextlib/iwidgets/dialog.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/iwidgets.rb'
+
+module Tk
+ module Iwidgets
+ class Dialog < Tk::Iwidgets::Dialogshell
+ end
+ end
+end
+
+class Tk::Iwidgets::Dialog
+ TkCommandNames = ['::iwidgets::dialog'.freeze].freeze
+ WidgetClassName = 'Dialog'.freeze
+ WidgetClassNames[WidgetClassName] = self
+end
diff --git a/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb b/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb
new file mode 100644
index 0000000000..8359a3c551
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb
@@ -0,0 +1,109 @@
+#
+# tkextlib/iwidgets/dialogshell.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/iwidgets.rb'
+
+module Tk
+ module Iwidgets
+ class Dialogshell < Tk::Iwidgets::Shell
+ end
+ end
+end
+
+class Tk::Iwidgets::Dialogshell
+ TkCommandNames = ['::iwidgets::dialogshell'.freeze].freeze
+ WidgetClassName = 'Dialogshell'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ ####################################
+
+ include TkItemConfigMethod
+
+ def __item_cget_cmd(id)
+ [self.path, 'buttoncget', id]
+ end
+ private :__item_cget_cmd
+
+ def __item_config_cmd(id)
+ [self.path, 'buttonconfigure', id]
+ end
+ private :__item_config_cmd
+
+ def tagid(tagOrId)
+ if tagOrId.kind_of?(Tk::Itk::Component)
+ tagOrId.name
+ else
+ _get_eval_string(tagOrId)
+ end
+ end
+
+ alias buttoncget itemcget
+ alias buttonconfigure itemconfigure
+ alias buttonconfiginfo itemconfiginfo
+ alias current_buttonconfiginfo current_itemconfiginfo
+
+ private :itemcget, :itemconfigure
+ private :itemconfiginfo, :current_itemconfiginfo
+
+ ####################################
+
+ def add(tag=nil, keys={})
+ if tag.kind_of?(Hash)
+ keys = tag
+ tag = nil
+ end
+ unless tag
+ tag = Tk::Itk::Component.new(self)
+ end
+ tk_call(@path, 'add', tagid(tag), *hash_kv(keys))
+ tag
+ end
+
+ def default(idx)
+ tk_call(@path, 'default', index(idx))
+ self
+ end
+
+ def delete(idx)
+ tk_call(@path, 'delete', index(idx))
+ self
+ end
+
+ def hide(idx)
+ tk_call(@path, 'hide', index(idx))
+ self
+ end
+
+ def index(idx)
+ number(tk_call(@path, 'index', tagid(idx)))
+ end
+
+ def insert(idx, tag=nil, keys={})
+ if tag.kind_of?(Hash)
+ keys = tag
+ tag = nil
+ end
+ unless tag
+ tag = Tk::Itk::Component.new(self)
+ end
+ tk_call(@path, 'insert', index(idx), tagid(tag), *hash_kv(keys))
+ tag
+ end
+
+ def invoke(idx=nil)
+ if idx
+ tk_call(@path, 'invoke', index(idx))
+ else
+ tk_call(@path, 'invoke')
+ end
+ self
+ end
+
+ def show(idx)
+ tk_call(@path, 'show', index(idx))
+ self
+ end
+end
diff --git a/ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb b/ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb
new file mode 100644
index 0000000000..8418467925
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb
@@ -0,0 +1,45 @@
+#
+# tkextlib/iwidgets/disjointlistbox.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/iwidgets.rb'
+
+module Tk
+ module Iwidgets
+ class Disjointlistbox < Tk::Itk::Widget
+ end
+ end
+end
+
+class Tk::Iwidgets::Disjointlistbox
+ TkCommandNames = ['::iwidgets::disjointlistbox'.freeze].freeze
+ WidgetClassName = 'Disjointlistbox'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def set_lhs(*items)
+ tk_call(@path, 'setlhs', items)
+ self
+ end
+ def set_rhs(*items)
+ tk_call(@path, 'setrhs', items)
+ self
+ end
+
+ def get_lhs
+ simplelist(tk_call(@path, 'getlhs'))
+ end
+ def get_rhs
+ simplelist(tk_call(@path, 'getrhs'))
+ end
+
+ def insert_lhs(*items)
+ tk_call(@path, 'insertlhs', items)
+ self
+ end
+ def insert_rhs(*items)
+ tk_call(@path, 'insertrhs', items)
+ self
+ end
+end
diff --git a/ext/tk/lib/tkextlib/iwidgets/entryfield.rb b/ext/tk/lib/tkextlib/iwidgets/entryfield.rb
new file mode 100644
index 0000000000..b38615a671
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/entryfield.rb
@@ -0,0 +1,152 @@
+#
+# tkextlib/iwidgets/entryfield.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/iwidgets.rb'
+
+module Tk
+ module Iwidgets
+ class Entryfield < Tk::Iwidgets::Labeledwidget
+ end
+ end
+end
+
+class Tk::Iwidgets::Entryfield
+ TkCommandNames = ['::iwidgets::entryfield'.freeze].freeze
+ WidgetClassName = 'Entryfield'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ ####################################
+
+ include Tk::ValidateConfigure
+
+ class EntryfieldValidate < TkValidateCommand
+ #class CalCmdArgs < TkUtil::CallbackSubst
+ class ValidateArgs < TkUtil::CallbackSubst
+ KEY_TBL = [
+ [ ?c, ?s, :char ],
+ [ ?P, ?s, :post ],
+ [ ?S, ?s, :current ],
+ [ ?W, ?w, :widget ],
+ nil
+ ]
+ PROC_TBL = [
+ [ ?s, TkComm.method(:string) ],
+ [ ?w, TkComm.method(:window) ],
+ nil
+ ]
+ _setup_subst_table(KEY_TBL, PROC_TBL);
+ end
+
+ def self._config_keys
+ ['validate', 'invalid']
+ end
+ end
+
+ def __validation_class_list
+ super << EntryfieldValidate
+ end
+
+ def validate(cmd = Proc.new, args = nil)
+ if cmd.kind_of?(ValidateCmd)
+ configure('validate', cmd)
+ elsif args
+ configure('validate', [cmd, args])
+ else
+ configure('validate', cmd)
+ end
+ end
+
+ def invalid(cmd = Proc.new, args = nil)
+ if cmd.kind_of?(ValidateCmd)
+ configure('invalid', cmd)
+ elsif args
+ configure('invalid', [cmd, args])
+ else
+ configure('invalid', cmd)
+ end
+ end
+
+ ####################################
+
+ def clear
+ tk_call(@path, 'clear')
+ self
+ end
+
+ def delete(first, last=None)
+ tk_send_without_enc('delete', first, last)
+ self
+ end
+
+ def value
+ _fromUTF8(tk_send_without_enc('get'))
+ end
+ alias get value
+
+ def cursor=(index)
+ tk_send_without_enc('icursor', index)
+ #self
+ index
+ end
+ alias icursor cursor=
+
+ def index(index)
+ number(tk_send_without_enc('index', index))
+ end
+
+ def insert(pos,text)
+ tk_send_without_enc('insert', pos, _get_eval_enc_str(text))
+ self
+ end
+
+ def mark(pos)
+ tk_send_without_enc('scan', 'mark', pos)
+ self
+ end
+ def dragto(pos)
+ tk_send_without_enc('scan', 'dragto', pos)
+ self
+ end
+ def selection_adjust(index)
+ tk_send_without_enc('selection', 'adjust', index)
+ self
+ end
+ def selection_clear
+ tk_send_without_enc('selection', 'clear')
+ self
+ end
+ def selection_from(index)
+ tk_send_without_enc('selection', 'from', index)
+ self
+ end
+ def selection_present()
+ bool(tk_send_without_enc('selection', 'present'))
+ end
+ def selection_range(s, e)
+ tk_send_without_enc('selection', 'range', s, e)
+ self
+ end
+ def selection_to(index)
+ tk_send_without_enc('selection', 'to', index)
+ self
+ end
+
+ # based on tk/scrollable.rb
+ def xview(*index)
+ if index.size == 0
+ list(tk_send_without_enc('xview'))
+ else
+ tk_send_without_enc('xview', *index)
+ self
+ end
+ end
+ def xview_moveto(*index)
+ xview('moveto', *index)
+ end
+ def xview_scroll(*index)
+ xview('scroll', *index)
+ end
+end
diff --git a/ext/tk/lib/tkextlib/iwidgets/extbutton.rb b/ext/tk/lib/tkextlib/iwidgets/extbutton.rb
new file mode 100644
index 0000000000..7b1e35aa2d
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/extbutton.rb
@@ -0,0 +1,30 @@
+#
+# tkextlib/iwidgets/extbutton.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/iwidgets.rb'
+
+module Tk
+ module Iwidgets
+ class Extbutton < Tk::Itk::Widget
+ end
+ end
+end
+
+class Tk::Iwidgets::Extbutton
+ TkCommandNames = ['::iwidgets::extbutton'.freeze].freeze
+ WidgetClassName = 'Extbutton'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def invoke
+ tk_call(@path, 'invoke')
+ self
+ end
+
+ def flash
+ tk_call(@path, 'flash')
+ self
+ end
+end
diff --git a/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb b/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb
new file mode 100644
index 0000000000..282647893c
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb
@@ -0,0 +1,33 @@
+#
+# tkextlib/iwidgets/extfileselectionbox.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/iwidgets.rb'
+
+module Tk
+ module Iwidgets
+ class Extfileselectionbox < Tk::Itk::Widget
+ end
+ end
+end
+
+class Tk::Iwidgets::Extfileselectionbox
+ TkCommandNames = ['::iwidgets::extfileselectionbox'.freeze].freeze
+ WidgetClassName = 'Extfileselectionbox'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def child_site
+ window(tk_call(@path, 'childsite'))
+ end
+
+ def filter
+ tk_call(@path, 'filter')
+ self
+ end
+
+ def get
+ tk_call(@path, 'get')
+ end
+end
diff --git a/ext/tk/lib/tkextlib/iwidgets/extfileselectiondialog.rb b/ext/tk/lib/tkextlib/iwidgets/extfileselectiondialog.rb
new file mode 100644
index 0000000000..14388be7c4
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/extfileselectiondialog.rb
@@ -0,0 +1,33 @@
+#
+# tkextlib/iwidgets/extfileselectiondialog.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/iwidgets.rb'
+
+module Tk
+ module Iwidgets
+ class Extfileselectiondialog < Tk::Iwidgets::Dialog
+ end
+ end
+end
+
+class Tk::Iwidgets::Extfileselectiondialog
+ TkCommandNames = ['::iwidgets::extfileselectiondialog'.freeze].freeze
+ WidgetClassName = 'Extfileselectiondialog'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def child_site
+ window(tk_call(@path, 'childsite'))
+ end
+
+ def filter
+ tk_call(@path, 'filter')
+ self
+ end
+
+ def get
+ tk_call(@path, 'get')
+ end
+end
diff --git a/ext/tk/lib/tkextlib/iwidgets/feedback.rb b/ext/tk/lib/tkextlib/iwidgets/feedback.rb
new file mode 100644
index 0000000000..d7439d818a
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/feedback.rb
@@ -0,0 +1,30 @@
+#
+# tkextlib/iwidgets/feedback.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/iwidgets.rb'
+
+module Tk
+ module Iwidgets
+ class Feedback < Tk::Iwidgets::Labeledwidget
+ end
+ end
+end
+
+class Tk::Iwidgets::Feedback
+ TkCommandNames = ['::iwidgets::feedback'.freeze].freeze
+ WidgetClassName = 'Feedback'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def reset
+ tk_call(@path, 'reset')
+ self
+ end
+
+ def step(inc=1)
+ tk_call(@path, 'step', inc)
+ self
+ end
+end
diff --git a/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb b/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb
new file mode 100644
index 0000000000..46de13d1b2
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb
@@ -0,0 +1,33 @@
+#
+# tkextlib/iwidgets/fileselectionbox.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/iwidgets.rb'
+
+module Tk
+ module Iwidgets
+ class Fileselectionbox < Tk::Itk::Widget
+ end
+ end
+end
+
+class Tk::Iwidgets::Fileselectionbox
+ TkCommandNames = ['::iwidgets::fileselectionbox'.freeze].freeze
+ WidgetClassName = 'Fileselectionbox'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def child_site
+ window(tk_call(@path, 'childsite'))
+ end
+
+ def filter
+ tk_call(@path, 'filter')
+ self
+ end
+
+ def get
+ tk_call(@path, 'get')
+ end
+end
diff --git a/ext/tk/lib/tkextlib/iwidgets/fileselectiondialog.rb b/ext/tk/lib/tkextlib/iwidgets/fileselectiondialog.rb
new file mode 100644
index 0000000000..50f459e56d
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/fileselectiondialog.rb
@@ -0,0 +1,33 @@
+#
+# tkextlib/iwidgets/fileselectiondialog.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/iwidgets.rb'
+
+module Tk
+ module Iwidgets
+ class Fileselectiondialog < Tk::Iwidgets::Dialog
+ end
+ end
+end
+
+class Tk::Iwidgets::Fileselectiondialog
+ TkCommandNames = ['::iwidgets::fileselectiondialog'.freeze].freeze
+ WidgetClassName = 'Fileselectiondialog'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def child_site
+ window(tk_call(@path, 'childsite'))
+ end
+
+ def filter
+ tk_call(@path, 'filter')
+ self
+ end
+
+ def get
+ tk_call(@path, 'get')
+ end
+end
diff --git a/ext/tk/lib/tkextlib/iwidgets/finddialog.rb b/ext/tk/lib/tkextlib/iwidgets/finddialog.rb
new file mode 100644
index 0000000000..a161c3c2a4
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/finddialog.rb
@@ -0,0 +1,29 @@
+#
+# tkextlib/iwidgets/finddialog.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/iwidgets.rb'
+
+module Tk
+ module Iwidgets
+ class Finddialog < Tk::Iwidgets::Dialogshell
+ end
+ end
+end
+
+class Tk::Iwidgets::Finddialog
+ TkCommandNames = ['::iwidgets::finddialog'.freeze].freeze
+ WidgetClassName = 'Finddialog'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def clear
+ tk_call(@path, 'clear')
+ self
+ end
+
+ def find
+ tk_call(@path, 'find')
+ end
+end
diff --git a/ext/tk/lib/tkextlib/iwidgets/labeledframe.rb b/ext/tk/lib/tkextlib/iwidgets/labeledframe.rb
new file mode 100644
index 0000000000..89669ea815
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/labeledframe.rb
@@ -0,0 +1,24 @@
+#
+# tkextlib/iwidgets/labeledframe.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/iwidgets.rb'
+
+module Tk
+ module Iwidgets
+ class Labeledframe < Tk::Itk::Archetype
+ end
+ end
+end
+
+class Tk::Iwidgets::Labeledframe
+ TkCommandNames = ['::iwidgets::labeledframe'.freeze].freeze
+ WidgetClassName = 'Labeledframe'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def child_site
+ window(tk_call(@path, 'childsite'))
+ end
+end
diff --git a/ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb b/ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb
new file mode 100644
index 0000000000..f847922386
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb
@@ -0,0 +1,30 @@
+#
+# tkextlib/iwidgets/labeledwidget.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/iwidgets.rb'
+
+module Tk
+ module Iwidgets
+ class Labeledwidget < Tk::Itk::Widget
+ end
+ end
+end
+
+class Tk::Iwidgets::Labeledwidget
+ extend TkCore
+
+ TkCommandNames = ['::iwidgets::labeledwidget'.freeze].freeze
+ WidgetClassName = 'Labeledwidget'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def self.alignlabels(*wins)
+ tk_call('::iwidgets::Labeledwidget::alignlabels', *wins)
+ end
+
+ def child_site
+ window(tk_call(@path, 'childsite'))
+ end
+end
diff --git a/ext/tk/lib/tkextlib/iwidgets/setup.rb b/ext/tk/lib/tkextlib/iwidgets/setup.rb
new file mode 100644
index 0000000000..ce0f0bd4d4
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/setup.rb
@@ -0,0 +1,8 @@
+#
+# setup.rb -- setup script before calling TkPackage.require()
+#
+# If you need some setup operations (for example, add a library path
+# to the library search path) before using Tcl/Tk library packages
+# wrapped by Ruby scripts in this directory, please write the setup
+# operations in this file.
+#
diff --git a/ext/tk/lib/tkextlib/iwidgets/shell.rb b/ext/tk/lib/tkextlib/iwidgets/shell.rb
new file mode 100644
index 0000000000..dabf2e6f25
--- /dev/null
+++ b/ext/tk/lib/tkextlib/iwidgets/shell.rb
@@ -0,0 +1,38 @@
+#
+# tkextlib/iwidgets/shell.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/iwidgets.rb'
+
+module Tk
+ module Iwidgets
+ class Shell < Tk::Itk::Toplevel
+ end
+ end
+end
+
+class Tk::Iwidgets::Shell
+ TkCommandNames = ['::iwidgets::shell'.freeze].freeze
+ WidgetClassName = 'Shell'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def activate
+ tk_call(@path, 'activate') # may return val of deactibate method
+ end
+
+ def center(win=None)
+ tk_call(@path, 'center', win)
+ self
+ end
+
+ def child_site
+ window(tk_call(@path, 'childsite'))
+ end
+
+ def deactivate(val=None)
+ tk_call(@path, 'deactivate', val)
+ self
+ end
+end
diff --git a/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/clear.gif b/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/clear.gif
new file mode 100644
index 0000000000..bd45628aa7
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/clear.gif
Binary files differ
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/buttonbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/buttonbox.rb
new file mode 100644
index 0000000000..2b7cd45205
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/buttonbox.rb
@@ -0,0 +1,22 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+# sample 1
+p bb1 = Tk::Iwidgets::Buttonbox.new
+p bb1.add('Yes', :text=>'Yes', :command=>proc{puts 'Yes'})
+p bb1.add('No', :text=>'No', :command=>proc{puts 'No'})
+p bb1.add('Maybe', :text=>'Maybe', :command=>proc{puts 'Maybe'})
+bb1.default('Yes')
+bb1.pack(:expand=>true, :fill=>:both, :pady=>5)
+print "\n"
+
+# sample 2
+p bb2 = Tk::Iwidgets::Buttonbox.new
+p btn1 = bb2.add(:text=>'Yes', :command=>proc{puts 'Yes'})
+p btn2 = bb2.add(:text=>'No', :command=>proc{puts 'No'})
+p btn3 = bb2.add(:text=>'Maybe', :command=>proc{puts 'Maybe'})
+bb2.default(btn1)
+bb2.pack(:expand=>true, :fill=>:both, :pady=>5)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb b/ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb
new file mode 100644
index 0000000000..7a7c65ae82
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb
@@ -0,0 +1,10 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+Tk::Iwidgets::Calendar.new(:command=>proc{|arg| puts(arg.date)},
+ :weekendbackground=>'mistyrose',
+ :weekdaybackground=>'ghostwhite',
+ :outline=>'black', :startday=>'wednesday',
+ :days=>%w(We Th Fr Sa Su Mo Tu)).pack
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/canvasprintbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/canvasprintbox.rb
new file mode 100644
index 0000000000..c7c043000a
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/canvasprintbox.rb
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+Tk::Iwidgets::Canvasprintbox.new(:orient=>:landscape, :stretch=>1) \
+ .pack(:padx=>10, :pady=>10, :fill=>:both, :expand=>true)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/canvasprintdialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/canvasprintdialog.rb
new file mode 100644
index 0000000000..ea8d63e6eb
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/canvasprintdialog.rb
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+Tk::Iwidgets::Canvasprintdialog.new.activate
+
+Tk.mainloop
+
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/checkbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/checkbox.rb
new file mode 100644
index 0000000000..bae0eba73a
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/checkbox.rb
@@ -0,0 +1,12 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+cb = Tk::Iwidgets::Checkbox.new
+cb.add('bold', :text=>'Bold')
+cb.add('italic', :text=>'Italic')
+cb.add('underline', :text=>'Underline')
+cb.select('underline')
+cb.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb
new file mode 100644
index 0000000000..5c2e6cbbd7
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb
@@ -0,0 +1,32 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+#
+# Non-editable Dropdown Combobox
+#
+cb1 = Tk::Iwidgets::Combobox.new(:labeltext=>'Month:',
+ :selectioncommand=>proc{
+ puts(cb1.get_curselection)
+ },
+ :editable=>false, :listheight=>185,
+ :popupcursor=>'hand1')
+
+cb1.insert_list('end', *%w(Jan Feb Mar Apr May June Jul Aug Sept Oct Nov Dec))
+
+
+#
+# Editable Dropdown Combobox
+#
+cb2 = Tk::Iwidgets::Combobox.new(:labeltext=>'Operating System:',
+ :selectioncommand=>proc{
+ puts(cb2.get_curselection)
+ })
+
+cb2.insert_list('end', *%w(Linux HP-UX SunOS Solaris Irix))
+cb2.insert_entry('end', 'L')
+
+cb1.pack(:padx=>10, :pady=>10, :fill=>:x)
+cb2.pack(:padx=>10, :pady=>10, :fill=>:x)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/dateentry.rb b/ext/tk/sample/tkextlib/iwidgets/sample/dateentry.rb
new file mode 100644
index 0000000000..5727879217
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/dateentry.rb
@@ -0,0 +1,7 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+Tk::Iwidgets::Dateentry.new.pack
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/datefield.rb b/ext/tk/sample/tkextlib/iwidgets/sample/datefield.rb
new file mode 100644
index 0000000000..12d498245d
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/datefield.rb
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+df = Tk::Iwidgets::Datefield.new(:command=>proc{puts(df.get)})
+df.pack(:fill=>:x, :expand=>true, :padx=>10, :pady=>10)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/dialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/dialog.rb
new file mode 100644
index 0000000000..3449cd4b3d
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/dialog.rb
@@ -0,0 +1,20 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+Thread.new{Tk.mainloop}
+
+d = Tk::Iwidgets::Dialog.new(:modality=>:application)
+
+d.buttonconfigure('OK', :command=>proc{puts 'OK'; d.deactivate true})
+d.buttonconfigure('Apply', :command=>proc{puts 'Apply'})
+d.buttonconfigure('Cancel', :command=>proc{puts 'Cancel'; d.deactivate false})
+d.buttonconfigure('Help', :command=>proc{puts 'Help'})
+
+TkListbox.new(d.child_site, :relief=>:sunken).pack(:expand=>true, :fill=>:both)
+
+if TkComm.bool(d.activate)
+ puts "Exit via OK button"
+else
+ puts "Exit via Cancel button"
+end
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb b/ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb
new file mode 100644
index 0000000000..d4578297ec
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb
@@ -0,0 +1,14 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+ds = Tk::Iwidgets::Dialogshell.new(:modality=>:none)
+
+ds.add('OK', :text=>'OK', :command=>proc{puts 'OK'; ds.deactivate})
+ds.add('Cancel', :text=>'Cancel', :command=>proc{puts 'Cancel'; ds.deactivate})
+ds.default('OK')
+
+TkButton.new(:text=>'ACTIVATE', :padx=>7, :pady=>7,
+ :command=>proc{puts ds.activate}).pack(:padx=>10, :pady=>10)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb
new file mode 100644
index 0000000000..f7a0e5c48e
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+djl = Tk::Iwidgets::Disjointlistbox.new.pack(:fill=>:both, :expand=>true,
+ :padx=>10, :pady=>10)
+djl.set_lhs(*[0,2,4,5])
+djl.set_rhs(3,6)
+
+djl.insert_lhs(1,7,8)
+djl.insert_rhs(9)
+
+p djl.get_lhs
+p djl.get_rhs
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb
new file mode 100644
index 0000000000..24253fcb98
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb
@@ -0,0 +1,39 @@
+#!/usr/bin/env ruby
+#########################################################
+#
+# use Tk::UTF8_String() for a utf8 charecter
+#
+#########################################################
+require 'tk'
+require 'tkextlib/iwidgets'
+
+TkOption.add('*textBackground', 'white')
+
+ef = Tk::Iwidgets::Entryfield.new(:command=>proc{puts "Return Pressed"})
+
+fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:',
+ :fixed=>10, :width=>12)
+
+nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:',
+ :validate=>:numeric, :width=>12)
+
+aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:',
+ :validate=>:alphabetic, :width=>12,
+ :invalid=>proc{
+ puts "Alphabetic contents invalid"
+ })
+
+pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12,
+ :show=>Tk::UTF8_String("\267"),
+ ## <=== utf8 character
+ :command=>proc{puts "Return Pressed"})
+
+Tk::Iwidgets::Labeledwidget.alignlabels(ef, fef, nef, aef, pef)
+
+ef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5)
+fef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5)
+nef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5)
+aef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5)
+pef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb
new file mode 100644
index 0000000000..9a80e4aaf2
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb
@@ -0,0 +1,40 @@
+#!/usr/bin/env ruby
+#########################################################
+#
+# set $KCODE to 'utf' for a utf8 charecter
+#
+#########################################################
+$KCODE='utf'
+
+require 'tk'
+require 'tkextlib/iwidgets'
+
+TkOption.add('*textBackground', 'white')
+
+ef = Tk::Iwidgets::Entryfield.new(:command=>proc{puts "Return Pressed"})
+
+fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:',
+ :fixed=>10, :width=>12)
+
+nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:',
+ :validate=>:numeric, :width=>12)
+
+aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:',
+ :validate=>:alphabetic, :width=>12,
+ :invalid=>proc{
+ puts "Alphabetic contents invalid"
+ })
+
+pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12,
+ :show=>"\267", ## <=== utf8 character
+ :command=>proc{puts "Return Pressed"})
+
+Tk::Iwidgets::Labeledwidget.alignlabels(ef, fef, nef, aef, pef)
+
+ef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5)
+fef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5)
+nef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5)
+aef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5)
+pef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb
new file mode 100644
index 0000000000..e830308396
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb
@@ -0,0 +1,40 @@
+#!/usr/bin/env ruby
+#########################################################
+#
+# set Tk.encoding = 'utf-8' for a utf8 charecter
+#
+#########################################################
+require 'tk'
+require 'tkextlib/iwidgets'
+
+Tk.encoding = 'utf-8'
+
+TkOption.add('*textBackground', 'white')
+
+ef = Tk::Iwidgets::Entryfield.new(:command=>proc{puts "Return Pressed"})
+
+fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:',
+ :fixed=>10, :width=>12)
+
+nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:',
+ :validate=>:numeric, :width=>12)
+
+aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:',
+ :validate=>:alphabetic, :width=>12,
+ :invalid=>proc{
+ puts "Alphabetic contents invalid"
+ })
+
+pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12,
+ :show=>"\267", ## <=== utf8 character
+ :command=>proc{puts "Return Pressed"})
+
+Tk::Iwidgets::Labeledwidget.alignlabels(ef, fef, nef, aef, pef)
+
+ef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5)
+fef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5)
+nef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5)
+aef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5)
+pef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb b/ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb
new file mode 100644
index 0000000000..83a6a07b64
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb
@@ -0,0 +1,20 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+Tk::Iwidgets::Extbutton.new(:text=>'Bitmap example', :bitmap=>'info',
+ :background=>'bisque', :activeforeground=>'red',
+ :bitmapforeground=>'blue', :defaultring=>true,
+ :command=>proc{
+ puts "Bisque is beautiful"
+ }).pack(:expand=>true)
+
+#img = TkPhotoImage.new(:file=>File.join(File.dirname(File.expand_path(__FILE__)), '../../../images/earthris.gif'))
+img = TkPhotoImage.new(:file=>File.join(File.dirname(File.expand_path(__FILE__)), '../catalog_demo/images/clear.gif'))
+
+Tk::Iwidgets::Extbutton.new(:text=>'Image example', :relief=>:ridge,
+ :image=>img, :imagepos=>:e, :font=>'9x15bold',
+ :activebackground=>'lightyellow',
+ :background=>'lightgreen').pack(:expand=>true)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb
new file mode 100644
index 0000000000..ef3b14ff4b
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+Tk::Iwidgets::Extfileselectionbox.new.pack(:padx=>10, :pady=>10,
+ :fill=>:both, :expand=>true)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectiondialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectiondialog.rb
new file mode 100644
index 0000000000..80a31d06e7
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectiondialog.rb
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+mainloop = Thread.new{Tk.mainloop}
+
+#
+# Non-modal example
+#
+nmfsd = Tk::Iwidgets::Extfileselectiondialog.new(:title=>'Non-Modal')
+nmfsd.buttonconfigure('OK', :command=>proc{
+ puts "You selected #{nmfsd.get}"
+ nmfsd.deactivate
+ })
+nmfsd.activate
+
+#
+# Modal example
+#
+mfsd = Tk::Iwidgets::Extfileselectiondialog.new(:modality=>:application)
+mfsd.center
+if TkComm.bool(mfsd.activate)
+ puts "You selected #{mfsd.get}"
+else
+ puts "You cancelled the dialog"
+end
+
+
+mainloop.join
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/feedback.rb b/ext/tk/sample/tkextlib/iwidgets/sample/feedback.rb
new file mode 100644
index 0000000000..c39ebd9d22
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/feedback.rb
@@ -0,0 +1,10 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+Tk::Iwidgets::Feedback.new(:labeltext=>'Status', :steps=>20){|fb|
+ pack(:padx=>10, :pady=>10, :fill=>:both, :expand=>true)
+ TkTimer.new(500, 20, proc{fb.step}).start(5000)
+}
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb
new file mode 100644
index 0000000000..f0313d9481
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+Tk::Iwidgets::Fileselectionbox.new.pack(:padx=>10, :pady=>10,
+ :fill=>:both, :expand=>true)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/fileselectiondialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/fileselectiondialog.rb
new file mode 100644
index 0000000000..955e5cbd20
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/fileselectiondialog.rb
@@ -0,0 +1,28 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+mainloop = Thread.new{Tk.mainloop}
+
+#
+# Non-modal example
+#
+nmfsd = Tk::Iwidgets::Fileselectiondialog.new(:title=>'Non-Modal')
+nmfsd.buttonconfigure('OK', :command=>proc{
+ puts "You selected #{nmfsd.get}"
+ nmfsd.deactivate
+ })
+nmfsd.activate
+
+#
+# Modal example
+#
+mfsd = Tk::Iwidgets::Fileselectiondialog.new(:modality=>:application)
+mfsd.center
+if TkComm.bool(mfsd.activate)
+ puts "You selected #{mfsd.get}"
+else
+ puts "You cancelled the dialog"
+end
+
+mainloop.join
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb b/ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb
new file mode 100644
index 0000000000..1fed7d55e7
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb
@@ -0,0 +1,13 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+lw = Tk::Iwidgets::Labeledwidget.new(:labeltext=>'Canvas Widget',
+ :labelpos=>:s)
+lw.pack(:fill=>:both, :expand=>true, :padx=>10, :pady=>10)
+
+cw = TkCanvas.new(lw.child_site, :relief=>:raised, :width=>200, :height=>200,
+ :borderwidth=>3, :background=>:white)
+cw.pack(:padx=>10, :pady=>10)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb b/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb
new file mode 100644
index 0000000000..850ddb29d4
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+sh = Tk::Iwidgets::Shell.new(:modality=>:application,
+ :padx=>20, :pady=>20, :title=>'Shell')
+
+TkButton.new(:text=>'ACTIVATE', :padx=>7, :pady=>7,
+ :command=>proc{puts sh.activate}).pack(:padx=>10, :pady=>10)
+
+TkLabel.new(sh.child_site, :text=>'SHELL').pack
+TkButton.new(sh.child_site, :text=>'YES',
+ :command=>proc{sh.deactivate 'press YES'}).pack(:fill=>:x)
+TkButton.new(sh.child_site, :text=>'NO',
+ :command=>proc{sh.deactivate 'press NO'}).pack(:fill=>:x)
+
+Tk.mainloop