mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
![nagai](/assets/img/avatar_default.png)
* ext/tk/*: Support new features of Tcl/Tk8.6b1 and minor bug fixes. ( [KNOWN BUG] Ruby/Tk on Ruby 1.9 will not work on Cygwin. ) * ext/tk/*: Unify sources between Ruby 1.8 & 1.9. Improve default_widget_set handling. * ext/tk/*: Multi-TkInterpreter (multi-tk.rb) works on Ruby 1.8 & 1.9. ( [KNOWN BUG] On Ruby 1.8, join to a long term Thread on Tk callbacks may freeze. On Ruby 1.9, cannot create a second master interpreter (creating slaves are OK); supported master interpreter is the default master interpreter only. ) * ext/tk/lib/tkextlib/*: Update supported versions of Tk extensions. Tcllib 1.8/Tklib 0.4.1 ==> Tcllib 1.11.1/Tklib 0.5 BWidgets 1.7 ==> BWidgets 1.8 TkTable 2.9 ==> TkTable 2.10 TkTreeCtrl 2005-12-02 ==> TkTreeCtrl 2.2.9 Tile 0.8.0/8.5.1 ==> Tile 0.8.3/8.6b1 IncrTcl 2005-02-14 ==> IncrTcl 2008-12-15 TclX 2005-02-07 ==> TclX 2008-12-15 Trofs 0.4.3 ==> Trofs 0.4.4 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
141 lines
3.9 KiB
Ruby
141 lines
3.9 KiB
Ruby
#
|
|
# tkextlib/blt/unix_dnd.rb
|
|
#
|
|
# *** This is alpha version, because there is no document on BLT. ***
|
|
#
|
|
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
|
|
#
|
|
|
|
require 'tk'
|
|
require 'tkextlib/blt.rb'
|
|
|
|
module Tk::BLT
|
|
module DnD
|
|
extend TkCore
|
|
|
|
TkCommandNames = ['::blt::dnd'.freeze].freeze
|
|
|
|
##############################
|
|
|
|
extend TkItemConfigMethod
|
|
|
|
class << self
|
|
def __item_cget_cmd(id)
|
|
['::blt::dnd', *id]
|
|
end
|
|
private :__item_cget_cmd
|
|
|
|
def __item_config_cmd(id)
|
|
['::blt::dnd', *id]
|
|
end
|
|
private :__item_config_cmd
|
|
|
|
private :itemcget_tkstring, :itemcget, :itemcget_strict
|
|
private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
|
|
|
|
def cget_tkstring(win, option)
|
|
itemcget_tkstring(['cget', win], option)
|
|
end
|
|
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
|
|
def configinfo(win, slot=nil)
|
|
itemconfiginfo(['configure', win], slot)
|
|
end
|
|
def current_configinfo(win, slot=nil)
|
|
current_itemconfiginfo(['configure', win], slot)
|
|
end
|
|
|
|
def token_cget_tkstring(win, option)
|
|
itemcget_tkstring(['token', 'cget', win], option)
|
|
end
|
|
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
|
|
def token_configinfo(win, slot=nil)
|
|
itemconfiginfo(['token', 'configure', win], slot)
|
|
end
|
|
def current_token_configinfo(win, slot=nil)
|
|
current_itemconfiginfo(['token', 'configure', win], slot)
|
|
end
|
|
|
|
def token_windowconfigure(win, slot, value=None)
|
|
itemconfigure(['token', 'window', win], slot, value)
|
|
end
|
|
def token_windowconfiginfo(win, slot=nil)
|
|
itemconfiginfo(['token', 'window', win], slot)
|
|
end
|
|
def current_token_windowconfiginfo(win, slot=nil)
|
|
current_itemconfiginfo(['token', 'window', win], slot)
|
|
end
|
|
end
|
|
|
|
##############################
|
|
|
|
def self.cancel(win)
|
|
tk_call('::blt::dnd', 'cancel', *wins)
|
|
end
|
|
def self.delete(*wins)
|
|
tk_call('::blt::dnd', 'delete', *wins)
|
|
end
|
|
def self.delete_source(*wins)
|
|
tk_call('::blt::dnd', 'delete', '-source', *wins)
|
|
end
|
|
def self.delete_target(*wins)
|
|
tk_call('::blt::dnd', 'delete', '-target', *wins)
|
|
end
|
|
def self.drag(win, x, y, token=None)
|
|
tk_call('::blt::dnd', 'drag', win, x, y, token)
|
|
end
|
|
def self.drop(win, x, y, token=None)
|
|
tk_call('::blt::dnd', 'drop', win, x, y, token)
|
|
end
|
|
def self.get_data(win, fmt=nil, cmd=nil)
|
|
if fmt
|
|
tk_call('::blt::dnd', 'getdata', win, fmt, cmd)
|
|
else
|
|
list(tk_call('::blt::dnd', 'getdata', win))
|
|
end
|
|
end
|
|
def self.names(pat=None)
|
|
list(tk_call('::blt::dnd', 'names', pat))
|
|
end
|
|
def self.source_names(pat=None)
|
|
list(tk_call('::blt::dnd', 'names', '-source', pat))
|
|
end
|
|
def self.target_names(pat=None)
|
|
list(tk_call('::blt::dnd', 'names', '-target', pat))
|
|
end
|
|
def self.pull(win, fmt)
|
|
tk_call('::blt::dnd', 'pull', win, fmt)
|
|
end
|
|
def self.register(win, keys={})
|
|
tk_call('::blt::dnd', 'register', win, keys)
|
|
end
|
|
def self.select(win, x, y, timestamp)
|
|
tk_call('::blt::dnd', 'select', win, x, y, timestamp)
|
|
end
|
|
def self.set_data(win, fmt=nil, cmd=nil)
|
|
if fmt
|
|
tk_call('::blt::dnd', 'setdata', win, fmt, cmd)
|
|
else
|
|
list(tk_call('::blt::dnd', 'setdata', win))
|
|
end
|
|
end
|
|
def self.token(*args)
|
|
tk_call('::blt::dnd', 'token', *args)
|
|
end
|
|
end
|
|
end
|