aboutsummaryrefslogtreecommitdiffstats
path: root/ext/tk/lib/tkextlib/tcllib
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tk/lib/tkextlib/tcllib')
-rw-r--r--ext/tk/lib/tkextlib/tcllib/autoscroll.rb12
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ctext.rb11
-rw-r--r--ext/tk/lib/tkextlib/tcllib/dialog.rb84
-rw-r--r--ext/tk/lib/tkextlib/tcllib/getstring.rb131
-rw-r--r--ext/tk/lib/tkextlib/tcllib/history.rb73
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ip_entry.rb5
-rw-r--r--ext/tk/lib/tkextlib/tcllib/panelframe.rb72
-rw-r--r--ext/tk/lib/tkextlib/tcllib/plotchart.rb154
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ruler.rb65
-rw-r--r--ext/tk/lib/tkextlib/tcllib/screenruler.rb68
-rw-r--r--ext/tk/lib/tkextlib/tcllib/scrollwin.rb61
-rw-r--r--ext/tk/lib/tkextlib/tcllib/style.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/superframe.rb51
-rw-r--r--ext/tk/lib/tkextlib/tcllib/swaplist.rb147
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tablelist.rb27
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tablelist_core.rb770
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb25
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tkpiechart.rb16
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tooltip.rb95
-rw-r--r--ext/tk/lib/tkextlib/tcllib/widget.rb48
20 files changed, 1914 insertions, 2 deletions
diff --git a/ext/tk/lib/tkextlib/tcllib/autoscroll.rb b/ext/tk/lib/tkextlib/tcllib/autoscroll.rb
index f2c898458f..6940a9174c 100644
--- a/ext/tk/lib/tkextlib/tcllib/autoscroll.rb
+++ b/ext/tk/lib/tkextlib/tcllib/autoscroll.rb
@@ -125,6 +125,7 @@ class TkScrollbar
end
# TkPackage.require('autoscroll', '1.0')
+# TkPackage.require('autoscroll', '1.1')
TkPackage.require('autoscroll')
module Tk
@@ -142,7 +143,16 @@ module Tk
def self.unautoscroll(win)
tk_call_without_enc('::autoscroll::unautoscroll', win.path)
end
+
+ def self.wrap
+ # v1.1
+ tk_call_without_enc('::autoscroll::wrap')
+ end
+
+ def self.unwrap
+ # v1.1
+ tk_call_without_enc('::autoscroll::unwrap')
+ end
end
end
end
-
diff --git a/ext/tk/lib/tkextlib/tcllib/ctext.rb b/ext/tk/lib/tkextlib/tcllib/ctext.rb
index aa2ef20365..70a45dd8e7 100644
--- a/ext/tk/lib/tkextlib/tcllib/ctext.rb
+++ b/ext/tk/lib/tkextlib/tcllib/ctext.rb
@@ -47,6 +47,17 @@ class Tk::Tcllib::CText
end
private :create_self
+ def __strval_optkeys
+ super() << 'linemapfg' << 'linemapbg' <<
+ 'linemap_select_fg' << 'linemap_select_bg'
+ end
+ private :__strval_optkeys
+
+ def __boolval_optkeys
+ super() << 'highlight' << 'linemap_markable'
+ end
+ private :__boolval_optkeys
+
def append(*args)
tk_send('append', *args)
end
diff --git a/ext/tk/lib/tkextlib/tcllib/dialog.rb b/ext/tk/lib/tkextlib/tcllib/dialog.rb
new file mode 100644
index 0000000000..825621b5a1
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/dialog.rb
@@ -0,0 +1,84 @@
+#
+# tkextlib/tcllib/dialog.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# * Part of tcllib extension
+# * Generic dialog widget (themed)
+#
+
+require 'tk'
+require 'tkextlib/tcllib.rb'
+
+# TkPackage.require('widget::dialog', '1.2')
+TkPackage.require('widget::dialog')
+
+module Tk::Tcllib
+ module Widget
+ class Dialog < TkWindow
+ PACKAGE_NAME = 'widget::dialog'.freeze
+ def self.package_name
+ PACKAGE_NAME
+ end
+
+ def self.package_version
+ begin
+ TkPackage.require('widget::dialog')
+ rescue
+ ''
+ end
+ end
+ end
+ end
+end
+
+class Tk::Tcllib::Widget::Dialog
+ TkCommandNames = ['::widget::dialog'.freeze].freeze
+
+ def __boolval_optkeys
+ ['separator', 'synchronous', 'transient']
+ end
+ private :__boolval_optkeys
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
+ else
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
+ end
+ end
+ private :create_self
+
+ def add(what, *args)
+ window(tk_send('add', *args))
+ end
+
+ def get_frame
+ window(tk_send('getframe'))
+ end
+
+ def set_widget(widget)
+ tk_send('setwidget', widget)
+ self
+ end
+
+ def display
+ tk_send('display')
+ self
+ end
+ alias show display
+
+ def cancel
+ tk_send('cancel')
+ self
+ end
+
+ def close(reason = None)
+ tk_send('close', reason)
+ end
+
+ def withdraw
+ tk_send('withdraw')
+ self
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tcllib/getstring.rb b/ext/tk/lib/tkextlib/tcllib/getstring.rb
new file mode 100644
index 0000000000..bf5e54e8cf
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/getstring.rb
@@ -0,0 +1,131 @@
+#
+# tkextlib/tcllib/getstring.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# * Part of tcllib extension
+# * A dialog which consists of an Entry, OK, and Cancel buttons.
+#
+
+require 'tk'
+require 'tk/entry'
+require 'tkextlib/tcllib.rb'
+
+# TkPackage.require('getstring', '0.1')
+TkPackage.require('getstring')
+
+module Tk::Tcllib
+ class GetString_Dialog < TkWindow
+ PACKAGE_NAME = 'getstring'.freeze
+ def self.package_name
+ PACKAGE_NAME
+ end
+
+ def self.package_version
+ begin
+ TkPackage.require('getstring')
+ rescue
+ ''
+ end
+ end
+ end
+end
+
+
+class Tk::Tcllib::GetString_Dialog
+ TkCommandNames = ['::getstring::tk_getString'.freeze].freeze
+ WidgetClassName = 'TkSDialog'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def self.show(*args)
+ dialog = self.new(*args)
+ dialog.show
+ [dialog.status, dialog.value]
+ end
+ def self.display(*args)
+ self.show(*args)
+ end
+
+ def initialize(*args) # args = (parent=nil, text='', keys=nil)
+ keys = args.pop
+ if keys.kind_of?(Hash)
+ text = args.pop
+ @keys = _symbolkey2str(keys)
+ args.push(keys)
+ else
+ text = keys
+ @keys = {}
+ end
+ if text
+ @text = text.dup
+ else
+ @text = ''
+ end
+
+ @variable = TkVariable.new
+ @status = nil
+
+ super(*args)
+ end
+
+ def create_self(keys)
+ # dummy
+ end
+ private :create_self
+
+ def show
+ @variable.value = ''
+ @status = bool(tk_call(self.class::TkCommandNames[0],
+ @path, @variable, @text, *hash_kv(@keys)))
+ end
+ alias display show
+
+ def status
+ @status
+ end
+
+ def value
+ @variable.value
+ end
+
+ def cget(slot)
+ slot = slot.to_s
+ if slot == 'text'
+ @text
+ else
+ @keys[slot]
+ end
+ end
+
+ def configure(slot, value=None)
+ if slot.kind_of?(Hash)
+ slot.each{|k, v| configure(k, v)}
+ else
+ slot = slot.to_s
+ value = _symbolkey2str(value) if value.kind_of?(Hash)
+ if value && value != None
+ if slot == 'text'
+ @text = value.to_s
+ else
+ @keys[slot] = value
+ end
+ else
+ if slot == 'text'
+ @text = ''
+ else
+ @keys.delete(slot)
+ end
+ end
+ end
+ self
+ end
+
+ def configinfo(slot = nil)
+ if slot
+ slot = slot.to_s
+ [ slot, nil, nil, nil, ( (slot == 'text')? @text: @keys[slot] ) ]
+ else
+ @keys.collect{|k, v| [ k, nil, nil, nil, v ] } \
+ << [ 'text', nil, nil, nil, @text ]
+ end
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tcllib/history.rb b/ext/tk/lib/tkextlib/tcllib/history.rb
new file mode 100644
index 0000000000..a01a4ebfcc
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/history.rb
@@ -0,0 +1,73 @@
+#
+# tkextlib/tcllib/history.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# * Part of tcllib extension
+# * Provides a history for Entry widgets
+#
+
+require 'tk'
+require 'tk/entry'
+require 'tkextlib/tcllib.rb'
+
+# TkPackage.require('history', '0.1')
+TkPackage.require('history')
+
+module Tk::Tcllib
+ module History
+ PACKAGE_NAME = 'history'.freeze
+ def self.package_name
+ PACKAGE_NAME
+ end
+
+ def self.package_version
+ begin
+ TkPackage.require('history')
+ rescue
+ ''
+ end
+ end
+ end
+end
+
+module Tk::Tcllib::History
+ extend TkCore
+
+ def self.init(entry, length=None)
+ tk_call_without_enc('::history::init', entry.path, length)
+ entry.extend(self) # add methods to treat history to the entry widget
+ end
+
+ def self.remove(entry)
+ tk_call_without_enc('::history::remove', entry.path)
+ entry
+ end
+
+ def history_remove
+ tk_call_without_enc('::history::remove', @path)
+ self
+ end
+
+ def history_add(text)
+ tk_call('::history::add', @path, text)
+ self
+ end
+
+ def history_get
+ simplelist(tk_call_without_enc('::history::get', @path))
+ end
+
+ def history_clear
+ tk_call_without_enc('::history::clear', @path)
+ self
+ end
+
+ def history_configure(opt, value)
+ tk_call('::history::configure', @path, opt, value)
+ self
+ end
+
+ def history_configinfo(opt)
+ tk_call('::history::configure', @path, opt)
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tcllib/ip_entry.rb b/ext/tk/lib/tkextlib/tcllib/ip_entry.rb
index e24d1ba147..8c9e0bd683 100644
--- a/ext/tk/lib/tkextlib/tcllib/ip_entry.rb
+++ b/ext/tk/lib/tkextlib/tcllib/ip_entry.rb
@@ -51,6 +51,11 @@ class Tk::Tcllib::IP_Entry
end
private :create_self
+ def __strval_optkeys
+ super() << 'fg' << 'bg' << 'insertbackground'
+ end
+ private :__strval_optkeys
+
def complete?
bool(tk_send_without_enc('complete'))
end
diff --git a/ext/tk/lib/tkextlib/tcllib/panelframe.rb b/ext/tk/lib/tkextlib/tcllib/panelframe.rb
new file mode 100644
index 0000000000..2a4562e779
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/panelframe.rb
@@ -0,0 +1,72 @@
+#
+# tkextlib/tcllib/panelframe.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# * Part of tcllib extension
+# * Create PanelFrame widgets.
+#
+
+require 'tk'
+require 'tkextlib/tcllib.rb'
+
+# TkPackage.require('widget::panelframe', '1.0')
+TkPackage.require('widget::panelframe')
+
+module Tk::Tcllib
+ module Widget
+ class PanelFrame < TkWindow
+ PACKAGE_NAME = 'widget::panelframe'.freeze
+ def self.package_name
+ PACKAGE_NAME
+ end
+
+ def self.package_version
+ begin
+ TkPackage.require('widget::panelframe')
+ rescue
+ ''
+ end
+ end
+ end
+ Panelframe = PanelFrame
+ end
+end
+
+class Tk::Tcllib::Widget::PanelFrame
+ TkCommandNames = ['::widget::panelframe'.freeze].freeze
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
+ else
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
+ end
+ end
+ private :create_self
+
+ def add(what, *args)
+ window(tk_send('add', *args))
+ end
+
+ #def get_frame
+ # window(tk_send('getframe'))
+ #end
+
+ def set_widget(widget)
+ tk_send('setwidget', widget)
+ self
+ end
+
+ def remove(*wins)
+ tk_send('remove', *wins)
+ end
+ def remove_destroy(*wins)
+ tk_send('remove', '-destroy', *wins)
+ end
+ alias delete remove_destroy
+
+ def items
+ simplelist(tk_send('items')).collect!{|w| window(w)}
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tcllib/plotchart.rb b/ext/tk/lib/tkextlib/tcllib/plotchart.rb
index a8d2be00a8..f5f344ceb3 100644
--- a/ext/tk/lib/tkextlib/tcllib/plotchart.rb
+++ b/ext/tk/lib/tkextlib/tcllib/plotchart.rb
@@ -61,6 +61,7 @@ require 'tk'
require 'tkextlib/tcllib.rb'
# TkPackage.require('Plotchart', '0.9')
+# TkPackage.require('Plotchart', '1.1')
TkPackage.require('Plotchart')
module Tk
@@ -272,6 +273,51 @@ module Tk::Tcllib::Plotchart
self
end
+ def contourlines(xcrd, ycrd, vals, clss=None)
+ xcrd = array2tk_list(xcrd) if xcrd.kind_of?(Array)
+ ycrd = array2tk_list(ycrd) if ycrd.kind_of?(Array)
+ vals = array2tk_list(vals) if vals.kind_of?(Array)
+ clss = array2tk_list(clss) if clss.kind_of?(Array)
+
+ tk_call_without_enc(@chart, 'contourlines', xcrd, ycrd, vals, clss)
+ self
+ end
+
+ def contourfill(xcrd, ycrd, vals, klasses=None)
+ xcrd = array2tk_list(xcrd) if xcrd.kind_of?(Array)
+ ycrd = array2tk_list(ycrd) if ycrd.kind_of?(Array)
+ vals = array2tk_list(vals) if vals.kind_of?(Array)
+ clss = array2tk_list(clss) if clss.kind_of?(Array)
+
+ tk_call_without_enc(@chart, 'contourfill', xcrd, ycrd, vals, clss)
+ self
+ end
+
+ def contourbox(xcrd, ycrd, vals, klasses=None)
+ xcrd = array2tk_list(xcrd) if xcrd.kind_of?(Array)
+ ycrd = array2tk_list(ycrd) if ycrd.kind_of?(Array)
+ vals = array2tk_list(vals) if vals.kind_of?(Array)
+ clss = array2tk_list(clss) if clss.kind_of?(Array)
+
+ tk_call_without_enc(@chart, 'contourbox', xcrd, ycrd, vals, clss)
+ self
+ end
+
+ def color_map(colors)
+ colors = array2tk_list(colors) if colors.kind_of?(Array)
+
+ tk_call_without_enc(@chart, 'colorMap', colors)
+ self
+ end
+
+ def grid_cells(xcrd, ycrd)
+ xcrd = array2tk_list(xcrd) if xcrd.kind_of?(Array)
+ ycrd = array2tk_list(ycrd) if ycrd.kind_of?(Array)
+
+ tk_call_without_enc(@chart, 'grid', xcrd, ycrd)
+ self
+ end
+
def dataconfig(series, key, value=None)
if key.kind_of?(Hash)
tk_call_without_enc(@chart, 'dataconfig', series, *hash_kv(key, true))
@@ -479,6 +525,13 @@ module Tk::Tcllib::Plotchart
self
end
+ def plot_funcont(conts, cmd=Proc.new)
+ conts = array2tk_list(conts) if conts.kind_of?(Array)
+ Tk.ip_eval("proc #{@path}_#{@chart} {x y} {#{install_cmd(cmd)} $x $y}")
+ tk_call_without_enc(@chart, 'plotfuncont', "#{@path}_#{@chart}", conts)
+ self
+ end
+
def grid_size(nxcells, nycells)
tk_call_without_enc(@chart, 'gridsize', nxcells, nycells)
self
@@ -633,7 +686,7 @@ module Tk::Tcllib::Plotchart
# time_end := String of time format (e.g. "1 january 2004")
# items := Expected/maximum number of items
# ( This determines the vertical spacing. )
- if args[0].kind_of?(Array)
+ if args[0].kind_of?(String)
@time_begin = args.shift
@time_end = args.shift
@items = args.shift
@@ -680,6 +733,105 @@ module Tk::Tcllib::Plotchart
end
############################
+ class Gnattchart < TkCanvas
+ include ChartMethod
+
+ TkCommandNames = [
+ 'canvas'.freeze,
+ '::Plotchart::createGnattchart'.freeze
+ ].freeze
+
+ def initialize(*args)
+ # args := ([parent,] time_begin, time_end, items [, text_width] [, keys])
+ # time_begin := String of time format (e.g. "1 january 2004")
+ # time_end := String of time format (e.g. "1 january 2004")
+ # items := Expected/maximum number of items
+ # ( This determines the vertical spacing. )
+ if args[0].kind_of?(String)
+ @time_begin = args.shift
+ @time_end = args.shift
+ @items = args.shift
+
+ if args[0].kind_of?(Fixnum)
+ @text_width = args.shift
+ else
+ @text_width = None
+ end
+
+ super(*args) # create canvas widget
+ else
+ parent = args.shift
+
+ @time_begin = args.shift
+ @time_end = args.shift
+ @items = args.shift
+
+ if args[0].kind_of?(Fixnum)
+ @text_width = args.shift
+ else
+ @text_width = None
+ end
+
+ if parent.kind_of?(TkCanvas)
+ @path = parent.path
+ else
+ super(parent, *args) # create canvas widget
+ end
+ end
+
+ @chart = _create_chart
+ end
+
+ def _create_chart
+ p self.class::TkCommandNames[1] if $DEBUG
+ tk_call_without_enc(self.class::TkCommandNames[1], @path,
+ @time_begin, @time_end, @items, @text_width)
+ end
+ private :_create_chart
+
+ def task(txt, time_begin, time_end, completed=0.0)
+ list(tk_call_without_enc(@chart, 'task', txt, time_begin, time_end,
+ completed)).collect!{|id|
+ TkcItem.id2obj(self, id)
+ }
+ end
+
+ def milestone(txt, time, col=None)
+ tk_call_without_enc(@chart, 'milestone', txt, time, col)
+ self
+ end
+
+ def vertline(txt, time)
+ tk_call_without_enc(@chart, 'vertline', txt, time)
+ self
+ end
+
+ def connect(from_task, to_task)
+ from_task = array2tk_list(from_task) if from_task.kind_of?(Array)
+ to_task = array2tk_list(to_task) if to_task.kind_of?(Array)
+
+ tk_call_without_enc(@chart, 'connect', from_task, to_task)
+ self
+ end
+
+ def summary(txt, tasks)
+ tasks = array2tk_list(tasks) if tasks.kind_of?(Array)
+ tk_call_without_enc(@chart, 'summary', tasks)
+ self
+ end
+
+ def color_of_part(keyword, newcolor)
+ tk_call_without_enc(@chart, 'color', keyword, newcolor)
+ self
+ end
+
+ def font_of_part(keyword, newfont)
+ tk_call_without_enc(@chart, 'font', keyword, newfont)
+ self
+ end
+ end
+
+ ############################
class PlotSeries < TkObject
SeriesID_TBL = TkCore::INTERP.create_table
Series_ID = ['series'.freeze, '00000'.taint].freeze
diff --git a/ext/tk/lib/tkextlib/tcllib/ruler.rb b/ext/tk/lib/tkextlib/tcllib/ruler.rb
new file mode 100644
index 0000000000..88ffb2c912
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/ruler.rb
@@ -0,0 +1,65 @@
+#
+# tkextlib/tcllib/ruler.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# * Part of tcllib extension
+# * ruler widget
+#
+
+require 'tk'
+require 'tkextlib/tcllib.rb'
+
+# TkPackage.require('widget::ruler', '1.0')
+TkPackage.require('widget::ruler')
+
+module Tk::Tcllib
+ module Widget
+ class Ruler < TkWindow
+ PACKAGE_NAME = 'widget::ruler'.freeze
+ def self.package_name
+ PACKAGE_NAME
+ end
+
+ def self.package_version
+ begin
+ TkPackage.require('widget::ruler')
+ rescue
+ ''
+ end
+ end
+ end
+ end
+end
+
+class Tk::Tcllib::Widget::Ruler
+ TkCommandNames = ['::widget::ruler'.freeze].freeze
+
+ def __boolval_optkeys
+ ['showvalues', 'outline', 'grid']
+ end
+ private :__boolval_optkeys
+
+ def __numlistval_optkeys
+ ['interval', 'sizes']
+ end
+ private :__numlistval_optkeys
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
+ else
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
+ end
+ end
+ private :create_self
+
+ def redraw
+ tk_send('redraw')
+ self
+ end
+
+ def shade(org, dest, frac)
+ tk_send('shade', org, dest, frac)
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tcllib/screenruler.rb b/ext/tk/lib/tkextlib/tcllib/screenruler.rb
new file mode 100644
index 0000000000..1b4067e2f0
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/screenruler.rb
@@ -0,0 +1,68 @@
+#
+# tkextlib/tcllib/screenruler.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# * Part of tcllib extension
+# * screenruler dialog
+#
+
+require 'tk'
+require 'tkextlib/tcllib.rb'
+
+# TkPackage.require('widget::screenruler', '1.1')
+TkPackage.require('widget::screenruler')
+
+module Tk::Tcllib
+ module Widget
+ class ScreenRuler < TkWindow
+ PACKAGE_NAME = 'widget::ruler'.freeze
+ def self.package_name
+ PACKAGE_NAME
+ end
+
+ def self.package_version
+ begin
+ TkPackage.require('widget::screenruler')
+ rescue
+ ''
+ end
+ end
+ end
+ Screenruler = ScreenRuler
+ end
+end
+
+class Tk::Tcllib::Widget::ScreenRuler
+ TkCommandNames = ['::widget::screenruler'.freeze].freeze
+
+ def __boolval_optkeys
+ ['topmost', 'reflect']
+ end
+ private :__boolval_optkeys
+
+ def __numlistval_optkeys
+ ['alpha']
+ end
+ private :__numlistval_optkeys
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
+ else
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
+ end
+ end
+ private :create_self
+
+ def display
+ tk_send('display')
+ self
+ end
+ alias show display
+
+ def hide
+ tk_send('hide')
+ self
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tcllib/scrollwin.rb b/ext/tk/lib/tkextlib/tcllib/scrollwin.rb
new file mode 100644
index 0000000000..717728e34a
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/scrollwin.rb
@@ -0,0 +1,61 @@
+#
+# tkextlib/tcllib/scrollwin.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# * Part of tcllib extension
+# * Scrolled widget
+#
+
+require 'tk'
+require 'tkextlib/tcllib.rb'
+
+# TkPackage.require('widget::scrolledwindow', '1.0')
+TkPackage.require('widget::scrolledwindow')
+
+module Tk::Tcllib
+ module Widget
+ class ScrolledWindow < TkWindow
+ PACKAGE_NAME = 'widget::scrolledwindow'.freeze
+ def self.package_name
+ PACKAGE_NAME
+ end
+
+ def self.package_version
+ begin
+ TkPackage.require('widget::scrolledwindow')
+ rescue
+ ''
+ end
+ end
+ end
+ Scrolledwindow = ScrolledWindow
+ end
+end
+
+class Tk::Tcllib::Widget::ScrolledWindow
+ TkCommandNames = ['::widget::scrolledwindow'.freeze].freeze
+
+ def __numlistval_optkeys
+ ['ipad']
+ end
+ private :__numlistval_optkeys
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
+ else
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
+ end
+ end
+ private :create_self
+
+ def get_frame
+ window(tk_send('getframe'))
+ end
+
+ def set_widget(widget)
+ tk_send('setwidget', widget)
+ self
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tcllib/style.rb b/ext/tk/lib/tkextlib/tcllib/style.rb
index 33d103a452..dac6916e46 100644
--- a/ext/tk/lib/tkextlib/tcllib/style.rb
+++ b/ext/tk/lib/tkextlib/tcllib/style.rb
@@ -39,6 +39,7 @@ module Tk::Tcllib
end
# TkPackage.require('style', '0.1')
+# TkPackage.require('style', '0.3')
TkPackage.require('style')
module Tk::Tcllib
diff --git a/ext/tk/lib/tkextlib/tcllib/superframe.rb b/ext/tk/lib/tkextlib/tcllib/superframe.rb
new file mode 100644
index 0000000000..35da37efbf
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/superframe.rb
@@ -0,0 +1,51 @@
+#
+# tkextlib/tcllib/superframe.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# * Part of tcllib extension
+# * Superframe widget - enhanced labelframe widget
+#
+
+require 'tk'
+require 'tkextlib/tcllib.rb'
+
+# TkPackage.require('widget::superframe', '1.0')
+TkPackage.require('widget::superframe')
+
+module Tk::Tcllib
+ module Widget
+ class SuperFrame < TkWindow
+ PACKAGE_NAME = 'widget::superframe'.freeze
+ def self.package_name
+ PACKAGE_NAME
+ end
+
+ def self.package_version
+ begin
+ TkPackage.require('widget::superframe')
+ rescue
+ ''
+ end
+ end
+ end
+ Superframe = SuperlFrame
+ end
+end
+
+class Tk::Tcllib::Widget::SuperFrame
+ TkCommandNames = ['::widget::superframe'.freeze].freeze
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
+ else
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
+ end
+ end
+ private :create_self
+
+ def labelwidget
+ window(tk_send('labelwidget'))
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tcllib/swaplist.rb b/ext/tk/lib/tkextlib/tcllib/swaplist.rb
new file mode 100644
index 0000000000..97de0a27c1
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/swaplist.rb
@@ -0,0 +1,147 @@
+#
+# tkextlib/tcllib/swaplist.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# * Part of tcllib extension
+# * A dialog which allows a user to move options between two lists
+#
+
+require 'tk'
+require 'tkextlib/tcllib.rb'
+
+# TkPackage.require('swaplist', '0.1')
+TkPackage.require('swaplist')
+
+module Tk::Tcllib
+ class Swaplist_Dialog < TkWindow
+ PACKAGE_NAME = 'swaplist'.freeze
+ def self.package_name
+ PACKAGE_NAME
+ end
+
+ def self.package_version
+ begin
+ TkPackage.require('swaplist')
+ rescue
+ ''
+ end
+ end
+ end
+end
+
+
+class Tk::Tcllib::Swaplist_Dialog
+ TkCommandNames = ['::swaplist::swaplist'.freeze].freeze
+ WidgetClassName = 'Swaplist'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def self.show(*args)
+ dialog = self.new(*args)
+ dialog.show
+ [dialog.status, dialog.value]
+ end
+ def self.display(*args)
+ self.show(*args)
+ end
+
+ def initialize(*args)
+ # args = (parent=nil, complete_list=[], selected_list=[], keys=nil)
+ keys = args.pop
+ if keys.kind_of?(Hash)
+ @selected_list = args.pop
+ @complete_list = args.pop
+ @keys = _symbolkey2str(keys)
+ args.push(keys)
+ else
+ @selected_list = keys
+ @complete_list = args.pop
+ @keys = {}
+ end
+
+ @selected_list = [] unless @selected_list
+ @complete_list = [] unless @complete_list
+
+ @variable = TkVariable.new
+ @status = nil
+
+ super(*args)
+ end
+
+ def create_self(keys)
+ # dummy
+ end
+ private :create_self
+
+ def show
+ @variable.value = ''
+ @status = bool(tk_call(self.class::TkCommandNames[0],
+ @path, @variable,
+ @complete_list, @selected_list,
+ *hash_kv(@keys)))
+ end
+ alias display show
+
+ def status
+ @status
+ end
+
+ def value
+ @variable.list
+ end
+ alias selected value
+
+ def cget(slot)
+ slot = slot.to_s
+ if slot == 'complete_list'
+ @complete_list
+ elsif slot == 'selected_list'
+ @selected_list
+ else
+ @keys[slot]
+ end
+ end
+
+ def configure(slot, value=None)
+ if slot.kind_of?(Hash)
+ slot.each{|k, v| configure(k, v)}
+ else
+ slot = slot.to_s
+ value = _symbolkey2str(value) if value.kind_of?(Hash)
+ if value && value != None
+ if slot == 'complete_list'
+ @complete_list = value
+ elsif slot == 'selected_list'
+ @selected_list = value
+ else
+ @keys[slot] = value
+ end
+ else
+ if slot == 'complete_list'
+ @complete_list = []
+ elsif slot == 'selected_list'
+ @selected_list = []
+ else
+ @keys.delete(slot)
+ end
+ end
+ end
+ self
+ end
+
+ def configinfo(slot = nil)
+ if slot
+ slot = slot.to_s
+ if slot == 'complete_list'
+ [ slot, nil, nil, nil, @complete_list ]
+ elsif slot == 'selected_list'
+ [ slot, nil, nil, nil, @selected_list ]
+ else
+ [ slot, nil, nil, nil, @keys[slot] ]
+ end
+ else
+ @keys.collect{|k, v| [ k, nil, nil, nil, v ] } \
+ << [ 'complete_list', nil, nil, nil, @complete_list ] \
+ << [ 'selected_list', nil, nil, nil, @selected_list ]
+ end
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tcllib/tablelist.rb b/ext/tk/lib/tkextlib/tcllib/tablelist.rb
new file mode 100644
index 0000000000..42435a1971
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/tablelist.rb
@@ -0,0 +1,27 @@
+#
+# tkextlib/tcllib/tablelist.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# * Part of tcllib extension
+# * A multi-column listbox
+
+require 'tk'
+require 'tkextlib/tcllib.rb'
+
+# check Tile extension :: If already loaded, use tablelist_tile.
+unless defined? Tk::Tcllib::Tablelist_usingTile
+ Tk::Tcllib::Tablelist_usingTile = TkPackage.provide('tile')
+end
+
+if Tk::Tcllib::Tablelist_usingTile
+ # with Tile
+ require 'tkextlib/tcllib/tablelist_tile'
+
+else
+ # without Tile
+
+ # TkPackage.require('Tablelist', '4.2')
+ TkPackage.require('Tablelist')
+
+ requrie 'tkextlib/tcllib/tablelist_core'
+end
diff --git a/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb b/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb
new file mode 100644
index 0000000000..a939a58331
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb
@@ -0,0 +1,770 @@
+#
+# tkextlib/tcllib/tablelist_core.rb
+#
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# * Part of tcllib extension
+# * This file is required by 'tkextlib/tcllib/tablelist.rb' or
+# 'tkextlib/tcllib/tablelist_tile.rb'.
+#
+
+module Tk
+ module Tcllib
+ class Tablelist < TkWindow
+ if Tk::Tcllib::Tablelist_usingTile
+ PACKAGE_NAME = 'Tablelist_tile'.freeze
+ else
+ PACKAGE_NAME = 'Tablelist'.freeze
+ end
+ def self.package_name
+ PACKAGE_NAME
+ end
+
+ def self.package_version
+ begin
+ TkPackage.require(self.package_name)
+ rescue
+ ''
+ end
+ end
+
+ def self.use_Tile?
+ (Tk::Tcllib::Tablelist_usingTile)? true: false
+ end
+ end
+ TableList = Tablelist
+ end
+end
+
+module Tk::Tcllib::TablelistItemConfig
+ include TkItemConfigMethod
+
+ def _to_idx(idx)
+ if idx.kind_of?(Array)
+ idx.collect{|elem| _get_eval_string(elem)}.join(',')
+ else
+ idx
+ end
+ end
+ def _from_idx(idx)
+ return idx unless idx.kind_of?(String)
+
+ if idx[0] == ?@ # '@x,y'
+ idx
+ elsif idx =~ /([^,]+),([^,]+)/
+ row = $1, column = $2
+ [num_or_str(row), num_or_str(column)]
+ else
+ num_or_str(idx)
+ end
+ end
+ private :_to_idx, :_from_idx
+
+ def __item_cget_cmd(mixed_id)
+ [self.path, mixed_id[0] + 'cget', _to_idx(mixed_id[1])]
+ end
+ def __item_config_cmd(mixed_id)
+ [self.path, mixed_id[0] + 'configure', _to_idx(mixed_id[1])]
+ end
+
+ def cell_cget(tagOrId, option)
+ itemcget(['cell', tagOrId], option)
+ end
+ def cell_configure(tagOrId, slot, value=None)
+ itemconfigure(['cell', tagOrId], slot, value)
+ end
+ def cell_configinfo(tagOrId, slot=nil)
+ itemconfiginfo(['cell', tagOrId], slot)
+ end
+ def current_cell_configinfo(tagOrId, slot=nil)
+ current_itemconfiginfo(['cell', tagOrId], slot)
+ end
+ alias cellcget cell_cget
+ alias cellconfigure cell_configure
+ alias cellconfiginfo cell_configinfo
+ alias current_cellconfiginfo current_cell_configinfo
+
+ def column_cget(tagOrId, option)
+ itemcget(['column', tagOrId], option)
+ end
+ def column_configure(tagOrId, slot, value=None)
+ itemconfigure(['column', tagOrId], slot, value)
+ end
+ def column_configinfo(tagOrId, slot=nil)
+ itemconfiginfo(['column', tagOrId], slot)
+ end
+ def current_column_configinfo(tagOrId, slot=nil)
+ current_itemconfiginfo(['column', tagOrId], slot)
+ end
+ alias columncget column_cget
+ alias columnconfigure column_configure
+ alias columnconfiginfo column_configinfo
+ alias current_columnconfiginfo current_column_configinfo
+
+ def row_cget(tagOrId, option)
+ itemcget(['row', tagOrId], option)
+ end
+ def row_configure(tagOrId, slot, value=None)
+ itemconfigure(['row', tagOrId], slot, value)
+ end
+ def row_configinfo(tagOrId, slot=nil)
+ itemconfiginfo(['row', tagOrId], slot)
+ end
+ def current_row_configinfo(tagOrId, slot=nil)
+ current_itemconfiginfo(['row', tagOrId], slot)
+ end
+ alias rowcget row_cget
+ alias rowconfigure row_configure
+ alias rowconfiginfo row_configinfo
+ alias current_rowconfiginfo current_row_configinfo
+
+ private :itemcget, :itemconfigure
+ private :itemconfiginfo, :current_itemconfiginfo
+end
+
+class Tk::Tcllib::Tablelist
+ include Tk::Tcllib::TablelistItemConfig
+ include Scrollable
+
+ TkCommandNames = ['::tablelist::tablelist'.freeze].freeze
+ WidgetClassName = 'Tablelist'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
+ else
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
+ end
+ end
+ private :create_self
+
+ ##########################
+
+ def __numval_optkeys
+ super() + ['titlecolumns']
+ end
+ private :__numval_optkeys
+
+ def __strval_optkeys
+ super() + ['snipstring']
+ end
+ private :__strval_optkeys
+
+ def __boolval_optkeys
+ super() + [
+ 'forceeditendcommand', 'movablecolumns', 'movablerows',
+ 'protecttitlecolumns', 'resizablecolumns',
+ 'showarrow', 'showlabels', 'showseparators'
+ ]
+ end
+ private :__boolval_optkeys
+
+ def __listval_optkeys
+ super() + ['columns']
+ end
+ private :__listval_optkeys
+
+ def __tkvariable_optkeys
+ super() + ['listvariable']
+ 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.
+ super().update('stretch'=>proc{|v| (v == 'all')? v: simplelist(v)})
+ end
+ private :__val2ruby_optkeys
+
+ def __ruby2val_optkeys # { key=>proc, ... }
+ # The method is used to convert a ruby's object to a opt-value.
+ # When set the value of the option "key", "proc.call(value)" is called.
+ # That is, "-#{key} #{proc.call(value)}".
+ super().update('stretch'=>proc{|v|
+ (v.kind_of?(Array))? v.collect{|e| _to_idx(e)}: v
+ })
+ end
+ private :__ruby2val_optkeys
+
+ def __font_optkeys
+ super() + ['labelfont']
+ end
+ private :__font_optkeys
+
+ ##########################
+
+ def __item_strval_optkeys(id)
+ if id[0] == 'cell'
+ super(id) + ['title']
+ else
+ super(id) - ['text'] + ['title']
+ end
+ end
+ private :__item_strval_optkeys
+
+ def __item_boolval_optkeys(id)
+ super(id) + [
+ 'editable', 'hide', 'resizable', 'showarrow', 'stretchable',
+ ]
+ end
+ private :__item_boolval_optkeys
+
+ def __item_listval_optkeys(id)
+ if id[0] == 'cell'
+ super(id)
+ else
+ super(id) + ['text']
+ end
+ end
+ private :__item_listval_optkeys
+
+ def __item_font_optkeys(id)
+ # maybe need to override
+ super(id) + ['labelfont']
+ end
+ private :__item_font_optkeys
+
+ ##########################
+
+ def activate(index)
+ tk_send('activate', _to_idx(index))
+ self
+ end
+
+ def activate_cell(index)
+ tk_send('activatecell', _to_idx(index))
+ self
+ end
+ alias activatecell activate_cell
+
+ def get_attrib(name=nil)
+ if name && name != None
+ tk_send('attrib', name)
+ else
+ ret = []
+ lst = simplelist(tk_send('attrib'))
+ until lst.empty?
+ ret << ( [lst.shift] << lst.shift )
+ end
+ ret
+ end
+ end
+ def set_attrib(*args)
+ tk_send('attrib', *(args.flatten))
+ self
+ end
+
+ def bbox(index)
+ list(tk_send('bbox', _to_idx(index)))
+ end
+
+ def bodypath
+ window(tk_send('bodypath'))
+ end
+
+ def bodytag
+ TkBindTag.new_by_name(tk_send('bodytag'))
+ end
+
+ def cancel_editing
+ tk_send('cancelediting')
+ self
+ end
+ alias cancelediting cancel_editing
+
+ def cellindex(idx)
+ _from_idx(tk_send('cellindex', _to_idx(idx)))
+ end
+
+ def cellselection_anchor(idx)
+ tk_send('cellselection', 'anchor', _to_idx(idx))
+ self
+ end
+
+ def cellselection_clear(first, last=nil)
+ if first.kind_of?(Array)
+ tk_send('cellselection', 'clear', first.collect{|idx| _to_idx(idx)})
+ else
+ first = _to_idx(first)
+ last = (last)? _to_idx(last): first
+ tk_send('cellselection', 'clear', first, last)
+ end
+ self
+ end
+
+ def cellselection_includes(idx)
+ bool(tk_send('cellselection', 'includes', _to_idx(idx)))
+ end
+
+ def cellselection_set(first, last=nil)
+ if first.kind_of?(Array)
+ tk_send('cellselection', 'set', first.collect{|idx| _to_idx(idx)})
+ else
+ first = _to_idx(first)
+ last = (last)? _to_idx(last): first
+ tk_send('cellselection', 'set', first, last)
+ end
+ self
+ end
+
+ def columncount
+ number(tk_send('columncount'))
+ end
+
+ def columnindex(idx)
+ number(tk_send('columnindex', _to_idx(idx)))
+ end
+
+ def containing(y)
+ idx = num_or_str(tk_send('containing', y))
+ (idx.kind_of?(Fixnum) && idx < 0)? nil: idx
+ end
+
+ def containing_cell(x, y)
+ idx = _from_idx(tk_send('containingcell', x, y))
+ if idx.kind_of?(Array)
+ [
+ ((idx[0].kind_of?(Fixnum) && idx[0] < 0)? nil: idx[0]),
+ ((idx[1].kind_of?(Fixnum) && idx[1] < 0)? nil: idx[1])
+ ]
+ else
+ idx
+ end
+ end
+ alias containingcell containing_cell
+
+ def containing_column(x)
+ idx = num_or_str(tk_send('containingcolumn', x))
+ (idx.kind_of?(Fixnum) && idx < 0)? nil: idx
+ end
+ alias containingcolumn containing_column
+
+ def curcellselection
+ simplelist(tk_send('curcellselection')).collect!{|idx| _from_idx(idx)}
+ end
+
+ def curselection
+ list(tk_send('curselection'))
+ end
+
+ def delete_items(first, last=nil)
+ if first.kind_of?(Array)
+ tk_send('delete', first.collect{|idx| _to_idx(idx)})
+ else
+ first = _to_idx(first)
+ last = (last)? _to_idx(last): first
+ tk_send('delete', first, last)
+ end
+ self
+ end
+ alias delete delete_items
+ alias deleteitems delete_items
+
+ def delete_columns(first, last=nil)
+ if first.kind_of?(Array)
+ tk_send('deletecolumns', first.collect{|idx| _to_idx(idx)})
+ else
+ first = _to_idx(first)
+ last = (last)? _to_idx(last): first
+ tk_send('deletecolumns', first, last)
+ end
+ self
+ end
+ alias deletecolumns delete_columns
+
+ def edit_cell(idx)
+ tk_send('editcell', _to_idx(idx))
+ self
+ end
+ alias editcell edit_cell
+
+ def editwinpath
+ window(tk_send('editwinpath'))
+ end
+
+ def entrypath
+ window(tk_send('entrypath'))
+ end
+
+ def fill_column(idx, txt)
+ tk_send('fillcolumn', _to_idx(idx), txt)
+ self
+ end
+ alias fillcolumn fill_column
+
+ def finish_editing
+ tk_send('finishediting')
+ self
+ end
+ alias finishediting finish_editing
+
+ def get(first, last=nil)
+ if first.kind_of?(Array)
+ simplelist(tk_send('get', first.collect{|idx| _to_idx(idx)})).collect!{|elem| simplelist(elem) }
+ else
+ first = _to_idx(first)
+ last = (last)? _to_idx(last): first
+ simplelist(tk_send('get', first, last))
+ end
+ end
+
+ def get_cells(first, last=nil)
+ if first.kind_of?(Array)
+ simplelist(tk_send('getcells', first.collect{|idx| _to_idx(idx)})).collect!{|elem| simplelist(elem) }
+ else
+ first = _to_idx(first)
+ last = (last)? _to_idx(last): first
+ simplelist(tk_send('getcells', first, last))
+ end
+ end
+ alias getcells get_cells
+
+ def get_columns(first, last=nil)
+ if first.kind_of?(Array)
+ simplelist(tk_send('getcolumns', first.collect{|idx| _to_idx(idx)})).collect!{|elem| simplelist(elem) }
+ else
+ first = _to_idx(first)
+ last = (last)? _to_idx(last): first
+ simplelist(tk_send('getcolumns', first, last))
+ end
+ end
+ alias getcolumns get_columns
+
+ def get_keys(first, last=nil)
+ if first.kind_of?(Array)
+ simplelist(tk_send('getkeys', first.collect{|idx| _to_idx(idx)})).collect!{|elem| simplelist(elem) }
+ else
+ first = _to_idx(first)
+ last = (last)? _to_idx(last): first
+ simplelist(tk_send('getkeys', first, last))
+ end
+ end
+ alias getkeys get_keys
+
+ def imagelabelpath(idx)
+ window(tk_send('imagelabelpath', _to_idx(idx)))
+ end
+
+ def index(idx)
+ number(tk_send('index', _to_idx(idx)))
+ end
+
+ def insert(idx, *items)
+ tk_send('insert', _to_idx(idx), *items)
+ self
+ end
+
+ def insert_columnlist(idx, columnlist)
+ tk_send('insertcolumnlist', _to_idx(idx), columnlist)
+ self
+ end
+ alias insertcolumnlist insert_columnlist
+
+ def insert_columns(idx, *args)
+ tk_send('insertcolums', _to_idx(idx), *args)
+ self
+ end
+ alias insertcolumns insert_columns
+
+ def insert_list(idx, list)
+ tk_send('insertlist', _to_idx(idx), list)
+ self
+ end
+ alias insertlist insert_list
+
+ def itemlistvar
+ TkVarAccess.new(tk_send('itemlistvar'))
+ end
+
+ def labelpath(idx)
+ window(tk_send('labelpath', _to_idx(idx)))
+ end
+
+ def labels
+ simplelist(tk_send('labels'))
+ end
+
+ def move(src, target)
+ tk_send('move', _to_idx(src), _to_idx(target))
+ self
+ end
+
+ def move_column(src, target)
+ tk_send('movecolumn', _to_idx(src), _to_idx(target))
+ self
+ end
+ alias movecolumn move_column
+
+ def nearest(y)
+ _from_idx(tk_send('nearest', y))
+ end
+
+ def nearest_cell(x, y)
+ _from_idx(tk_send('nearestcell', x, y))
+ end
+ alias nearestcell nearest_cell
+
+ def nearest_column(x)
+ _from_idx(tk_send('nearestcolumn', x))
+ end
+ alias nearestcolumn nearest_column
+
+ def reject_input
+ tk_send('rejectinput')
+ self
+ end
+ alias rejectinput reject_input
+
+ def reset_sortinfo
+ tk_send('resetsortinfo')
+ self
+ end
+ alias resetsortinfo reset_sortinfo
+
+ def scan_mark(x, y)
+ tk_send('scan', 'mark', x, y)
+ self
+ end
+
+ def scan_dragto(x, y)
+ tk_send('scan', 'dragto', x, y)
+ self
+ end
+
+ def see(idx)
+ tk_send('see', _to_idx(idx))
+ self
+ end
+
+ def see_cell(idx)
+ tk_send('seecell', _to_idx(idx))
+ self
+ end
+ alias seecell see_cell
+
+ def see_column(idx)
+ tk_send('seecolumn', _to_idx(idx))
+ self
+ end
+ alias seecolumn see_column
+
+ def selection_anchor(idx)
+ tk_send('selection', 'anchor', _to_idx(idx))
+ self
+ end
+
+ def selection_clear(first, last=nil)
+ if first.kind_of?(Array)
+ tk_send('selection', 'clear', first.collect{|idx| _to_idx(idx)})
+ else
+ first = _to_idx(first)
+ last = (last)? _to_idx(last): first
+ tk_send('selection', 'clear', first, last)
+ end
+ self
+ end
+
+ def selection_includes(idx)
+ bool(tk_send('selection', 'includes', _to_idx(idx)))
+ end
+
+ def selection_set(first, last=nil)
+ if first.kind_of?(Array)
+ tk_send('selection', 'set', first.collect{|idx| _to_idx(idx)})
+ else
+ first = _to_idx(first)
+ last = (last)? _to_idx(last): first
+ tk_send('selection', 'set', first, last)
+ end
+ self
+ end
+
+ def separatorpath(idx=nil)
+ if idx
+ window(tk_send('separatorpath', _to_idx(idx)))
+ else
+ window(tk_send('separatorpath'))
+ end
+ end
+
+ def separators
+ simplelist(tk_send('separators')).collect!{|w| window(w)}
+ end
+
+ def size
+ number(tk_send('size'))
+ end
+
+ def sort(order=nil)
+ if order
+ order = order.to_s
+ order = '-' << order if order[0] != ?-
+ if order.length < 2
+ order = nil
+ end
+ end
+ if order
+ tk_send('sort', order)
+ else
+ tk_send('sort')
+ end
+ self
+ end
+ def sort_increasing
+ tk_send('sort', '-increasing')
+ self
+ end
+ def sort_decreasing
+ tk_send('sort', '-decreasing')
+ self
+ end
+
+ DEFAULT_sortByColumn_cmd = '::tablelist::sortByColumn'
+
+ def sort_by_column(idx, order=nil)
+ if order
+ order = order.to_s
+ order = '-' << order if order[0] != ?-
+ if order.length < 2
+ order = nil
+ end
+ end
+ if order
+ tk_send('sortbycolumn', _to_idx(idx), order)
+ else
+ tk_send('sortbycolumn', _to_idx(idx))
+ end
+ self
+ end
+ def sort_by_column_increasing(idx)
+ tk_send('sortbycolumn', _to_idx(idx), '-increasing')
+ self
+ end
+ def sort_by_column_decreasing(idx)
+ tk_send('sortbycolumn', _to_idx(idx), '-decreasing')
+ self
+ end
+
+ def sortcolumn
+ idx = num_or_str(tk_send('sortcolum'))
+ (idx.kind_of?(Fixnum) && idx < 0)? nil: idx
+ end
+
+ def sortorder
+ tk_send('sortorder')
+ end
+
+ def toggle_visibility(first, last=nil)
+ if first.kind_of?(Array)
+ tk_send('togglevisibility', first.collect{|idx| _to_idx(idx)})
+ else
+ first = _to_idx(first)
+ last = (last)? _to_idx(last): first
+ tk_send('togglevisibility', first, last)
+ end
+ self
+ end
+ alias togglevisibility toggle_visibility
+
+ def windowpath(idx)
+ window(tk_send('windowpath', _to_idx(idx)))
+ end
+end
+
+class << Tk::Tcllib::Tablelist
+ ############################################################
+ # helper commands
+ def getTablelistPath(descendant)
+ window(Tk.tk_call('::tablelist::getTablelistPath', descendant))
+ end
+
+ def convEventFields(descendant, x, y)
+ window(Tk.tk_call('::tablelist::convEventFields', descendant, x, y))
+ end
+
+
+ ############################################################
+ # with the BWidget package
+ def addBWidgetEntry(name=None)
+ Tk.tk_call('::tablelist::addBWidgetEntry', name)
+ end
+
+ def addBWidgetSpinBox(name=None)
+ Tk.tk_call('::tablelist::addBWidgetSpinBox', name)
+ end
+
+ def addBWidgetComboBox(name=None)
+ Tk.tk_call('::tablelist::addBWidgetComboBox', name)
+ end
+
+
+ ############################################################
+ # with the Iwidgets ([incr Widgets]) package
+ def addIncrEntryfield(name=None)
+ Tk.tk_call('::tablelist::addIncrEntry', name)
+ end
+
+ def addIncrDateTimeWidget(type, seconds=false, name=None)
+ # type := 'datefield'|'dateentry'|timefield'|'timeentry'
+ if seconds && seconds != None
+ seconds = '-seconds'
+ else
+ seconds = None
+ end
+ Tk.tk_call('::tablelist::addDateTimeWidget', type, seconds, name)
+ end
+
+ def addIncrSpinner(name=None)
+ Tk.tk_call('::tablelist::addIncrSpinner', name)
+ end
+
+ def addIncrSpinint(name=None)
+ Tk.tk_call('::tablelist::addIncrSpinint', name)
+ end
+
+ def addIncrCombobox(name=None)
+ Tk.tk_call('::tablelist::addIncrCombobox', name)
+ end
+
+
+ ############################################################
+ # with Bryan Oakley's combobox package
+ def addOakleyCombobox(name=None)
+ Tk.tk_call('::tablelist::addOakleyCombobox', name)
+ end
+
+ ############################################################
+ # with the multi-entry package Mentry is a library extension
+ def addDateMentry(format, separator, gmt=false, name=None)
+ if gmt && gmt != None
+ gmt = '-gmt'
+ else
+ gmt = None
+ end
+ Tk.tk_call('::tablelist::addDateMentry', format, separator, gmt, name)
+ end
+
+ def addTimeMentry(format, separator, gmt=false, name=None)
+ if gmt && gmt != None
+ gmt = '-gmt'
+ else
+ gmt = None
+ end
+ Tk.tk_call('::tablelist::addTimeMentry', format, separator, gmt, name)
+ end
+
+ def addFixedPointMentry(count1, count2, comma=false, name=None)
+ if comma && comma != None
+ comma = '-comma'
+ else
+ comma = None
+ end
+ Tk.tk_call('::tablelist::addFixedPoingMentry', count1, count2, comma, name)
+ end
+
+ def addIPAddrMentry(name=None)
+ Tk.tk_call('::tablelist::addIPAddrMentry', name)
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb b/ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb
new file mode 100644
index 0000000000..0cb4eb735d
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb
@@ -0,0 +1,25 @@
+#
+# tkextlib/tcllib/tablelist_tlie.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# * Part of tcllib extension
+# * A multi-column listbox
+
+require 'tk'
+require 'tkextlib/tcllib.rb'
+
+# TkPackage.require('tablelist_tile', '4.2')
+TkPackage.require('Tablelist_tile')
+
+unless defined? Tk::Tcllib::Tablelist_usingTile
+ Tk::Tcllib::Tablelist_usingTile = true
+end
+
+requrie 'tkextlib/tcllib/tablelist_core'
+
+module Tk
+ module Tcllib
+ Tablelist_Tile = Tablelist
+ TableList_Tile = Tablelist
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb b/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb
index 5fb89dd734..92dde65ce7 100644
--- a/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb
+++ b/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb
@@ -56,6 +56,22 @@ module Tk::Tcllib::Tkpiechart
:default_value=>1, :current_value=>2}
end
private :__configinfo_struct
+
+ def __boolval_optkeys
+ super() << 'select' << 'autoupdate' << 'selectable'
+ end
+ private :__boolval_optkeys
+
+ def __strval_optkeys
+ super() << 'bordercolor' << 'textbackground' <<
+ 'widestvaluetext' << 'title'
+ end
+ private :__strval_optkeys
+
+ def __listval_optkeys
+ super() << 'colors'
+ end
+ private :__listval_optkeys
end
####################################
diff --git a/ext/tk/lib/tkextlib/tcllib/tooltip.rb b/ext/tk/lib/tkextlib/tcllib/tooltip.rb
new file mode 100644
index 0000000000..4301b39fd3
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/tooltip.rb
@@ -0,0 +1,95 @@
+#
+# tkextlib/tcllib/tooltip.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# * Part of tcllib extension
+# * Provides tooltips, a small text message that is displayed when the
+# mouse hovers over a widget.
+#
+
+require 'tk'
+require 'tkextlib/tcllib.rb'
+
+# TkPackage.require('tooltip', '1.1')
+TkPackage.require('tooltip')
+
+module Tk::Tcllib
+ module Tooltip
+ PACKAGE_NAME = 'tooltip'.freeze
+ def self.package_name
+ PACKAGE_NAME
+ end
+
+ def self.package_version
+ begin
+ TkPackage.require('tooltip')
+ rescue
+ ''
+ end
+ end
+ end
+end
+
+module Tk::Tcllib::Tooltip
+ extend TkCore
+
+ WidgetClassName = 'Tooltip'.freeze
+ def self.database_classname
+ self::WidgetClassName
+ end
+ def self.database_class
+ WidgetClassNames[self::WidgetClassName]
+ end
+
+ def self.clear(glob_path_pat = None)
+ self.clear_glob(glob_path_pat)
+ end
+
+ def self.clear_glob(glob_path_pat)
+ tk_call_without_enc('::tooltip::tooltip', 'clear', glob_path_pat)
+ end
+
+ def self.clear_widgets(*args)
+ self.clear_glob("{#{args.collect{|w| _get_eval_string(w)}.join(',')}}")
+ end
+
+ def self.clear_children(*args)
+ self.clear_glob("{#{args.collect{|w| s = _get_eval_string(w); "#{s},#{s}.*"}.join(',')}}")
+ end
+
+ def self.delay(millisecs=None)
+ number(tk_call_without_enc('::tooltip::tooltip', 'delay', millisecs))
+ end
+ def self.delay=(millisecs)
+ self.delay(millisecs)
+ end
+
+ def self.disable
+ tk_call_without_enc('::tooltip::tooltip', 'disable')
+ false
+ end
+ def self.off
+ self.disable
+ end
+
+ def self.enable
+ tk_call_without_enc('::tooltip::tooltip', 'enable')
+ true
+ end
+ def self.on
+ self.enable
+ end
+
+ def self.register(widget, msg, keys=nil)
+ if keys.kind_of?(Hash)
+ args = hash_kv(keys) << msg
+ else
+ args = msg
+ end
+ tk_call_without_enc('::tooltip::tooltip', widget.path, *args)
+ end
+
+ def self.erase(widget)
+ tk_call_without_enc('::tooltip::tooltip', widget.path, '')
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tcllib/widget.rb b/ext/tk/lib/tkextlib/tcllib/widget.rb
new file mode 100644
index 0000000000..ed69f67ce6
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/widget.rb
@@ -0,0 +1,48 @@
+#
+# tkextlib/tcllib/widget.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# * Part of tcllib extension
+# * megawidget package that uses snit as the object system (snidgets)
+#
+
+require 'tk'
+require 'tkextlib/tcllib.rb'
+
+# TkPackage.require('widget', '3.0')
+TkPackage.require('widget')
+
+module Tk::Tcllib
+ module Widget
+ PACKAGE_NAME = 'widget'.freeze
+ def self.package_name
+ PACKAGE_NAME
+ end
+
+ def self.package_version
+ begin
+ TkPackage.require('widget')
+ rescue
+ ''
+ end
+ end
+ end
+end
+
+module Tk::Tcllib::Widget
+ autoload :Dialog, 'tkextlib/tcllib/dialog'
+
+ autoload :Panelframe, 'tkextlib/tcllib/panelframe'
+ autoload :PanelFrame, 'tkextlib/tcllib/panelframe'
+
+ autoload :Ruler, 'tkextlib/tcllib/ruler'
+
+ autoload :Screenruler, 'tkextlib/tcllib/screenruler'
+ autoload :ScreenRuler, 'tkextlib/tcllib/screenruler'
+
+ autoload :Scrolledwindow, 'tkextlib/tcllib/scrollwin'
+ autoload :ScrolledWindow, 'tkextlib/tcllib/scrollwin'
+
+ autoload :Superframe, 'tkextlib/tcllib/superframe'
+ autoload :SuperFrame, 'tkextlib/tcllib/superframe'
+end