* ext/tk/lib/tk.rb: Tk.destroy uses TkWindow#epath

* ext/tk/lib/tk/image.rb: bug fix
* ext/tk/lib/tk/wm.rb: add 'iconphoto' method(Windows only)
* ext/tk/lib/tkextlib/*: some methods uses TkWindow#epath


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagai 2004-11-26 09:07:25 +00:00
parent 6d0f22ebc6
commit 27c24b0f3b
10 changed files with 67 additions and 15 deletions

View File

@ -1,3 +1,13 @@
Fri Nov 26 18:02:44 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk.rb: Tk.destroy uses TkWindow#epath
* ext/tk/lib/tk/image.rb: bug fix
* ext/tk/lib/tk/wm.rb: add 'iconphoto' method(Windows only)
* ext/tk/lib/tkextlib/*: some methods uses TkWindow#epath
Fri Nov 26 14:29:39 2004 Yukihiro Matsumoto <matz@ruby-lang.org> Fri Nov 26 14:29:39 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* io.c (rb_io_initialize): [ruby-dev:24963] * io.c (rb_io_initialize): [ruby-dev:24963]

View File

@ -1,15 +1,25 @@
2004-11-26 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* bwidget/notebook.rb: uses epath
* bwidget/widget.rb: ditto
* tktable/tktable.rb: ditto
* tcllib/cursor.rb: ditto, and bug fix
2004-11-10 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> 2004-11-10 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* lib/tile/style.rb: bug fix * tile/style.rb: bug fix
2004-11-07 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> 2004-11-07 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb: * iwidgets/scrolledcanvas.rb: bind-event methods accept multi
bind-event methods accept multi substitution arguments. substitution arguments.
* ext/tk/lib/tkextlib/tktable/tktable.rb: ditto. * tktable/tktable.rb: ditto.
* ext/tk/lib/tkextlib/treectrl/tktreectrl.rb: ditto * treectrl/tktreectrl.rb: ditto
2004-11-03 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> 2004-11-03 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>

View File

@ -1677,7 +1677,14 @@ module Tk
end end
def Tk.destroy(*wins) def Tk.destroy(*wins)
tk_call_without_enc('destroy', *wins) #tk_call_without_enc('destroy', *wins)
tk_call_without_enc('destroy', *(wins.collect{|win|
if win.kind_of?(TkWindow)
win.epath
else
win
end
}))
end end
def Tk.exit def Tk.exit

View File

@ -70,7 +70,9 @@ class TkPhotoImage<TkImage
keys.delete(opt) keys.delete(opt)
end end
} }
hash_kv(keys).flatten keys.collect{|k,v|
['-' << k, v]
}.flatten
end end
private :_photo_hash_kv private :_photo_hash_kv

View File

@ -439,7 +439,7 @@ class TkOptionMenubutton<TkMenubutton
install_win(if parent then parent.path end) install_win(if parent then parent.path end)
@menu = OptionMenu.new(tk_call('tk_optionMenu', @menu = OptionMenu.new(tk_call('tk_optionMenu',
@path, @variable.id, *args)) @path, @variable.id, *args))
configure(keys) if keys configure(keys) if keys
end end

View File

@ -120,6 +120,18 @@ module Tk
end end
end end
def iconphoto(*imgs)
# Windows only
tk_call_without_enc('wm', 'iconphoto', path, *imgs)
self
end
def iconphoto_default(*imgs)
# Windows only
tk_call_without_enc('wm', 'iconphoto', path, '-default', *imgs)
self
end
def iconify(ex = true) def iconify(ex = true)
tk_call_without_enc('wm', 'iconify', path) if ex tk_call_without_enc('wm', 'iconify', path) if ex
self self

View File

@ -31,7 +31,8 @@ class Tk::BWidget::NoteBook
def tagid(id) def tagid(id)
if id.kind_of?(TkWindow) if id.kind_of?(TkWindow)
id.path #id.path
id.epath
elsif id.kind_of?(TkObject) elsif id.kind_of?(TkObject)
id.to_eval id.to_eval
else else

View File

@ -56,7 +56,7 @@ module Tk::BWidget::Widget
end end
def self.destroy(win) def self.destroy(win)
tk_call('Widget::destroy', win) tk_call('Widget::destroy', _epath(win))
end end
def self.focus_next(win) def self.focus_next(win)

View File

@ -51,7 +51,7 @@ class TkWindow
def cursor_propagate(cursor) def cursor_propagate(cursor)
# Sets the cursor for self and all its descendants to cursor. # Sets the cursor for self and all its descendants to cursor.
#tk_call_without_enc('::cursor::propagate', @path, cursor) #tk_call_without_enc('::cursor::propagate', @path, cursor)
Tk::Tcllib::Cursor.cursor_propagate(cursor) Tk::Tcllib::Cursor.cursor_propagate(self, cursor)
end end
def cursor_restore(cursor = None) def cursor_restore(cursor = None)
# Restore the original or previously set cursor for self and all its # Restore the original or previously set cursor for self and all its
@ -59,7 +59,7 @@ class TkWindow
# widget that did not have a preset cursor (set by a previous call # widget that did not have a preset cursor (set by a previous call
# to TkWindow#cursor_propagate). # to TkWindow#cursor_propagate).
#tk_call_without_enc('::cursor::restore', @path, cursor) #tk_call_without_enc('::cursor::restore', @path, cursor)
Tk::Tcllib::Cursor.cursor_restore(cursor) Tk::Tcllib::Cursor.cursor_restore(self, cursor)
end end
end end
@ -75,15 +75,17 @@ module Tk
module Cursor module Cursor
extend TkCore extend TkCore
def self.cursor_display(win=None) def self.cursor_display(win=None)
tk_call_without_enc('::cursor::display', win) tk_call_without_enc('::cursor::display', _epath(win))
end end
def self.cursor_propagate(win, cursor) def self.cursor_propagate(win, cursor)
tk_call_without_enc('::cursor::propagate', win.path, cursor) #tk_call_without_enc('::cursor::propagate', win.path, cursor)
tk_call_without_enc('::cursor::propagate', _epath(win), cursor)
end end
def self.cursor_restore(win, cursor = None) def self.cursor_restore(win, cursor = None)
tk_call_without_enc('::cursor::restore', win.path, cursor) #tk_call_without_enc('::cursor::restore', win.path, cursor)
tk_call_without_enc('::cursor::restore', _epath(win), cursor)
end end
end end
end end

View File

@ -71,6 +71,14 @@ module Tk::TkTable::ConfigMethod
itemcget(['window', tagid(tagOrId)], option) itemcget(['window', tagid(tagOrId)], option)
end end
def window_configure(tagOrId, slot, value=None) def window_configure(tagOrId, slot, value=None)
if slot == :window || slot == 'window'
value = _epath(value)
elsif slot.kind_of?(Hash)
if slot.key?(:window) || slot.key?('window')
slot = _symbolkey2str(slot)
slot['window'] = _epath(slot['window'])
end
end
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)