diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-23 05:22:13 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-23 05:22:13 +0000 |
commit | 61a68941b1d22973dfb832e0575596d53f3e31b4 (patch) | |
tree | ad2e6871fc4bd6e4bfbfe2aa71b888e51a4b2261 /ext/tk/lib/tkextlib | |
parent | 280f8df3706176fac38ef42e3fc79d30ac6e1e16 (diff) |
Merge from ruby_1_8. Add files that have not been added yet.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tkextlib')
37 files changed, 479 insertions, 50 deletions
diff --git a/ext/tk/lib/tkextlib/blt/component.rb b/ext/tk/lib/tkextlib/blt/component.rb index dd387634ee..b2005b2f2b 100644 --- a/ext/tk/lib/tkextlib/blt/component.rb +++ b/ext/tk/lib/tkextlib/blt/component.rb @@ -85,6 +85,9 @@ module Tk::BLT def axis_cget(id, option) ret = itemcget(['axis', tagid(id)], option) end + def axis_cget_strict(id, option) + ret = itemcget_strict(['axis', tagid(id)], option) + end def axis_configure(*args) slot = args.pop if slot.kind_of?(Hash) @@ -118,6 +121,9 @@ module Tk::BLT def crosshairs_cget(option) itemcget('crosshairs', option) end + def crosshairs_cget_strict(option) + itemcget_strict('crosshairs', option) + end def crosshairs_configure(slot, value=None) itemconfigure('crosshairs', slot, value) end @@ -131,6 +137,9 @@ module Tk::BLT def element_cget(id, option) itemcget(['element', tagid(id)], option) end + def element_cget_strict(id, option) + itemcget_strict(['element', tagid(id)], option) + end def element_configure(*args) slot = args.pop if slot.kind_of?(Hash) @@ -152,6 +161,9 @@ module Tk::BLT def bar_cget(id, option) itemcget(['bar', tagid(id)], option) end + def bar_cget_strict(id, option) + itemcget_strict(['bar', tagid(id)], option) + end def bar_configure(*args) slot = args.pop if slot.kind_of?(Hash) @@ -173,6 +185,9 @@ module Tk::BLT def line_cget(id, option) itemcget(['line', tagid(id)], option) end + def line_cget_strict(id, option) + itemcget_strict(['line', tagid(id)], option) + end def line_configure(*args) slot = args.pop if slot.kind_of?(Hash) @@ -194,6 +209,9 @@ module Tk::BLT def gridline_cget(option) itemcget('grid', option) end + def gridline_cget_strict(option) + itemcget_strict('grid', option) + end def gridline_configure(slot, value=None) itemconfigure('grid', slot, value) end @@ -207,6 +225,9 @@ module Tk::BLT def legend_cget(option) itemcget('legend', option) end + def legend_cget_strict(option) + itemcget_strict('legend', option) + end def legend_configure(slot, value=None) itemconfigure('legend', slot, value) end @@ -220,6 +241,9 @@ module Tk::BLT def pen_cget(id, option) itemcget(['pen', tagid(id)], option) end + def pen_cget_strict(id, option) + itemcget_strict(['pen', tagid(id)], option) + end def pen_configure(*args) slot = args.pop if slot.kind_of?(Hash) @@ -241,6 +265,9 @@ module Tk::BLT def postscript_cget(option) itemcget('postscript', option) end + def postscript_cget_strict(option) + itemcget_strict('postscript', option) + end def postscript_configure(slot, value=None) itemconfigure('postscript', slot, value) end @@ -254,6 +281,9 @@ module Tk::BLT def marker_cget(id, option) itemcget(['marker', tagid(id)], option) end + def marker_cget_strict(id, option) + itemcget_strict(['marker', tagid(id)], option) + end def marker_configure(*args) slot = args.pop if slot.kind_of?(Hash) @@ -273,11 +303,12 @@ module Tk::BLT end alias __itemcget itemcget + alias __itemcget_strict itemcget_strict alias __itemconfiginfo itemconfiginfo alias __current_itemconfiginfo current_itemconfiginfo private :__itemcget, :__itemconfiginfo, :__current_itemconfiginfo - def itemcget(tagOrId, option) + def itemcget_strict(tagOrId, option) ret = __itemcget(tagid(tagOrId), option) if option == 'bindtags' || option == :bindtags ret.collect{|tag| TkBindTag.id2obj(tag)} @@ -285,6 +316,27 @@ module Tk::BLT ret end end + def itemcget(tagOrId, option) + unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__ + itemcget_strict(tagOrId, option) + else + begin + itemcget_strict(tagOrId, option) + rescue => e + begin + if current_itemconfiginfo(tagOrId).has_key?(option.to_s) + # error on known option + fail e + else + # unknown option + nil + end + rescue + fail e # tag error + end + end + end + end def itemconfiginfo(tagOrId, slot = nil) ret = __itemconfiginfo(tagid(tagOrId), slot) @@ -321,8 +373,8 @@ module Tk::BLT ret end - private :itemcget, :itemconfigure - private :itemconfiginfo, :current_itemconfiginfo + private :itemcget, :itemcget_strict + private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo ################# @@ -428,6 +480,9 @@ module Tk::BLT def cget(option) @chart.axis_cget(@id, option) end + def cget_strict(option) + @chart.axis_cget_strict(@id, option) + end def configure(key, value=None) @chart.axis_configure(@id, key, value) self @@ -530,6 +585,9 @@ module Tk::BLT def cget(option) @chart.crosshair_cget(option) end + def cget_strict(option) + @chart.crosshair_cget_strict(option) + end def configure(key, value=None) @chart.crosshair_configure(key, value) self @@ -675,6 +733,9 @@ module Tk::BLT # @chart.element_cget(@id, option) @chart.__send__(@typename + '_cget', @id, option) end + def cget_strict(option) + @chart.__send__(@typename + '_cget_strict', @id, option) + end def configure(key, value=None) # @chart.element_configure(@id, key, value) @chart.__send__(@typename + '_configure', @id, key, value) @@ -775,6 +836,9 @@ module Tk::BLT def cget(option) @chart.gridline_cget(option) end + def cget_strict(option) + @chart.gridline_cget_strict(option) + end def configure(key, value=None) @chart.gridline_configure(key, value) self @@ -846,6 +910,9 @@ module Tk::BLT def cget(option) @chart.legend_cget(option) end + def cget_strict(option) + @chart.legend_cget_strict(option) + end def configure(key, value=None) @chart.legend_configure(key, value) self @@ -972,6 +1039,9 @@ module Tk::BLT def cget(option) @chart.pen_cget(@id, option) end + def cget_strict(option) + @chart.pen_cget_strict(@id, option) + end def configure(key, value=None) @chart.pen_configure(@id, key, value) self @@ -1039,6 +1109,9 @@ module Tk::BLT def cget(option) @chart.postscript_cget(option) end + def cget_strict(option) + @chart.postscript_cget_strict(option) + end def configure(key, value=None) @chart.postscript_configure(key, value) self @@ -1117,6 +1190,13 @@ module Tk::BLT fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey) } + __item_optkey_aliases(nil).each{|alias_name, real_name| + alias_name = alias_name.to_s + if keys.has_key?(alias_name) + keys[real_name.to_s] = keys.delete(alias_name) + end + } + __item_methodcall_optkeys(nil).each{|key| key = key.to_s methodkeys[key] = keys.delete(key) if keys.key?(key) @@ -1192,6 +1272,9 @@ module Tk::BLT def cget(option) @chart.marker_cget(@id, option) end + def cget_strict(option) + @chart.marker_cget_strict(@id, option) + end def configure(key, value=None) @chart.marker_configure(@id, key, value) self @@ -1774,6 +1857,9 @@ module Tk::BLT def xaxis_cget(option) itemcget('xaxis', option) end + def xaxis_cget_strict(option) + itemcget_strict('xaxis', option) + end def xaxis_configure(slot, value=None) if slot.kind_of?(Hash) slot = _symbolkey2str(slot) @@ -1843,6 +1929,9 @@ module Tk::BLT def x2axis_cget(option) itemcget('x2axis', option) end + def x2axis_cget_strict(option) + itemcget_strict('x2axis', option) + end def x2axis_configure(slot, value=None) if slot.kind_of?(Hash) slot = _symbolkey2str(slot) @@ -1912,6 +2001,9 @@ module Tk::BLT def yaxis_cget(option) itemcget('yaxis', option) end + def yaxis_cget_strict(option) + itemcget_strict('yaxis', option) + end def yaxis_configure(slot, value=None) if slot.kind_of?(Hash) slot = _symbolkey2str(slot) @@ -1981,6 +2073,9 @@ module Tk::BLT def y2axis_cget(option) itemcget('y2axis', option) end + def y2axis_cget_strict(option) + itemcget_strict('y2axis', option) + end def y2axis_configure(slot, value=None) if slot.kind_of?(Hash) slot = _symbolkey2str(slot) diff --git a/ext/tk/lib/tkextlib/blt/htext.rb b/ext/tk/lib/tkextlib/blt/htext.rb index a0cf3dc036..0d9cb30185 100644 --- a/ext/tk/lib/tkextlib/blt/htext.rb +++ b/ext/tk/lib/tkextlib/blt/htext.rb @@ -22,6 +22,7 @@ module Tk::BLT WidgetClassNames[WidgetClassName] = self alias window_cget itemcget + alias window_cget_strict itemcget_strict alias window_configure itemconfigure alias window_configuinfo itemconfiginfo alias current_window_configuinfo current_itemconfiginfo diff --git a/ext/tk/lib/tkextlib/blt/table.rb b/ext/tk/lib/tkextlib/blt/table.rb index 0be9d8d42a..dfa10269ed 100644 --- a/ext/tk/lib/tkextlib/blt/table.rb +++ b/ext/tk/lib/tkextlib/blt/table.rb @@ -29,6 +29,9 @@ module Tk::BLT def blt_table_cget(*args) Tk::BLT::Table.cget(self, *args) end + def blt_table_cget_strict(*args) + Tk::BLT::Table.cget_strict(self, *args) + end def blt_table_configure(*args) Tk::BLT::Table.configure(self, *args) @@ -92,6 +95,9 @@ module Tk::BLT def blt_table_itemcget(*args) Tk::BLT::Table.itemcget(self, *args) end + def blt_table_itemcget_strict(*args) + Tk::BLT::Table.itemcget_strict(self, *args) + end def blt_table_itemconfigure(*args) Tk::BLT::Table.itemconfigure(self, *args) @@ -136,12 +142,13 @@ class << Tk::BLT::Table private :__item_pathname alias __itemcget itemcget + alias __itemcget_strict itemcget_strict alias __itemconfigure itemconfigure alias __itemconfiginfo itemconfiginfo alias __current_itemconfiginfo current_itemconfiginfo - private :__itemcget, :__itemconfigure - private :__itemconfiginfo, :__current_itemconfiginfo + private :__itemcget, :__itemcget_strict + private :__itemconfigure, :__itemconfiginfo, :__current_itemconfiginfo def __boolval_optkeys super() << 'propagate' @@ -176,6 +183,9 @@ class << Tk::BLT::Table def cget(container, option) __itemcget([container], option) end + def cget_strict(container, option) + __itemcget_strict([container], option) + end def configure(container, *args) __itemconfigure([container], *args) @@ -192,6 +202,9 @@ class << Tk::BLT::Table def itemcget(container, item, option) __itemcget([container, tagid(item)], option) end + def itemcget_strict(container, item, option) + __itemcget_strict([container, tagid(item)], option) + end def itemconfigure(container, *args) if args[-1].kind_of?(Hash) diff --git a/ext/tk/lib/tkextlib/blt/tabset.rb b/ext/tk/lib/tkextlib/blt/tabset.rb index 1a0f312c4c..ca81ad8f95 100644 --- a/ext/tk/lib/tkextlib/blt/tabset.rb +++ b/ext/tk/lib/tkextlib/blt/tabset.rb @@ -128,6 +128,9 @@ module Tk::BLT def cget(*args) @t.tab_cget(@id, *args) end + def cget_strict(*args) + @t.tab_cget_strict(@id, *args) + end def configure(*args) @t.tab_configure(@id, *args) end @@ -240,6 +243,7 @@ module Tk::BLT private :__item_pathname alias tab_cget itemcget + alias tab_cget_strict itemcget_strict alias tab_configure itemconfigure alias tab_configinfo itemconfiginfo alias current_tab_configinfo current_itemconfiginfo diff --git a/ext/tk/lib/tkextlib/blt/ted.rb b/ext/tk/lib/tkextlib/blt/ted.rb index 8b727c1eec..670265fc78 100644 --- a/ext/tk/lib/tkextlib/blt/ted.rb +++ b/ext/tk/lib/tkextlib/blt/ted.rb @@ -30,12 +30,15 @@ module Tk::BLT end private :__item_config_cmd - private :itemcget, :itemconfigure - private :itemconfiginfo, :current_itemconfiginfo + private :itemcget, :itemcget_strict + private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo def cget(master, option) itemcget(master, option) end + def cget_strict(master, option) + itemcget_strict(master, option) + end def configure(master, slot, value=None) itemconfigure(master, slot, value) end diff --git a/ext/tk/lib/tkextlib/blt/treeview.rb b/ext/tk/lib/tkextlib/blt/treeview.rb index 672869bfa2..c5a5697186 100644 --- a/ext/tk/lib/tkextlib/blt/treeview.rb +++ b/ext/tk/lib/tkextlib/blt/treeview.rb @@ -98,6 +98,9 @@ module Tk::BLT::Treeview::ConfigMethod def column_cget(name, option) itemcget(['column', name], option) end + def column_cget_strict(name, option) + itemcget_strict(['column', name], option) + end def column_configure(name, slot, value=None) itemconfigure(['column', name], slot, value) end @@ -111,6 +114,9 @@ module Tk::BLT::Treeview::ConfigMethod def button_cget(option) itemcget('button', option) end + def button_cget_strict(option) + itemcget_strict('button', option) + end def button_configure(slot, value=None) itemconfigure('button', slot, value) end @@ -129,6 +135,14 @@ module Tk::BLT::Treeview::ConfigMethod ret end end + def entry_cget_strict(option) + ret = itemcget_strict('entry', option) + if option == 'bindtags' || option == :bindtags + ret.collect{|tag| TkBindTag.id2obj(tag)} + else + ret + end + end def entry_configure(slot, value=None) itemconfigure('entry', slot, value) end @@ -170,6 +184,9 @@ module Tk::BLT::Treeview::ConfigMethod def sort_cget(option) itemcget('sort', option) end + def sort_cget_strict(option) + itemcget_strict('sort', option) + end def sort_configure(slot, value=None) itemconfigure('sort', slot, value) end @@ -183,6 +200,9 @@ module Tk::BLT::Treeview::ConfigMethod def text_cget(option) itemcget('text', option) end + def text_cget_strict(option) + itemcget_strict('text', option) + end def text_configure(slot, value=None) itemconfigure('text', slot, value) end @@ -193,8 +213,8 @@ module Tk::BLT::Treeview::ConfigMethod current_itemconfiginfo('text', slot) end - private :itemcget, :itemconfigure - private :itemconfiginfo, :current_itemconfiginfo + private :itemcget, :itemcget_strict + private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo end class Tk::BLT::Treeview diff --git a/ext/tk/lib/tkextlib/blt/unix_dnd.rb b/ext/tk/lib/tkextlib/blt/unix_dnd.rb index 7a994233a2..445002d7a5 100644 --- a/ext/tk/lib/tkextlib/blt/unix_dnd.rb +++ b/ext/tk/lib/tkextlib/blt/unix_dnd.rb @@ -30,12 +30,15 @@ module Tk::BLT end private :__item_config_cmd - private :itemcget, :itemconfigure - private :itemconfiginfo, :current_itemconfiginfo + private :itemcget, :itemcget_strict + private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo def cget(win, option) itemcget(['cget', win], option) end + def cget_strict(win, option) + itemcget_strict(['cget', win], option) + end def configure(win, slot, value=None) itemconfigure(['configure', win], slot, value) end @@ -49,6 +52,9 @@ module Tk::BLT def token_cget(win, option) itemcget(['token', 'cget', win], option) end + def token_cget_strict(win, option) + itemcget_strict(['token', 'cget', win], option) + end def token_configure(win, slot, value=None) itemconfigure(['token', 'configure', win], slot, value) end diff --git a/ext/tk/lib/tkextlib/blt/watch.rb b/ext/tk/lib/tkextlib/blt/watch.rb index 2daf417e0b..219ff78e97 100644 --- a/ext/tk/lib/tkextlib/blt/watch.rb +++ b/ext/tk/lib/tkextlib/blt/watch.rb @@ -146,7 +146,7 @@ module Tk::BLT end end end - def cget(key) + def cget_strict(key) key = key.to_s begin info.assoc(key)[1] @@ -154,5 +154,22 @@ module Tk::BLT fail ArgumentError, "unknown option '#{key}'" end end + def cget(key) + unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__ + cget_strict(key) + else + begin + cget_strict(key) + rescue => e + if current_configinfo.has_key?(key.to_s) + # error on known option + fail e + else + # unknown option + nil + end + end + end + end end end diff --git a/ext/tk/lib/tkextlib/bwidget/dialog.rb b/ext/tk/lib/tkextlib/bwidget/dialog.rb index 0ddee21d05..291ca4a962 100644 --- a/ext/tk/lib/tkextlib/bwidget/dialog.rb +++ b/ext/tk/lib/tkextlib/bwidget/dialog.rb @@ -59,6 +59,13 @@ class Tk::BWidget::Dialog end end + def cget_strict(slot) + if slot.to_s == 'relative' + super('parent') + else + super(slot) + end + end def cget(slot) if slot.to_s == 'relative' super('parent') diff --git a/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb b/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb index 224304f2ab..846e58062d 100644 --- a/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb +++ b/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb @@ -34,6 +34,13 @@ module Tk::BWidget::DynamicHelp ['DynamicHelp::configure'] end + def self.cget_strict(slot) + slot = slot.to_s + info = {} + self.current_configinfo.each{|k,v| info[k.to_s] = v if k.to_s == slot} + fail RuntimeError, "unknown option \"-#{slot}\"" if info.empty? + info.values[0] + end def self.cget(slot) self.current_configinfo(slot).values[0] end diff --git a/ext/tk/lib/tkextlib/bwidget/listbox.rb b/ext/tk/lib/tkextlib/bwidget/listbox.rb index d8cd72fec2..093fcb6fb3 100644 --- a/ext/tk/lib/tkextlib/bwidget/listbox.rb +++ b/ext/tk/lib/tkextlib/bwidget/listbox.rb @@ -297,6 +297,9 @@ class Tk::BWidget::ListBox::Item def cget(key) @listbox.itemcget(@id, key) end + def cget_strict(key) + @listbox.itemcget_strict(@id, key) + end def configure(key, val=None) @listbox.itemconfigure(@id, key, val) diff --git a/ext/tk/lib/tkextlib/bwidget/messagedlg.rb b/ext/tk/lib/tkextlib/bwidget/messagedlg.rb index cc8a996f46..b88461baf7 100644 --- a/ext/tk/lib/tkextlib/bwidget/messagedlg.rb +++ b/ext/tk/lib/tkextlib/bwidget/messagedlg.rb @@ -65,6 +65,17 @@ class Tk::BWidget::MessageDlg end @keys[slot] end + def cget_strict(slot) + slot = slot.to_s + if slot == 'relative' + slot = 'parent' + end + if winfo_exist? + val = super(slot) + @keys[slot] = val + end + @keys[slot] + end def configure(slot, value=None) if winfo_exist? diff --git a/ext/tk/lib/tkextlib/bwidget/tree.rb b/ext/tk/lib/tkextlib/bwidget/tree.rb index 7a46db575e..aed4512a73 100644 --- a/ext/tk/lib/tkextlib/bwidget/tree.rb +++ b/ext/tk/lib/tkextlib/bwidget/tree.rb @@ -358,6 +358,9 @@ class Tk::BWidget::Tree::Node def cget(key) @tree.itemcget(@id, key) end + def cget_strict(key) + @tree.itemcget_strict(@id, key) + end def configure(key, val=None) @tree.itemconfigure(@id, key, val) diff --git a/ext/tk/lib/tkextlib/bwidget/widget.rb b/ext/tk/lib/tkextlib/bwidget/widget.rb index 34e51308a5..a93364b567 100644 --- a/ext/tk/lib/tkextlib/bwidget/widget.rb +++ b/ext/tk/lib/tkextlib/bwidget/widget.rb @@ -29,6 +29,13 @@ module Tk::BWidget::Widget ['Widget::configure'] end + def self.cget_strict(slot) + slot = slot.to_s + info = {} + self.current_configinfo.each{|k,v| info[k.to_s] = v if k.to_s == slot} + fail RuntimeError, "unknown option \"-#{slot}\"" if info.empty? + info.values[0] + end def self.cget(slot) self.current_configinfo(slot).values[0] end @@ -105,9 +112,12 @@ module Tk::BWidget::Widget tk_call('Widget::setoption', win, option, value) end - def self.sub_cget(win, subwidget) + def self.sub_cget_strict(win, subwidget) tk_call('Widget::subcget', win, subwidget) end + def self.sub_cget(win, subwidget) + self.sub_cget_strict(win, subwidget) + end def self.sync_options(klass, subclass, subpath, options) tk_call('Widget::syncoptions', klass, subclass, subpath, options) diff --git a/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb b/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb index a055e07ac9..05d58c386f 100644 --- a/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb @@ -47,12 +47,13 @@ class Tk::Iwidgets::Buttonbox end alias buttoncget itemcget + alias buttoncget_strict itemcget_strict alias buttonconfigure itemconfigure alias buttonconfiginfo itemconfiginfo alias current_buttonconfiginfo current_itemconfiginfo - private :itemcget, :itemconfigure - private :itemconfiginfo, :current_itemconfiginfo + private :itemcget, :itemcget_strict + private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo #################################### diff --git a/ext/tk/lib/tkextlib/iwidgets/checkbox.rb b/ext/tk/lib/tkextlib/iwidgets/checkbox.rb index 7d2b41f806..c85d356c55 100644 --- a/ext/tk/lib/tkextlib/iwidgets/checkbox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/checkbox.rb @@ -47,12 +47,13 @@ class Tk::Iwidgets::Checkbox end alias buttoncget itemcget + alias buttoncget_strict itemcget_strict alias buttonconfigure itemconfigure alias buttonconfiginfo itemconfiginfo alias current_buttonconfiginfo current_itemconfiginfo - private :itemcget, :itemconfigure - private :itemconfiginfo, :current_itemconfiginfo + private :itemcget, :itemcget_strict + private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo #################################### diff --git a/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb b/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb index d6c668621d..8d43cc07ab 100644 --- a/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb +++ b/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb @@ -47,12 +47,13 @@ class Tk::Iwidgets::Dialogshell end alias buttoncget itemcget + alias buttoncget_strict itemcget_strict alias buttonconfigure itemconfigure alias buttonconfiginfo itemconfiginfo alias current_buttonconfiginfo current_itemconfiginfo - private :itemcget, :itemconfigure - private :itemconfiginfo, :current_itemconfiginfo + private :itemcget, :itemcget_strict + private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo #################################### diff --git a/ext/tk/lib/tkextlib/iwidgets/menubar.rb b/ext/tk/lib/tkextlib/iwidgets/menubar.rb index dea3d34c2a..5aaefbe50d 100644 --- a/ext/tk/lib/tkextlib/iwidgets/menubar.rb +++ b/ext/tk/lib/tkextlib/iwidgets/menubar.rb @@ -62,12 +62,13 @@ class Tk::Iwidgets::Menubar end alias menucget itemcget + alias menucget_strict itemcget_strict alias menuconfigure itemconfigure alias menuconfiginfo itemconfiginfo alias current_menuconfiginfo current_itemconfiginfo - private :itemcget, :itemconfigure - private :itemconfiginfo, :current_itemconfiginfo + private :itemcget, :itemcget_strict + private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo #################################### diff --git a/ext/tk/lib/tkextlib/iwidgets/messagebox.rb b/ext/tk/lib/tkextlib/iwidgets/messagebox.rb index 2bbbec7666..98ac32900c 100644 --- a/ext/tk/lib/tkextlib/iwidgets/messagebox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/messagebox.rb @@ -47,12 +47,13 @@ class Tk::Iwidgets::Messagebox private :__item_boolval_optkeys alias typecget itemcget + alias typecget_strict itemcget_strict alias typeconfigure itemconfigure alias typeconfiginfo itemconfiginfo alias current_typeconfiginfo current_itemconfiginfo - private :itemcget, :itemconfigure - private :itemconfiginfo, :current_itemconfiginfo + private :itemcget, :itemcget_strict + private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo #################################### diff --git a/ext/tk/lib/tkextlib/iwidgets/notebook.rb b/ext/tk/lib/tkextlib/iwidgets/notebook.rb index 268452afec..03b50633df 100644 --- a/ext/tk/lib/tkextlib/iwidgets/notebook.rb +++ b/ext/tk/lib/tkextlib/iwidgets/notebook.rb @@ -42,12 +42,13 @@ class Tk::Iwidgets::Notebook end alias pagecget itemcget + alias pagecget_strict itemcget_strict alias pageconfigure itemconfigure alias pageconfiginfo itemconfiginfo alias current_pageconfiginfo current_itemconfiginfo - private :itemcget, :itemconfigure - private :itemconfiginfo, :current_itemconfiginfo + private :itemcget, :itemcget_strict + private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo #################################### diff --git a/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb b/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb index 035df0a5b8..3bf73d69fe 100644 --- a/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb +++ b/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb @@ -42,12 +42,13 @@ class Tk::Iwidgets::Panedwindow end alias panecget itemcget + alias panecget_strict itemcget_strict alias paneconfigure itemconfigure alias paneconfiginfo itemconfiginfo alias current_paneconfiginfo current_itemconfiginfo - private :itemcget, :itemconfigure - private :itemconfiginfo, :current_itemconfiginfo + private :itemcget, :itemcget_strict + private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo #################################### diff --git a/ext/tk/lib/tkextlib/iwidgets/radiobox.rb b/ext/tk/lib/tkextlib/iwidgets/radiobox.rb index cfcbca1aad..e9d9521252 100644 --- a/ext/tk/lib/tkextlib/iwidgets/radiobox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/radiobox.rb @@ -47,12 +47,13 @@ class Tk::Iwidgets::Radiobox end alias buttoncget itemcget + alias buttoncget_strict itemcget_strict alias buttonconfigure itemconfigure alias buttonconfiginfo itemconfiginfo alias current_buttonconfiginfo current_itemconfiginfo - private :itemcget, :itemconfigure - private :itemconfiginfo, :current_itemconfiginfo + private :itemcget, :itemcget_strict + private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo #################################### diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb index d85f232b37..d6436d202a 100644 --- a/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb +++ b/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb @@ -116,7 +116,7 @@ class Tk::Iwidgets::Scrolledtext get('-displaychars', *index) end - def image_cget(index, slot) + def image_cget_strict(index, slot) case slot.to_s when 'text', 'label', 'show', 'data', 'file' _fromUTF8(tk_send_without_enc('image', 'cget', @@ -127,6 +127,27 @@ class Tk::Iwidgets::Scrolledtext "-#{slot}"))) end end + def image_cget(index, slot) + unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__ + image_cget_strict(index, slot) + else + begin + image_cget_strict(index, slot) + rescue => e + begin + if current_image_configinfo.has_key?(slot.to_s) + # error on known option + fail e + else + # unknown option + nil + end + rescue + fail e # tag error + end + end + end + end def image_configure(index, slot, value=None) if slot.kind_of? Hash diff --git a/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb b/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb index 382604102e..dbb90e5102 100644 --- a/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb +++ b/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb @@ -47,12 +47,13 @@ class Tk::Iwidgets::Tabnotebook end alias pagecget itemcget + alias pagecget_strict itemcget_strict alias pageconfigure itemconfigure alias pageconfiginfo itemconfiginfo alias current_pageconfiginfo current_itemconfiginfo - private :itemcget, :itemconfigure - private :itemconfiginfo, :current_itemconfiginfo + private :itemcget, :itemcget_strict + private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo #################################### diff --git a/ext/tk/lib/tkextlib/iwidgets/tabset.rb b/ext/tk/lib/tkextlib/iwidgets/tabset.rb index 618260e8e3..300ba9dee0 100644 --- a/ext/tk/lib/tkextlib/iwidgets/tabset.rb +++ b/ext/tk/lib/tkextlib/iwidgets/tabset.rb @@ -42,12 +42,13 @@ class Tk::Iwidgets::Tabset end alias tabcget itemcget + alias tabcget_strict itemcget_strict alias tabconfigure itemconfigure alias tabconfiginfo itemconfiginfo alias current_tabconfiginfo current_itemconfiginfo - private :itemcget, :itemconfigure - private :itemconfiginfo, :current_itemconfiginfo + private :itemcget, :itemcget_strict + private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo #################################### diff --git a/ext/tk/lib/tkextlib/tcllib/getstring.rb b/ext/tk/lib/tkextlib/tcllib/getstring.rb index bf5e54e8cf..fc5d8b26d9 100644 --- a/ext/tk/lib/tkextlib/tcllib/getstring.rb +++ b/ext/tk/lib/tkextlib/tcllib/getstring.rb @@ -87,7 +87,7 @@ class Tk::Tcllib::GetString_Dialog @variable.value end - def cget(slot) + def cget_strict(slot) slot = slot.to_s if slot == 'text' @text @@ -95,6 +95,9 @@ class Tk::Tcllib::GetString_Dialog @keys[slot] end end + def cget(slot) + cget_strict(slot) + end def configure(slot, value=None) if slot.kind_of?(Hash) diff --git a/ext/tk/lib/tkextlib/tcllib/swaplist.rb b/ext/tk/lib/tkextlib/tcllib/swaplist.rb index 97de0a27c1..1c813e36da 100644 --- a/ext/tk/lib/tkextlib/tcllib/swaplist.rb +++ b/ext/tk/lib/tkextlib/tcllib/swaplist.rb @@ -90,7 +90,7 @@ class Tk::Tcllib::Swaplist_Dialog end alias selected value - def cget(slot) + def cget_strict(slot) slot = slot.to_s if slot == 'complete_list' @complete_list @@ -100,6 +100,9 @@ class Tk::Tcllib::Swaplist_Dialog @keys[slot] end end + def cget(slot) + cget_strict(slot) + end def configure(slot, value=None) if slot.kind_of?(Hash) diff --git a/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb b/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb index a939a58331..d7a6c97210 100644 --- a/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb +++ b/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb @@ -70,6 +70,9 @@ module Tk::Tcllib::TablelistItemConfig def cell_cget(tagOrId, option) itemcget(['cell', tagOrId], option) end + def cell_cget_strict(tagOrId, option) + itemcget_strict(['cell', tagOrId], option) + end def cell_configure(tagOrId, slot, value=None) itemconfigure(['cell', tagOrId], slot, value) end @@ -80,6 +83,7 @@ module Tk::Tcllib::TablelistItemConfig current_itemconfiginfo(['cell', tagOrId], slot) end alias cellcget cell_cget + alias cellcget_strict cell_cget_strict alias cellconfigure cell_configure alias cellconfiginfo cell_configinfo alias current_cellconfiginfo current_cell_configinfo @@ -87,6 +91,9 @@ module Tk::Tcllib::TablelistItemConfig def column_cget(tagOrId, option) itemcget(['column', tagOrId], option) end + def column_cget_strict(tagOrId, option) + itemcget_strict(['column', tagOrId], option) + end def column_configure(tagOrId, slot, value=None) itemconfigure(['column', tagOrId], slot, value) end @@ -97,6 +104,7 @@ module Tk::Tcllib::TablelistItemConfig current_itemconfiginfo(['column', tagOrId], slot) end alias columncget column_cget + alias columncget_strict column_cget_strict alias columnconfigure column_configure alias columnconfiginfo column_configinfo alias current_columnconfiginfo current_column_configinfo @@ -104,6 +112,9 @@ module Tk::Tcllib::TablelistItemConfig def row_cget(tagOrId, option) itemcget(['row', tagOrId], option) end + def row_cget_strict(tagOrId, option) + itemcget_strict(['row', tagOrId], option) + end def row_configure(tagOrId, slot, value=None) itemconfigure(['row', tagOrId], slot, value) end @@ -114,12 +125,13 @@ module Tk::Tcllib::TablelistItemConfig current_itemconfiginfo(['row', tagOrId], slot) end alias rowcget row_cget + alias rowcget_strict row_cget_strict alias rowconfigure row_configure alias rowconfiginfo row_configinfo alias current_rowconfiginfo current_row_configinfo - private :itemcget, :itemconfigure - private :itemconfiginfo, :current_itemconfiginfo + private :itemcget, :itemcget_strict + private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo end class Tk::Tcllib::Tablelist diff --git a/ext/tk/lib/tkextlib/tile/dialog.rb b/ext/tk/lib/tkextlib/tile/dialog.rb index b10378d7de..ef2d1fe577 100644 --- a/ext/tk/lib/tkextlib/tile/dialog.rb +++ b/ext/tk/lib/tkextlib/tile/dialog.rb @@ -54,9 +54,21 @@ class Tk::Tile::Dialog window(tk_call_without_enc('::ttk::dialog::clientframe', @path)) end + def cget_strict(slot) + @keys[slot.to_s] + end + def cget(slot) + @keys[slot.to_s] + end +=begin def cget(slot) - @keys[slot] + unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__ + cget_strict(slot) + else + cget_strict(slot) rescue nil + end end +=end def configure(slot, value=None) if slot.kind_of?(Hash) diff --git a/ext/tk/lib/tkextlib/tile/tentry.rb b/ext/tk/lib/tkextlib/tile/tentry.rb index 4b221fcb88..0bea98dcd9 100644 --- a/ext/tk/lib/tkextlib/tile/tentry.rb +++ b/ext/tk/lib/tkextlib/tile/tentry.rb @@ -27,6 +27,11 @@ class Tk::Tile::TEntry < Tk::Entry WidgetClassName = 'TEntry'.freeze WidgetClassNames[WidgetClassName] = self + def __optkey_aliases + {:vcmd=>:validatecommand, :invcmd=>:invalidcommand} + end + private :__optkey_aliases + def __boolval_optkeys super() << 'exportselection' end diff --git a/ext/tk/lib/tkextlib/tile/tnotebook.rb b/ext/tk/lib/tkextlib/tile/tnotebook.rb index 075059d5cc..4d65e363da 100644 --- a/ext/tk/lib/tkextlib/tile/tnotebook.rb +++ b/ext/tk/lib/tkextlib/tile/tnotebook.rb @@ -41,13 +41,35 @@ class Tk::Tile::TNotebook < TkWindow private :__item_methodcall_optkeys #alias tabcget itemcget + #alias tabcget_strict itemcget_strict alias tabconfigure itemconfigure alias tabconfiginfo itemconfiginfo alias current_tabconfiginfo current_itemconfiginfo - def tabcget(tagOrId, option) + def tabcget_strict(tagOrId, option) tabconfigure(tagOrId, option)[-1] end + def tabcget(tagOrId, option) + unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__ + tabcget_strict(tagOrId, option) + else + begin + tabcget_strict(tagOrId, option) + rescue => e + begin + if current_tabconfiginfo(tagOrId).has_key?(option.to_s) + # not tag error & option is known -> error on known option + fail e + else + # not tag error & option is unknown + nil + end + rescue + fail e # tag error + end + end + end + end ################################ include Tk::Tile::TileWidget diff --git a/ext/tk/lib/tkextlib/tile/tpaned.rb b/ext/tk/lib/tkextlib/tile/tpaned.rb index f24b12e92e..d96ff43973 100644 --- a/ext/tk/lib/tkextlib/tile/tpaned.rb +++ b/ext/tk/lib/tkextlib/tile/tpaned.rb @@ -66,10 +66,33 @@ class Tk::Tile::TPaned < TkWindow self end - def panecget(pane, slot) + def panecget_strict(pane, slot) pane = _epath(pane) tk_tcl2ruby(tk_send_without_enc('pane', pane, "-#{slot}")) end + alias pane_cget_strict panecget_strict + + def panecget(pane, slot) + unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__ + panecget_strict(pane, slot) + else + begin + panecget_strict(pane, slot) + rescue => e + begin + if current_paneconfiginfo(pane).has_key?(slot.to_s) + # not tag error & option is known -> error on known option + fail e + else + # not tag error & option is unknown + nil + end + rescue + fail e # tag error + end + end + end + end alias pane_cget panecget def paneconfigure(pane, key, value=nil) diff --git a/ext/tk/lib/tkextlib/tile/treeview.rb b/ext/tk/lib/tkextlib/tile/treeview.rb index 7f31b9c233..c978a1a07b 100644 --- a/ext/tk/lib/tkextlib/tile/treeview.rb +++ b/ext/tk/lib/tkextlib/tile/treeview.rb @@ -33,6 +33,12 @@ module Tk::Tile::TreeviewConfig else if slot slot = slot.to_s + + alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot} + if real_name + slot = real_name.to_s + end + case slot when /^(#{__tile_specific_item_optkeys(tagid(tagOrId)).join('|')})$/ begin @@ -198,6 +204,12 @@ module Tk::Tile::TreeviewConfig else if slot slot = slot.to_s + + alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot} + if real_name + slot = real_name.to_s + end + case slot when /^(#{__tile_specific_item_optkeys(tagid(tagOrId)).join('|')})$/ begin @@ -508,17 +520,21 @@ module Tk::Tile::TreeviewConfig end alias __itemcget itemcget + alias __itemcget_strict itemcget_strict alias __itemconfigure itemconfigure alias __itemconfiginfo itemconfiginfo alias __current_itemconfiginfo current_itemconfiginfo - private :__itemcget, :__itemconfigure - private :__itemconfiginfo, :__current_itemconfiginfo + private :__itemcget, :__itemcget_strict + private :__itemconfigure, :__itemconfiginfo, :__current_itemconfiginfo # Treeview Item def itemcget(tagOrId, option) __itemcget([:item, tagOrId], option) end + def itemcget_strict(tagOrId, option) + __itemcget_strict([:item, tagOrId], option) + end def itemconfigure(tagOrId, slot, value=None) __itemconfigure([:item, tagOrId], slot, value) end @@ -533,6 +549,9 @@ module Tk::Tile::TreeviewConfig def columncget(tagOrId, option) __itemcget([:column, tagOrId], option) end + def columncget_strict(tagOrId, option) + __itemcget_strict([:column, tagOrId], option) + end def columnconfigure(tagOrId, slot, value=None) __itemconfigure([:column, tagOrId], slot, value) end @@ -543,12 +562,13 @@ module Tk::Tile::TreeviewConfig __current_itemconfiginfo([:column, tagOrId], slot) end alias column_cget columncget + alias column_cget_strict columncget_strict alias column_configure columnconfigure alias column_configinfo columnconfiginfo alias current_column_configinfo current_columnconfiginfo # Treeview Heading - def headingcget(tagOrId, option) + def headingcget_strict(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. @@ -558,7 +578,28 @@ module Tk::Tile::TreeviewConfig tk_call(*(__item_cget_cmd([:heading, tagOrId]) << "-#{option}")) end else - __itemcget([:heading, tagOrId], option) + __itemcget_strict([:heading, tagOrId], option) + end + end + def headingcget(tagOrId, option) + unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__ + headingcget_strict(tagOrId, option) + else + begin + headingcget_strict(tagOrId, option) + rescue => e + begin + if current_headingconfiginfo(tagOrId).has_key?(option.to_s) + # not tag error & option is known -> error on known option + fail e + else + # not tag error & option is unknown + nil + end + rescue + fail e # tag error + end + end end end def headingconfigure(tagOrId, slot, value=None) @@ -590,6 +631,7 @@ module Tk::Tile::TreeviewConfig __current_itemconfiginfo([:heading, tagOrId], slot) end alias heading_cget headingcget + alias heading_cget_strict headingcget_strict alias heading_configure headingconfigure alias heading_configinfo headingconfiginfo alias current_heading_configinfo current_headingconfiginfo @@ -598,6 +640,9 @@ module Tk::Tile::TreeviewConfig def tagcget(tagOrId, option) __itemcget([:tag, tagOrId], option) end + def tagcget_strict(tagOrId, option) + __itemcget_strict([:tag, tagOrId], option) + end def tagconfigure(tagOrId, slot, value=None) __itemconfigure([:tag, tagOrId], slot, value) end @@ -608,6 +653,7 @@ module Tk::Tile::TreeviewConfig __current_itemconfiginfo([:tag, tagOrId], slot) end alias tag_cget tagcget + alias tag_cget_strict tagcget_strict alias tag_configure tagconfigure alias tag_configinfo tagconfiginfo alias current_tag_configinfo current_tagconfiginfo @@ -694,6 +740,9 @@ class Tk::Tile::Treeview::Item < TkObject def cget(option) @t.itemcget(@id, option) end + def cget_strict(option) + @t.itemcget_strict(@id, option) + end def configure(key, value=None) @t.itemconfigure(@id, key, value) @@ -933,6 +982,9 @@ class Tk::Tile::Treeview::Tag < TkObject def cget(option) @t.tagcget(@id, option) end + def cget_strict(option) + @t.tagcget_strict(@id, option) + end def configure(key, value=None) @t.tagconfigure(@id, key, value) diff --git a/ext/tk/lib/tkextlib/tktable/tktable.rb b/ext/tk/lib/tkextlib/tktable/tktable.rb index b5bf4ea6c3..f6cf24b40f 100644 --- a/ext/tk/lib/tkextlib/tktable/tktable.rb +++ b/ext/tk/lib/tkextlib/tktable/tktable.rb @@ -77,6 +77,9 @@ module Tk::TkTable::ConfigMethod def tag_cget(tagOrId, option) itemcget(['tag', tagid(tagOrId)], option) end + def tag_cget_strict(tagOrId, option) + itemcget_strict(['tag', tagid(tagOrId)], option) + end def tag_configure(tagOrId, slot, value=None) itemconfigure(['tag', tagid(tagOrId)], slot, value) end @@ -90,6 +93,9 @@ module Tk::TkTable::ConfigMethod def window_cget(tagOrId, option) itemcget(['window', tagid(tagOrId)], option) end + def window_cget_strict(tagOrId, option) + itemcget_strict(['window', tagid(tagOrId)], option) + end def window_configure(tagOrId, slot, value=None) if slot == :window || slot == 'window' value = _epath(value) @@ -108,8 +114,8 @@ module Tk::TkTable::ConfigMethod current_itemconfiginfo(['window', tagid(tagOrId)], slot) end - private :itemcget, :itemconfigure - private :itemconfiginfo, :current_itemconfiginfo + private :itemcget, :itemcget_strict + private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo end ##################################################### @@ -194,6 +200,9 @@ class Tk::TkTable::CellTag def cget(key) @t.tag_cget(@id, key) end + def cget_strict(key) + @t.tag_cget_strict(@id, key) + end def configure(key, val=None) @t.tag_configure(@id, key, val) end diff --git a/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb b/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb index 5e86a19406..e10e6e299e 100644 --- a/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb +++ b/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb @@ -417,6 +417,9 @@ module Tk::TreeCtrl::ConfigMethod def column_cget(tagOrId, option) itemcget(['column', tagOrId], option) end + def column_cget_strict(tagOrId, option) + itemcget_strict(['column', tagOrId], option) + end def column_configure(tagOrId, slot, value=None) itemconfigure(['column', tagOrId], slot, value) end @@ -430,6 +433,9 @@ module Tk::TreeCtrl::ConfigMethod def column_dragcget(option) itemcget(['column', 'drag'], option) end + def column_dragcget_strict(option) + itemcget_strict(['column', 'drag'], option) + end def column_dragconfigure(slot, value=None) itemconfigure(['column', 'drag'], slot, value) end @@ -443,6 +449,9 @@ module Tk::TreeCtrl::ConfigMethod def debug_cget(option) itemcget('debug', option) end + def debug_cget_strict(option) + itemcget_strict('debug', option) + end def debug_configure(slot, value=None) itemconfigure('debug', slot, value) end @@ -456,6 +465,9 @@ module Tk::TreeCtrl::ConfigMethod def dragimage_cget(option) itemcget('dragimage', option) end + def dragimage_cget_strict(option) + itemcget_strict('dragimage', option) + end def dragimage_configure(slot, value=None) itemconfigure('dragimage', slot, value) end @@ -469,6 +481,9 @@ module Tk::TreeCtrl::ConfigMethod def element_cget(tagOrId, option) itemcget(['element', tagOrId], option) end + def element_cget_strict(tagOrId, option) + itemcget_strict(['element', tagOrId], option) + end def element_configure(tagOrId, slot, value=None) itemconfigure(['element', tagOrId], slot, value) end @@ -482,6 +497,9 @@ module Tk::TreeCtrl::ConfigMethod def item_cget(tagOrId, option) itemcget(['item', tagOrId], option) end + def item_cget_strict(tagOrId, option) + itemcget_strict(['item', tagOrId], option) + end def item_configure(tagOrId, slot, value=None) itemconfigure(['item', tagOrId], slot, value) end @@ -495,6 +513,9 @@ module Tk::TreeCtrl::ConfigMethod def item_element_cget(item, column, elem, option) itemcget([['item', 'element'], [item, column, elem]], option) end + def item_element_cget_strict(item, column, elem, option) + itemcget_strict([['item', 'element'], [item, column, elem]], option) + end def item_element_configure(item, column, elem, slot, value=None) itemconfigure([['item', 'element'], [item, column, elem]], slot, value) end @@ -508,6 +529,9 @@ module Tk::TreeCtrl::ConfigMethod def marquee_cget(option) itemcget('marquee', option) end + def marquee_cget_strict(option) + itemcget_strict('marquee', option) + end def marquee_configure(slot, value=None) itemconfigure('marquee', slot, value) end @@ -523,6 +547,17 @@ module Tk::TreeCtrl::ConfigMethod # "notify" doesn't have cget subcommand. current_itemconfiginfo(['notify', [win, pattern]])[option.to_s] end + def notify_cget_strict(win, pattern, option) + pattern = "<#{pattern}>" + # "notify" doesn't have cget subcommand. + info = current_itemconfiginfo(['notify', [win, pattern]]) + option = option.to_s + unless info.has_key?(option) + fail RuntimeError, "unknown option \"#{option}\"" + else + info[option] + end + end def notify_configure(win, pattern, slot, value=None) pattern = "<#{pattern}>" itemconfigure(['notify', [win, pattern]], slot, value) @@ -539,6 +574,9 @@ module Tk::TreeCtrl::ConfigMethod def style_cget(tagOrId, option) itemcget(['style', tagOrId], option) end + def style_cget_strict(tagOrId, option) + itemcget_strict(['style', tagOrId], option) + end def style_configure(tagOrId, slot, value=None) itemconfigure(['style', tagOrId], slot, value) end @@ -549,8 +587,8 @@ module Tk::TreeCtrl::ConfigMethod current_itemconfiginfo(['style', tagOrId], slot) end - private :itemcget, :itemconfigure - private :itemconfiginfo, :current_itemconfiginfo + private :itemcget, :itemcget_strict + private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo end ############################################## @@ -1706,6 +1744,9 @@ class Tk::TreeCtrl::Column < TkObject def cget(opt) @tree.column_cget(@tree.column_index(@id), opt) end + def cget_strict(opt) + @tree.column_cget_strict(@tree.column_index(@id), opt) + end def configure(*args) @tree.column_configure(@tree.column_index(@id), *args) @@ -1806,6 +1847,9 @@ class Tk::TreeCtrl::Element < TkObject def cget(opt) @tree.element_cget(@id, opt) end + def cget_strict(opt) + @tree.element_cget_strict(@id, opt) + end def configure(*args) @tree.element_configure(@id, *args) @@ -1937,6 +1981,9 @@ class Tk::TreeCtrl::Item < TkObject def cget(opt) @tree.item_cget(@id, opt) end + def cget_strict(opt) + @tree.item_cget_strict(@id, opt) + end def configure(*args) @tree.item_configure(@id, *args) @@ -1970,6 +2017,9 @@ class Tk::TreeCtrl::Item < TkObject def element_cget(opt) @tree.item_element_cget(@id, opt) end + def element_cget_strict(opt) + @tree.item_element_cget_strict(@id, opt) + end def element_configure(*args) @tree.item_element_configure(@id, *args) @@ -2221,6 +2271,9 @@ class Tk::TreeCtrl::Style < TkObject def cget(opt) @tree.style_cget(@id, opt) end + def cget_strict(opt) + @tree.style_cget_strict(@id, opt) + end def configure(*args) @tree.style_configure(@id, *args) diff --git a/ext/tk/lib/tkextlib/version.rb b/ext/tk/lib/tkextlib/version.rb index f437dea7fd..434ed11a2e 100644 --- a/ext/tk/lib/tkextlib/version.rb +++ b/ext/tk/lib/tkextlib/version.rb @@ -2,5 +2,5 @@ # release date of tkextlib # module Tk - Tkextlib_RELEASE_DATE = '2008-05-14'.freeze + Tkextlib_RELEASE_DATE = '2008-05-23'.freeze end diff --git a/ext/tk/lib/tkextlib/vu/pie.rb b/ext/tk/lib/tkextlib/vu/pie.rb index 1975803db1..c1fb6857bf 100644 --- a/ext/tk/lib/tkextlib/vu/pie.rb +++ b/ext/tk/lib/tkextlib/vu/pie.rb @@ -177,6 +177,10 @@ class Tk::Vu::PieSlice @pie.itemcget(@id, slot) end + def cget_strict(slot) + @pie.itemcget_strict(@id, slot) + end + def configure(*args) @pie.itemconfigure(@id, *args) self |