summaryrefslogtreecommitdiff
path: root/ext/tk/lib/tkextlib
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-04-09 09:27:54 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-04-09 09:27:54 +0000
commit9e985d3e58ab381d56e8d995ce5021f28b5c3cb2 (patch)
treeda7b85808dea3da6a0eca7a6a553170a27ed191f /ext/tk/lib/tkextlib
parent98d168ffc7331938a2aaaf761768de28f012dc24 (diff)
* ext/tk/lib/tk.rb: update RELEASE_DATE
* ext/tk/lib/tk/image.rb: support to create TkImage object without creating a new image object on Tk. * ext/tk/lib/tk/menu.rb: use TkCommandNames on create_self() * ext/tk/lib/tk/root.rb: TkRoot.to_eval() returns '.'. * ext/tk/lib/tk/text.rb: add methods to create a TkText::IndexString from (x, y) coords. * ext/tk/lib/tkextlib/tile.rb: bug fix and update support status. * ext/tk/lib/tkextlib/tile/*.rb: ditto. * ext/tk/sample/tkextlib/tile: New demo. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tkextlib')
-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
25 files changed, 378 insertions, 21 deletions
diff --git a/ext/tk/lib/tkextlib/SUPPORT_STATUS b/ext/tk/lib/tkextlib/SUPPORT_STATUS
index bf4572b15f..45af92b420 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 89bfeff0f3..342b268c70 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 1d029e4569..fb11da2009 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 da9f1eb3a8..a71aaf8792 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 1c3e6a715d..c79866eb13 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 c8c0a802df..99b2fd0e72 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 9a6245db82..abce6f6604 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 aff560b699..6a954b3789 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 8c1f2e0153..4585d19b6d 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 ad47062f33..2bc137d769 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 b77049305f..8f93cc8004 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 256d37670e..638ebe11a8 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 7685392934..536aaa1f59 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 ba3400a51b..87980c7fe5 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 47338a9f9d..540ee78390 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 0000000000..531182d969
--- /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 f01aeb641b..3f47cd9b8b 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 5066538b87..94e991195d 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 1a5fa97e24..fcd3c7b484 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 0000000000..380fe96187
--- /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 a0e4b10c91..f8b79d9221 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 def9d12a4b..92f020e70b 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 ebcbc3c312..308db78722 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 b9a203575a..6d060a1175 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 136666c4af..c0475f5d5e 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