summaryrefslogtreecommitdiff
path: root/ruby_1_8_5/ext/tk/lib/tkextlib/tile
diff options
context:
space:
mode:
Diffstat (limited to 'ruby_1_8_5/ext/tk/lib/tkextlib/tile')
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/tile/dialog.rb84
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/tile/setup.rb8
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/tile/style.rb103
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/tile/tbutton.rb30
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/tile/tcheckbutton.rb32
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/tile/tcombobox.rb55
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/tile/tentry.rb40
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/tile/tframe.rb30
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/tile/tlabel.rb30
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/tile/tlabelframe.rb30
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/tile/tmenubutton.rb30
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/tile/tnotebook.rb110
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/tile/tpaned.rb188
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/tile/tprogressbar.rb53
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/tile/tradiobutton.rb32
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/tile/treeview.rb280
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/tile/tscale.rb50
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/tile/tscrollbar.rb30
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/tile/tseparator.rb30
-rw-r--r--ruby_1_8_5/ext/tk/lib/tkextlib/tile/tsquare.rb30
20 files changed, 1275 insertions, 0 deletions
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/tile/dialog.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/dialog.rb
new file mode 100644
index 0000000000..f8ddf62598
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/dialog.rb
@@ -0,0 +1,84 @@
+#
+# ttk::dialog (tile-0.7+)
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class Dialog < TkWindow
+ end
+ end
+end
+
+class Tk::Tile::Dialog
+ TkCommandNames = ['::ttk::dialog'.freeze].freeze
+
+ def self.show(*args)
+ dialog = self.new(*args)
+ dialog.show
+ [dialog.status, dialog.value]
+ end
+ def self.display(*args)
+ self.show(*args)
+ end
+
+ def self.define_dialog_type(name, keys)
+ Tk.tk_call('::ttk::dialog::define', name, keys)
+ name
+ end
+
+ def self.style(*args)
+ ['Dialog', *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+
+ #########################
+
+ def initialize(keys={})
+ @keys = _symbolkey2str(keys)
+ super(*args)
+ end
+
+ def create_self(keys)
+ # dummy
+ end
+ private :create_self
+
+ def show
+ tk_call(self.class::TkCommandNames[0], @path, *hash_kv(@keys))
+ end
+ alias display show
+
+ def client_frame
+ window(tk_call_without_enc('::ttk::dialog::clientframe'))
+ end
+
+ def cget(slot)
+ @keys[slot]
+ 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
+ @keys[slot] = value
+ else
+ @keys.delete(slot)
+ end
+ end
+ self
+ end
+
+ def configinfo(slot = nil)
+ if slot
+ slot = slot.to_s
+ [ slot, nil, nil, nil, @keys[slot] ]
+ else
+ @keys.collect{|k, v| [ k, nil, nil, nil, v ] }
+ end
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/tile/setup.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/setup.rb
new file mode 100644
index 0000000000..ce0f0bd4d4
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/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/tile/style.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/style.rb
new file mode 100644
index 0000000000..485a36d7d6
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/style.rb
@@ -0,0 +1,103 @@
+#
+# style commands
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ module Style
+ end
+ end
+end
+
+module Tk::Tile::Style
+ extend TkCore
+end
+
+class << Tk::Tile::Style
+ def configure(style=nil, keys=nil)
+ if style.kind_of?(Hash)
+ keys = style
+ style = nil
+ end
+ style = '.' unless style
+
+ if Tk::Tile::TILE_SPEC_VERSION_ID < 7
+ sub_cmd = 'default'
+ else
+ sub_cmd = 'configure'
+ end
+
+ if keys && keys != None
+ tk_call('style', sub_cmd, style, *hash_kv(keys))
+ else
+ tk_call('style', sub_cmd, style)
+ end
+ end
+ alias default configure
+
+ def map(style=nil, keys=nil)
+ if style.kind_of?(Hash)
+ keys = style
+ style = nil
+ end
+ style = '.' unless style
+
+ if keys && keys != None
+ tk_call('style', 'map', style, *hash_kv(keys))
+ else
+ tk_call('style', 'map', style)
+ end
+ end
+
+ include Tk::Tile::ParseStyleLayout
+
+ def layout(style=nil, spec=nil)
+ if style.kind_of?(Hash)
+ spec = style
+ style = nil
+ end
+ style = '.' unless style
+
+ if spec
+ tk_call('style', 'layout', style, spec)
+ else
+ _style_layout(list(tk_call('style', 'layout', style)))
+ end
+ end
+
+ def element_create(name, type, *args)
+ tk_call('style', 'element', 'create', name, type, *args)
+ end
+
+ def element_names()
+ list(tk_call('style', 'element', 'names'))
+ end
+
+ def element_options(elem)
+ simplelist(tk_call('style', 'element', 'options', elem))
+ end
+
+ def theme_create(name, keys=nil)
+ if keys && keys != None
+ tk_call('style', 'theme', 'create', name, *hash_kv(keys))
+ else
+ tk_call('style', 'theme', 'create', name)
+ end
+ end
+
+ def theme_settings(name, cmd=nil, &b)
+ cmd = Proc.new(&b) if !cmd && b
+ tk_call('style', 'theme', 'settings', name, cmd)
+ end
+
+ def theme_names()
+ list(tk_call('style', 'theme', 'names'))
+ end
+
+ def theme_use(name)
+ tk_call('style', 'theme', 'use', name)
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tbutton.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tbutton.rb
new file mode 100644
index 0000000000..1142a27100
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tbutton.rb
@@ -0,0 +1,30 @@
+#
+# tbutton widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TButton < TkButton
+ end
+ Button = TButton
+ end
+end
+
+class Tk::Tile::TButton < TkButton
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::button'.freeze].freeze
+ else
+ TkCommandNames = ['::tbutton'.freeze].freeze
+ end
+ WidgetClassName = 'TButton'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tcheckbutton.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tcheckbutton.rb
new file mode 100644
index 0000000000..fce799683d
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tcheckbutton.rb
@@ -0,0 +1,32 @@
+#
+# tcheckbutton widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TCheckButton < TkCheckButton
+ end
+ TCheckbutton = TCheckButton
+ CheckButton = TCheckButton
+ Checkbutton = TCheckButton
+ end
+end
+
+class Tk::Tile::TCheckButton < TkCheckButton
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::checkbutton'.freeze].freeze
+ else
+ TkCommandNames = ['::tcheckbutton'.freeze].freeze
+ end
+ WidgetClassName = 'TCheckbutton'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tcombobox.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tcombobox.rb
new file mode 100644
index 0000000000..c63ab94dbe
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tcombobox.rb
@@ -0,0 +1,55 @@
+#
+# tcombobox widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TCombobox < Tk::Tile::TEntry
+ end
+ Combobox = TCombobox
+ end
+end
+
+class Tk::Tile::TCombobox < Tk::Tile::TEntry
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::combobox'.freeze].freeze
+ else
+ TkCommandNames = ['::tcombobox'.freeze].freeze
+ end
+ WidgetClassName = 'TCombobox'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def __boolval_optkeys
+ super() << 'exportselection'
+ end
+ private :__boolval_optkeys
+
+ def __listval_optkeys
+ super() << 'values'
+ end
+ private :__listval_optkeys
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+
+ def current
+ number(tk_send_without_enc('current', idx))
+ end
+ def current=(idx)
+ tk_send_without_enc('current', idx)
+ end
+
+ def identify(x, y)
+ tk_send_without_enc('identify', x, y)
+ end
+
+ def set(val)
+ tk_send('set', val)
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tentry.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tentry.rb
new file mode 100644
index 0000000000..4d57ce7756
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tentry.rb
@@ -0,0 +1,40 @@
+#
+# tentry widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TEntry < TkEntry
+ end
+ Entry = TEntry
+ end
+end
+
+class Tk::Tile::TEntry < TkEntry
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::entry'.freeze].freeze
+ else
+ TkCommandNames = ['::tentry'.freeze].freeze
+ end
+ WidgetClassName = 'TEntry'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def __boolval_optkeys
+ super() << 'exportselection'
+ end
+ private :__boolval_optkeys
+
+ def __strval_optkeys
+ super() << 'show'
+ end
+ private :__strval_optkeys
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tframe.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tframe.rb
new file mode 100644
index 0000000000..691c9c42af
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tframe.rb
@@ -0,0 +1,30 @@
+#
+# tframe widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TFrame < TkFrame
+ end
+ Frame = TFrame
+ end
+end
+
+class Tk::Tile::TFrame < TkFrame
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::frame'.freeze].freeze
+ else
+ TkCommandNames = ['::tframe'.freeze].freeze
+ end
+ WidgetClassName = 'TFrame'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tlabel.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tlabel.rb
new file mode 100644
index 0000000000..4111d1906a
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tlabel.rb
@@ -0,0 +1,30 @@
+#
+# tlabel widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TLabel < TkLabel
+ end
+ Label = TLabel
+ end
+end
+
+class Tk::Tile::TLabel < TkLabel
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::label'.freeze].freeze
+ else
+ TkCommandNames = ['::tlabel'.freeze].freeze
+ end
+ WidgetClassName = 'TLabel'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tlabelframe.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tlabelframe.rb
new file mode 100644
index 0000000000..8981232b25
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tlabelframe.rb
@@ -0,0 +1,30 @@
+#
+# tlabelframe widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TLabelframe < Tk::Tile::TFrame
+ end
+ Labelframe = TLabelframe
+ end
+end
+
+class Tk::Tile::TLabelframe < Tk::Tile::TFrame
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::labelframe'.freeze].freeze
+ else
+ TkCommandNames = ['::tlabelframe'.freeze].freeze
+ end
+ WidgetClassName = 'TLabelframe'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tmenubutton.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tmenubutton.rb
new file mode 100644
index 0000000000..4b81fa1c81
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tmenubutton.rb
@@ -0,0 +1,30 @@
+#
+# tmenubutton widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TMenubutton < TkMenubutton
+ end
+ Menubutton = TMenubutton
+ end
+end
+
+class Tk::Tile::TMenubutton < TkMenubutton
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::menubutton'.freeze].freeze
+ else
+ TkCommandNames = ['::tmenubutton'.freeze].freeze
+ end
+ WidgetClassName = 'TMenubutton'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tnotebook.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tnotebook.rb
new file mode 100644
index 0000000000..abaed8ee9c
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tnotebook.rb
@@ -0,0 +1,110 @@
+#
+# tnotebook widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TNotebook < TkWindow
+ end
+ Notebook = TNotebook
+ end
+end
+
+class Tk::Tile::TNotebook < TkWindow
+ ################################
+ include TkItemConfigMethod
+
+ def __item_cget_cmd(id)
+ [self.path, 'tab', id]
+ end
+ private :__item_cget_cmd
+
+ def __item_config_cmd(id)
+ [self.path, 'tab', id]
+ end
+ private :__item_config_cmd
+
+ def __item_listval_optkeys
+ []
+ end
+ private :__item_listval_optkeys
+
+ def __item_methodcall_optkeys # { key=>method, ... }
+ {}
+ end
+ private :__item_listval_optkeys
+
+ #alias tabcget itemcget
+ alias tabconfigure itemconfigure
+ alias tabconfiginfo itemconfiginfo
+ alias current_tabconfiginfo current_itemconfiginfo
+
+ def tabcget(tagOrId, option)
+ tabconfigure(tagOrId, option)[-1]
+ end
+ ################################
+
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::notebook'.freeze].freeze
+ else
+ TkCommandNames = ['::tnotebook'.freeze].freeze
+ end
+ WidgetClassName = 'TNotebook'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+
+ def enable_traversal()
+ if Tk::Tile::TILE_SPEC_VERSION_ID < 5
+ tk_call_without_enc('::tile::enableNotebookTraversal', @path)
+ elsif Tk::Tile::TILE_SPEC_VERSION_ID < 7
+ tk_call_without_enc('::tile::notebook::enableTraversal', @path)
+ else
+ tk_call_without_enc('::ttk::notebook::enableTraversal', @path)
+ end
+ self
+ end
+
+ def add(child, keys=nil)
+ if keys && keys != None
+ tk_send_without_enc('add', _epath(child), *hash_kv(keys))
+ else
+ tk_send_without_enc('add', _epath(child))
+ end
+ self
+ end
+
+ def forget(idx)
+ tk_send('forget', idx)
+ self
+ end
+
+ def index(idx)
+ number(tk_send('index', idx))
+ end
+
+ def insert(idx, subwin, keys=nil)
+ if keys && keys != None
+ tk_send('insert', idx, subwin, *hash_kv(keys))
+ else
+ tk_send('insert', idx, subwin)
+ end
+ self
+ end
+
+ def select(idx)
+ tk_send('select', idx)
+ self
+ end
+
+ def tabs
+ list(tk_send('tabs'))
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tpaned.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tpaned.rb
new file mode 100644
index 0000000000..11178b19d3
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tpaned.rb
@@ -0,0 +1,188 @@
+#
+# tpaned widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TPaned < TkWindow
+ end
+ Paned = TPaned
+ end
+end
+
+class Tk::Tile::TPaned < TkWindow
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::paned'.freeze].freeze
+ else
+ TkCommandNames = ['::tpaned'.freeze].freeze
+ end
+ WidgetClassName = 'TPaned'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+
+ def add(win, keys)
+ win = _epath(win)
+ tk_send_without_enc('add', win, *hash_kv(keys))
+ self
+ end
+
+ def forget(pane)
+ pane = _epath(pane)
+ tk_send_without_enc('forget', pane)
+ self
+ end
+
+ def insert(pos, win, keys)
+ win = _epath(win)
+ tk_send_without_enc('insert', pos, win, *hash_kv(keys))
+ self
+ end
+
+ def panecget(pane, slot)
+ pane = _epath(pane)
+ tk_tcl2ruby(tk_send_without_enc('pane', pane, "-#{slot}"))
+ end
+ alias pane_cget panecget
+
+ def paneconfigure(pane, key, value=nil)
+ pane = _epath(pane)
+ if key.kind_of? Hash
+ params = []
+ key.each{|k, v|
+ params.push("-#{k}")
+ # params.push((v.kind_of?(TkObject))? v.epath: v)
+ params.push(_epath(v))
+ }
+ tk_send_without_enc('pane', pane, *params)
+ else
+ # value = value.epath if value.kind_of?(TkObject)
+ value = _epath(value)
+ tk_send_without_enc('pane', pane, "-#{key}", value)
+ end
+ self
+ end
+ alias pane_config paneconfigure
+ alias pane_configure paneconfigure
+
+ def paneconfiginfo(win)
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ win = _epath(win)
+ if key
+ conf = tk_split_list(tk_send_without_enc('pane', win, "-#{key}"))
+ conf[0] = conf[0][1..-1]
+ if conf[0] == 'hide'
+ conf[3] = bool(conf[3]) unless conf[3].empty?
+ conf[4] = bool(conf[4]) unless conf[4].empty?
+ end
+ conf
+ else
+ tk_split_simplelist(tk_send_without_enc('pane',
+ win)).collect{|conflist|
+ conf = tk_split_simplelist(conflist)
+ conf[0] = conf[0][1..-1]
+ if conf[3]
+ if conf[0] == 'hide'
+ conf[3] = bool(conf[3]) unless conf[3].empty?
+ elsif conf[3].index('{')
+ conf[3] = tk_split_list(conf[3])
+ else
+ conf[3] = tk_tcl2ruby(conf[3])
+ end
+ end
+ if conf[4]
+ if conf[0] == 'hide'
+ conf[4] = bool(conf[4]) unless conf[4].empty?
+ elsif conf[4].index('{')
+ conf[4] = tk_split_list(conf[4])
+ else
+ conf[4] = tk_tcl2ruby(conf[4])
+ end
+ end
+ conf[1] = conf[1][1..-1] if conf.size == 2 # alias info
+ conf
+ }
+ end
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
+ win = _epath(win)
+ if key
+ conf = tk_split_list(tk_send_without_enc('pane', win, "-#{key}"))
+ key = conf.shift[1..-1]
+ if key == 'hide'
+ conf[2] = bool(conf[2]) unless conf[2].empty?
+ conf[3] = bool(conf[3]) unless conf[3].empty?
+ end
+ { key => conf }
+ else
+ ret = {}
+ tk_split_simplelist(tk_send_without_enc('pane',
+ win)).each{|conflist|
+ conf = tk_split_simplelist(conflist)
+ key = conf.shift[1..-1]
+ if key
+ if key == 'hide'
+ conf[2] = bool(conf[2]) unless conf[2].empty?
+ elsif conf[2].index('{')
+ conf[2] = tk_split_list(conf[2])
+ else
+ conf[2] = tk_tcl2ruby(conf[2])
+ end
+ end
+ if conf[3]
+ if key == 'hide'
+ conf[3] = bool(conf[3]) unless conf[3].empty?
+ elsif conf[3].index('{')
+ conf[3] = tk_split_list(conf[3])
+ else
+ conf[3] = tk_tcl2ruby(conf[3])
+ end
+ end
+ if conf.size == 1
+ ret[key] = conf[0][1..-1] # alias info
+ else
+ ret[key] = conf
+ end
+ }
+ ret
+ end
+ end
+ end
+ alias pane_configinfo paneconfiginfo
+
+ def current_paneconfiginfo(win, key=nil)
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ if key
+ conf = paneconfiginfo(win, key)
+ {conf[0] => conf[4]}
+ else
+ ret = {}
+ paneconfiginfo(win).each{|conf|
+ ret[conf[0]] = conf[4] if conf.size > 2
+ }
+ ret
+ end
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
+ ret = {}
+ paneconfiginfo(win, key).each{|k, conf|
+ ret[k] = conf[-1] if conf.kind_of?(Array)
+ }
+ ret
+ end
+ end
+ alias current_pane_configinfo current_paneconfiginfo
+
+ def identify(x, y)
+ list(tk_send_without_enc('identify', x, y))
+ end
+
+ def sashpos(idx, newpos=None)
+ num_or_str(tk_send_without_enc('sashpos', idx, newpos))
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tprogressbar.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tprogressbar.rb
new file mode 100644
index 0000000000..36c1c75c23
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tprogressbar.rb
@@ -0,0 +1,53 @@
+#
+# tprogressbar widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TProgressbar < TkWindow
+ end
+ Progressbar = TProgressbar
+ end
+end
+
+class Tk::Tile::TProgressbar
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::progressbar'.freeze].freeze
+ else
+ TkCommandNames = ['::tprogressbar'.freeze].freeze
+ end
+ WidgetClassName = 'TProgressbar'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+
+ def step(amount=None)
+ tk_send_without_enc('step', amount).to_f
+ end
+ #def step=(amount)
+ # tk_send_without_enc('step', amount)
+ #end
+
+ def start(interval=None)
+ if Tk::Tile::TILE_SPEC_VERSION_ID < 5
+ tk_call_without_enc('::tile::progressbar::start', @path, interval)
+ else
+ tk_send_without_enc('start', interval)
+ end
+ end
+
+ def stop(amount=None)
+ if Tk::Tile::TILE_SPEC_VERSION_ID < 5
+ tk_call_without_enc('::tile::progressbar::stop', @path)
+ else
+ tk_send_without_enc('stop', amount)
+ end
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tradiobutton.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tradiobutton.rb
new file mode 100644
index 0000000000..e2f614cb97
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tradiobutton.rb
@@ -0,0 +1,32 @@
+#
+# tradiobutton widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TRadioButton < TkRadioButton
+ end
+ TRadiobutton = TRadioButton
+ RadioButton = TRadioButton
+ Radiobutton = TRadioButton
+ end
+end
+
+class Tk::Tile::TRadioButton < TkRadioButton
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::radiobutton'.freeze].freeze
+ else
+ TkCommandNames = ['::tradiobutton'.freeze].freeze
+ end
+ WidgetClassName = 'TRadiobutton'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/tile/treeview.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/treeview.rb
new file mode 100644
index 0000000000..d3ffbbfa6b
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/treeview.rb
@@ -0,0 +1,280 @@
+#
+# treeview widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class Treeview < TkWindow
+ end
+
+ module TreeviewConfig
+ include TkItemConfigMethod
+
+ def __item_cget_cmd(id)
+ [self.path, id[0], id[1]]
+ end
+ private :__item_cget_cmd
+
+ def __item_config_cmd(id)
+ [self.path, id[0], id[1]]
+ end
+ private :__item_config_cmd
+
+ def __item_numstrval_optkeys(id)
+ case id[0]
+ when :item, 'item'
+ ['width']
+ when :column, 'column'
+ super(id[1])
+ when :heading, 'heading'
+ super(id[1])
+ end
+ end
+ private :__item_numstrval_optkeys
+
+ def __item_strval_optkeys(id)
+ case id[0]
+ when :item, 'item'
+ super(id) + ['id']
+ when :column, 'column'
+ super(id[1])
+ when :heading, 'heading'
+ super(id[1])
+ end
+ end
+ private :__item_strval_optkeys
+
+ def __item_boolval_optkeys(id)
+ case id[0]
+ when :item, 'item'
+ ['open']
+ when :column, 'column'
+ super(id[1])
+ when :heading, 'heading'
+ super(id[1])
+ end
+ end
+ private :__item_boolval_optkeys
+
+ def __item_listval_optkeys(id)
+ case id[0]
+ when :item, 'item'
+ ['values']
+ when :column, 'column'
+ []
+ when :heading, 'heading'
+ []
+ end
+ end
+ private :__item_listval_optkeys
+
+ alias __itemcget itemcget
+ alias __itemconfigure itemconfigure
+ alias __itemconfiginfo itemconfiginfo
+ alias __current_itemconfiginfo current_itemconfiginfo
+
+ private :__itemcget, :__itemconfigure
+ private :__itemconfiginfo, :__current_itemconfiginfo
+
+ # Treeview Item
+ def itemcget(tagOrId, option)
+ __itemcget([:item, tagOrId], option)
+ end
+ def itemconfigure(tagOrId, slot, value=None)
+ __itemconfigure([:item, tagOrId], slot, value)
+ end
+ def itemconfiginfo(tagOrId, slot=nil)
+ __itemconfiginfo([:item, tagOrId], slot)
+ end
+ def current_itemconfiginfo(tagOrId, slot=nil)
+ __current_itemconfiginfo([:item, tagOrId], slot)
+ end
+
+ # Treeview Column
+ def columncget(tagOrId, option)
+ __itemcget([:column, tagOrId], option)
+ end
+ def columnconfigure(tagOrId, slot, value=None)
+ __itemconfigure([:column, tagOrId], slot, value)
+ end
+ def columnconfiginfo(tagOrId, slot=nil)
+ __itemconfiginfo([:column, tagOrId], slot)
+ end
+ def current_columnconfiginfo(tagOrId, slot=nil)
+ __current_itemconfiginfo([:column, tagOrId], slot)
+ end
+ alias column_cget columncget
+ alias column_configure columnconfigure
+ alias column_configinfo columnconfiginfo
+ alias current_column_configinfo current_columnconfiginfo
+
+ # Treeview Heading
+ def headingcget(tagOrId, option)
+ __itemcget([:heading, tagOrId], option)
+ end
+ def headingconfigure(tagOrId, slot, value=None)
+ __itemconfigure([:heading, tagOrId], slot, value)
+ end
+ def headingconfiginfo(tagOrId, slot=nil)
+ __itemconfiginfo([:heading, tagOrId], slot)
+ end
+ def current_headingconfiginfo(tagOrId, slot=nil)
+ __current_itemconfiginfo([:heading, tagOrId], slot)
+ end
+ alias heading_cget headingcget
+ alias heading_configure headingconfigure
+ alias heading_configinfo headingconfiginfo
+ alias current_heading_configinfo current_headingconfiginfo
+ end
+ end
+end
+
+class Tk::Tile::Treeview < TkWindow
+ include Tk::Tile::TileWidget
+ include Scrollable
+
+ include Tk::Tile::TreeviewConfig
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::treeview'.freeze].freeze
+ else
+ TkCommandNames = ['::treeview'.freeze].freeze
+ end
+ WidgetClassName = 'Treeview'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+
+ def tagid(id)
+ if id.kind_of?(Array)
+ [id[0], _get_eval_string(id[1])]
+ else
+ _get_eval_string(id)
+ end
+ end
+
+ def children(item)
+ simplelist(tk_send_without_enc('children', item))
+ end
+ def set_children(item, *items)
+ tk_send_without_enc('children', item,
+ array2tk_list(items.flatten, true))
+ self
+ end
+
+ def delete(*items)
+ tk_send_without_enc('delete', array2tk_list(items.flatten, true))
+ self
+ end
+
+ def detach(*items)
+ tk_send_without_enc('detach', array2tk_list(items.flatten, true))
+ self
+ end
+
+ def exist?(item)
+ bool(tk_send_without_enc('exists', _get_eval_enc_str(item)))
+ end
+
+ def focus_item(item = None)
+ tk_send('focus', item)
+ end
+
+ def identify(x, y)
+ ret = simplelist(tk_send('identify', x, y))
+ case ret[0]
+ when 'heading', 'separator', 'cell'
+ ret[-1] = num_or_str(ret[-1])
+ end
+ end
+
+ def index(item)
+ number(tk_send('index', item))
+ end
+
+ def insert(parent, idx, keys={})
+ keys = _symbolkey2str(keys)
+ id = keys.delete('id')
+ if id
+ tk_send('insert', parent, idx, '-id', id, *hash_kv(keys))
+ else
+ tk_send('insert', parent, idx, *hash_kv(keys))
+ end
+ self
+ end
+
+ def instate(spec, cmd=Proc.new)
+ tk_send('instate', spec, cmd)
+ end
+ def state(spec=None)
+ tk_send('state', spec)
+ end
+
+ def move(item, parent, idx)
+ tk_send('move', item, parent, idx)
+ self
+ end
+
+ def next(item)
+ tk_send('next', item)
+ end
+
+ def parent(item)
+ tk_send('parent', item)
+ end
+
+ def prev(item)
+ tk_send('prev', item)
+ end
+
+ def see(item)
+ tk_send('see', item)
+ self
+ end
+
+ def selection
+ simplelist(tk_send('selection'))
+ end
+ alias selection_get selection
+
+ def selection_add(*items)
+ tk_send('selection', 'add', array2tk_list(items.flatten, true))
+ self
+ end
+ def selection_remove(*items)
+ tk_send('selection', 'remove', array2tk_list(items.flatten, true))
+ self
+ end
+ def selection_set(*items)
+ tk_send('selection', 'set', array2tk_list(items.flatten, true))
+ self
+ end
+ def selection_toggle(*items)
+ tk_send('selection', 'toggle', array2tk_list(items.flatten, true))
+ self
+ end
+
+ def get_directory(item)
+ # tile-0.7+
+ ret = []
+ lst = simplelist(tk_send('set', item))
+ until lst.empty?
+ col = lst.shift
+ val = lst.shift
+ ret << [col, val]
+ end
+ ret
+ end
+ def get(item, col)
+ tk_send('set', item, col)
+ end
+ def set(item, col, value)
+ tk_send('set', item, col, value)
+ self
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tscale.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tscale.rb
new file mode 100644
index 0000000000..7ec72e3515
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tscale.rb
@@ -0,0 +1,50 @@
+#
+# tscale & tprogress widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TScale < TkScale
+ end
+ Scale = TScale
+
+ class TProgress < TScale
+ end
+ Progress = TProgress
+ end
+end
+
+class Tk::Tile::TScale < TkScale
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::scale'.freeze].freeze
+ else
+ TkCommandNames = ['::tscale'.freeze].freeze
+ end
+ WidgetClassName = 'TScale'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
+
+class Tk::Tile::TProgress < Tk::Tile::TScale
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::progress'.freeze].freeze
+ else
+ TkCommandNames = ['::tprogress'.freeze].freeze
+ end
+ WidgetClassName = 'TProgress'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tscrollbar.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tscrollbar.rb
new file mode 100644
index 0000000000..bd49ae18e3
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tscrollbar.rb
@@ -0,0 +1,30 @@
+#
+# tscrollbar widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TScrollbar < TkScrollbar
+ end
+ Scrollbar = TScrollbar
+ end
+end
+
+class Tk::Tile::TScrollbar < TkScrollbar
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::scrollbar'.freeze].freeze
+ else
+ TkCommandNames = ['::tscrollbar'.freeze].freeze
+ end
+ WidgetClassName = 'TScrollbar'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tseparator.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tseparator.rb
new file mode 100644
index 0000000000..ca731d4e5b
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tseparator.rb
@@ -0,0 +1,30 @@
+#
+# tseparator widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TSeparator < TkWindow
+ end
+ Separator = TSeparator
+ end
+end
+
+class Tk::Tile::TSeparator < TkWindow
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::separator'.freeze].freeze
+ else
+ TkCommandNames = ['::tseparator'.freeze].freeze
+ end
+ WidgetClassName = 'TSeparator'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
diff --git a/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tsquare.rb b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tsquare.rb
new file mode 100644
index 0000000000..600b55e4e7
--- /dev/null
+++ b/ruby_1_8_5/ext/tk/lib/tkextlib/tile/tsquare.rb
@@ -0,0 +1,30 @@
+#
+# tsquare widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TSquare < TkWindow
+ end
+ Square = TSquare
+ end
+end
+
+class Tk::Tile::TSquare < TkWindow
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::square'.freeze].freeze
+ else
+ TkCommandNames = ['::tsquare'.freeze].freeze
+ end
+ WidgetClassName = 'TSquare'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end