summaryrefslogtreecommitdiffstats
path: root/ext/tk/lib
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tk/lib')
-rw-r--r--ext/tk/lib/tk.rb2
-rw-r--r--ext/tk/lib/tk/image.rb43
-rw-r--r--ext/tk/lib/tk/menu.rb7
-rw-r--r--ext/tk/lib/tk/root.rb5
-rw-r--r--ext/tk/lib/tk/text.rb12
-rw-r--r--ext/tk/lib/tkextlib/SUPPORT_STATUS5
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ctext.rb5
-rw-r--r--ext/tk/lib/tkextlib/tcllib/datefield.rb4
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ip_entry.rb5
-rw-r--r--ext/tk/lib/tkextlib/tile.rb44
-rw-r--r--ext/tk/lib/tkextlib/tile/style.rb28
-rw-r--r--ext/tk/lib/tkextlib/tile/tbutton.rb4
-rw-r--r--ext/tk/lib/tkextlib/tile/tcheckbutton.rb4
-rw-r--r--ext/tk/lib/tkextlib/tile/tcombobox.rb4
-rw-r--r--ext/tk/lib/tkextlib/tile/tentry.rb4
-rw-r--r--ext/tk/lib/tkextlib/tile/tframe.rb4
-rw-r--r--ext/tk/lib/tkextlib/tile/tlabel.rb4
-rw-r--r--ext/tk/lib/tkextlib/tile/tlabelframe.rb4
-rw-r--r--ext/tk/lib/tkextlib/tile/tmenubutton.rb4
-rw-r--r--ext/tk/lib/tkextlib/tile/tnotebook.rb6
-rw-r--r--ext/tk/lib/tkextlib/tile/tpaned.rb187
-rw-r--r--ext/tk/lib/tkextlib/tile/tprogressbar.rb6
-rw-r--r--ext/tk/lib/tkextlib/tile/tradiobutton.rb4
-rw-r--r--ext/tk/lib/tkextlib/tile/treeview.rb4
-rw-r--r--ext/tk/lib/tkextlib/tile/tscale.rb47
-rw-r--r--ext/tk/lib/tkextlib/tile/tscrollbar.rb4
-rw-r--r--ext/tk/lib/tkextlib/tile/tseparator.rb4
-rw-r--r--ext/tk/lib/tkextlib/tile/tsquare.rb4
-rw-r--r--ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb5
-rw-r--r--ext/tk/lib/tkextlib/treectrl/tktreectrl.rb5
30 files changed, 441 insertions, 27 deletions
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb
index 77ca443cf..3468b108a 100644
--- a/ext/tk/lib/tk.rb
+++ b/ext/tk/lib/tk.rb
@@ -4024,7 +4024,7 @@ end
#Tk.freeze
module Tk
- RELEASE_DATE = '2005-04-02'.freeze
+ RELEASE_DATE = '2005-04-09'.freeze
autoload :AUTO_PATH, 'tk/variable'
autoload :TCL_PACKAGE_PATH, 'tk/variable'
diff --git a/ext/tk/lib/tk/image.rb b/ext/tk/lib/tk/image.rb
index d38414d09..e3880106a 100644
--- a/ext/tk/lib/tk/image.rb
+++ b/ext/tk/lib/tk/image.rb
@@ -14,18 +14,55 @@ class TkImage<TkObject
TkCore::INTERP.init_ip_env{ Tk_IMGTBL.clear }
+ def self.new(keys=nil)
+ if keys.kind_of?(Hash)
+ name = nil
+ if keys.key?(:imagename)
+ name = keys[:imagename]
+ elsif keys.key?('imagename')
+ name = keys['imagename']
+ end
+ if name
+ if name.kind_of?(TkImage)
+ obj = name
+ else
+ name = _get_eval_string(name)
+ obj = Tk_IMGTBL[name]
+ end
+ if obj
+ if !(keys[:without_creating] || keys['without_creating'])
+ keys = _symbolkey2str(keys)
+ keys.delete('imagename')
+ keys.delete('without_creating')
+ obj.instance_eval{
+ tk_call_without_enc('image', 'create',
+ @type, @path, *hash_kv(keys, true))
+ }
+ end
+ return obj
+ end
+ end
+ end
+ super(keys)
+ end
+
def initialize(keys=nil)
@path = nil
+ without_creating = false
if keys.kind_of?(Hash)
keys = _symbolkey2str(keys)
@path = keys.delete('imagename')
+ without_creating = keys.delete('without_creating')
end
unless @path
# @path = Tk_Image_ID.join('')
@path = Tk_Image_ID.join(TkCore::INTERP._ip_id_)
Tk_Image_ID[1].succ!
end
- tk_call_without_enc('image', 'create', @type, @path, *hash_kv(keys, true))
+ unless without_creating
+ tk_call_without_enc('image', 'create',
+ @type, @path, *hash_kv(keys, true))
+ end
Tk_IMGTBL[@path] = self
end
@@ -61,7 +98,7 @@ end
class TkBitmapImage<TkImage
def initialize(*args)
@type = 'bitmap'
- super
+ super(*args)
end
end
@@ -85,7 +122,7 @@ class TkPhotoImage<TkImage
def initialize(*args)
@type = 'photo'
- super
+ super(*args)
end
def blank
diff --git a/ext/tk/lib/tk/menu.rb b/ext/tk/lib/tk/menu.rb
index a0b0a80b1..54b42705e 100644
--- a/ext/tk/lib/tk/menu.rb
+++ b/ext/tk/lib/tk/menu.rb
@@ -402,9 +402,12 @@ class TkMenubutton<TkLabel
WidgetClassNames[WidgetClassName] = self
def create_self(keys)
if keys and keys != None
- tk_call_without_enc('menubutton', @path, *hash_kv(keys, true))
+ # tk_call_without_enc('menubutton', @path, *hash_kv(keys, true))
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
else
- tk_call_without_enc('menubutton', @path)
+ # tk_call_without_enc('menubutton', @path)
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
end
end
private :create_self
diff --git a/ext/tk/lib/tk/root.rb b/ext/tk/lib/tk/root.rb
index 24a5cf1ea..dd5f52ca8 100644
--- a/ext/tk/lib/tk/root.rb
+++ b/ext/tk/lib/tk/root.rb
@@ -52,6 +52,11 @@ class TkRoot<TkWindow
WidgetClassName = 'Tk'.freeze
WidgetClassNames[WidgetClassName] = self
+ def self.to_eval
+ # self::WidgetClassName
+ '.'
+ end
+
def create_self
@path = '.'
end
diff --git a/ext/tk/lib/tk/text.rb b/ext/tk/lib/tk/text.rb
index d294de9fd..c75cc2d5b 100644
--- a/ext/tk/lib/tk/text.rb
+++ b/ext/tk/lib/tk/text.rb
@@ -131,6 +131,10 @@ class TkText<TkTextWin
class IndexString < String
include IndexModMethods
+ def self.at(x,y)
+ self.new("@#{x},#{y}")
+ end
+
def self.new(str)
if str.kind_of?(String)
super(str)
@@ -183,6 +187,14 @@ class TkText<TkTextWin
end
private :create_self
+ def self.at(x, y)
+ TkText::IndexString.at(x, y)
+ end
+
+ def at(x, y)
+ TkText::IndexString.at(x, y)
+ end
+
def index(idx)
TkText::IndexString.new(tk_send_without_enc('index',
_get_eval_enc_str(idx)))
diff --git a/ext/tk/lib/tkextlib/SUPPORT_STATUS b/ext/tk/lib/tkextlib/SUPPORT_STATUS
index bf4572b15..45af92b42 100644
--- a/ext/tk/lib/tkextlib/SUPPORT_STATUS
+++ b/ext/tk/lib/tkextlib/SUPPORT_STATUS
@@ -79,8 +79,9 @@ BLT 2.4z http://sourceforge.net/projects/blt
==> blt
TkTreeCtrl CVS/Hd(2005-03-25)
- http://tktreectrl.sourceforge.net/ ==> treectrl
+ http://tktreectrl.sourceforge.net/ ==> treectrl
+Tile 0.6 http://tktable.sourceforge.net/tile/ ==> tile
===< support (may be alpha or beta quality) >=================================
@@ -93,8 +94,6 @@ TclX CVS/Hd(2005-02-07)
==> tclx (partial support; infox command and
XPG/3 message catalogs only)
-Tile 0.6 http://tktable.sourceforge.net/tile/ ==> tile
-
===< possibly available (not tested; alpha quality) >=========================
diff --git a/ext/tk/lib/tkextlib/tcllib/ctext.rb b/ext/tk/lib/tkextlib/tcllib/ctext.rb
index 89bfeff0f..342b268c7 100644
--- a/ext/tk/lib/tkextlib/tcllib/ctext.rb
+++ b/ext/tk/lib/tkextlib/tcllib/ctext.rb
@@ -34,9 +34,10 @@ class Tk::Tcllib::CText
def create_self(keys)
if keys and keys != None
- tk_call_without_enc('ctext', @path, *hash_kv(keys, true))
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
else
- tk_call_without_enc('ctext', @path)
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
end
end
private :create_self
diff --git a/ext/tk/lib/tkextlib/tcllib/datefield.rb b/ext/tk/lib/tkextlib/tcllib/datefield.rb
index 1d029e456..fb11da200 100644
--- a/ext/tk/lib/tkextlib/tcllib/datefield.rb
+++ b/ext/tk/lib/tkextlib/tcllib/datefield.rb
@@ -42,10 +42,10 @@ class Tk::Tcllib::Datefield
def create_self(keys)
if keys and keys != None
- tk_call_without_enc('::datefield::datefield', @path,
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
*hash_kv(keys, true))
else
- tk_call_without_enc('::datefield::datefield', @path)
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
end
end
private :create_self
diff --git a/ext/tk/lib/tkextlib/tcllib/ip_entry.rb b/ext/tk/lib/tkextlib/tcllib/ip_entry.rb
index da9f1eb3a..a71aaf879 100644
--- a/ext/tk/lib/tkextlib/tcllib/ip_entry.rb
+++ b/ext/tk/lib/tkextlib/tcllib/ip_entry.rb
@@ -38,9 +38,10 @@ class Tk::Tcllib::IP_Entry
def create_self(keys)
if keys and keys != None
- tk_call_without_enc('::ipentry::ipentry', @path, *hash_kv(keys, true))
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
else
- tk_call_without_enc('::ipentry::ipentry', @path)
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
end
end
private :create_self
diff --git a/ext/tk/lib/tkextlib/tile.rb b/ext/tk/lib/tkextlib/tile.rb
index 1c3e6a715..c79866eb1 100644
--- a/ext/tk/lib/tkextlib/tile.rb
+++ b/ext/tk/lib/tkextlib/tile.rb
@@ -45,6 +45,43 @@ module Tk
end
end
+ def self.load_images(imgdir, pat=TkComm::None)
+ images = Hash[*TkComm.simplelist(Tk.tk_call('::tile::LoadImages',
+ imgdir, pat))]
+ images.keys.each{|k|
+ images[k] = TkPhotoImage.new(:imagename=>images[k],
+ :without_creating=>true)
+ }
+
+ images
+ end
+
+ def self.style(*args)
+ args.map!{|arg| TkComm._get_eval_string(arg)}.join('.')
+ end
+
+ module KeyNav
+ def self.enableMnemonics(w)
+ Tk.tk_call('::keynav::enableMnemonics', w)
+ end
+ def self.defaultButton(w)
+ Tk.tk_call('::keynav::defaultButton', w)
+ end
+ end
+
+ module Font
+ Default = 'TkDefaultFont'
+ Text = 'TkTextFont'
+ Heading = 'TkHeadingFont'
+ Caption = 'TkCaptionFont'
+ Tooltip = 'TkTooltipFont'
+
+ Fixed = 'TkFixedFont'
+ Menu = 'TkMenuFont'
+ SmallCaption = 'TkSmallCaptionFont'
+ Icon = 'TkIconFont'
+ end
+
module TileWidget
def instate(state, script=nil, &b)
if script
@@ -84,12 +121,17 @@ module Tk
autoload :TNotebook, 'tkextlib/tile/tnotebook'
+ autoload :TPaned, 'tkextlib/tile/tpaned'
+
autoload :TProgressbar, 'tkextlib/tile/tprogressbar'
autoload :TRadioButton, 'tkextlib/tile/tradiobutton'
autoload :TRadiobutton, 'tkextlib/tile/tradiobutton'
- autoload :TScrollbar, 'tkextlib/tile/tsrollbar'
+ autoload :TScale, 'tkextlib/tile/tscale'
+ autoload :TProgress, 'tkextlib/tile/tscale'
+
+ autoload :TScrollbar, 'tkextlib/tile/tscrollbar'
autoload :TSeparator, 'tkextlib/tile/tseparator'
diff --git a/ext/tk/lib/tkextlib/tile/style.rb b/ext/tk/lib/tkextlib/tile/style.rb
index c8c0a802d..99b2fd0e7 100644
--- a/ext/tk/lib/tkextlib/tile/style.rb
+++ b/ext/tk/lib/tkextlib/tile/style.rb
@@ -17,7 +17,13 @@ module Tk::Tile::Style
end
class << Tk::Tile::Style
- def default(style, keys=nil)
+ def default(style=nil, keys=nil)
+ if style.kind_of?(Hash)
+ keys = style
+ style = nil
+ end
+ style = '.' unless style
+
if keys && keys != None
tk_call('style', 'default', style, *hash_kv(keys))
else
@@ -25,7 +31,13 @@ class << Tk::Tile::Style
end
end
- def map(style, keys=nil)
+ 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
@@ -33,7 +45,13 @@ class << Tk::Tile::Style
end
end
- def layout(style, spec=nil)
+ 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
@@ -51,9 +69,9 @@ class << Tk::Tile::Style
def theme_create(name, keys=nil)
if keys && keys != None
- tk_call('style', 'theme', 'create', name, type, *hash_kv(keys))
+ tk_call('style', 'theme', 'create', name, *hash_kv(keys))
else
- tk_call('style', 'theme', 'create', name, type)
+ tk_call('style', 'theme', 'create', name)
end
end
diff --git a/ext/tk/lib/tkextlib/tile/tbutton.rb b/ext/tk/lib/tkextlib/tile/tbutton.rb
index 9a6245db8..abce6f660 100644
--- a/ext/tk/lib/tkextlib/tile/tbutton.rb
+++ b/ext/tk/lib/tkextlib/tile/tbutton.rb
@@ -22,4 +22,8 @@ class Tk::Tile::TButton < TkButton
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/ext/tk/lib/tkextlib/tile/tcheckbutton.rb b/ext/tk/lib/tkextlib/tile/tcheckbutton.rb
index aff560b69..6a954b378 100644
--- a/ext/tk/lib/tkextlib/tile/tcheckbutton.rb
+++ b/ext/tk/lib/tkextlib/tile/tcheckbutton.rb
@@ -23,4 +23,8 @@ class Tk::Tile::TCheckButton < TkCheckButton
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/ext/tk/lib/tkextlib/tile/tcombobox.rb b/ext/tk/lib/tkextlib/tile/tcombobox.rb
index 8c1f2e015..4585d19b6 100644
--- a/ext/tk/lib/tkextlib/tile/tcombobox.rb
+++ b/ext/tk/lib/tkextlib/tile/tcombobox.rb
@@ -23,6 +23,10 @@ class Tk::Tile::TCombobox < Tk::Tile::TEntry
WidgetClassName = 'TCombobox'.freeze
WidgetClassNames[WidgetClassName] = self
+ 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
diff --git a/ext/tk/lib/tkextlib/tile/tentry.rb b/ext/tk/lib/tkextlib/tile/tentry.rb
index ad47062f3..2bc137d76 100644
--- a/ext/tk/lib/tkextlib/tile/tentry.rb
+++ b/ext/tk/lib/tkextlib/tile/tentry.rb
@@ -22,4 +22,8 @@ class Tk::Tile::TEntry < TkEntry
end
WidgetClassName = 'TEntry'.freeze
WidgetClassNames[WidgetClassName] = self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
end
diff --git a/ext/tk/lib/tkextlib/tile/tframe.rb b/ext/tk/lib/tkextlib/tile/tframe.rb
index b77049305..8f93cc800 100644
--- a/ext/tk/lib/tkextlib/tile/tframe.rb
+++ b/ext/tk/lib/tkextlib/tile/tframe.rb
@@ -22,4 +22,8 @@ class Tk::Tile::TFrame < TkFrame
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/ext/tk/lib/tkextlib/tile/tlabel.rb b/ext/tk/lib/tkextlib/tile/tlabel.rb
index 256d37670..638ebe11a 100644
--- a/ext/tk/lib/tkextlib/tile/tlabel.rb
+++ b/ext/tk/lib/tkextlib/tile/tlabel.rb
@@ -22,4 +22,8 @@ class Tk::Tile::TLabel < TkLabel
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/ext/tk/lib/tkextlib/tile/tlabelframe.rb b/ext/tk/lib/tkextlib/tile/tlabelframe.rb
index 768539293..536aaa1f5 100644
--- a/ext/tk/lib/tkextlib/tile/tlabelframe.rb
+++ b/ext/tk/lib/tkextlib/tile/tlabelframe.rb
@@ -22,4 +22,8 @@ class Tk::Tile::TLabelframe < Tk::Tile::TFrame
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/ext/tk/lib/tkextlib/tile/tmenubutton.rb b/ext/tk/lib/tkextlib/tile/tmenubutton.rb
index ba3400a51..87980c7fe 100644
--- a/ext/tk/lib/tkextlib/tile/tmenubutton.rb
+++ b/ext/tk/lib/tkextlib/tile/tmenubutton.rb
@@ -22,4 +22,8 @@ class Tk::Tile::TMenubutton < TkMenubutton
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/ext/tk/lib/tkextlib/tile/tnotebook.rb b/ext/tk/lib/tkextlib/tile/tnotebook.rb
index 47338a9f9..540ee7839 100644
--- a/ext/tk/lib/tkextlib/tile/tnotebook.rb
+++ b/ext/tk/lib/tkextlib/tile/tnotebook.rb
@@ -53,8 +53,12 @@ class Tk::Tile::TNotebook < TkWindow
WidgetClassName = 'TNotebook'.freeze
WidgetClassNames[WidgetClassName] = self
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+
def enable_traversal()
- tk_call_without_end('tile::enableNotebookTraversal', @path)
+ tk_call_without_enc('::tile::notebook::enableTraversal', @path)
self
end
diff --git a/ext/tk/lib/tkextlib/tile/tpaned.rb b/ext/tk/lib/tkextlib/tile/tpaned.rb
new file mode 100644
index 000000000..531182d96
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tile/tpaned.rb
@@ -0,0 +1,187 @@
+#
+# tpaned widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TPaned < TkWindow
+ end
+ 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/ext/tk/lib/tkextlib/tile/tprogressbar.rb b/ext/tk/lib/tkextlib/tile/tprogressbar.rb
index f01aeb641..3f47cd9b8 100644
--- a/ext/tk/lib/tkextlib/tile/tprogressbar.rb
+++ b/ext/tk/lib/tkextlib/tile/tprogressbar.rb
@@ -7,7 +7,7 @@ require 'tkextlib/tile.rb'
module Tk
module Tile
- class TProgressbar < TkWidget
+ class TProgressbar < TkWindow
end
end
end
@@ -23,6 +23,10 @@ class Tk::Tile::TProgressbar
WidgetClassName = 'TProgressbar'.freeze
WidgetClassNames[WidgetClassName] = self
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+
def step
tk_send_without_enc('step').to_f
end
diff --git a/ext/tk/lib/tkextlib/tile/tradiobutton.rb b/ext/tk/lib/tkextlib/tile/tradiobutton.rb
index 5066538b8..94e991195 100644
--- a/ext/tk/lib/tkextlib/tile/tradiobutton.rb
+++ b/ext/tk/lib/tkextlib/tile/tradiobutton.rb
@@ -23,4 +23,8 @@ class Tk::Tile::TRadioButton < TkRadioButton
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/ext/tk/lib/tkextlib/tile/treeview.rb b/ext/tk/lib/tkextlib/tile/treeview.rb
index 1a5fa97e2..fcd3c7b48 100644
--- a/ext/tk/lib/tkextlib/tile/treeview.rb
+++ b/ext/tk/lib/tkextlib/tile/treeview.rb
@@ -117,6 +117,10 @@ class Tk::Tile::Treeview < TkWindow
WidgetClassName = 'Treeview'.freeze
WidgetClassNames[WidgetClassName] = self
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+
def tagid(id)
_get_eval_string(id)
end
diff --git a/ext/tk/lib/tkextlib/tile/tscale.rb b/ext/tk/lib/tkextlib/tile/tscale.rb
new file mode 100644
index 000000000..380fe9618
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tile/tscale.rb
@@ -0,0 +1,47 @@
+#
+# 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
+ class TProgress < TScale
+ end
+ 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/ext/tk/lib/tkextlib/tile/tscrollbar.rb b/ext/tk/lib/tkextlib/tile/tscrollbar.rb
index a0e4b10c9..f8b79d922 100644
--- a/ext/tk/lib/tkextlib/tile/tscrollbar.rb
+++ b/ext/tk/lib/tkextlib/tile/tscrollbar.rb
@@ -22,4 +22,8 @@ class Tk::Tile::TScrollbar < TkScrollbar
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/ext/tk/lib/tkextlib/tile/tseparator.rb b/ext/tk/lib/tkextlib/tile/tseparator.rb
index def9d12a4..92f020e70 100644
--- a/ext/tk/lib/tkextlib/tile/tseparator.rb
+++ b/ext/tk/lib/tkextlib/tile/tseparator.rb
@@ -22,4 +22,8 @@ class Tk::Tile::TSeparator < TkWindow
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/ext/tk/lib/tkextlib/tile/tsquare.rb b/ext/tk/lib/tkextlib/tile/tsquare.rb
index ebcbc3c31..308db7872 100644
--- a/ext/tk/lib/tkextlib/tile/tsquare.rb
+++ b/ext/tk/lib/tkextlib/tile/tsquare.rb
@@ -22,4 +22,8 @@ class Tk::Tile::TSquare < TkWindow
end
WidgetClassName = 'TSquare'.freeze
WidgetClassNames[WidgetClassName] = self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
end
diff --git a/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb b/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb
index b9a203575..6d060a117 100644
--- a/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb
+++ b/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb
@@ -91,9 +91,10 @@ class Tk::HTML_Widget
def create_self(keys)
if keys and keys != None
- tk_call_without_enc('html', @path, *hash_kv(keys, true))
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
else
- tk_call_without_enc('html', @path)
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
end
end
private :create_self
diff --git a/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb b/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb
index 136666c4a..c0475f5d5 100644
--- a/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb
+++ b/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb
@@ -531,9 +531,10 @@ class Tk::TreeCtrl
def create_self(keys)
if keys and keys != None
- tk_call_without_enc('treectrl', @path, *hash_kv(keys, true))
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
else
- tk_call_without_enc('treectrl', @path)
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
end
end
private :create_self