summaryrefslogtreecommitdiff
path: root/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget
diff options
context:
space:
mode:
Diffstat (limited to 'ruby_1_8_5/ext/tk/lib/tkextlib/bwidget')
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/arrowbutton.rb21
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/bitmap.rb21
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/button.rb31
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/buttonbox.rb78
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/combobox.rb45
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/dialog.rb157
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/dragsite.rb31
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/dropsite.rb39
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb56
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/entry.rb43
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/label.rb41
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/labelentry.rb80
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/labelframe.rb46
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/listbox.rb339
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/mainframe.rb92
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/messagedlg.rb178
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/notebook.rb148
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/pagesmanager.rb61
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/panedwindow.rb31
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/panelframe.rb51
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/passwddlg.rb44
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/progressbar.rb20
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/progressdlg.rb54
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/scrollableframe.rb34
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/scrolledwindow.rb32
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/scrollview.rb25
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/selectcolor.rb45
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/selectfont.rb85
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/separator.rb20
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/setup.rb8
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/spinbox.rb98
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/statusbar.rb46
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/titleframe.rb27
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/tree.rb434
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/widget.rb113
35 files changed, 2674 insertions, 0 deletions
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/arrowbutton.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/arrowbutton.rb
new file mode 100644
index 0000000000..770e5e9ef1
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/arrowbutton.rb
@@ -0,0 +1,21 @@
+#
+# tkextlib/bwidget/arrowbutton.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/bwidget.rb'
+require 'tkextlib/bwidget/button'
+
+module Tk
+ module BWidget
+ class ArrowButton < Tk::BWidget::Button
+ end
+ end
+end
+
+class Tk::BWidget::ArrowButton
+ TkCommandNames = ['ArrowButton'.freeze].freeze
+ WidgetClassName = 'ArrowButton'.freeze
+ WidgetClassNames[WidgetClassName] = self
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/bitmap.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/bitmap.rb
new file mode 100644
index 0000000000..6cfde203e8
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/bitmap.rb
@@ -0,0 +1,21 @@
+#
+# tkextlib/bwidget/bitmap.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tk/image'
+require 'tkextlib/bwidget.rb'
+
+module Tk
+ module BWidget
+ class Bitmap < TkPhotoImage
+ end
+ end
+end
+
+class Tk::BWidget::Bitmap
+ def initialize(name)
+ @path = tk_call_without_enc('Bitmap::get', name)
+ Tk_IMGTBL[@path] = self
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/button.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/button.rb
new file mode 100644
index 0000000000..4a9d4a7948
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/button.rb
@@ -0,0 +1,31 @@
+#
+# tkextlib/bwidget/button.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tk/button'
+require 'tkextlib/bwidget.rb'
+
+module Tk
+ module BWidget
+ class Button < TkButton
+ end
+ end
+end
+
+class Tk::BWidget::Button
+ TkCommandNames = ['Button'.freeze].freeze
+ WidgetClassName = 'Button'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def __strval_optkeys
+ super() << 'helptext'
+ end
+ private :__strval_optkeys
+
+ def __tkvariable_optkeys
+ super() << 'helpvar'
+ end
+ private :__tkvariable_optkeys
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/buttonbox.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/buttonbox.rb
new file mode 100644
index 0000000000..ef999239f9
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/buttonbox.rb
@@ -0,0 +1,78 @@
+#
+# tkextlib/bwidget/buttonbox.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/bwidget.rb'
+require 'tkextlib/bwidget/button'
+
+module Tk
+ module BWidget
+ class ButtonBox < TkWindow
+ end
+ end
+end
+
+class Tk::BWidget::ButtonBox
+ TkCommandNames = ['ButtonBox'.freeze].freeze
+ WidgetClassName = 'ButtonBox'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ include TkItemConfigMethod
+
+ def __boolval_optkeys
+ super() << 'homogeneous'
+ end
+ private :__boolval_optkeys
+
+ def tagid(tagOrId)
+ if tagOrId.kind_of?(Tk::BWidget::Button)
+ name = tagOrId[:name]
+ return index(name) unless name.empty?
+ end
+ if tagOrId.kind_of?(TkButton)
+ return index(tagOrId[:text])
+ end
+ # index(tagOrId.to_s)
+ index(_get_eval_string(tagOrId))
+ end
+
+ def add(keys={}, &b)
+ win = window(tk_send('add', *hash_kv(keys)))
+ win.instance_eval(&b) if b
+ win
+ end
+
+ def delete(idx)
+ tk_send('delete', tagid(idx))
+ self
+ end
+
+ def index(idx)
+ if idx.kind_of?(Tk::BWidget::Button)
+ name = idx[:name]
+ idx = name unless name.empty?
+ end
+ if idx.kind_of?(TkButton)
+ idx = idx[:text]
+ end
+ number(tk_send('index', idx.to_s))
+ end
+
+ def insert(idx, keys={}, &b)
+ win = window(tk_send('insert', tagid(idx), *hash_kv(keys)))
+ win.instance_eval(&b) if b
+ win
+ end
+
+ def invoke(idx)
+ tk_send('invoke', tagid(idx))
+ self
+ end
+
+ def set_focus(idx)
+ tk_send('setfocus', tagid(idx))
+ self
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/combobox.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/combobox.rb
new file mode 100644
index 0000000000..31f71c3aaf
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/combobox.rb
@@ -0,0 +1,45 @@
+#
+# tkextlib/bwidget/combobox.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tk/entry'
+require 'tkextlib/bwidget.rb'
+require 'tkextlib/bwidget/listbox'
+require 'tkextlib/bwidget/spinbox'
+
+module Tk
+ module BWidget
+ class ComboBox < Tk::BWidget::SpinBox
+ end
+ end
+end
+
+class Tk::BWidget::ComboBox
+ include Scrollable
+
+ TkCommandNames = ['ComboBox'.freeze].freeze
+ WidgetClassName = 'ComboBox'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def get_listbox(&b)
+ win = window(tk_send_without_enc('getlistbox'))
+ win.instance_eval(&b) if b
+ win
+ end
+
+ def icursor(idx)
+ tk_send_without_enc('icursor', idx)
+ end
+
+ def post
+ tk_send_without_enc('post')
+ self
+ end
+
+ def unpost
+ tk_send_without_enc('unpost')
+ self
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/dialog.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/dialog.rb
new file mode 100644
index 0000000000..2790d88d24
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/dialog.rb
@@ -0,0 +1,157 @@
+#
+# tkextlib/bwidget/dialog.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tk/frame'
+require 'tkextlib/bwidget.rb'
+require 'tkextlib/bwidget/buttonbox'
+
+module Tk
+ module BWidget
+ class Dialog < TkWindow
+ end
+ end
+end
+
+class Tk::BWidget::Dialog
+ TkCommandNames = ['Dialog'.freeze].freeze
+ WidgetClassName = 'Dialog'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ include TkItemConfigMethod
+
+ def __strval_optkeys
+ super() << 'title'
+ end
+ private :__strval_optkeys
+
+ def __boolval_optkeys
+ super() << 'transient' << 'homogeneous'
+ end
+ private :__boolval_optkeys
+
+ def initialize(parent=nil, keys=nil)
+ @relative = ''
+ if parent.kind_of?(Hash)
+ keys = _symbolkey2str(parent)
+ @relative = keys['parent'] if keys.key?('parent')
+ @relative = keys.delete('relative') if keys.key?('relative')
+ super(keys)
+ elsif keys
+ keys = _symbolkey2str(keys)
+ @relative = keys.delete('parent') if keys.key?('parent')
+ @relative = keys.delete('relative') if keys.key?('relative')
+ super(parent, keys)
+ else
+ super(parent)
+ end
+ end
+
+ def create_self(keys)
+ cmd = self.class::TkCommandNames[0]
+ if keys and keys != None
+ tk_call_without_enc(cmd, @path, '-parent', @relative,
+ *hash_kv(keys, true))
+ else
+ tk_call_without_enc(cmd, @path, '-parent', @relative)
+ end
+ end
+
+ def cget(slot)
+ if slot.to_s == 'relative'
+ super('parent')
+ else
+ super(slot)
+ end
+ end
+
+ def configure(slot, value=None)
+ if slot.kind_of?(Hash)
+ slot = _symbolkey2str(slot)
+ slot['parent'] = slot.delete('relative') if slot.key?('relative')
+ super(slot)
+ else
+ if slot.to_s == 'relative'
+ super('parent', value)
+ else
+ super(slot, value)
+ end
+ end
+ end
+
+ def configinfo(slot=nil)
+ if slot
+ if slot.to_s == 'relative'
+ super('parent')
+ else
+ super(slot)
+ end
+ else
+ ret = super()
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ ret << ['relative', 'parent']
+ else
+ ret['relative'] = 'parent'
+ end
+ end
+ end
+
+ def tagid(tagOrId)
+ if tagOrId.kind_of?(Tk::BWidget::Button)
+ name = tagOrId[:name]
+ return index(name) unless name.empty?
+ end
+ if tagOrId.kind_of?(TkButton)
+ return index(tagOrId[:text])
+ end
+ # index(tagOrId.to_s)
+ index(_get_eval_string(tagOrId))
+ end
+
+ def add(keys={}, &b)
+ win = window(tk_send('add', *hash_kv(keys)))
+ win.instance_eval(&b) if b
+ win
+ end
+
+ def get_frame(&b)
+ win = window(tk_send('getframe'))
+ win.instance_eval(&b) if b
+ win
+ end
+
+ def get_buttonbox(&b)
+ win = window(@path + '.bbox')
+ win.instance_eval(&b) if b
+ win
+ end
+
+ def draw(focus_win=None)
+ tk_send('draw', focus_win)
+ end
+
+ def enddialog(ret)
+ tk_send('enddialog', ret)
+ end
+
+ def index(idx)
+ get_buttonbox.index(idx)
+ end
+
+ def invoke(idx)
+ tk_send('invoke', tagid(idx))
+ self
+ end
+
+ def set_focus(idx)
+ tk_send('setfocus', tagid(idx))
+ self
+ end
+
+ def withdraw
+ tk_send('withdraw')
+ self
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/dragsite.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/dragsite.rb
new file mode 100644
index 0000000000..4d4de1780c
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/dragsite.rb
@@ -0,0 +1,31 @@
+#
+# tkextlib/bwidget/dragsite.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/bwidget.rb'
+
+module Tk
+ module BWidget
+ module DragSite
+ end
+ end
+end
+
+module Tk::BWidget::DragSite
+ include Tk
+ extend Tk
+
+ def self.include(klass, type, event)
+ tk_call('DragSite::include', klass, type, event)
+ end
+
+ def self.register(path, keys={})
+ tk_call('DragSite::register', path, *hash_kv(keys))
+ end
+
+ def self.set_drag(path, subpath, initcmd, endcmd, force=None)
+ tk_call('DragSite::setdrag', path, subpath, initcmd, endcmd, force)
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/dropsite.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/dropsite.rb
new file mode 100644
index 0000000000..e5e98fbc51
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/dropsite.rb
@@ -0,0 +1,39 @@
+#
+# tkextlib/bwidget/dropsite.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/bwidget.rb'
+
+module Tk
+ module BWidget
+ module DropSite
+ end
+ end
+end
+
+module Tk::BWidget::DropSite
+ include Tk
+ extend Tk
+
+ def self.include(klass, type)
+ tk_call('DropSite::include', klass, type)
+ end
+
+ def self.register(path, keys={})
+ tk_call('DropSite::register', path, *hash_kv(keys))
+ end
+
+ def self.set_cursor(cursor)
+ tk_call('DropSite::setcursor', cursor)
+ end
+
+ def self.set_drop(path, subpath, dropover, drop, force=None)
+ tk_call('DropSite::setdrop', path, subpath, dropover, drop, force)
+ end
+
+ def self.set_operation(op)
+ tk_call('DropSite::setoperation', op)
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb
new file mode 100644
index 0000000000..224304f2ab
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb
@@ -0,0 +1,56 @@
+#
+# tkextlib/bwidget/dynamichelp.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/bwidget.rb'
+
+module Tk
+ module BWidget
+ module DynamicHelp
+ end
+ end
+end
+
+module Tk::BWidget::DynamicHelp
+ include Tk
+ extend Tk
+
+ def self.__pathname
+ 'DynamicHelp::configure'
+ end
+
+ def __strval_optkeys
+ super() << 'topbackground'
+ end
+ private :__strval_optkeys
+
+ def self.__cget_cmd
+ ['DynamicHelp::configure']
+ end
+
+ def self.__config_cmd
+ ['DynamicHelp::configure']
+ end
+
+ def self.cget(slot)
+ self.current_configinfo(slot).values[0]
+ end
+
+ def self.add(widget, keys={})
+ tk_call('DynamicHelp::add', widget, *hash_kv(keys))
+ end
+
+ def self.delete(widget)
+ tk_call('DynamicHelp::delete', widget)
+ end
+
+ def self.include(klass, type)
+ tk_call('DynamicHelp::include', klass, type)
+ end
+
+ def self.sethelp(path, subpath, force=None)
+ tk_call('DynamicHelp::sethelp', path, subpath, force)
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/entry.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/entry.rb
new file mode 100644
index 0000000000..aafb4aa7ff
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/entry.rb
@@ -0,0 +1,43 @@
+#
+# tkextlib/bwidget/entry.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tk/entry'
+require 'tkextlib/bwidget.rb'
+
+module Tk
+ module BWidget
+ class Entry < TkEntry
+ end
+ end
+end
+
+class Tk::BWidget::Entry
+ include Scrollable
+
+ TkCommandNames = ['Entry'.freeze].freeze
+ WidgetClassName = 'Entry'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def __strval_optkeys
+ super() << 'helptext' << 'insertbackground'
+ end
+ private :__strval_optkeys
+
+ def __boolval_optkeys
+ super() << 'dragenabled' << 'dropenabled' << 'editable'
+ end
+ private :__boolval_optkeys
+
+ def __tkvariable_optkeys
+ super() << 'helpvar'
+ end
+ private :__tkvariable_optkeys
+
+ def invoke
+ tk_send_without_enc('invoke')
+ self
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/label.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/label.rb
new file mode 100644
index 0000000000..ce10ecaf8b
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/label.rb
@@ -0,0 +1,41 @@
+#
+# tkextlib/bwidget/label.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tk/label'
+require 'tkextlib/bwidget.rb'
+
+module Tk
+ module BWidget
+ class Label < TkLabel
+ end
+ end
+end
+
+class Tk::BWidget::Label
+ TkCommandNames = ['Label'.freeze].freeze
+ WidgetClassName = 'Label'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def __strval_optkeys
+ super() << 'helptext'
+ end
+ private :__strval_optkeys
+
+ def __boolval_optkeys
+ super() << 'dragenabled' << 'dropenabled'
+ end
+ private :__boolval_optkeys
+
+ def __tkvariable_optkeys
+ super() << 'helpvar'
+ end
+ private :__tkvariable_optkeys
+
+ def set_focus
+ tk_send_without_enc('setfocus')
+ self
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/labelentry.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/labelentry.rb
new file mode 100644
index 0000000000..931feb9b48
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/labelentry.rb
@@ -0,0 +1,80 @@
+#
+# tkextlib/bwidget/labelentry.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tk/entry'
+require 'tkextlib/bwidget.rb'
+require 'tkextlib/bwidget/labelframe'
+require 'tkextlib/bwidget/entry'
+
+module Tk
+ module BWidget
+ class LabelEntry < TkEntry
+ end
+ end
+end
+
+class Tk::BWidget::LabelEntry
+ include Scrollable
+
+ TkCommandNames = ['LabelEntry'.freeze].freeze
+ WidgetClassName = 'LabelEntry'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def __strval_optkeys
+ super() << 'helptext' << 'insertbackground' << 'entryfg' << 'entrybg'
+ end
+ private :__strval_optkeys
+
+ def __tkvariable_optkeys
+ super() << 'helpvar'
+ end
+ private :__tkvariable_optkeys
+
+ def __font_optkeys
+ super() << 'labelfont'
+ end
+ private :__font_optkeys
+
+ #def entrybind(*args)
+ # _bind([path, 'bind'], *args)
+ # self
+ #end
+ def entrybind(context, *args)
+ # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ if TkComm._callback_entry?(args[0]) || !block_given?
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind([path, 'bind'], context, cmd, *args)
+ self
+ end
+
+ #def entrybind_append(*args)
+ # _bind_append([path, 'bind'], *args)
+ # self
+ #end
+ def entrybind_append(context, *args)
+ #if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ if TkComm._callback_entry?(args[0]) || !block_given?
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_append([path, 'bind'], context, cmd, *args)
+ self
+ end
+
+ def entrybind_remove(*args)
+ _bind_remove([path, 'bind'], *args)
+ self
+ end
+
+ def entrybindinfo(*args)
+ _bindinfo([path, 'bind'], *args)
+ self
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/labelframe.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/labelframe.rb
new file mode 100644
index 0000000000..f7b267eebb
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/labelframe.rb
@@ -0,0 +1,46 @@
+#
+# tkextlib/bwidget/labelframe.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tk/frame'
+require 'tkextlib/bwidget.rb'
+require 'tkextlib/bwidget/label'
+
+module Tk
+ module BWidget
+ class LabelFrame < TkWindow
+ end
+ end
+end
+
+class Tk::BWidget::LabelFrame
+ TkCommandNames = ['LabelFrame'.freeze].freeze
+ WidgetClassName = 'LabelFrame'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def __strval_optkeys
+ super() << 'helptext'
+ end
+ private :__strval_optkeys
+
+ def __boolval_optkeys
+ super() << 'dragenabled' << 'dropenabled'
+ end
+ private :__boolval_optkeys
+
+ def __tkvariable_optkeys
+ super() << 'helpvar'
+ end
+ private :__tkvariable_optkeys
+
+ def self.align(*args)
+ tk_call('LabelFrame::align', *args)
+ end
+ def get_frame(&b)
+ win = window(tk_send_without_enc('getframe'))
+ win.instance_eval(&b) if b
+ win
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/listbox.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/listbox.rb
new file mode 100644
index 0000000000..1267500661
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/listbox.rb
@@ -0,0 +1,339 @@
+#
+# tkextlib/bwidget/listbox.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tk/canvas'
+require 'tkextlib/bwidget.rb'
+
+module Tk
+ module BWidget
+ class ListBox < TkWindow
+ # is NOT a subclass of a listbox widget class.
+ # because it constructed on a canvas widget.
+
+ class Item < TkObject
+ end
+ end
+ end
+end
+
+class Tk::BWidget::ListBox
+ include TkItemConfigMethod
+ include Scrollable
+
+ TkCommandNames = ['ListBox'.freeze].freeze
+ WidgetClassName = 'ListBox'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ class Event_for_Items < TkEvent::Event
+ def self._get_extra_args_tbl
+ [
+ TkComm.method(:string) # item idenfier
+ ]
+ end
+ end
+
+ def __boolval_optkeys
+ super() << 'autofocus' << 'dragenabled' << 'dropenabled' << 'selectfill'
+ end
+ private :__boolval_optkeys
+
+ def tagid(tag)
+ if tag.kind_of?(Tk::BWidget::ListBox::Item)
+ tag.id
+ else
+ # tag
+ _get_eval_string(tag)
+ end
+ end
+
+ #def imagebind(*args)
+ # _bind_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
+ # self
+ #end
+ def imagebind(context, *args)
+ #if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ if TkComm._callback_entry?(args[0]) || !block_given?
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_for_event_class(Event_for_Items, [path, 'bindImage'],
+ context, cmd, *args)
+ self
+ end
+
+ #def imagebind_append(*args)
+ # _bind_append_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
+ # self
+ #end
+ def imagebind_append(context, *args)
+ #if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ if TkComm._callback_entry?(args[0]) || !block_given?
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_append_for_event_class(Event_for_Items, [path, 'bindImage'],
+ context, cmd, *args)
+ self
+ end
+
+ def imagebind_remove(*args)
+ _bind_remove_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
+ self
+ end
+
+ def imagebindinfo(*args)
+ _bindinfo_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
+ end
+
+ #def textbind(*args)
+ # _bind_for_event_class(Event_for_Items, [path, 'bindText'], *args)
+ # self
+ #end
+ def textbind(context, *args)
+ #if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ if TkComm._callback_entry?(args[0]) || !block_given?
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_for_event_class(Event_for_Items, [path, 'bindText'],
+ context, cmd, *args)
+ self
+ end
+
+ #def textbind_append(*args)
+ # _bind_append_for_event_class(Event_for_Items, [path, 'bindText'], *args)
+ # self
+ #end
+ def textbind_append(context, *args)
+ #if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ if TkComm._callback_entry?(args[0]) || !block_given?
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_append_for_event_class(Event_for_Items, [path, 'bindText'],
+ context, cmd, *args)
+ self
+ end
+
+ def textbind_remove(*args)
+ _bind_remove_for_event_class(Event_for_Items, [path, 'bindText'], *args)
+ self
+ end
+
+ def textbindinfo(*args)
+ _bindinfo_for_event_class(Event_for_Items, [path, 'bindText'], *args)
+ end
+
+ def delete(*args)
+ tk_send('delete', *args)
+ self
+ end
+
+ def edit(item, text, *args)
+ tk_send('edit', tagid(item), text, *args)
+ self
+ end
+
+ def exist?(item)
+ bool(tk_send('exists', tagid(item)))
+ end
+
+ def index(item)
+ num_or_str(tk_send('index', tagid(item)))
+ end
+
+ def insert(idx, item, keys={})
+ tk_send('insert', idx, tagid(item), *hash_kv(keys))
+ self
+ end
+
+ def get_item(idx)
+ tk_send('items', idx)
+ end
+
+ def items(first=None, last=None)
+ list(tk_send('items', first, last))
+ end
+
+ def move(item, idx)
+ tk_send('move', tagid(item), idx)
+ self
+ end
+
+ def reorder(neworder)
+ tk_send('reorder', neworder)
+ self
+ end
+
+ def see(item)
+ tk_send('see', tagid(item))
+ self
+ end
+
+ def selection_clear
+ tk_send_without_enc('selection', 'clear')
+ self
+ end
+
+ def selection_set(*args)
+ tk_send_without_enc('selection', 'set',
+ *(args.collect{|item| tagid(item)}))
+ self
+ end
+
+ def selection_add(*args)
+ tk_send_without_enc('selection', 'add',
+ *(args.collect{|item| tagid(item)}))
+ self
+ end
+
+ def selection_remove(*args)
+ tk_send_without_enc('selection', 'remove',
+ *(args.collect{|item| tagid(item)}))
+ self
+ end
+
+ def selection_get(*args)
+ simplelist(tk_send_without_enc('selection', 'get')).collect{|item|
+ Tk::BWidget::ListBox::Item.id2obj(self, item)
+ }
+ end
+end
+
+class Tk::BWidget::ListBox::Item
+ include TkTreatTagFont
+
+ ListItem_TBL = TkCore::INTERP.create_table
+ ListItem_ID = ['bw:item'.freeze, '00000'.taint].freeze
+
+ TkCore::INTERP.init_ip_env{ ListItem_TBL.clear }
+
+ def self.id2obj(lbox, id)
+ lpath = lbox.path
+ return id unless ListItem_TBL[lpath]
+ ListItem_TBL[lpath][id]? ListItem_TBL[lpath][id]: id
+ end
+
+ def initialize(lbox, *args)
+ if lbox.kind_of?(Tk::BWidget::ListBox)
+ @listbox = lbox
+ else
+ fail RuntimeError,
+ "expect Tk::BWidget::ListBox or Tk::BWidget::ListBox::Item for 1st argument"
+ end
+
+ if args[-1].kind_of?(Hash)
+ keys = _symbolkey2str(args.pop)
+ else
+ keys = {}
+ end
+
+ index = keys.delete('index')
+ unless args.empty?
+ index = args.shift
+ end
+ index = 'end' unless index
+
+ unless args.empty?
+ fail RuntimeError, 'too much arguments'
+ end
+
+ @lpath = @listbox.path
+
+ if keys.key?('itemname')
+ @path = @id = keys.delete('itemname')
+ else
+ @path = @id = ListItem_ID.join(TkCore::INTERP._ip_id_)
+ ListItem_ID[1].succ!
+ end
+
+ ListItem_TBL[@id] = self
+ ListItem_TBL[@lpath] = {} unless ListItem_TBL[@lpath]
+ ListItem_TBL[@lpath][@id] = self
+
+ @listbox.insert(index, @id, keys)
+ end
+
+ def listbox
+ @listbox
+ end
+
+ def id
+ @id
+ end
+
+ def [](key)
+ cget(key)
+ end
+
+ def []=(key, val)
+ configure(key, val)
+ val
+ end
+
+ def cget(key)
+ @listbox.itemcget(@id, key)
+ end
+
+ def configure(key, val=None)
+ @listbox.itemconfigure(@id, key, val)
+ end
+
+ def configinfo(key=nil)
+ @listbox.itemconfiginfo(@id, key)
+ end
+
+ def current_configinfo(key=nil)
+ @listbox.current_itemconfiginfo(@id, key)
+ end
+
+ def delete
+ @listbox.delete(@id)
+ self
+ end
+
+ def edit(*args)
+ @listbox.edit(@id, *args)
+ self
+ end
+
+ def exist?
+ @listbox.exist?(@id)
+ end
+
+ def index
+ @listbox.index(@id)
+ end
+
+ def move(index)
+ @listbox.move(@id, index)
+ end
+
+ def see
+ @listbox.see(@id)
+ end
+
+ def selection_add
+ @listbox.selection_add(@id)
+ end
+
+ def selection_remove
+ @listbox.selection_remove(@id)
+ end
+
+ def selection_set
+ @listbox.selection_set(@id)
+ end
+
+ def selection_toggle
+ @listbox.selection_toggle(@id)
+ end
+end
+
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/mainframe.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/mainframe.rb
new file mode 100644
index 0000000000..c54e878557
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/mainframe.rb
@@ -0,0 +1,92 @@
+#
+# tkextlib/bwidget/mainframe.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tk/frame'
+require 'tkextlib/bwidget.rb'
+require 'tkextlib/bwidget/progressbar'
+
+module Tk
+ module BWidget
+ class MainFrame < TkWindow
+ end
+ end
+end
+
+class Tk::BWidget::MainFrame
+ TkCommandNames = ['MainFrame'.freeze].freeze
+ WidgetClassName = 'MainFrame'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def __strval_optkeys
+ super() << 'progressfg'
+ end
+ private :__strval_optkeys
+
+ def __tkvariable_optkeys
+ super() << 'progressvar'
+ end
+ private :__tkvariable_optkeys
+
+ def __val2ruby_optkeys # { key=>proc, ... }
+ # The method is used to convert a opt-value to a ruby's object.
+ # When get the value of the option "key", "proc.call(value)" is called.
+ {
+ 'menu'=>proc{|v| simplelist(v).collect!{|elem| simplelist(v)}}
+ }
+ end
+ private :__val2ruby_optkeys
+
+ def add_indicator(keys={}, &b)
+ win = window(tk_send('addindicator', *hash_kv(keys)))
+ win.instance_eval(&b) if b
+ win
+ end
+
+ def add_toolbar(&b)
+ win = window(tk_send('addtoolbar'))
+ win.instance_eval(&b) if b
+ win
+ end
+
+ def get_frame(&b)
+ win = window(tk_send('getframe'))
+ win.instance_eval(&b) if b
+ win
+ end
+
+ def get_indicator(idx, &b)
+ win = window(tk_send('getindicator', idx))
+ win.instance_eval(&b) if b
+ win
+ end
+
+ def get_menu(menu_id, &b)
+ win = window(tk_send('getmenu', menu_id))
+ win.instance_eval(&b) if b
+ win
+ end
+
+ def get_toolbar(idx, &b)
+ win = window(tk_send('gettoolbar', idx))
+ win.instance_eval(&b) if b
+ win
+ end
+
+ def set_menustate(tag, state)
+ tk_send('setmenustate', tag, state)
+ self
+ end
+
+ def show_statusbar(name)
+ tk_send('showstatusbar', name)
+ self
+ end
+
+ def show_toolbar(idx, mode)
+ tk_send('showtoolbar', idx, mode)
+ self
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/messagedlg.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/messagedlg.rb
new file mode 100644
index 0000000000..9c946d0630
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/messagedlg.rb
@@ -0,0 +1,178 @@
+#
+# tkextlib/bwidget/messagedlg.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/bwidget.rb'
+require 'tkextlib/bwidget/dialog.rb'
+
+module Tk
+ module BWidget
+ class MessageDlg < TkWindow
+ end
+ end
+end
+
+class Tk::BWidget::MessageDlg
+ TkCommandNames = ['MessageDlg'.freeze].freeze
+ WidgetClassName = 'MessageDlg'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def initialize(parent=nil, keys=nil)
+ @relative = ''
+ if parent.kind_of?(Hash)
+ keys = _symbolkey2str(parent)
+ @relative = keys['parent'] if keys.key?('parent')
+ @relative = keys.delete('relative') if keys.key?('relative')
+ super(keys)
+ elsif keys
+ keys = _symbolkey2str(keys)
+ @relative = keys.delete('parent') if keys.key?('parent')
+ @relative = keys.delete('relative') if keys.key?('relative')
+ super(parent, keys)
+ else
+ super(parent)
+ end
+ end
+
+ def create_self(keys)
+ # NOT create widget.
+ # Because the widget no longer exist when returning from creation.
+ @keys = _symbolkey2str(keys).update('parent'=>@relative)
+ @info = nil
+ end
+ private :create_self
+
+ def __strval_optkeys
+ super() << 'message' << 'title'
+ end
+ private :__strval_optkeys
+
+ def __listval_optkeys
+ super() << 'buttons'
+ end
+ private :__listval_optkeys
+
+ def cget(slot)
+ slot = slot.to_s
+ if slot == 'relative'
+ slot = 'parent'
+ end
+ if winfo_exist?
+ val = super(slot)
+ @keys[slot] = val
+ end
+ @keys[slot]
+ end
+
+ def configure(slot, value=None)
+ if winfo_exist?
+ super(slot, value)
+ end
+ if slot.kind_of?(Hash)
+ slot = _symbolkey2str(slot)
+ slot['parent'] = slot.delete('relative') if slot.key?('relative')
+ @keys.update(slot)
+
+ if @info
+ # update @info
+ slot.each{|k, v|
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ if (inf = @info.assoc(k))
+ inf[-1] = v
+ else
+ @info << [k, '', '', '', v]
+ end
+ else
+ if (inf = @info[k])
+ inf[-1] = v
+ else
+ @info[k] = ['', '', '', v]
+ end
+ end
+ }
+ end
+
+ else # ! Hash
+ slot = slot.to_s
+ slot = 'parent' if slot == 'relative'
+ @keys[slot] = value
+
+ if @info
+ # update @info
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ if (inf = @info.assoc(slot))
+ inf[-1] = value
+ else
+ @info << [slot, '', '', '', value]
+ end
+ else
+ if (inf = @info[slot])
+ inf[-1] = value
+ else
+ @info[slot] = ['', '', '', value]
+ end
+ end
+ end
+ end
+
+ self
+ end
+
+ def configinfo(slot=nil)
+ if winfo_exist?
+ @info = super()
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ @info << ['relative', 'parent']
+ else
+ @info['relative'] = 'parent'
+ end
+ end
+
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ if @info
+ if winfo_exist?
+ # update @keys
+ @info.each{|inf| @keys[inf[0]] = inf[-1] if inf.size > 2 }
+ end
+ else
+ @info = []
+ @keys.each{|k, v|
+ @info << [k, '', '', '', v]
+ }
+ @info << ['relative', 'parent']
+ end
+
+ if slot
+ @info.asoc(slot.to_s).dup
+ else
+ @info.dup
+ end
+
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
+ if @info
+ if winfo_exist?
+ # update @keys
+ @info.each{|k, inf| @keys[k] = inf[-1] if inf.size > 2 }
+ end
+ else
+ @info = {}
+ @keys.each{|k, v|
+ @info[k] = ['', '', '', v]
+ }
+ @info['relative'] = 'parent'
+ end
+
+ if slot
+ @info[slot.to_s].dup
+ else
+ @info.dup
+ end
+ end
+ end
+
+ def create
+ num_or_str(tk_call(self.class::TkCommandNames[0], @path, *hash_kv(@keys)))
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/notebook.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/notebook.rb
new file mode 100644
index 0000000000..5146d4915d
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/notebook.rb
@@ -0,0 +1,148 @@
+#
+# tkextlib/bwidget/notebook.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tk/frame'
+require 'tkextlib/bwidget.rb'
+
+module Tk
+ module BWidget
+ class NoteBook < TkWindow
+ end
+ end
+end
+
+class Tk::BWidget::NoteBook
+ include TkItemConfigMethod
+
+ TkCommandNames = ['NoteBook'.freeze].freeze
+ WidgetClassName = 'NoteBook'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ class Event_for_Tabs < TkEvent::Event
+ def self._get_extra_args_tbl
+ [
+ TkComm.method(:string) # page idenfier
+ ]
+ end
+ end
+
+ def __boolval_optkeys
+ super() << 'homogeneous'
+ end
+ private :__boolval_optkeys
+
+ def tagid(id)
+ if id.kind_of?(TkWindow)
+ #id.path
+ id.epath
+ elsif id.kind_of?(TkObject)
+ id.to_eval
+ else
+ # id.to_s
+ _get_eval_string(id)
+ end
+ end
+
+ #def tabbind(*args)
+ # _bind_for_event_class(Event_for_Tabs, [path, 'bindtabs'], *args)
+ # self
+ #end
+ def tabbind(context, *args)
+ #if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ if TkComm._callback_entry?(args[0]) || !block_given?
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_for_event_class(Event_for_Tabs, [path, 'bindtabs'],
+ context, cmd, *args)
+ self
+ end
+
+ #def tabbind_append(*args)
+ # _bind_append_for_event_class(Event_for_Tabs, [path, 'bindtabs'], *args)
+ # self
+ #end
+ def tabbind_append(context, *args)
+ #if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ if TkComm._callback_entry?(args[0]) || !block_given?
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_append_for_event_class(Event_for_Tabs, [path, 'bindtabs'],
+ context, cmd, *args)
+ self
+ end
+
+ def tabbind_remove(*args)
+ _bind_remove_for_event_class(Event_for_Tabs, [path, 'bindtabs'], *args)
+ self
+ end
+
+ def tabbindinfo(*args)
+ _bindinfo_for_event_class(Event_for_Tabs, [path, 'bindtabs'], *args)
+ end
+
+ def add(page, &b)
+ win = window(tk_send('add', tagid(page)))
+ win.instance_eval(&b) if b
+ win
+ end
+
+ def compute_size
+ tk_send('compute_size')
+ self
+ end
+
+ def delete(page, destroyframe=None)
+ tk_send('delete', tagid(page), destroyframe)
+ self
+ end
+
+ def get_frame(page, &b)
+ win = window(tk_send('getframe', tagid(page)))
+ win.instance_eval(&b) if b
+ win
+ end
+
+ def index(page)
+ num_or_str(tk_send('index', tagid(page)))
+ end
+
+ def insert(index, page, keys={}, &b)
+ win = window(tk_send('insert', index, tagid(page), *hash_kv(keys)))
+ win.instance_eval(&b) if b
+ win
+ end
+
+ def move(page, index)
+ tk_send('move', tagid(page), index)
+ self
+ end
+
+ def get_page(page)
+ tk_send('pages', page)
+ end
+
+ def pages(first=None, last=None)
+ list(tk_send('pages', first, last))
+ end
+
+ def raise(page=nil)
+ if page
+ tk_send('raise', page)
+ self
+ else
+ tk_send('raise')
+ end
+ end
+
+ def see(page)
+ tk_send('see', page)
+ self
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/pagesmanager.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/pagesmanager.rb
new file mode 100644
index 0000000000..fc01284be6
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/pagesmanager.rb
@@ -0,0 +1,61 @@
+#
+# tkextlib/bwidget/pagesmanager.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tk/frame'
+require 'tkextlib/bwidget.rb'
+
+module Tk
+ module BWidget
+ class PagesManager < TkWindow
+ end
+ end
+end
+
+class Tk::BWidget::PagesManager
+ TkCommandNames = ['PagesManager'.freeze].freeze
+ WidgetClassName = 'PagesManager'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def tagid(id)
+ # id.to_s
+ _get_eval_string(id)
+ end
+
+ def add(page, &b)
+ win = window(tk_send('add', tagid(page)))
+ win.instance_eval(&b) if b
+ win
+ end
+
+ def compute_size
+ tk_send('compute_size')
+ self
+ end
+
+ def delete(page)
+ tk_send('delete', tagid(page))
+ self
+ end
+
+ def get_frame(page, &b)
+ win = window(tk_send('getframe', tagid(page)))
+ win.instance_eval(&b) if b
+ win
+ end
+
+ def get_page(page)
+ tk_send('pages', page)
+ end
+
+ def pages(first=None, last=None)
+ list(tk_send('pages', first, last))
+ end
+
+ def raise(page=None)
+ tk_send('raise', page)
+ self
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/panedwindow.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/panedwindow.rb
new file mode 100644
index 0000000000..19982c6095
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/panedwindow.rb
@@ -0,0 +1,31 @@
+#
+# tkextlib/bwidget/panedwindow.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tk/frame'
+require 'tkextlib/bwidget.rb'
+
+module Tk
+ module BWidget
+ class PanedWindow < TkWindow
+ end
+ end
+end
+
+class Tk::BWidget::PanedWindow
+ TkCommandNames = ['PanedWindow'.freeze].freeze
+ WidgetClassName = 'PanedWindow'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def add(keys={})
+ window(tk_send('add', *hash_kv(keys)))
+ end
+
+ def get_frame(idx, &b)
+ win = window(tk_send_without_enc('getframe', idx))
+ win.instance_eval(&b) if b
+ win
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/panelframe.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/panelframe.rb
new file mode 100644
index 0000000000..13f8817d74
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/panelframe.rb
@@ -0,0 +1,51 @@
+#
+# tkextlib/bwidget/panelframe.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tk/frame'
+require 'tkextlib/bwidget.rb'
+
+module Tk
+ module BWidget
+ class PanelFrame < TkWindow
+ end
+ end
+end
+
+class Tk::BWidget::PanelFrame
+ TkCommandNames = ['PanelFrame'.freeze].freeze
+ WidgetClassName = 'PanelFrame'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def __strval_optkeys
+ super() + ['panelforeground', 'panelbackground']
+ end
+ private :__strval_optkeys
+
+ def add(win, keys={})
+ tk_send('add', win, keys)
+ self
+ end
+
+ def delete(*wins)
+ tk_send('delete', *wins)
+ self
+ end
+
+ def get_frame(&b)
+ win = window(tk_send_without_enc('getframe'))
+ win.instance_eval(&b) if b
+ win
+ end
+
+ def items
+ list(tk_send('items'))
+ end
+
+ def remove(*wins)
+ tk_send('remove', *wins)
+ self
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/passwddlg.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/passwddlg.rb
new file mode 100644
index 0000000000..0b635d97bb
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/passwddlg.rb
@@ -0,0 +1,44 @@
+#
+# tkextlib/bwidget/passwddlg.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/bwidget.rb'
+require 'tkextlib/bwidget/messagedlg'
+
+module Tk
+ module BWidget
+ class PasswdDlg < Tk::BWidget::MessageDlg
+ end
+ end
+end
+
+class Tk::BWidget::PasswdDlg
+ TkCommandNames = ['PasswdDlg'.freeze].freeze
+ WidgetClassName = 'PasswdDlg'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def __strval_optkeys
+ super() << 'loginhelptext' << 'loginlabel' << 'logintext' <<
+ 'passwdlabel' << 'passwdtext'
+ end
+ private :__strval_optkeys
+
+ def __boolval_optkeys
+ super() << 'passwdeditable' << 'homogeneous'
+ end
+ private :__boolval_optkeys
+
+ def __tkvariable_optkeys
+ super() << 'loginhelpvar' << 'logintextvariable' <<
+ 'passwdhelpvar' << 'passwdtextvariable'
+ end
+ private :__tkvariable_optkeys
+
+ def create
+ login, passwd = simplelist(tk_call(self.class::TkCommandNames[0],
+ @path, *hash_kv(@keys)))
+ [login, passwd]
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/progressbar.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/progressbar.rb
new file mode 100644
index 0000000000..0253ce2ada
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/progressbar.rb
@@ -0,0 +1,20 @@
+#
+# tkextlib/bwidget/progressbar.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/bwidget.rb'
+
+module Tk
+ module BWidget
+ class ProgressBar < TkWindow
+ end
+ end
+end
+
+class Tk::BWidget::ProgressBar
+ TkCommandNames = ['ProgressBar'.freeze].freeze
+ WidgetClassName = 'ProgressBar'.freeze
+ WidgetClassNames[WidgetClassName] = self
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/progressdlg.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/progressdlg.rb
new file mode 100644
index 0000000000..fbf00f3b00
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/progressdlg.rb
@@ -0,0 +1,54 @@
+#
+# tkextlib/bwidget/progressdlg.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tk/variable'
+require 'tkextlib/bwidget.rb'
+require 'tkextlib/bwidget/progressbar'
+require 'tkextlib/bwidget/messagedlg'
+
+module Tk
+ module BWidget
+ class ProgressDlg < Tk::BWidget::MessageDlg
+ end
+ end
+end
+
+class Tk::BWidget::ProgressDlg
+ TkCommandNames = ['ProgressDlg'.freeze].freeze
+ WidgetClassName = 'ProgressDlg'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def create_self(keys)
+ # NOT create widget for reusing the object
+ super(keys)
+ @keys['textvariable'] = TkVariable.new unless @keys.key?('textvariable')
+ @keys['variable'] = TkVariable.new unless @keys.key?('variable')
+ end
+
+ def textvariable
+ @keys['textvariable']
+ end
+
+ def text
+ @keys['textvariable'].value
+ end
+
+ def text= (txt)
+ @keys['textvariable'].value = txt
+ end
+
+ def variable
+ @keys['variable']
+ end
+
+ def value
+ @keys['variable'].value
+ end
+
+ def value= (val)
+ @keys['variable'].value = val
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/scrollableframe.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/scrollableframe.rb
new file mode 100644
index 0000000000..a3986681a5
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/scrollableframe.rb
@@ -0,0 +1,34 @@
+#
+# tkextlib/bwidget/scrollableframe.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tk/frame'
+require 'tkextlib/bwidget.rb'
+
+module Tk
+ module BWidget
+ class ScrollableFrame < TkWindow
+ end
+ end
+end
+
+class Tk::BWidget::ScrollableFrame
+ include Scrollable
+
+ TkCommandNames = ['ScrollableFrame'.freeze].freeze
+ WidgetClassName = 'ScrollableFrame'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def get_frame(&b)
+ win = window(tk_send_without_enc('getframe'))
+ win.instance_eval(&b) if b
+ win
+ end
+
+ def see(win, vert=None, horiz=None)
+ tk_send_without_enc('see', win, vert, horiz)
+ self
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/scrolledwindow.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/scrolledwindow.rb
new file mode 100644
index 0000000000..e9e53235b7
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/scrolledwindow.rb
@@ -0,0 +1,32 @@
+#
+# tkextlib/bwidget/scrolledwindow.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tk/frame'
+require 'tkextlib/bwidget.rb'
+
+module Tk
+ module BWidget
+ class ScrolledWindow < TkWindow
+ end
+ end
+end
+
+class Tk::BWidget::ScrolledWindow
+ TkCommandNames = ['ScrolledWindow'.freeze].freeze
+ WidgetClassName = 'ScrolledWindow'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def get_frame(&b)
+ win = window(tk_send_without_enc('getframe'))
+ win.instance_eval(&b) if b
+ win
+ end
+
+ def set_widget(win)
+ tk_send_without_enc('setwidget', win)
+ self
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/scrollview.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/scrollview.rb
new file mode 100644
index 0000000000..0546af2c43
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/scrollview.rb
@@ -0,0 +1,25 @@
+#
+# tkextlib/bwidget/scrollview.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/bwidget.rb'
+
+module Tk
+ module BWidget
+ class ScrollView < TkWindow
+ end
+ end
+end
+
+class Tk::BWidget::ScrollView
+ TkCommandNames = ['ScrollView'.freeze].freeze
+ WidgetClassName = 'ScrollView'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def __strval_optkeys
+ super() << 'fill'
+ end
+ private :__strval_optkeys
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/selectcolor.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/selectcolor.rb
new file mode 100644
index 0000000000..742a84cd84
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/selectcolor.rb
@@ -0,0 +1,45 @@
+#
+# tkextlib/bwidget/selectcolor.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/bwidget.rb'
+require 'tkextlib/bwidget/messagedlg'
+
+module Tk
+ module BWidget
+ class SelectColor < Tk::BWidget::MessageDlg
+ end
+ end
+end
+
+class Tk::BWidget::SelectColor
+ extend Tk
+
+ TkCommandNames = ['SelectColor'.freeze].freeze
+ WidgetClassName = 'SelectColor'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def dialog(keys={})
+ newkeys = @keys.dup
+ newkeys.update(_symbolkey2str(keys))
+ tk_call('SelectColor::dialog', @path, *hash_kv(newkeys))
+ end
+
+ def menu(*args)
+ if args[-1].kind_of?(Hash)
+ keys = args.pop
+ else
+ keys = {}
+ end
+ place = args.flatten
+ newkeys = @keys.dup
+ newkeys.update(_symbolkey2str(keys))
+ tk_call('SelectColor::menu', @path, place, *hash_kv(newkeys))
+ end
+
+ def self.set_color(idx, color)
+ tk_call('SelectColor::setcolor', idx, color)
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/selectfont.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/selectfont.rb
new file mode 100644
index 0000000000..478787602a
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/selectfont.rb
@@ -0,0 +1,85 @@
+#
+# tkextlib/bwidget/selectfont.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/bwidget.rb'
+require 'tkextlib/bwidget/messagedlg'
+
+module Tk
+ module BWidget
+ class SelectFont < Tk::BWidget::MessageDlg
+ class Dialog < Tk::BWidget::SelectFont
+ end
+ class Toolbar < TkWindow
+ end
+ end
+ end
+end
+
+class Tk::BWidget::SelectFont
+ extend Tk
+
+ TkCommandNames = ['SelectFont'.freeze].freeze
+ WidgetClassName = 'SelectFont'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def __strval_optkeys
+ super() << 'sampletext' << 'title'
+ end
+ private :__strval_optkeys
+
+ def __font_optkeys
+ [] # without fontobj operation
+ end
+ private :__font_optkeys
+
+ def create
+ tk_call(self.class::TkCommandNames[0], @path, *hash_kv(@keys))
+ end
+
+ def self.load_font
+ tk_call('SelectFont::loadfont')
+ end
+end
+
+class Tk::BWidget::SelectFont::Dialog
+ def __font_optkeys
+ [] # without fontobj operation
+ end
+
+ def create_self(keys)
+ super(keys)
+ @keys['type'] = 'dialog'
+ end
+
+ def configure(slot, value=None)
+ if slot.kind_of?(Hash)
+ slot.delete['type']
+ slot.delete[:type]
+ return self if slot.empty?
+ else
+ return self if slot == 'type' || slot == :type
+ end
+ super(slot, value)
+ end
+
+ def create
+ @keys['type'] = 'dialog'
+ tk_call(Tk::BWidget::SelectFont::TkCommandNames[0], @path, *hash_kv(@keys))
+ end
+end
+
+class Tk::BWidget::SelectFont::Toolbar
+ def __font_optkeys
+ [] # without fontobj operation
+ end
+
+ def create_self(keys)
+ keys = {} unless keys
+ keys = _symbolkey2str(keys)
+ keys['type'] = 'toolbar'
+ tk_call(Tk::BWidget::SelectFont::TkCommandNames[0], @path, *hash_kv(keys))
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/separator.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/separator.rb
new file mode 100644
index 0000000000..d9c3458e51
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/separator.rb
@@ -0,0 +1,20 @@
+#
+# tkextlib/bwidget/separator.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/bwidget.rb'
+
+module Tk
+ module BWidget
+ class Separator < TkWindow
+ end
+ end
+end
+
+class Tk::BWidget::Separator
+ TkCommandNames = ['Separator'.freeze].freeze
+ WidgetClassName = 'Separator'.freeze
+ WidgetClassNames[WidgetClassName] = self
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/setup.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/setup.rb
new file mode 100644
index 0000000000..ce0f0bd4d4
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/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/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/spinbox.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/spinbox.rb
new file mode 100644
index 0000000000..ca4c046e5c
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/spinbox.rb
@@ -0,0 +1,98 @@
+#
+# tkextlib/bwidget/entry.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/bwidget.rb'
+require 'tkextlib/bwidget/arrowbutton'
+require 'tkextlib/bwidget/entry'
+
+module Tk
+ module BWidget
+ class SpinBox < TkEntry
+ end
+ end
+end
+
+class Tk::BWidget::SpinBox
+ include Scrollable
+
+ TkCommandNames = ['SpinBox'.freeze].freeze
+ WidgetClassName = 'SpinBox'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def __strval_optkeys
+ super() << 'helptext' << 'insertbackground' << 'entryfg' << 'entrybg'
+ end
+ private :__strval_optkeys
+
+ def __boolval_optkeys
+ super() << 'dragenabled' << 'dropenabled' << 'editable'
+ end
+ private :__boolval_optkeys
+
+ def __listval_optkeys
+ super() << 'values'
+ end
+ private :__listval_optkeys
+
+ def __tkvariable_optkeys
+ super() << 'helpvar'
+ end
+ private :__tkvariable_optkeys
+
+ #def entrybind(*args)
+ # _bind([path, 'bind'], *args)
+ # self
+ #end
+ def entrybind(context, *args)
+ #if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ if TkComm._callback_entry?(args[0]) || !block_given?
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind([path, 'bind'], context, cmd, *args)
+ self
+ end
+
+ #def entrybind_append(*args)
+ # _bind_append([path, 'bind'], *args)
+ # self
+ #end
+ def entrybind_append(context, *args)
+ #if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ if TkComm._callback_entry?(args[0]) || !block_given?
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_append([path, 'bind'], context, cmd, *args)
+ self
+ end
+
+ def entrybind_remove(*args)
+ _bind_remove([path, 'bind'], *args)
+ self
+ end
+
+ def entrybindinfo(*args)
+ _bindinfo([path, 'bind'], *args)
+ self
+ end
+
+ def get_index_of_value
+ number(tk_send_without_enc('getvalue'))
+ end
+ alias get_value get_index_of_value
+ alias get_value_index get_index_of_value
+
+ def set_value_by_index(idx)
+ idx = "@#{idx}" if idx.kind_of?(Integer)
+ tk_send_without_enc('setvalue', idx)
+ self
+ end
+ alias set_value set_value_by_index
+ alias set_index_value set_value_by_index
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/statusbar.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/statusbar.rb
new file mode 100644
index 0000000000..df16e4c0b7
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/statusbar.rb
@@ -0,0 +1,46 @@
+#
+# tkextlib/bwidget/statusbar.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tk/frame'
+require 'tkextlib/bwidget.rb'
+
+module Tk
+ module BWidget
+ class StatusBar < TkWindow
+ end
+ end
+end
+
+class Tk::BWidget::StatusBar
+ TkCommandNames = ['StatusBar'.freeze].freeze
+ WidgetClassName = 'StatusBar'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def __boolval_optkeys
+ super() << 'showresize'
+ end
+ private :__boolval_optkeys
+
+ def add(win, keys={})
+ tk_send('add', win, keys)
+ self
+ end
+
+ def delete(*wins)
+ tk_send('delete', *wins)
+ self
+ end
+
+ def get_frame(&b)
+ win = window(tk_send_without_enc('getframe'))
+ win.instance_eval(&b) if b
+ win
+ end
+
+ def items
+ list(tk_send('items'))
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/titleframe.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/titleframe.rb
new file mode 100644
index 0000000000..f519490430
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/titleframe.rb
@@ -0,0 +1,27 @@
+#
+# tkextlib/bwidget/titleframe.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tk/frame'
+require 'tkextlib/bwidget.rb'
+
+module Tk
+ module BWidget
+ class TitleFrame < TkWindow
+ end
+ end
+end
+
+class Tk::BWidget::TitleFrame
+ TkCommandNames = ['TitleFrame'.freeze].freeze
+ WidgetClassName = 'TitleFrame'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def get_frame(&b)
+ win = window(tk_send_without_enc('getframe'))
+ win.instance_eval(&b) if b
+ win
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/tree.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/tree.rb
new file mode 100644
index 0000000000..e7178debe2
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/tree.rb
@@ -0,0 +1,434 @@
+#
+# tkextlib/bwidget/tree.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tk/canvas'
+require 'tkextlib/bwidget.rb'
+
+module Tk
+ module BWidget
+ class Tree < TkWindow
+ class Node < TkObject
+ end
+ end
+ end
+end
+
+class Tk::BWidget::Tree
+ include TkItemConfigMethod
+ include Scrollable
+
+ TkCommandNames = ['Tree'.freeze].freeze
+ WidgetClassName = 'Tree'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ class Event_for_Items < TkEvent::Event
+ def self._get_extra_args_tbl
+ [
+ TkComm.method(:string) # item idenfier
+ ]
+ end
+ end
+
+ def __strval_optkeys
+ super() << 'crossfill' << 'linesfill'
+ end
+ private :__strval_optkeys
+
+ def __boolval_optkeys
+ super() << 'dragenabled' << 'dropenabled' <<
+ 'redraw' << 'selectfill' << 'showlines'
+ end
+ private :__boolval_optkeys
+
+ def __tkvariable_optkeys
+ super() << 'helpvar'
+ end
+ private :__tkvariable_optkeys
+
+ def tagid(tag)
+ if tag.kind_of?(Tk::BWidget::Tree::Node)
+ tag.id
+ else
+ # tag
+ _get_eval_string(tag)
+ end
+ end
+
+ #def imagebind(*args)
+ # _bind_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
+ # self
+ #end
+ def imagebind(context, *args)
+ #if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ if TkComm._callback_entry?(args[0]) || !block_given?
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_for_event_class(Event_for_Items, [path, 'bindImage'],
+ context, cmd, *args)
+ self
+ end
+
+ #def imagebind_append(*args)
+ # _bind_append_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
+ # self
+ #end
+ def imagebind_append(context, *args)
+ #if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ if TkComm._callback_entry?(args[0]) || !block_given?
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_append_for_event_class(Event_for_Items, [path, 'bindImage'],
+ context, cmd, *args)
+ self
+ end
+
+ def imagebind_remove(*args)
+ _bind_remove_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
+ self
+ end
+
+ def imagebindinfo(*args)
+ _bindinfo_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
+ end
+
+ #def textbind(*args)
+ # _bind_for_event_class(Event_for_Items, [path, 'bindText'], *args)
+ # self
+ #end
+ def textbind(context, *args)
+ #if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ if TkComm._callback_entry?(args[0]) || !block_given?
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_for_event_class(Event_for_Items, [path, 'bindText'],
+ context, cmd, *args)
+ self
+ end
+
+ #def textbind_append(*args)
+ # _bind_append_for_event_class(Event_for_Items, [path, 'bindText'], *args)
+ # self
+ #end
+ def textbind_append(context, *args)
+ #if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ if TkComm._callback_entry?(args[0]) || !block_given?
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_append_for_event_class(Event_for_Items, [path, 'bindText'],
+ context, cmd, *args)
+ self
+ end
+
+ def textbind_remove(*args)
+ _bind_remove_for_event_class(Event_for_Items, [path, 'bindText'], *args)
+ self
+ end
+
+ def textbindinfo(*args)
+ _bindinfo_for_event_class(Event_for_Items, [path, 'bindText'], *args)
+ end
+
+ def close_tree(node, recurse=None)
+ tk_send('closetree', tagid(node), recurse)
+ self
+ end
+
+ def delete(*args)
+ tk_send('delete', *(args.collect{|node| tagid(node)}))
+ self
+ end
+
+ def edit(node, text, *args)
+ tk_send('edit', tagid(node), text, *args)
+ self
+ end
+
+ def exist?(node)
+ bool(tk_send('exists', tagid(node)))
+ end
+
+ def index(node)
+ num_or_str(tk_send('index', tagid(node)))
+ end
+
+ def insert(idx, parent, node, keys={})
+ tk_send('insert', idx, tagid(parent), tagid(node), *hash_kv(keys))
+ self
+ end
+
+ def move(parent, node, idx)
+ tk_send('move', tagid(parent), tagid(node), idx)
+ self
+ end
+
+ def get_node(node, idx)
+ Tk::BWidget::Tree::Node.id2obj(self, tk_send('nodes', tagid(node), idx))
+ end
+
+ def nodes(node, first=None, last=None)
+ simplelist(tk_send('nodes', tagid(node), first, last)).collect{|node|
+ Tk::BWidget::Tree::Node.id2obj(self, node)
+ }
+ end
+
+ def open?(node)
+ bool(@tree.itemcget(tagid(node), 'open'))
+ end
+
+ def open_tree(node, recurse=None)
+ tk_send('opentree', tagid(node), recurse)
+ self
+ end
+
+ def parent(node)
+ Tk::BWidget::Tree::Node.id2obj(self, tk_send('parent', tagid(node)))
+ end
+
+ def reorder(node, neworder)
+ tk_send('reorder', tagid(node), neworder)
+ self
+ end
+
+ def see(node)
+ tk_send('see', tagid(node))
+ self
+ end
+
+ def selection_add(*args)
+ tk_send_without_enc('selection', 'add',
+ *(args.collect{|node| tagid(node)}))
+ self
+ end
+
+ def selection_clear
+ tk_send_without_enc('selection', 'clear')
+ self
+ end
+
+ def selection_get
+ list(tk_send_without_enc('selection', 'get'))
+ end
+
+ def selection_include?(*args)
+ bool(tk_send_without_enc('selection', 'get',
+ *(args.collect{|node| tagid(node)})))
+ end
+
+ def selection_range(*args)
+ tk_send_without_enc('selection', 'range',
+ *(args.collect{|node| tagid(node)}))
+ self
+ end
+
+ def selection_remove(*args)
+ tk_send_without_enc('selection', 'remove',
+ *(args.collect{|node| tagid(node)}))
+ self
+ end
+
+ def selection_set(*args)
+ tk_send_without_enc('selection', 'set',
+ *(args.collect{|node| tagid(node)}))
+ self
+ end
+
+ def selection_toggle(*args)
+ tk_send_without_enc('selection', 'toggle',
+ *(args.collect{|node| tagid(node)}))
+ self
+ end
+
+ def toggle(node)
+ tk_send_without_enc('toggle', tagid(node))
+ self
+ end
+
+ def visible(node)
+ bool(tk_send_without_enc('visible', tagid(node)))
+ end
+end
+
+class Tk::BWidget::Tree::Node
+ include TkTreatTagFont
+
+ TreeNode_TBL = TkCore::INTERP.create_table
+ TreeNode_ID = ['bw:node'.freeze, '00000'.taint].freeze
+
+ TkCore::INTERP.init_ip_env{ TreeNode_TBL.clear }
+
+ def self.id2obj(tree, id)
+ tpath = tree.path
+ return id unless TreeNode_TBL[tpath]
+ TreeNode_TBL[tpath][id]? TreeNode_TBL[tpath][id]: id
+ end
+
+ def initialize(tree, *args)
+ if tree.kind_of?(Tk::BWidget::Tree)
+ @tree = tree
+ parent = args.shift
+ if parent.kind_of?(Tk::BWidget::Tree::Node)
+ if parent.tree.path != @tree.path
+ fail RuntimeError, 'tree of parent node is not match'
+ end
+ end
+ elsif tree.kind_of?(Tk::BWidget::Tree::Node)
+ @tree = tree.tree
+ parent = tree.parent
+ else
+ fail RuntimeError,
+ "expect Tk::BWidget::Tree or Tk::BWidget::Tree::Node for 1st argument"
+ end
+
+ if args[-1].kind_of?(Hash)
+ keys = _symbolkey2str(args.pop)
+ else
+ keys = {}
+ end
+
+ index = keys.delete('index')
+ unless args.empty?
+ index = args.shift
+ end
+ index = 'end' unless index
+
+ unless args.empty?
+ fail RuntimeError, 'too much arguments'
+ end
+
+ @tpath = @tree.path
+
+ if keys.key?('nodename')
+ @path = @id = keys.delete('nodename')
+ else
+ @path = @id = TreeNode_ID.join(TkCore::INTERP._ip_id_)
+ TreeNode_ID[1].succ!
+ end
+
+ TreeNode_TBL[@id] = self
+ TreeNode_TBL[@tpath] = {} unless TreeNode_TBL[@tpath]
+ TreeNode_TBL[@tpath][@id] = self
+
+ @tree.insert(index, parent, @id, keys)
+ end
+
+ def tree
+ @tree
+ end
+
+ def id
+ @id
+ end
+
+ def [](key)
+ cget(key)
+ end
+
+ def []=(key, val)
+ configure(key, val)
+ val
+ end
+
+ def cget(key)
+ @tree.itemcget(@id, key)
+ end
+
+ def configure(key, val=None)
+ @tree.itemconfigure(@id, key, val)
+ end
+
+ def configinfo(key=nil)
+ @tree.itemconfiginfo(@id, key)
+ end
+
+ def current_configinfo(key=nil)
+ @tree.current_itemconfiginfo(@id, key)
+ end
+
+ def close_tree(recurse=None)
+ @tree.close_tree(@id, recurse)
+ self
+ end
+
+ def delete
+ @tree.delete(@id)
+ self
+ end
+
+ def edit(*args)
+ @tree.edit(@id, *args)
+ self
+ end
+
+ def exist?
+ @tree.exist?(@id)
+ end
+
+ def index
+ @tree.index(@id)
+ end
+
+ def move(index, parent=nil)
+ if parent
+ @tree.move(parent, @id, index)
+ else
+ @tree.move(self.parent, @id, index)
+ end
+ end
+
+ def open_tree(recurse=None)
+ @tree.open_tree(@id, recurse)
+ self
+ end
+
+ def open?
+ bool(@tree.itemcget(@id, 'open'))
+ end
+
+ def parent
+ @tree.parent(@id)
+ end
+
+ def reorder(neworder)
+ @tree.reorder(@id, neworder)
+ end
+
+ def see
+ @tree.see(@id)
+ end
+
+ def selection_add
+ @tree.selection_add(@id)
+ end
+
+ def selection_remove
+ @tree.selection_remove(@id)
+ end
+
+ def selection_set
+ @tree.selection_set(@id)
+ end
+
+ def selection_toggle
+ @tree.selection_toggle(@id)
+ end
+
+ def toggle
+ @tree.toggle(@id)
+ end
+
+ def visible
+ @tree.visible(@id)
+ end
+end
+
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/widget.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/widget.rb
new file mode 100644
index 0000000000..568e503a8b
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/bwidget/widget.rb
@@ -0,0 +1,113 @@
+#
+# tkextlib/bwidget/widget.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+require 'tkextlib/bwidget.rb'
+
+module Tk
+ module BWidget
+ module Widget
+ end
+ end
+end
+
+module Tk::BWidget::Widget
+ include Tk
+ extend Tk
+
+ def self.__pathname
+ 'Widget::configure'
+ end
+
+ def self.__cget_cmd
+ ['Widget::cget']
+ end
+
+ def self.__config_cmd
+ ['Widget::configure']
+ end
+
+ def self.cget(slot)
+ self.current_configinfo(slot).values[0]
+ end
+
+ def self.add_map(klass, subclass, subpath, opts)
+ tk_call('Widget::addmap', klass, subclass, subpath, opts)
+ end
+
+ def self.bwinclude(klass, subclass, subpath, *args)
+ tk_call('Widget::bwinclude', klass, subclass, subpath, *args)
+ end
+
+ def self.create(klass, path, rename=None, &b)
+ win = window(tk_call('Widget::create', klass, path, rename))
+ win.instance_eval(&b) if b
+ win
+ end
+
+ def self.declare(klass, optlist)
+ tk_call('Widget::declare', klass, optlist)
+ end
+
+ def self.define(klass, filename, *args)
+ tk_call('Widget::define', klass, filename, *args)
+ end
+
+ def self.destroy(win)
+ tk_call('Widget::destroy', _epath(win))
+ end
+
+ def self.focus_next(win)
+ tk_call('Widget::focusNext', win)
+ end
+
+ def self.focus_ok(win)
+ tk_call('Widget::focusOk', win)
+ end
+
+ def self.focus_prev(win)
+ tk_call('Widget::focusPrev', win)
+ end
+
+ def self.generate_doc(dir, widgetlist)
+ tk_call('Widget::generate-doc', dir, widgetlist)
+ end
+
+ def self.generate_widget_doc(klass, iscmd, file)
+ tk_call('Widget::generate-widget-doc', klass, iscmd, file)
+ end
+
+ def self.get_option(win, option)
+ tk_call('Widget::getoption', win, option)
+ end
+
+ def self.get_variable(win, varname, my_varname=None)
+ tk_call('Widget::getVariable', win, varname, my_varname)
+ end
+
+ def self.has_changed(win, option, pvalue)
+ tk_call('Widget::hasChanged', win, option, pvalue)
+ end
+
+ def self.init(klass, win, options)
+ tk_call('Widget::init', klass, win, options)
+ end
+
+ def self.set_option(win, option, value)
+ tk_call('Widget::setoption', win, option, value)
+ end
+
+ def self.sub_cget(win, subwidget)
+ tk_call('Widget::subcget', win, subwidget)
+ end
+
+ def self.sync_options(klass, subclass, subpath, options)
+ tk_call('Widget::syncoptions', klass, subclass, subpath, options)
+ end
+
+ def self.tkinclude(klass, tkwidget, subpath, *args)
+ tk_call('Widget::tkinclude', klass, tkwidget, subpath, *args)
+ end
+end