1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/tk/lib/tk.rb: bind-event methods accept multi substitution arguments.

* ext/tk/lib/tk/canvas.rb: ditto.
* ext/tk/lib/tk/canvastag.rb: ditto.
* ext/tk/lib/tk/text.rb: ditto.
* ext/tk/lib/tk/texttag.rb: ditto.
* ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb: ditto.
* ext/tk/lib/tkextlib/tktable/tktable.rb: ditto.
* ext/tk/lib/tkextlib/treectrl/tktreectrl.rb: ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagai 2004-11-07 14:53:02 +00:00
parent 4cbaddcf8c
commit c2ac862f1a
10 changed files with 98 additions and 74 deletions

View file

@ -1,3 +1,18 @@
Sun Nov 7 23:49:26 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk.rb: bind-event methods accept multi substitution
arguments.
* ext/tk/lib/tk/canvas.rb: ditto.
* ext/tk/lib/tk/canvastag.rb: ditto.
* ext/tk/lib/tk/text.rb: ditto.
* ext/tk/lib/tk/texttag.rb: ditto.
* ext/tk/lib/tkextlib: ditto.
Sat Nov 6 20:40:16 2004 Masaki Suketa <masaki.suketa@nifty.ne.jp> Sat Nov 6 20:40:16 2004 Masaki Suketa <masaki.suketa@nifty.ne.jp>
* ext/win32ole/win32ole.c: rename WIN32OLE#ole_obj_help to * ext/win32ole/win32ole.c: rename WIN32OLE#ole_obj_help to

View file

@ -1,3 +1,12 @@
2004-11-07 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb:
bind-event methods accept multi substitution arguments.
* ext/tk/lib/tkextlib/tktable/tktable.rb: ditto.
* ext/tk/lib/tkextlib/treectrl/tktreectrl.rb: ditto
2004-11-03 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> 2004-11-03 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* SUPPORT_STATUS: BLT moves to 'plan to support' from 'not determined' * SUPPORT_STATUS: BLT moves to 'plan to support' from 'not determined'

View file

