summaryrefslogtreecommitdiff
path: root/ext/tk/sample/tkextlib/iwidgets/sample
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tk/sample/tkextlib/iwidgets/sample')
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/feedback.rb2
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/finddialog.rb15
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/labeledframe.rb14
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb64
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb124
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb44
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb30
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb30
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb14
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb22
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb22
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb17
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb9
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/scrolledcanvas.rb13
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb18
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb15
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb22
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb11
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb19
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb12
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/spindate.rb7
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb10
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb33
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/spintime.rb7
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb26
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb30
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/tabset.rb34
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb152
28 files changed, 815 insertions, 1 deletions
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/feedback.rb b/ext/tk/sample/tkextlib/iwidgets/sample/feedback.rb
index c39ebd9d22..7b87a029ed 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/feedback.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/feedback.rb
@@ -4,7 +4,7 @@ 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)
+ TkTimer.new(500, 20, proc{fb.step}).start(2500)
}
Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/finddialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/finddialog.rb
new file mode 100644
index 0000000000..110efb9b96
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/finddialog.rb
@@ -0,0 +1,15 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+mainloop = Thread.new{Tk.mainloop}
+
+st = Tk::Iwidgets::Scrolledtext.new.pack
+st.insert('end', "Now is the time for all good men\n")
+st.insert('end', "to come to the aid of their country")
+
+fd = Tk::Iwidgets::Finddialog.new(:textwidget=>st)
+fd.center(st)
+fd.activate
+
+mainloop.join
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/labeledframe.rb b/ext/tk/sample/tkextlib/iwidgets/sample/labeledframe.rb
new file mode 100644
index 0000000000..4e2e21e727
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/labeledframe.rb
@@ -0,0 +1,14 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+lf = Tk::Iwidgets::Labeledframe.new(:labeltext=>'Entry Frame', :labelpos=>:n)
+lf.pack(:fill=>:both, :expand=>true, :padx=>10, :pady=>10)
+
+cs = lf.child_site
+
+Tk::Iwidgets::Entryfield.new(cs, :labeltext=>'Name:').pack(:side=>:top, :fill=>:x)
+Tk::Iwidgets::Spinint.new(cs, :labeltext=>'Number:').pack(:side=>:top, :fill=>:x)
+Tk::Iwidgets::Pushbutton.new(cs, :text=>'Details:').pack(:side=>:top, :fill=>:x)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb b/ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb
new file mode 100644
index 0000000000..85b28b45e7
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb
@@ -0,0 +1,64 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+mw = Tk::Iwidgets::Mainwindow.new
+
+mw.menubar.add(:menubutton, 'file', :text=>'File', :underline=>0,
+ :padx=>8, :pady=>2, :menu=>[
+ [:options, {:tearoff=>false}],
+
+ [:command, 'new', {
+ :label=>'New', :underline=>0,
+ :helpstr=>'Create a new file'
+ }
+ ],
+
+ [:command, 'open', {
+ :label=>'Open ...', :underline=>0,
+ :helpstr=>'Open an existing file'
+ }
+ ],
+
+ [:command, 'save', {
+ :label=>'Save', :underline=>0,
+ :helpstr=>'Save the current file'
+ }
+ ],
+
+ [:command, 'saveas', {
+ :label=>'Save As', :underline=>5,
+ :helpstr=>'Save the file as a different name'
+ }
+ ],
+
+ [:command, 'print', {
+ :label=>'Print', :underline=>0,
+ :helpstr=>'Print the file'
+ }
+ ],
+
+ [:separator, 'sep1'],
+
+ [:command, 'close', {
+ :label=>'Close', :underline=>0,
+ :helpstr=>'Close the file'
+ }
+ ],
+
+ [:separator, 'sep2'],
+
+ [:command, 'exit', {
+ :label=>'Exit', :underline=>1,
+ :helpstr=>'Exit this application'
+ }
+ ],
+
+ nil
+ ])
+
+Tk::Iwidgets::Scrolledtext.new(mw.child_site).pack(:fill=>:both, :expand=>true)
+
+mw.activate
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb b/ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb
new file mode 100644
index 0000000000..c61071470f
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb
@@ -0,0 +1,124 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+helpvar = TkVariable.new
+viewmode = TkVariable.new
+
+menu_spec = [
+ [:menubutton, 'file', {
+ :text=>'File', :menu=>[
+ [:options, {:tearoff=>false}],
+
+ [:command, 'new', {
+ :label=>'New', :helpstr=>'Open new document',
+ :command=>proc{puts 'NEW'}
+ }
+ ],
+
+ [:command, 'close', {
+ :label=>'Close', :helpstr=>'Close current document',
+ :command=>proc{puts 'CLOSE'}
+ }
+ ],
+
+ [:separator, 'sep1'],
+
+ [:command, 'exit', {
+ :label=>'Exit', :helpstr=>'Exit application',
+ :command=>proc{exit}
+ }
+ ]
+ ]
+ }
+ ],
+
+ [:menubutton, 'edit', {
+ :text=>'Edit', :menu=>[
+ [:options, {:tearoff=>false}],
+
+ [:command, 'undo', {
+ :label=>'Undo', :underline=>0,
+ :helpstr=>'Undo last command',
+ :command=>proc{puts 'UNDO'}
+ }
+ ],
+
+ [:separator, 'sep2'],
+
+ [:command, 'cut', {
+ :label=>'Cut', :underline=>1,
+ :helpstr=>'Cut selection to clipboard',
+ :command=>proc{puts 'CUT'}
+ }
+ ],
+
+ [:command, 'copy', {
+ :label=>'Copy', :underline=>1,
+ :helpstr=>'Copy selection to clipboard',
+ :command=>proc{puts 'COPY'}
+ }
+ ],
+
+ [:command, 'paste', {
+ :label=>'Paste', :underline=>0,
+ :helpstr=>'Paste clipboard contents',
+ :command=>proc{puts 'PASTE'}
+ }
+ ]
+ ]
+ }
+ ],
+
+ [:menubutton, 'options', {
+ :text=>'Options', :menu=>[
+ [:options, {:tearoff=>false, :selectcolor=>'blue'}],
+
+ [:radiobutton, 'byName', {
+ :variable=>viewmode, :value=>'NAME',
+ :label=>'by Name', :helpstr=>'View files by name order',
+ :command=>proc{puts 'NAME'}
+ }
+ ],
+
+ [:radiobutton, 'byDate', {
+ :variable=>viewmode, :value=>'DATE',
+ :label=>'by Date', :helpstr=>'View files by date order',
+ :command=>proc{puts 'DATE'}
+ }
+ ],
+
+ [:cascade, 'prefs', {
+ :label=>'Preferences', :menu=>[
+ [:command, 'colors', {
+ :label=>'Colors...', :helpstr=>'Change text colors',
+ :command=>proc{puts 'COLORS'}
+ }
+ ],
+
+ [:command, 'fonts', {
+ :label=>'Fonts...', :helpstr=>'Change text font',
+ :command=>proc{puts 'COLORS'}
+ }
+ ]
+ ]
+ }
+ ]
+ ]
+ }
+ ]
+]
+
+#mb = Tk::Iwidgets::Menubar.new(:helpvariable=>helpvar,
+# :menubuttons=>menu_spec)
+mb = Tk::Iwidgets::Menubar.new(:helpvariable=>helpvar)
+mb.configure(:menubuttons=>menu_spec)
+
+fr = TkFrame.new(:width=>300, :height=>300)
+ef = TkEntry.new(:textvariable=>helpvar)
+
+mb.pack(:anchor=>:nw, :fill=>:x, :expand=>true)
+fr.pack(:fill=>:both, :expand=>true)
+ef.pack(:anchor=>:sw, :fill=>:x, :expand=>true)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb
new file mode 100644
index 0000000000..eec4928afb
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb
@@ -0,0 +1,44 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+helpvar = TkVariable.new
+viewmode = TkVariable.new
+
+mb = Tk::Iwidgets::Menubar.new
+mb.menubuttons = [
+ [:menubutton, 'file', {
+ :text=>'File', :menu=>[
+ [:command, 'new', {:label=>'New'}],
+ [:command, 'close', {:label=>'Close'}],
+ [:separator, 'sep1'],
+ [:command, 'quit', {:label=>'Quit'}]
+ ]
+ }
+ ],
+ [:menubutton, 'edit', {:text=>'Edit'}]
+]
+
+mb.add(:command, '.edit.undo', :label=>'Undo', :underline=>0)
+mb.add(:separator, '.edit.sep2')
+mb.add(:command, '.edit.cut', :label=>'Cut', :underline=>1)
+mb.add(:command, '.edit.copy', :label=>'Copy', :underline=>1)
+mb.add(:command, '.edit.paste', :label=>'Paste', :underline=>0)
+
+mb.add(:menubutton, '.options', :text=>'Options', :menu=>[
+ [:radiobutton, 'byName', {
+ :variable=>viewmode, :value=>'NAME', :label=>'by Name'}
+ ],
+ [:radiobutton, 'byDate', {
+ :variable=>viewmode, :value=>'DATE', :label=>'by Date'}
+ ]
+ ])
+
+mb.add(:cascade, '.options.prefs', :label=>'Preferences', :menu=>[
+ [:command, 'colors', {:label=>'Colors...'}],
+ [:command, 'fonts', {:label=>'Fonts...'}]
+ ])
+
+mb.pack(:side=>:left, :anchor=>:nw, :fill=>:x, :expand=>true)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb b/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb
new file mode 100644
index 0000000000..77f1c1dc63
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb
@@ -0,0 +1,30 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+# Create the tabnotebook widget and pack it.
+nb = Tk::Iwidgets::Notebook.new(:width=>100, :height=>100)
+nb.pack(:anchor=>:nw, :fill=>:both, :expand=>true,
+ :side=>:left, :padx=>10, :pady=>10)
+
+# Add two pages to the tabnotebook,
+# labelled "Page One" and "Page Two"
+nb.add(:label=>'Page One')
+nb.add(:label=>'Page Two')
+
+# Get the child site frames of these two pages.
+page1CS = nb.child_site(0)
+page2CS = nb.child_site('Page Two')
+
+# Create buttons on each page of the tabnotebook.
+TkButton.new(page1CS, :text=>'Button One').pack
+TkButton.new(page2CS, :text=>'Button Two').pack
+
+# Select the first page of the tabnotebook.
+nb.select(0)
+
+# Create the scrollbar and associate teh scrollbar
+# and the notebook together, then pack the scrollbar
+nb.scrollbar(TkScrollbar.new).pack(:fill=>:y, :expand=>true, :pady=>10)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb
new file mode 100644
index 0000000000..e14e1207a5
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb
@@ -0,0 +1,30 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+# Create the tabnotebook widget and pack it.
+nb = Tk::Iwidgets::Notebook.new(:width=>100, :height=>100)
+nb.pack(:anchor=>:nw, :fill=>:both, :expand=>true,
+ :side=>:top, :padx=>10, :pady=>0)
+
+# Add two pages to the tabnotebook,
+# labelled "Page One" and "Page Two"
+nb.add(:label=>'Page One')
+nb.add(:label=>'Page Two')
+
+# Get the child site frames of these two pages.
+page1CS = nb.child_site(0)
+page2CS = nb.child_site('Page Two')
+
+# Create buttons on each page of the tabnotebook.
+TkButton.new(page1CS, :text=>'Button One').pack
+TkButton.new(page2CS, :text=>'Button Two').pack
+
+# Select the first page of the tabnotebook.
+nb.select(0)
+
+# Create the scrollbar and associate teh scrollbar
+# and the notebook together, then pack the scrollbar
+nb.xscrollbar(TkScrollbar.new).pack(:fill=>:x, :expand=>true, :padx=>10)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb b/ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb
new file mode 100644
index 0000000000..bdeafb691e
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb
@@ -0,0 +1,14 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+om = Tk::Iwidgets::Optionmenu.new(:labelmargin=>5, :labelpos=>:w,
+ :labeltext=>"Operating System :")
+
+om.insert('end', 'Unix', 'VMS', 'Linux', 'OS/2', 'Windows NT', 'DOS')
+om.sort_ascending
+om.select('Linux')
+
+om.pack(:padx=>10, :pady=>10)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb b/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb
new file mode 100644
index 0000000000..902b2c4bcb
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb
@@ -0,0 +1,22 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+pw = Tk::Iwidgets::Panedwindow.new(:width=>300, :height=>300)
+
+pw.add('top')
+pw.add('middle', :margin=>10)
+pw.add('bottom', :margin=>10, :minimum=>10)
+
+pw.pack(:fill=>:both, :expand=>true)
+
+pw.child_site_list.each{|pane|
+ TkButton.new(pane, :text=>pane.path, :relief=>:raised,
+ :borderwidth=>2).pack(:fill=>:both, :expand=>true)
+}
+
+pw.fraction(50,30,20)
+pw.paneconfigure(0, :minimum=>20)
+pw.paneconfigure('bottom', :margin=>15)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb
new file mode 100644
index 0000000000..8928393a8b
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb
@@ -0,0 +1,22 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+pw = Tk::Iwidgets::Panedwindow.new(:width=>300, :height=>300)
+
+top = pw.add
+middle = pw.add(:margin=>10)
+bottom = pw.add(:margin=>10, :minimum=>10)
+
+pw.pack(:fill=>:both, :expand=>true)
+
+pw.child_site_list.each{|pane|
+ TkButton.new(pane, :text=>pane.path, :relief=>:raised,
+ :borderwidth=>2).pack(:fill=>:both, :expand=>true)
+}
+
+pw.fraction(50,30,20)
+pw.paneconfigure(0, :minimum=>20) # 0 == pw.index(top)
+pw.paneconfigure(bottom, :margin=>15)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb
new file mode 100644
index 0000000000..7dbecc6dc0
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+mainloop = Thread.new{Tk.mainloop}
+
+TkOption.add('*textBackground', 'white')
+
+pd = Tk::Iwidgets::Promptdialog.new(:modality=>:global, :title=>'Password',
+ :labeltext=>'Password:', :show=>'*')
+pd.hide('Apply')
+
+if TkComm.bool(pd.activate)
+ puts "Password entered: #{pd.get}"
+else
+ puts "Password prompt cancelled"
+end
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb b/ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb
new file mode 100644
index 0000000000..b1f4d7d118
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+Tk::Iwidgets::Pushbutton.new(:text=>'Hello',
+ :command=>proc{puts 'Hello World'},
+ :defaultring=>true).pack(:padx=>10, :pady=>10)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledcanvas.rb b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledcanvas.rb
new file mode 100644
index 0000000000..92c94b96bb
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledcanvas.rb
@@ -0,0 +1,13 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+sc = Tk::Iwidgets::Scrolledcanvas.new
+
+sc.create(TkcRectangle, 100, 100, 400, 400, :fill=>'red')
+TkcRectangle.new(sc, 300, 300, 600, 600, :fill=>'green')
+TkcRectangle.new(sc, [[200, 200], [500, 500]], :fill=>'blue')
+
+sc.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb
new file mode 100644
index 0000000000..c12b664482
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb
@@ -0,0 +1,18 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+sf = Tk::Iwidgets::Scrolledframe.new(:width=>150, :height=>180,
+ :labeltext=>'scrolledframe')
+cs = sf.child_site
+
+TkButton.new(cs, :text=>'Hello').pack(:pady=>10)
+TkButton.new(cs, :text=>'World').pack(:pady=>10)
+TkButton.new(cs, :text=>'This is a test').pack(:pady=>10)
+TkButton.new(cs, :text=>'This is a really big button').pack(:pady=>10)
+TkButton.new(cs, :text=>'This is another really big button').pack(:pady=>10)
+TkButton.new(cs, :text=>'This is the last really big button').pack(:pady=>10)
+
+sf.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb
new file mode 100644
index 0000000000..6b0827ec89
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb
@@ -0,0 +1,15 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+TkOption.add('*textBackground', 'white')
+
+sh = Tk::Iwidgets::Scrolledhtml.new(:fontname=>'helvetica',
+ :linkcommand=>proc{|href|
+ sh.import_link(href)
+ })
+sh.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10)
+
+sh.import(Tk.getOpenFile(:title=>'select HTML document'))
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb
new file mode 100644
index 0000000000..98f932d058
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb
@@ -0,0 +1,22 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+TkOption.add('*textBackground', 'white')
+
+slb = Tk::Iwidgets::Scrolledlistbox.new(:selectmode=>:single,
+ :vscrollmode=>:static,
+ :hscrollmode=>:dynamic,
+ :labeltext=>'List',
+ :selectioncommand=>proc{
+ puts(slb.get_curselection)
+ },
+ :dblclickcommand=>proc{
+ puts('Double Click')
+ puts(slb.get_curselection)
+ })
+slb.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10)
+
+slb.insert('end', *['Hello', 'Out There', 'World'])
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb
new file mode 100644
index 0000000000..59a96fb9f6
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb
@@ -0,0 +1,11 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+st = Tk::Iwidgets::Scrolledtext.new(:hscrollmode=>:dynamic, :wrap=>:none,
+ :labeltext=>'Password File')
+st.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10)
+
+st.import('/etc/passwd')
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb
new file mode 100644
index 0000000000..d19970fac9
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb
@@ -0,0 +1,19 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+TkOption.add('*textBackground', 'white')
+
+sb = Tk::Iwidgets::Selectionbox.new.pack(:padx=>10, :pady=>10,
+ :fill=>:both, :expand=>true)
+
+sb.insert_items('end', *['Hello', 'Out There', 'World'])
+
+TkLabel.new(sb.child_site,
+ :text=>'Child Site is Here').pack(:fill=>:x, :padx=>10, :pady=>10)
+
+sb.insert_items(2, 'Cruel Cruel')
+
+sb.selection_set(1)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb
new file mode 100644
index 0000000000..4fbb2aa378
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb
@@ -0,0 +1,12 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+mainloop = Thread.new{Tk.mainloop}
+
+TkButton.new(:text=>'QUIT',
+ :command=>proc{Tk.root.destroy}).pack(:padx=>10, :pady=>10)
+
+Tk::Iwidgets::Selectiondialog.new.activate
+
+mainloop.join
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/spindate.rb b/ext/tk/sample/tkextlib/iwidgets/sample/spindate.rb
new file mode 100644
index 0000000000..17197a66b7
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/spindate.rb
@@ -0,0 +1,7 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+Tk::Iwidgets::Spindate.new.pack(:padx=>10, :pady=>10)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb b/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb
new file mode 100644
index 0000000000..4064081740
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb
@@ -0,0 +1,10 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+TkOption.add('*textBackground', 'white')
+
+Tk::Iwidgets::Spinint.new(:labeltext=>'Temperature', :labelpos=>:w, :width=>5,
+ :fixed=>true, :range=>[32, 212]).pack(:pady=>10)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb b/ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb
new file mode 100644
index 0000000000..44e8ec3034
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb
@@ -0,0 +1,33 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+class Spinner_demo < TkWindow
+ Months = %w(January February March April May June July August September October November December)
+
+ def block_input(c)
+ false
+ end
+
+ def spin_month(step)
+ index = Months.index(@spinner.get) + step
+ index = 11 if index < 0
+ index = 0 if index > 11
+
+ @spinner.value = Months[index]
+ end
+
+ def initialize(parent=nil)
+ @spinner = Tk::Iwidgets::Spinner.new(parent, :labeltext=>'Month : ',
+ :width=>10, :fixed=>10,
+ :validate=>proc{|c| block_input},
+ :decrement=>proc{spin_month -1},
+ :increment=>proc{spin_month 1})
+ @path = @spinner
+ @spinner.insert(0, Months[0])
+ end
+end
+
+Spinner_demo.new.pack(:padx=>10, :pady=>10)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/spintime.rb b/ext/tk/sample/tkextlib/iwidgets/sample/spintime.rb
new file mode 100644
index 0000000000..2c13884b94
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/spintime.rb
@@ -0,0 +1,7 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+Tk::Iwidgets::Spintime.new.pack(:padx=>10, :pady=>10)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb b/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb
new file mode 100644
index 0000000000..5a9897845f
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb
@@ -0,0 +1,26 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+# Create the tabnotebook widget and pack it.
+tn = Tk::Iwidgets::Tabnotebook.new(:width=>300, :height=>100)
+tn.pack(:anchor=>:nw, :fill=>:both, :expand=>true,
+ :side=>:left, :padx=>10, :pady=>10)
+
+# Add two pages to the tabnotebook,
+# labelled "Page One" and "Page Two"
+tn.add(:label=>'Page One')
+tn.add(:label=>'Page Two')
+
+# Get the child site frames of these two pages.
+page1CS = tn.child_site(0)
+page2CS = tn.child_site('Page Two')
+
+# Create buttons on each page of the tabnotebook.
+TkButton.new(page1CS, :text=>'Button One').pack
+TkButton.new(page2CS, :text=>'Button Two').pack
+
+# Select the first page of the tabnotebook.
+tn.select(0)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb
new file mode 100644
index 0000000000..c08603f899
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb
@@ -0,0 +1,30 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+# Create the tabnotebook widget and pack it.
+tn = Tk::Iwidgets::Tabnotebook.new(:width=>300, :height=>100)
+tn.pack(:anchor=>:nw, :fill=>:both, :expand=>true,
+ :side=>:top, :padx=>10, :pady=>0)
+
+# Add two pages to the tabnotebook,
+# labelled "Page One" and "Page Two"
+tn.add(:label=>'Page One')
+tn.add(:label=>'Page Two')
+
+# Get the child site frames of these two pages.
+page1CS = tn.child_site(0)
+page2CS = tn.child_site('Page Two')
+
+# Create buttons on each page of the tabnotebook.
+TkButton.new(page1CS, :text=>'Button One').pack
+TkButton.new(page2CS, :text=>'Button Two').pack
+
+# Select the first page of the tabnotebook.
+tn.select(0)
+
+# Create the scrollbar
+# and the notebook together, then pack the scrollbar
+tn.xscrollbar(TkScrollbar.new).pack(:fill=>:x, :expand=>true, :padx=>10)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/tabset.rb b/ext/tk/sample/tkextlib/iwidgets/sample/tabset.rb
new file mode 100644
index 0000000000..90be46b40b
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/tabset.rb
@@ -0,0 +1,34 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+# Create a listbox with two items (one and two)
+l = TkListbox.new(:selectmode=>:single, :exportselection=>false).pack
+l.insert('end', 'one')
+l.insert('end', 'two')
+l.selection_set(0)
+
+# Define a proc that knows how to select an item
+# from a list given an index from the tabset -command callback.
+selectItem = proc{|item|
+ l.selection_clear(l.curselection)
+ l.selection_set(item)
+ l.see(item)
+}
+
+# Create a tabset, set its -command to call selectItem
+# Add two labels to the tabset (one and two).
+ts = Tk::Iwidgets::Tabset.new(:command=>selectItem)
+ts.add(:label=>1)
+ts.add(:label=>2)
+ts.select(0)
+ts.pack(:fill=>:x, :expand=>true)
+
+# Define a proc that knows how to select a tab
+# given a y pixel coordinate from the list..
+selectTab = proc{|y| ts.select(l.nearest(y)) }
+
+# bind button 1 press to the selectTab procedure.
+l.bind('ButtonPress-1', proc{|y| selectTab.call(y) }, '%y')
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb b/ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb
new file mode 100644
index 0000000000..eba52ba5db
--- /dev/null
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb
@@ -0,0 +1,152 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/iwidgets'
+
+##########################################
+# icon images
+editcopy22 = TkPhotoImage.new(:data=><<'EOD')
+ R0lGODlhFgAWAIUAAPwCBBQSFPz+/DQyNISChDw6PMzKzMTGxERGRIyKjFxa
+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nhW+vxgZEBqz
+ kBvItxwdHryRCNGjHyAhHSLOgtgSI60c2yQjJd+eJqEnKK0hJCgnJSngAO0S
+ F+8qEvL0VrBogW+BLX4oVKgIyMIFQU8KfDV4R+8FDBcxZBREthAFiRIsOsyg
+ sVEUh4Un3pGoUcPGjZInK65QicPlxg8oX5RwqNJGjo0hdJwQ6EIkjRM6dvDY
+ CKIHSBc1Ztjw4eOH0oIrsgIJEqSFDBo0cuTgsdSTo7No0xYTZCcQACH+aENy
+ ZWF0ZWQgYnkgQk1QVG9HSUYgUHJvIHZlcnNpb24gMi41DQqpIERldmVsQ29y
+ IDE5OTcsMTk5OC4gQWxsIHJpZ2h0cyByZXNlcnZlZC4NCmh0dHA6Ly93d3cu
+ ZGV2ZWxjb3IuY29tADs=
+EOD
+
+text22 = TkPhotoImage.new(:data=><<'EOD')
+ R0lGODlhFgAWAIQAAPwCBAQCBBwaHAwKDBQSFLy+vLS2tJSWlBQWFKyqrFRS
+ VCwqLDQyNNTS1GxqbFxaXJyanIyOjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAAALAAAAAAWABYAAAVcICCOZGmK
+ QSoMaZsShBsQBdAapHvgaIDUqUPJlRjSbAoT0fRDKgODRbF0PLUYjZO2F2Bs
+ t9evNix+dsvDlGKK5jraudQb7qbX6a2HEJ+ycyF+LRE8ZTI+fX5oGCEAIf5o
+ Q3JlYXRlZCBieSBCTVBUb0dJRiBQcm8gdmVyc2lvbiAyLjUNCqkgRGV2ZWxD
+ b3IgMTk5NywxOTk4LiBBbGwgcmlnaHRzIHJlc2VydmVkLg0KaHR0cDovL3d3
+ dy5kZXZlbGNvci5jb20AOw==
+EOD
+
+##########################################
+
+bmp_dir = File.join(File.dirname(File.expand_path(__FILE__)),
+ '../catalog_demo/images')
+
+##########################################
+
+status_var = TkVariable.new
+radio_var = TkVariable.new
+check_var1 = TkVariable.new
+check_var2 = TkVariable.new
+
+tb = Tk::Iwidgets::Toolbar.new(:helpvariable=>status_var)
+
+##########################################
+
+tb.add(:button, :helpstr=>'Copy It', :image=>editcopy22,
+ :balloonstr=>'Copy', :command=>proc{puts 'Copy It'})
+
+tb.add(:button, :helpstr=>'Cut It', :image=>editcut22,
+ :balloonstr=>'Cut', :command=>proc{puts 'Cut It'})
+
+tb.add(:button, :helpstr=>'Paste It', :image=>editpaste22,
+ :balloonstr=>'Paste', :command=>proc{puts 'Paste It'})
+
+tb.add(:button, :helpstr=>'Delete It', :image=>editdelete22,
+ :balloonstr=>'Delete', :command=>proc{puts 'Delete It'})
+
+#--------------------------------
+
+tb.add(:frame, :borderwidth=>1, :width=>10, :height=>10)
+
+#--------------------------------
+
+tb.add(:radiobutton, :variable=>radio_var, :value=>'Box',
+ :bitmap=>"@#{bmp_dir}/box.xbm",
+ :helpstr=>'Radio Button #1', :balloonstr=>'Radio',
+ :command=>proc{puts 'Radio Button "Box"'})
+
+tb.add(:radiobutton, :variable=>radio_var, :value=>'Line',
+ :bitmap=>"@#{bmp_dir}/line.xbm",
+ :helpstr=>'Radio Button #2', :balloonstr=>'Radio',
+ :command=>proc{puts 'Radio Button "Line"'})
+
+tb.add(:radiobutton, :variable=>radio_var, :value=>'Oval',
+ :bitmap=>"@#{bmp_dir}/oval.xbm",
+ :helpstr=>'Radio Button #3', :balloonstr=>'Radio',
+ :command=>proc{puts 'Radio Button "Oval"'})
+
+#--------------------------------
+
+tb.add(:frame, :borderwidth=>1, :width=>10, :height=>10)
+
+#--------------------------------
+
+tb.add(:checkbutton, :variable=>check_var1, :onvalue=>'yes', :offvalue=>'no',
+ :image=>text22, :command=>proc{puts 'Checkbutton 1'})
+
+tb.add(:checkbutton, :variable=>check_var2, :onvalue=>'yes', :offvalue=>'no',
+ :bitmap=>"@#{bmp_dir}/points.xbm", :command=>proc{puts 'Checkbutton 2'})
+
+tb.pack(:side=>:top, :anchor=>:nw)
+
+Tk.mainloop