diff options
Diffstat (limited to 'ext/tk/lib/tkextlib/blt')
-rw-r--r-- | ext/tk/lib/tkextlib/blt/component.rb | 101 | ||||
-rw-r--r-- | ext/tk/lib/tkextlib/blt/dragdrop.rb | 6 | ||||
-rw-r--r-- | ext/tk/lib/tkextlib/blt/htext.rb | 1 | ||||
-rw-r--r-- | ext/tk/lib/tkextlib/blt/table.rb | 17 | ||||
-rw-r--r-- | ext/tk/lib/tkextlib/blt/tabset.rb | 4 | ||||
-rw-r--r-- | ext/tk/lib/tkextlib/blt/ted.rb | 9 | ||||
-rw-r--r-- | ext/tk/lib/tkextlib/blt/treeview.rb | 31 | ||||
-rw-r--r-- | ext/tk/lib/tkextlib/blt/unix_dnd.rb | 16 | ||||
-rw-r--r-- | ext/tk/lib/tkextlib/blt/watch.rb | 19 |
9 files changed, 187 insertions, 17 deletions
diff --git a/ext/tk/lib/tkextlib/blt/component.rb b/ext/tk/lib/tkextlib/blt/component.rb index dd387634e..b2005b2f2 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/dragdrop.rb b/ext/tk/lib/tkextlib/blt/dragdrop.rb index 98b1a4832..201548504 100644 --- a/ext/tk/lib/tkextlib/blt/dragdrop.rb +++ b/ext/tk/lib/tkextlib/blt/dragdrop.rb @@ -81,6 +81,7 @@ module Tk::BLT nil ] +=begin # for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) ) KEY_TBL.map!{|inf| if inf.kind_of?(Array) @@ -96,6 +97,7 @@ module Tk::BLT end inf } +=end _setup_subst_table(KEY_TBL, PROC_TBL) @@ -123,6 +125,7 @@ module Tk::BLT nil ] +=begin # for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) ) KEY_TBL.map!{|inf| if inf.kind_of?(Array) @@ -138,6 +141,7 @@ module Tk::BLT end inf } +=end _setup_subst_table(KEY_TBL, PROC_TBL) @@ -177,6 +181,7 @@ module Tk::BLT nil ] +=begin # for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) ) KEY_TBL.map!{|inf| if inf.kind_of?(Array) @@ -192,6 +197,7 @@ module Tk::BLT end inf } +=end _setup_subst_table(KEY_TBL, PROC_TBL) end diff --git a/ext/tk/lib/tkextlib/blt/htext.rb b/ext/tk/lib/tkextlib/blt/htext.rb index a0cf3dc03..0d9cb3018 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 0be9d8d42..dfa10269e 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 1a0f312c4..ca81ad8f9 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 39495842b..670265fc7 100644 --- a/ext/tk/lib/tkextlib/blt/ted.rb +++ b/ext/tk/lib/tkextlib/blt/ted.rb @@ -30,11 +30,14 @@ 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) - itemconfigure(master, slot, value) + itemcget(master, option) + end + def cget_strict(master, option) + itemcget_strict(master, option) end def configure(master, slot, value=None) itemconfigure(master, slot, value) diff --git a/ext/tk/lib/tkextlib/blt/treeview.rb b/ext/tk/lib/tkextlib/blt/treeview.rb index fc890614b..c5a569718 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 @@ -239,6 +259,7 @@ class Tk::BLT::Treeview nil ] +=begin # for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) ) KEY_TBL.map!{|inf| if inf.kind_of?(Array) @@ -254,6 +275,7 @@ class Tk::BLT::Treeview end inf } +=end _setup_subst_table(KEY_TBL, PROC_TBL); @@ -492,6 +514,7 @@ class Tk::BLT::Treeview nil ] +=begin # for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) ) KEY_TBL.map!{|inf| if inf.kind_of?(Array) @@ -507,6 +530,7 @@ class Tk::BLT::Treeview end inf } +=end _setup_subst_table(KEY_TBL, PROC_TBL); @@ -523,7 +547,8 @@ class Tk::BLT::Treeview def _find_exec_flag_value(val) if val.kind_of?(Array) cmd, *args = val - FindExecFlagValue.new(cmd, args.join(' ')) + #FindExecFlagValue.new(cmd, args.join(' ')) + FindExecFlagValue.new(cmd, *args) elsif TkComm._callback_entry?(val) FindExecFlagValue.new(val) else diff --git a/ext/tk/lib/tkextlib/blt/unix_dnd.rb b/ext/tk/lib/tkextlib/blt/unix_dnd.rb index 3130c1e56..445002d7a 100644 --- a/ext/tk/lib/tkextlib/blt/unix_dnd.rb +++ b/ext/tk/lib/tkextlib/blt/unix_dnd.rb @@ -30,11 +30,14 @@ 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) - itemconfigure(['cget', win], slot, value) + 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) @@ -46,8 +49,11 @@ module Tk::BLT current_itemconfiginfo(['configure', win], slot) end - def tokwn_cget(win, option) - itemconfigure(['token', 'cget', win], slot, value) + 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) diff --git a/ext/tk/lib/tkextlib/blt/watch.rb b/ext/tk/lib/tkextlib/blt/watch.rb index 2daf417e0..219ff78e9 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 |