@ -818,8 +818,8 @@ module TkComm
end end
end end
def _bind_core(mode, what, context, cmd, args=nil) def _bind_core(mode, what, context, cmd, *args)
id = install_bind(cmd, args) if cmd id = install_bind(cmd, *args) if cmd
begin begin
tk_call_without_enc(*(what + ["<#{tk_event_sequence(context)}>", tk_call_without_enc(*(what + ["<#{tk_event_sequence(context)}>",
mode + id])) mode + id]))
@ -829,12 +829,12 @@ module TkComm
end end
end end
def _bind(what, context, cmd, args=nil) def _bind(what, context, cmd, *args)
_bind_core('', what, context, cmd, args) _bind_core('', what, context, cmd, *args)
end end
def _bind_append(what, context, cmd, args=nil) def _bind_append(what, context, cmd, *args)
_bind_core('+', what, context, cmd, args) _bind_core('+', what, context, cmd, *args)
end end
def _bind_remove(what, context) def _bind_remove(what, context)
@ -868,8 +868,8 @@ module TkComm
end end
end end
def _bind_core_for_event_class(klass, mode, what, context, cmd, args=nil) def _bind_core_for_event_class(klass, mode, what, context, cmd, *args)
id = install_bind_for_event_class(klass, cmd, args) if cmd id = install_bind_for_event_class(klass, cmd, *args) if cmd
begin begin
tk_call_without_enc(*(what + ["<#{tk_event_sequence(context)}>", tk_call_without_enc(*(what + ["<#{tk_event_sequence(context)}>",
mode + id])) mode + id]))
@ -879,12 +879,12 @@ module TkComm
end end
end end
def _bind_for_event_class(klass, what, context, cmd, args=nil) def _bind_for_event_class(klass, what, context, cmd, *args)
_bind_core_for_event_class(klass, '', what, context, cmd, args) _bind_core_for_event_class(klass, '', what, context, cmd, *args)
end end
def _bind_append_for_event_class(klass, what, context, cmd, args=nil) def _bind_append_for_event_class(klass, what, context, cmd, *args)
_bind_core_for_event_class(klass, '+', what, context, cmd, args) _bind_core_for_event_class(klass, '+', what, context, cmd, *args)
end end
def _bind_remove_for_event_class(klass, what, context) def _bind_remove_for_event_class(klass, what, context)
@ -901,13 +901,13 @@ module TkComm
:_bind_append_for_event_class, :_bind_remove_for_event_class, :_bind_append_for_event_class, :_bind_remove_for_event_class,
:_bindinfo_for_event_class :_bindinfo_for_event_class
def bind(tagOrClass, context, cmd=Proc.new, args=nil) def bind(tagOrClass, context, cmd=Proc.new, *args)
_bind(["bind", tagOrClass], context, cmd, args) _bind(["bind", tagOrClass], context, cmd, *args)
tagOrClass tagOrClass
end end
def bind_append(tagOrClass, context, cmd=Proc.new, args=nil) def bind_append(tagOrClass, context, cmd=Proc.new, *args)
_bind_append(["bind", tagOrClass], context, cmd, args) _bind_append(["bind", tagOrClass], context, cmd, *args)
tagOrClass tagOrClass
end end
@ -920,13 +920,13 @@ module TkComm
_bindinfo(['bind', tagOrClass], context) _bindinfo(['bind', tagOrClass], context)
end end
def bind_all(context, cmd=Proc.new, args=nil) def bind_all(context, cmd=Proc.new, *args)
_bind(['bind', 'all'], context, cmd, args) _bind(['bind', 'all'], context, cmd, *args)
TkBindTag::ALL TkBindTag::ALL
end end
def bind_append_all(context, cmd=Proc.new, args=nil) def bind_append_all(context, cmd=Proc.new, *args)
_bind_append(['bind', 'all'], context, cmd, args) _bind_append(['bind', 'all'], context, cmd, *args)
TkBindTag::ALL TkBindTag::ALL
end end
@ -2060,12 +2060,12 @@ end
module TkBindCore module TkBindCore
def bind(context, cmd=Proc.new, args=nil) def bind(context, cmd=Proc.new, *args)
Tk.bind(self, context, cmd, args) Tk.bind(self, context, cmd, *args)
end end
def bind_append(context, cmd=Proc.new, args=nil) def bind_append(context, cmd=Proc.new, *args)
Tk.bind_append(self, context, cmd, args) Tk.bind_append(self, context, cmd, *args)
end end
def bind_remove(context) def bind_remove(context)

View file

@ -94,13 +94,13 @@ class TkCanvas<TkWindow
*tags.collect{|t| tagid(t)})) *tags.collect{|t| tagid(t)}))
end end
def itembind(tag, context, cmd=Proc.new, args=nil) def itembind(tag, context, cmd=Proc.new, *args)
_bind([path, "bind", tagid(tag)], context, cmd, args) _bind([path, "bind", tagid(tag)], context, cmd, *args)
self self
end end
def itembind_append(tag, context, cmd=Proc.new, args=nil) def itembind_append(tag, context, cmd=Proc.new, *args)
_bind_append([path, "bind", tagid(tag)], context, cmd, args) _bind_append([path, "bind", tagid(tag)], context, cmd, *args)
self self
end end

View file

