summaryrefslogtreecommitdiff
path: root/ext/tk/lib/tkextlib/tile
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tk/lib/tkextlib/tile')
-rw-r--r--ext/tk/lib/tkextlib/tile/dialog.rb6
-rw-r--r--ext/tk/lib/tkextlib/tile/sizegrip.rb11
-rw-r--r--ext/tk/lib/tkextlib/tile/style.rb20
-rw-r--r--ext/tk/lib/tkextlib/tile/tbutton.rb9
-rw-r--r--ext/tk/lib/tkextlib/tile/tcheckbutton.rb12
-rw-r--r--ext/tk/lib/tkextlib/tile/tcombobox.rb9
-rw-r--r--ext/tk/lib/tkextlib/tile/tentry.rb9
-rw-r--r--ext/tk/lib/tkextlib/tile/tframe.rb9
-rw-r--r--ext/tk/lib/tkextlib/tile/tlabel.rb9
-rw-r--r--ext/tk/lib/tkextlib/tile/tlabelframe.rb12
-rw-r--r--ext/tk/lib/tkextlib/tile/tmenubutton.rb12
-rw-r--r--ext/tk/lib/tkextlib/tile/tnotebook.rb18
-rw-r--r--ext/tk/lib/tkextlib/tile/tpaned.rb26
-rw-r--r--ext/tk/lib/tkextlib/tile/tprogressbar.rb9
-rw-r--r--ext/tk/lib/tkextlib/tile/tradiobutton.rb12
-rw-r--r--ext/tk/lib/tkextlib/tile/treeview.rb79
-rw-r--r--ext/tk/lib/tkextlib/tile/tscale.rb13
-rw-r--r--ext/tk/lib/tkextlib/tile/tscrollbar.rb21
-rw-r--r--ext/tk/lib/tkextlib/tile/tseparator.rb9
-rw-r--r--ext/tk/lib/tkextlib/tile/tspinbox.rb107
-rw-r--r--ext/tk/lib/tkextlib/tile/tsquare.rb2
21 files changed, 333 insertions, 81 deletions
diff --git a/ext/tk/lib/tkextlib/tile/dialog.rb b/ext/tk/lib/tkextlib/tile/dialog.rb
index ef2d1fe577..b112e6152b 100644
--- a/ext/tk/lib/tkextlib/tile/dialog.rb
+++ b/ext/tk/lib/tkextlib/tile/dialog.rb
@@ -12,6 +12,12 @@ module Tk
end
end
+begin
+ TkPackage.require('ttk::dialog') # this may be required.
+rescue RuntimeError
+ # ignore
+end
+
class Tk::Tile::Dialog
TkCommandNames = ['::ttk::dialog'.freeze].freeze
diff --git a/ext/tk/lib/tkextlib/tile/sizegrip.rb b/ext/tk/lib/tkextlib/tile/sizegrip.rb
index c5068919a4..d7da0a4075 100644
--- a/ext/tk/lib/tkextlib/tile/sizegrip.rb
+++ b/ext/tk/lib/tkextlib/tile/sizegrip.rb
@@ -13,17 +13,20 @@ module Tk
end
end
-Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Sizegrip, :TkSizegrip, :TkSizeGrip)
-
-
class Tk::Tile::SizeGrip < TkWindow
include Tk::Tile::TileWidget
TkCommandNames = ['::ttk::sizegrip'.freeze].freeze
WidgetClassName = 'TSizegrip'.freeze
- WidgetClassNames[WidgetClassName] = self
+ WidgetClassNames[WidgetClassName] ||= self
def self.style(*args)
[self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
end
end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Sizegrip,
+# :TkSizegrip, :TkSizeGrip)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/sizegrip.rb',
+ :Ttk, Tk::Tile::Sizegrip,
+ :TkSizegrip, :TkSizeGrip)
diff --git a/ext/tk/lib/tkextlib/tile/style.rb b/ext/tk/lib/tkextlib/tile/style.rb
index 26d79d378b..f38deda503 100644
--- a/ext/tk/lib/tkextlib/tile/style.rb
+++ b/ext/tk/lib/tkextlib/tile/style.rb
@@ -233,6 +233,8 @@ class << Tk::Tile::Style
def element_create(name, type, *args)
if type == 'image' || type == :image
element_create_image(name, *args)
+ elsif type == 'vsapi' || type == :vsapi
+ element_create_vsapi(name, *args)
else
tk_call(TkCommandNames[0], 'element', 'create', name, type, *args)
end
@@ -279,6 +281,24 @@ class << Tk::Tile::Style
end
end
+ def element_create_vsapi(name, class_name, part_id, *args)
+ # supported on Tcl/Tk 8.6 or later
+
+ # argument check
+ if (state_map = args.shift || None)
+ if state_map.kind_of?(Hash)
+ opts = _symbolkey2str(state_map)
+ state_map = None
+ end
+ end
+ opts = args.shift || None
+ fail ArgumentError, "too many arguments" unless args.empty?
+
+ # define a Microsoft Visual Styles element
+ tk_call(TkCommandNames[0], 'element', 'create', name, 'vsapi',
+ class_name, part_id, state_map, opts)
+ end
+
def element_names()
list(tk_call(TkCommandNames[0], 'element', 'names'))
end
diff --git a/ext/tk/lib/tkextlib/tile/tbutton.rb b/ext/tk/lib/tkextlib/tile/tbutton.rb
index 5d7db10fe9..c852024842 100644
--- a/ext/tk/lib/tkextlib/tile/tbutton.rb
+++ b/ext/tk/lib/tkextlib/tile/tbutton.rb
@@ -13,9 +13,6 @@ module Tk
end
end
-Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Button, :TkButton)
-
-
class Tk::Tile::TButton < Tk::Button
include Tk::Tile::TileWidget
@@ -25,9 +22,13 @@ class Tk::Tile::TButton < Tk::Button
TkCommandNames = ['::tbutton'.freeze].freeze
end
WidgetClassName = 'TButton'.freeze
- WidgetClassNames[WidgetClassName] = self
+ WidgetClassNames[WidgetClassName] ||= self
def self.style(*args)
[self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
end
end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Button, :TkButton)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tbutton.rb',
+ :Ttk, Tk::Tile::Button, :TkButton)
diff --git a/ext/tk/lib/tkextlib/tile/tcheckbutton.rb b/ext/tk/lib/tkextlib/tile/tcheckbutton.rb
index ca79d89e58..01751ede0f 100644
--- a/ext/tk/lib/tkextlib/tile/tcheckbutton.rb
+++ b/ext/tk/lib/tkextlib/tile/tcheckbutton.rb
@@ -15,10 +15,6 @@ module Tk
end
end
-Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Checkbutton,
- :TkCheckbutton, :TkCheckButton)
-
-
class Tk::Tile::TCheckButton < Tk::CheckButton
include Tk::Tile::TileWidget
@@ -28,9 +24,15 @@ class Tk::Tile::TCheckButton < Tk::CheckButton
TkCommandNames = ['::tcheckbutton'.freeze].freeze
end
WidgetClassName = 'TCheckbutton'.freeze
- WidgetClassNames[WidgetClassName] = self
+ WidgetClassNames[WidgetClassName] ||= self
def self.style(*args)
[self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
end
end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Checkbutton,
+# :TkCheckbutton, :TkCheckButton)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tcheckbutton.rb',
+ :Ttk, Tk::Tile::Checkbutton,
+ :TkCheckbutton, :TkCheckButton)
diff --git a/ext/tk/lib/tkextlib/tile/tcombobox.rb b/ext/tk/lib/tkextlib/tile/tcombobox.rb
index b64372f1c9..b5ab827e2d 100644
--- a/ext/tk/lib/tkextlib/tile/tcombobox.rb
+++ b/ext/tk/lib/tkextlib/tile/tcombobox.rb
@@ -13,9 +13,6 @@ module Tk
end
end
-Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Combobox, :TkCombobox)
-
-
class Tk::Tile::TCombobox < Tk::Tile::TEntry
include Tk::Tile::TileWidget
@@ -25,7 +22,7 @@ class Tk::Tile::TCombobox < Tk::Tile::TEntry
TkCommandNames = ['::tcombobox'.freeze].freeze
end
WidgetClassName = 'TCombobox'.freeze
- WidgetClassNames[WidgetClassName] = self
+ WidgetClassNames[WidgetClassName] ||= self
def __boolval_optkeys
super() << 'exportselection'
@@ -52,3 +49,7 @@ class Tk::Tile::TCombobox < Tk::Tile::TEntry
tk_send('set', val)
end
end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Combobox, :TkCombobox)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tcombobox.rb',
+ :Ttk, Tk::Tile::Combobox, :TkCombobox)
diff --git a/ext/tk/lib/tkextlib/tile/tentry.rb b/ext/tk/lib/tkextlib/tile/tentry.rb
index 0bea98dcd9..8d2633a774 100644
--- a/ext/tk/lib/tkextlib/tile/tentry.rb
+++ b/ext/tk/lib/tkextlib/tile/tentry.rb
@@ -13,9 +13,6 @@ module Tk
end
end
-Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Entry, :TkEntry)
-
-
class Tk::Tile::TEntry < Tk::Entry
include Tk::Tile::TileWidget
@@ -25,7 +22,7 @@ class Tk::Tile::TEntry < Tk::Entry
TkCommandNames = ['::tentry'.freeze].freeze
end
WidgetClassName = 'TEntry'.freeze
- WidgetClassNames[WidgetClassName] = self
+ WidgetClassNames[WidgetClassName] ||= self
def __optkey_aliases
{:vcmd=>:validatecommand, :invcmd=>:invalidcommand}
@@ -46,3 +43,7 @@ class Tk::Tile::TEntry < Tk::Entry
[self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
end
end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Entry, :TkEntry)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tentry.rb',
+ :Ttk, Tk::Tile::Entry, :TkEntry)
diff --git a/ext/tk/lib/tkextlib/tile/tframe.rb b/ext/tk/lib/tkextlib/tile/tframe.rb
index 3b5f98bb6e..d6d4312628 100644
--- a/ext/tk/lib/tkextlib/tile/tframe.rb
+++ b/ext/tk/lib/tkextlib/tile/tframe.rb
@@ -13,9 +13,6 @@ module Tk
end
end
-Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Frame, :TkFrame)
-
-
class Tk::Tile::TFrame < Tk::Frame
include Tk::Tile::TileWidget
@@ -25,9 +22,13 @@ class Tk::Tile::TFrame < Tk::Frame
TkCommandNames = ['::tframe'.freeze].freeze
end
WidgetClassName = 'TFrame'.freeze
- WidgetClassNames[WidgetClassName] = self
+ WidgetClassNames[WidgetClassName] ||= self
def self.style(*args)
[self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
end
end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Frame, :TkFrame)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tframe.rb',
+ :Ttk, Tk::Tile::Frame, :TkFrame)
diff --git a/ext/tk/lib/tkextlib/tile/tlabel.rb b/ext/tk/lib/tkextlib/tile/tlabel.rb
index 7d074d3842..55b98acc68 100644
--- a/ext/tk/lib/tkextlib/tile/tlabel.rb
+++ b/ext/tk/lib/tkextlib/tile/tlabel.rb
@@ -13,9 +13,6 @@ module Tk
end
end
-Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Label, :TkLabel)
-
-
class Tk::Tile::TLabel < Tk::Label
include Tk::Tile::TileWidget
@@ -25,9 +22,13 @@ class Tk::Tile::TLabel < Tk::Label
TkCommandNames = ['::tlabel'.freeze].freeze
end
WidgetClassName = 'TLabel'.freeze
- WidgetClassNames[WidgetClassName] = self
+ WidgetClassNames[WidgetClassName] ||= self
def self.style(*args)
[self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
end
end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Label, :TkLabel)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tlabel.rb',
+ :Ttk, Tk::Tile::Label, :TkLabel)
diff --git a/ext/tk/lib/tkextlib/tile/tlabelframe.rb b/ext/tk/lib/tkextlib/tile/tlabelframe.rb
index 9f4a11990c..a34c98583f 100644
--- a/ext/tk/lib/tkextlib/tile/tlabelframe.rb
+++ b/ext/tk/lib/tkextlib/tile/tlabelframe.rb
@@ -15,10 +15,6 @@ module Tk
end
end
-Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Labelframe,
- :TkLabelframe, :TkLabelFrame)
-
-
class Tk::Tile::TLabelframe < Tk::Tile::TFrame
include Tk::Tile::TileWidget
@@ -28,9 +24,15 @@ class Tk::Tile::TLabelframe < Tk::Tile::TFrame
TkCommandNames = ['::tlabelframe'.freeze].freeze
end
WidgetClassName = 'TLabelframe'.freeze
- WidgetClassNames[WidgetClassName] = self
+ WidgetClassNames[WidgetClassName] ||= self
def self.style(*args)
[self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
end
end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Labelframe,
+# :TkLabelframe, :TkLabelFrame)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tlabelframe.rb',
+ :Ttk, Tk::Tile::Labelframe,
+ :TkLabelframe, :TkLabelFrame)
diff --git a/ext/tk/lib/tkextlib/tile/tmenubutton.rb b/ext/tk/lib/tkextlib/tile/tmenubutton.rb
index 5612fb47eb..1cf553ec8c 100644
--- a/ext/tk/lib/tkextlib/tile/tmenubutton.rb
+++ b/ext/tk/lib/tkextlib/tile/tmenubutton.rb
@@ -15,10 +15,6 @@ module Tk
end
end
-Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Menubutton,
- :TkMenubutton, :TkMenuButton)
-
-
class Tk::Tile::TMenubutton < Tk::Menubutton
include Tk::Tile::TileWidget
@@ -28,9 +24,15 @@ class Tk::Tile::TMenubutton < Tk::Menubutton
TkCommandNames = ['::tmenubutton'.freeze].freeze
end
WidgetClassName = 'TMenubutton'.freeze
- WidgetClassNames[WidgetClassName] = self
+ WidgetClassNames[WidgetClassName] ||= self
def self.style(*args)
[self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
end
end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Menubutton,
+# :TkMenubutton, :TkMenuButton)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tmenubutton.rb',
+ :Ttk, Tk::Tile::Menubutton,
+ :TkMenubutton, :TkMenuButton)
diff --git a/ext/tk/lib/tkextlib/tile/tnotebook.rb b/ext/tk/lib/tkextlib/tile/tnotebook.rb
index d02e05b211..9e27e2c1fd 100644
--- a/ext/tk/lib/tkextlib/tile/tnotebook.rb
+++ b/ext/tk/lib/tkextlib/tile/tnotebook.rb
@@ -13,9 +13,6 @@ module Tk
end
end
-Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Notebook, :TkNotebook)
-
-
class Tk::Tile::TNotebook < TkWindow
################################
include TkItemConfigMethod
@@ -46,8 +43,11 @@ class Tk::Tile::TNotebook < TkWindow
alias tabconfiginfo itemconfiginfo
alias current_tabconfiginfo current_itemconfiginfo
+ def tabcget_tkstring(tagOrId, option)
+ tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{option}")), false, true)[-1]
+ end
def tabcget_strict(tagOrId, option)
- tabconfigure(tagOrId, option)[-1]
+ tabconfiginfo(tagOrId, option)[-1]
end
def tabcget(tagOrId, option)
unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
@@ -80,7 +80,7 @@ class Tk::Tile::TNotebook < TkWindow
TkCommandNames = ['::tnotebook'.freeze].freeze
end
WidgetClassName = 'TNotebook'.freeze
- WidgetClassNames[WidgetClassName] = self
+ WidgetClassNames[WidgetClassName] ||= self
def self.style(*args)
[self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
@@ -111,6 +111,10 @@ class Tk::Tile::TNotebook < TkWindow
self
end
+ def hide(idx)
+ tk_send('hide', idx)
+ end
+
def index(idx)
number(tk_send('index', idx))
end
@@ -137,3 +141,7 @@ class Tk::Tile::TNotebook < TkWindow
list(tk_send('tabs'))
end
end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Notebook, :TkNotebook)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tnotebook.rb',
+ :Ttk, Tk::Tile::Notebook, :TkNotebook)
diff --git a/ext/tk/lib/tkextlib/tile/tpaned.rb b/ext/tk/lib/tkextlib/tile/tpaned.rb
index aff6cac4bb..d6ad234559 100644
--- a/ext/tk/lib/tkextlib/tile/tpaned.rb
+++ b/ext/tk/lib/tkextlib/tile/tpaned.rb
@@ -13,10 +13,6 @@ module Tk
end
end
-Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Panedwindow,
- :TkPanedwindow, :TkPanedWindow)
-
-
class Tk::Tile::TPaned < TkWindow
include Tk::Tile::TileWidget
@@ -30,7 +26,7 @@ class Tk::Tile::TPaned < TkWindow
TkCommandNames = ['::tpaned'.freeze].freeze
end
WidgetClassName = 'TPaned'.freeze
- WidgetClassNames[WidgetClassName] = self
+ WidgetClassNames[WidgetClassName] ||= self
def self.style(*args)
[self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
@@ -66,6 +62,12 @@ class Tk::Tile::TPaned < TkWindow
self
end
+ def panecget_tkstring(pane, slot)
+ pane = _epath(pane)
+ tk_send_without_enc('pane', pane, "-#{slot}")
+ end
+ alias pane_cget_tkstring panecget_tkstring
+
def panecget_strict(pane, slot)
pane = _epath(pane)
tk_tcl2ruby(tk_send_without_enc('pane', pane, "-#{slot}"))
@@ -221,11 +223,23 @@ class Tk::Tile::TPaned < TkWindow
end
alias current_pane_configinfo current_paneconfiginfo
+ def panes
+ tk_split_simplelist(tk_send_without_enc('panes')).map{|w|
+ (obj = window(w))? obj: w
+ }
+ end
+
def identify(x, y)
- list(tk_send_without_enc('identify', x, y))
+ num_or_nil(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
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Panedwindow,
+# :TkPanedwindow, :TkPanedWindow)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tpaned.rb',
+ :Ttk, Tk::Tile::Panedwindow,
+ :TkPanedwindow, :TkPanedWindow)
diff --git a/ext/tk/lib/tkextlib/tile/tprogressbar.rb b/ext/tk/lib/tkextlib/tile/tprogressbar.rb
index f786d370dd..0c9d15e1b9 100644
--- a/ext/tk/lib/tkextlib/tile/tprogressbar.rb
+++ b/ext/tk/lib/tkextlib/tile/tprogressbar.rb
@@ -13,9 +13,6 @@ module Tk
end
end
-Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Progressbar, :TkProgressbar)
-
-
class Tk::Tile::TProgressbar
include Tk::Tile::TileWidget
@@ -25,7 +22,7 @@ class Tk::Tile::TProgressbar
TkCommandNames = ['::tprogressbar'.freeze].freeze
end
WidgetClassName = 'TProgressbar'.freeze
- WidgetClassNames[WidgetClassName] = self
+ WidgetClassNames[WidgetClassName] ||= self
def self.style(*args)
[self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
@@ -54,3 +51,7 @@ class Tk::Tile::TProgressbar
end
end
end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Progressbar, :TkProgressbar)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tprogressbar.rb',
+ :Ttk, Tk::Tile::Progressbar, :TkProgressbar)
diff --git a/ext/tk/lib/tkextlib/tile/tradiobutton.rb b/ext/tk/lib/tkextlib/tile/tradiobutton.rb
index 72e72170cb..5dbf260666 100644
--- a/ext/tk/lib/tkextlib/tile/tradiobutton.rb
+++ b/ext/tk/lib/tkextlib/tile/tradiobutton.rb
@@ -15,10 +15,6 @@ module Tk
end
end
-Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Radiobutton,
- :TkRadiobutton, :TkRadioButton)
-
-
class Tk::Tile::TRadioButton < Tk::RadioButton
include Tk::Tile::TileWidget
@@ -28,9 +24,15 @@ class Tk::Tile::TRadioButton < Tk::RadioButton
TkCommandNames = ['::tradiobutton'.freeze].freeze
end
WidgetClassName = 'TRadiobutton'.freeze
- WidgetClassNames[WidgetClassName] = self
+ WidgetClassNames[WidgetClassName] ||= self
def self.style(*args)
[self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
end
end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Radiobutton,
+# :TkRadiobutton, :TkRadioButton)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tradiobutton.rb',
+ :Ttk, Tk::Tile::Radiobutton,
+ :TkRadiobutton, :TkRadioButton)
diff --git a/ext/tk/lib/tkextlib/tile/treeview.rb b/ext/tk/lib/tkextlib/tile/treeview.rb
index 2046be8a69..70db3d6d78 100644
--- a/ext/tk/lib/tkextlib/tile/treeview.rb
+++ b/ext/tk/lib/tkextlib/tile/treeview.rb
@@ -12,9 +12,6 @@ module Tk
end
end
-Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Treeview, :TkTreeview)
-
-
module Tk::Tile::TreeviewConfig
include TkItemConfigMethod
@@ -519,16 +516,20 @@ module Tk::Tile::TreeviewConfig
end
end
+ alias __itemcget_tkstring itemcget_tkstring
alias __itemcget itemcget
alias __itemcget_strict itemcget_strict
alias __itemconfigure itemconfigure
alias __itemconfiginfo itemconfiginfo
alias __current_itemconfiginfo current_itemconfiginfo
- private :__itemcget, :__itemcget_strict
+ private :__itemcget_tkstring, :__itemcget, :__itemcget_strict
private :__itemconfigure, :__itemconfiginfo, :__current_itemconfiginfo
# Treeview Item
+ def itemcget_tkstring(tagOrId, option)
+ __itemcget_tkstring([:item, tagOrId], option)
+ end
def itemcget(tagOrId, option)
__itemcget([:item, tagOrId], option)
end
@@ -546,6 +547,9 @@ module Tk::Tile::TreeviewConfig
end
# Treeview Column
+ def columncget_tkstring(tagOrId, option)
+ __itemcget_tkstring([:column, tagOrId], option)
+ end
def columncget(tagOrId, option)
__itemcget([:column, tagOrId], option)
end
@@ -561,6 +565,7 @@ module Tk::Tile::TreeviewConfig
def current_columnconfiginfo(tagOrId, slot=nil)
__current_itemconfiginfo([:column, tagOrId], slot)
end
+ alias column_cget_tkstring columncget_tkstring
alias column_cget columncget
alias column_cget_strict columncget_strict
alias column_configure columnconfigure
@@ -568,6 +573,19 @@ module Tk::Tile::TreeviewConfig
alias current_column_configinfo current_columnconfiginfo
# Treeview Heading
+ def headingcget_tkstring(tagOrId, option)
+ if __tile_specific_item_optkeys([:heading, tagOrId]).index(option.to_s)
+ begin
+ # On tile-0.7.{2-8}, 'state' options has no '-' at its head.
+ tk_call(*(__item_cget_cmd([:heading, tagOrId]) << option.to_s))
+ rescue
+ # Maybe, 'state' option has '-' in future.
+ tk_call(*(__item_cget_cmd([:heading, tagOrId]) << "-#{option}"))
+ end
+ else
+ __itemcget_tkstring([:heading, tagOrId], option)
+ end
+ end
def headingcget_strict(tagOrId, option)
if __tile_specific_item_optkeys([:heading, tagOrId]).index(option.to_s)
begin
@@ -630,6 +648,7 @@ module Tk::Tile::TreeviewConfig
def current_headingconfiginfo(tagOrId, slot=nil)
__current_itemconfiginfo([:heading, tagOrId], slot)
end
+ alias heading_cget_tkstring headingcget_tkstring
alias heading_cget headingcget
alias heading_cget_strict headingcget_strict
alias heading_configure headingconfigure
@@ -637,6 +656,9 @@ module Tk::Tile::TreeviewConfig
alias current_heading_configinfo current_headingconfiginfo
# Treeview Tag
+ def tagcget_tkstring(tagOrId, option)
+ __itemcget_tkstring([:tag, :configure, tagOrId], option)
+ end
def tagcget(tagOrId, option)
__itemcget([:tag, :configure, tagOrId], option)
end
@@ -652,6 +674,7 @@ module Tk::Tile::TreeviewConfig
def current_tagconfiginfo(tagOrId, slot=nil)
__current_itemconfiginfo([:tag, :configure, tagOrId], slot)
end
+ alias tag_cget_tkstring tagcget_tkstring
alias tag_cget tagcget
alias tag_cget_strict tagcget_strict
alias tag_configure tagconfigure
@@ -737,6 +760,9 @@ class Tk::Tile::Treeview::Item < TkObject
@id
end
+ def cget_tkstring(option)
+ @t.itemcget_tkstring(@id, option)
+ end
def cget(option)
@t.itemcget(@id, option)
end
@@ -769,6 +795,11 @@ class Tk::Tile::Treeview::Item < TkObject
self
end
+ def tag_has?(tag)
+ @t.tag_has?(tag, @id)
+ end
+ alias has_tag? tag_has?
+
def bbox(column=None)
@t.bbox(@id, column)
end
@@ -907,7 +938,7 @@ class Tk::Tile::Treeview::Tag < TkObject
TagID_TBL = TkCore::INTERP.create_table
- (Tag_ID = ['tile_treeview_tag'.freeze, '00000'.taint]).instance_eval{
+ (Tag_ID = ['tile_treeview_tag'.freeze, TkUtil.untrust('00000')]).instance_eval{
@mutex = Mutex.new
def mutex; @mutex; end
freeze
@@ -950,6 +981,11 @@ class Tk::Tile::Treeview::Tag < TkObject
@id
end
+ def tag_has?(item)
+ @t.tag_has?(@id, item)
+ end
+ alias added? tag_has?
+
def bind(seq, *args)
if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
@@ -979,6 +1015,9 @@ class Tk::Tile::Treeview::Tag < TkObject
@t.tag_bindinfo(@id, seq)
end
+ def cget_tkstring(option)
+ @t.tagcget_tkstring(@id, option)
+ end
def cget(option)
@t.tagcget(@id, option)
end
@@ -1014,7 +1053,7 @@ class Tk::Tile::Treeview < TkWindow
TkCommandNames = ['::treeview'.freeze].freeze
end
WidgetClassName = 'Treeview'.freeze
- WidgetClassNames[WidgetClassName] = self
+ WidgetClassNames[WidgetClassName] ||= self
def __destroy_hook__
Tk::Tile::Treeview::Item::ItemID_TBL.mutex.synchronize{
@@ -1098,14 +1137,29 @@ class Tk::Tile::Treeview < TkWindow
end
end
+ def identify_region(x, y)
+ tk_send('identify', 'region', x, y)
+ end
+
+ def identify_item(x, y)
+ id = tk_send('identify', 'item', x, y)
+ (id.empty?)? nil: Tk::Tile::Treeview::Item.id2obj(self, id)
+ end
+
+ def identify_element(x, y)
+ tk_send('identify', 'element', x, y)
+ end
+
def row_identify(x, y)
id = tk_send('identify', 'row', x, y)
(id.empty?)? nil: Tk::Tile::Treeview::Item.id2obj(self, id)
end
+ alias identify_row row_identify
def column_identify(x, y)
tk_send('identify', 'column', x, y)
end
+ alias identify_column column_identify
def index(item)
number(tk_send('index', item))
@@ -1204,6 +1258,15 @@ class Tk::Tile::Treeview < TkWindow
self
end
+ def tag_has?(tag, item)
+ bool(tk_send('tag', 'has', tagid(tag), tagid(item)))
+ end
+ def tag_has(tag)
+ tk_split_simplelist(tk_send('tag', 'has', tagid(tag))).collect{|id|
+ Tk::Tile::Treeview::Item.id2obj(self, id)
+ }
+ end
+
def tag_bind(tag, seq, *args)
if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
@@ -1237,3 +1300,7 @@ class Tk::Tile::Treeview < TkWindow
end
alias tagbindinfo tag_bindinfo
end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Treeview, :TkTreeview)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/treeview.rb',
+ :Ttk, Tk::Tile::Treeview, :TkTreeview)
diff --git a/ext/tk/lib/tkextlib/tile/tscale.rb b/ext/tk/lib/tkextlib/tile/tscale.rb
index 2c46fd9bd4..7eefcef731 100644
--- a/ext/tk/lib/tkextlib/tile/tscale.rb
+++ b/ext/tk/lib/tkextlib/tile/tscale.rb
@@ -17,9 +17,6 @@ module Tk
end
end
-Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Scale, :TkScale)
-
-
class Tk::Tile::TScale < Tk::Scale
include Tk::Tile::TileWidget
@@ -29,11 +26,13 @@ class Tk::Tile::TScale < Tk::Scale
TkCommandNames = ['::tscale'.freeze].freeze
end
WidgetClassName = 'TScale'.freeze
- WidgetClassNames[WidgetClassName] = self
+ WidgetClassNames[WidgetClassName] ||= self
def self.style(*args)
[self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
end
+
+ alias identify ttk_identify
end
class Tk::Tile::TProgress < Tk::Tile::TScale
@@ -45,9 +44,13 @@ class Tk::Tile::TProgress < Tk::Tile::TScale
TkCommandNames = ['::tprogress'.freeze].freeze
end
WidgetClassName = 'TProgress'.freeze
- WidgetClassNames[WidgetClassName] = self
+ WidgetClassNames[WidgetClassName] ||= self
def self.style(*args)
[self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
end
end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Scale, :TkScale)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tscale.rb',
+ :Ttk, Tk::Tile::Scale, :TkScale)
diff --git a/ext/tk/lib/tkextlib/tile/tscrollbar.rb b/ext/tk/lib/tkextlib/tile/tscrollbar.rb
index 163b8f4713..c6bba5810b 100644
--- a/ext/tk/lib/tkextlib/tile/tscrollbar.rb
+++ b/ext/tk/lib/tkextlib/tile/tscrollbar.rb
@@ -13,9 +13,6 @@ module Tk
end
end
-Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Scrollbar, :TkScrollbar)
-
-
class Tk::Tile::TScrollbar < Tk::Scrollbar
include Tk::Tile::TileWidget
@@ -25,13 +22,21 @@ class Tk::Tile::TScrollbar < Tk::Scrollbar
TkCommandNames = ['::tscrollbar'.freeze].freeze
end
WidgetClassName = 'TScrollbar'.freeze
- WidgetClassNames[WidgetClassName] = self
+ WidgetClassNames[WidgetClassName] ||= self
def self.style(*args)
[self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
end
+
+ alias identify ttk_identify
end
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Scrollbar, :TkScrollbar)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tscrollbar.rb',
+ :Ttk, Tk::Tile::Scrollbar, :TkScrollbar)
+
+#######################################################################
+
class Tk::Tile::XScrollbar < Tk::Tile::TScrollbar
def create_self(keys)
keys = {} unless keys
@@ -50,5 +55,9 @@ class Tk::Tile::YScrollbar < Tk::Tile::TScrollbar
private :create_self
end
-Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::XScrollbar, :TkXScrollbar)
-Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::YScrollbar, :TkYScrollbar)
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::XScrollbar, :TkXScrollbar)
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::YScrollbar, :TkYScrollbar)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tscrollbar.rb',
+ :Ttk, Tk::Tile::XScrollbar, :TkXScrollbar)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tscrollbar.rb',
+ :Ttk, Tk::Tile::YScrollbar, :TkYScrollbar)
diff --git a/ext/tk/lib/tkextlib/tile/tseparator.rb b/ext/tk/lib/tkextlib/tile/tseparator.rb
index 30fae2c525..ffd2f6f89f 100644
--- a/ext/tk/lib/tkextlib/tile/tseparator.rb
+++ b/ext/tk/lib/tkextlib/tile/tseparator.rb
@@ -13,9 +13,6 @@ module Tk
end
end
-Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Separator, :TkSeparator)
-
-
class Tk::Tile::TSeparator < TkWindow
include Tk::Tile::TileWidget
@@ -25,9 +22,13 @@ class Tk::Tile::TSeparator < TkWindow
TkCommandNames = ['::tseparator'.freeze].freeze
end
WidgetClassName = 'TSeparator'.freeze
- WidgetClassNames[WidgetClassName] = self
+ WidgetClassNames[WidgetClassName] ||= self
def self.style(*args)
[self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
end
end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Separator, :TkSeparator)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tseparator.rb',
+ :Ttk, Tk::Tile::Separator, :TkSeparator)
diff --git a/ext/tk/lib/tkextlib/tile/tspinbox.rb b/ext/tk/lib/tkextlib/tile/tspinbox.rb
new file mode 100644
index 0000000000..2f2d73c5ab
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tile/tspinbox.rb
@@ -0,0 +1,107 @@
+#
+# ttk::spinbox widget (Tcl/Tk 8.6b1 or later)
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TSpinbox < Tk::Tile::TEntry
+ end
+ Spinbox = TSpinbox
+ end
+end
+
+class Tk::Tile::TSpinbox < Tk::Tile::TEntry
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::spinbox'.freeze].freeze
+ else
+ TkCommandNames = ['::tspinbox'.freeze].freeze
+ end
+ WidgetClassName = 'TSpinbox'.freeze
+ WidgetClassNames[WidgetClassName] ||= self
+
+ class SpinCommand < TkValidateCommand
+ class ValidateArgs < TkUtil::CallbackSubst
+ KEY_TBL = [
+ [ ?d, ?s, :direction ],
+ [ ?s, ?e, :current ],
+ [ ?W, ?w, :widget ],
+ nil
+ ]
+
+ PROC_TBL = [
+ [ ?s, TkComm.method(:string) ],
+ [ ?w, TkComm.method(:window) ],
+
+ [ ?e, proc{|val|
+ #enc = Tk.encoding
+ enc = ((Tk.encoding)? Tk.encoding : Tk.encoding_system)
+ if enc
+ Tk.fromUTF8(TkComm::string(val), enc)
+ else
+ TkComm::string(val)
+ end
+ }
+ ],
+
+ nil
+ ]
+
+ _setup_subst_table(KEY_TBL, PROC_TBL);
+
+ def self.ret_val(val)
+ (val)? '1': '0'
+ end
+ end
+
+ def self._config_keys
+ ['command']
+ end
+ end
+
+ def __validation_class_list
+ super() << SpinCommand
+ end
+
+ Tk::ValidateConfigure.__def_validcmd(binding, SpinCommand)
+
+ def __boolval_optkeys
+ super() << 'wrap'
+ end
+ private :__boolval_optkeys
+
+ def __strval_optkeys
+ super() << 'buttonbackground' << 'format'
+ end
+ private :__strval_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'))
+ end
+ def current=(idx)
+ tk_send('current', idx)
+ end
+
+ def set(val)
+ tk_send('set', val)
+ end
+
+ alias identify ttk_identify
+end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Spinbox, :TkSpinbox)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tspinbox.rb',
+ :Ttk, Tk::Tile::Spinbox, :TkSpinbox)
diff --git a/ext/tk/lib/tkextlib/tile/tsquare.rb b/ext/tk/lib/tkextlib/tile/tsquare.rb
index 600b55e4e7..a81cd7b98a 100644
--- a/ext/tk/lib/tkextlib/tile/tsquare.rb
+++ b/ext/tk/lib/tkextlib/tile/tsquare.rb
@@ -22,7 +22,7 @@ class Tk::Tile::TSquare < TkWindow
TkCommandNames = ['::tsquare'.freeze].freeze
end
WidgetClassName = 'TSquare'.freeze
- WidgetClassNames[WidgetClassName] = self
+ WidgetClassNames[WidgetClassName] ||= self
def self.style(*args)
[self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')