@ -21,31 +21,31 @@ module TkcTagAccess
@c.bbox(@id) @c.bbox(@id)
end end
def bind(seq, cmd=Proc.new, args=nil) def bind(seq, cmd=Proc.new, *args)
@c.itembind @id, seq, cmd, args @c.itembind(@id, seq, cmd, *args)
self self
end end
def bind_append(seq, cmd=Proc.new, args=nil) def bind_append(seq, cmd=Proc.new, *args)
@c.itembind_append @id, seq, cmd, args @c.itembind_append(@id, seq, cmd, *args)
self self
end end
def bind_remove(seq) def bind_remove(seq)
@c.itembind_remove @id, seq @c.itembind_remove(@id, seq)
self self
end end
def bindinfo(seq=nil) def bindinfo(seq=nil)
@c.itembindinfo @id, seq @c.itembindinfo(@id, seq)
end end
def cget(option) def cget(option)
@c.itemcget @id, option @c.itemcget(@id, option)
end end
def configure(key, value=None) def configure(key, value=None)
@c.itemconfigure @id, key, value @c.itemconfigure(@id, key, value)
self self
end end
# def configure(keys) # def configure(keys)
@ -53,71 +53,71 @@ module TkcTagAccess
# end # end
def configinfo(key=nil) def configinfo(key=nil)
@c.itemconfiginfo @id, key @c.itemconfiginfo(@id, key)
end end
def current_configinfo(key=nil) def current_configinfo(key=nil)
@c.current_itemconfiginfo @id, key @c.current_itemconfiginfo(@id, key)
end end
def coords(*args) def coords(*args)
@c.coords @id, *args @c.coords(@id, *args)
end end
def dchars(first, last=None) def dchars(first, last=None)
@c.dchars @id, first, last @c.dchars(@id, first, last)
self self
end end
def dtag(tag_to_del=None) def dtag(tag_to_del=None)
@c.dtag @id, tag_to_del @c.dtag(@id, tag_to_del)
self self
end end
def find def find
@c.find 'withtag', @id @c.find('withtag', @id)
end end
alias list find alias list find
def focus def focus
@c.itemfocus @id @c.itemfocus(@id)
end end
def gettags def gettags
@c.gettags @id @c.gettags(@id)
end end
def icursor(index) def icursor(index)
@c.icursor @id, index @c.icursor(@id, index)
self self
end end
def index(index) def index(index)
@c.index @id, index @c.index(@id, index)
end end
def insert(beforethis, string) def insert(beforethis, string)
@c.insert @id, beforethis, string @c.insert(@id, beforethis, string)
self self
end end
def lower(belowthis=None) def lower(belowthis=None)
@c.lower @id, belowthis @c.lower(@id, belowthis)
self self
end end
def move(xamount, yamount) def move(xamount, yamount)
@c.move @id, xamount, yamount @c.move(@id, xamount, yamount)
self self
end end
def raise(abovethis=None) def raise(abovethis=None)
@c.raise @id, abovethis @c.raise(@id, abovethis)
self self
end end
def scale(xorigin, yorigin, xscale, yscale) def scale(xorigin, yorigin, xscale, yscale)
@c.scale @id, xorigin, yorigin, xscale, yscale @c.scale(@id, xorigin, yorigin, xscale, yscale)
self self
end end
@ -135,7 +135,7 @@ module TkcTagAccess
end end
def itemtype def itemtype
@c.itemtype @id @c.itemtype(@id)
end end
# Following operators support logical expressions of canvas tags # Following operators support logical expressions of canvas tags
@ -337,14 +337,14 @@ class TkcGroup<TkcTag
def include(*tags) def include(*tags)
for i in tags for i in tags
i.addtag @id i.addtag(@id)
end end
self self
end end
def exclude(*tags) def exclude(*tags)
for i in tags for i in tags
i.delete @id i.delete(@id)
end end
self self
end end

View file

@ -519,13 +519,13 @@ class TkText<TkTextWin
alias deltag tag_delete alias deltag tag_delete
alias delete_tag tag_delete alias delete_tag tag_delete
def tag_bind(tag, seq, cmd=Proc.new, args=nil) def tag_bind(tag, seq, cmd=Proc.new, *args)
_bind([@path, 'tag', 'bind', tag], seq, cmd, args) _bind([@path, 'tag', 'bind', tag], seq, cmd, *args)
self self
end end
def tag_bind_append(tag, seq, cmd=Proc.new, args=nil) def tag_bind_append(tag, seq, cmd=Proc.new, *args)
_bind_append([@path, 'tag', 'bind', tag], seq, cmd, args) _bind_append([@path, 'tag', 'bind', tag], seq, cmd, *args)
self self
end end

View file

@ -162,13 +162,13 @@ class TkTextTag<TkObject
@t.current_tag_configinfo @id, key @t.current_tag_configinfo @id, key
end end
def bind(seq, cmd=Proc.new, args=nil) def bind(seq, cmd=Proc.new, *args)
_bind([@t.path, 'tag', 'bind', @id], seq, cmd, args) _bind([@t.path, 'tag', 'bind', @id], seq, cmd, *args)
self self
end end
def bind_append(seq, cmd=Proc.new, args=nil) def bind_append(seq, cmd=Proc.new, *args)
_bind_append([@t.path, 'tag', 'bind', @id], seq, cmd, args) _bind_append([@t.path, 'tag', 'bind', @id], seq, cmd, *args)
self self
end end

View file

@ -97,13 +97,13 @@ class Tk::Iwidgets::Scrolledcanvas
*tags.collect{|t| tagid(t)})) *tags.collect{|t| tagid(t)}))
end end
def itembind(tag, context, cmd=Proc.new, args=nil) def itembind(tag, context, cmd=Proc.new, *args)
_bind([path, "bind", tagid(tag)], context, cmd, args) _bind([path, "bind", tagid(tag)], context, cmd, *args)
self self
end end
def itembind_append(tag, context, cmd=Proc.new, args=nil) def itembind_append(tag, context, cmd=Proc.new, *args)
_bind_append([path, "bind", tagid(tag)], context, cmd, args) _bind_append([path, "bind", tagid(tag)], context, cmd, *args)
self self
end end

View file

@ -61,10 +61,10 @@ module Tk::TkTable::ConfigMethod
itemconfigure(['tag', tagid(tagOrId)], slot, value) itemconfigure(['tag', tagid(tagOrId)], slot, value)
end end
def tag_configinfo(tagOrId, slot=nil) def tag_configinfo(tagOrId, slot=nil)
itemconfigure(['tag', tagid(tagOrId)], slot) itemconfiginfo(['tag', tagid(tagOrId)], slot)
end end
def current_tag_configinfo(tagOrId, slot=nil) def current_tag_configinfo(tagOrId, slot=nil)
itemconfigure(['tag', tagid(tagOrId)], slot) current_itemconfiginfo(['tag', tagid(tagOrId)], slot)
end end
def window_cget(tagOrId, option) def window_cget(tagOrId, option)
@ -74,10 +74,10 @@ module Tk::TkTable::ConfigMethod
itemconfigure(['window', tagid(tagOrId)], slot, value) itemconfigure(['window', tagid(tagOrId)], slot, value)
end end
def window_configinfo(tagOrId, slot=nil) def window_configinfo(tagOrId, slot=nil)
itemconfigure(['window', tagid(tagOrId)], slot) itemconfiginfo(['window', tagid(tagOrId)], slot)
end end
def current_window_configinfo(tagOrId, slot=nil) def current_window_configinfo(tagOrId, slot=nil)
itemconfigure(['window', tagid(tagOrId)], slot) current_itemconfiginfo(['window', tagid(tagOrId)], slot)
end end
private :itemcget, :itemconfigure private :itemcget, :itemconfigure

View file

@ -743,13 +743,13 @@ class Tk::TreeCtrl
marquee_visible() marquee_visible()
end end
def notify_bind(obj, event, cmd=Proc.new, args=nil) def notify_bind(obj, event, cmd=Proc.new, *args)
_bind([@path, 'notify', 'bind', obj], event, cmd, args) _bind([@path, 'notify', 'bind', obj], event, cmd, *args)
self self
end end
def notify_bind_append(obj, event, cmd=Proc.new, args=nil) def notify_bind_append(obj, event, cmd=Proc.new, *args)
_bind([@path, 'notify', 'bind', obj], event, cmd, args) _bind([@path, 'notify', 'bind', obj], event, cmd, *args)
self self
end end