2 # tkextlib/blt/unix_dnd.rb
4 # *** This is alpha version, because there is no document on BLT. ***
6 # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
10 require 'tkextlib/blt.rb'
16 TkCommandNames = ['::blt::dnd'.freeze].freeze
18 ##############################
20 extend TkItemConfigMethod
23 def __item_cget_cmd(id)
26 private :__item_cget_cmd
28 def __item_config_cmd(id)
31 private :__item_config_cmd
33 private :itemcget, :itemcget_strict
34 private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
37 itemcget(['cget', win], option)
39 def cget_strict(win, option)
40 itemcget_strict(['cget', win], option)
42 def configure(win, slot, value=None)
43 itemconfigure(['configure', win], slot, value)
45 def configinfo(win, slot=nil)
46 itemconfiginfo(['configure', win], slot)
48 def current_configinfo(win, slot=nil)
49 current_itemconfiginfo(['configure', win], slot)
52 def token_cget(win, option)
53 itemcget(['token', 'cget', win], option)
55 def token_cget_strict(win, option)
56 itemcget_strict(['token', 'cget', win], option)
58 def token_configure(win, slot, value=None)
59 itemconfigure(['token', 'configure', win], slot, value)
61 def token_configinfo(win, slot=nil)
62 itemconfiginfo(['token', 'configure', win], slot)
64 def current_token_configinfo(win, slot=nil)
65 current_itemconfiginfo(['token', 'configure', win], slot)
68 def token_windowconfigure(win, slot, value=None)
69 itemconfigure(['token', 'window', win], slot, value)
71 def token_windowconfiginfo(win, slot=nil)
72 itemconfiginfo(['token', 'window', win], slot)
74 def current_token_windowconfiginfo(win, slot=nil)
75 current_itemconfiginfo(['token', 'window', win], slot)
79 ##############################
82 tk_call('::blt::dnd', 'cancel', *wins)
84 def self.delete(*wins)
85 tk_call('::blt::dnd', 'delete', *wins)
87 def self.delete_source(*wins)
88 tk_call('::blt::dnd', 'delete', '-source', *wins)
90 def self.delete_target(*wins)
91 tk_call('::blt::dnd', 'delete', '-target', *wins)
93 def self.drag(win, x, y, token=None)
94 tk_call('::blt::dnd', 'drag', win, x, y, token)
96 def self.drop(win, x, y, token=None)
97 tk_call('::blt::dnd', 'drop', win, x, y, token)
99 def self.get_data(win, fmt=nil, cmd=nil)
101 tk_call('::blt::dnd', 'getdata', win, fmt, cmd)
103 list(tk_call('::blt::dnd', 'getdata', win))
106 def self.names(pat=None)
107 list(tk_call('::blt::dnd', 'names', pat))
109 def self.source_names(pat=None)
110 list(tk_call('::blt::dnd', 'names', '-source', pat))
112 def self.target_names(pat=None)
113 list(tk_call('::blt::dnd', 'names', '-target', pat))
115 def self.pull(win, fmt)
116 tk_call('::blt::dnd', 'pull', win, fmt)
118 def self.register(win, keys={})
119 tk_call('::blt::dnd', 'register', win, keys)
121 def self.select(win, x, y, timestamp)
122 tk_call('::blt::dnd', 'select', win, x, y, timestamp)
124 def self.set_data(win, fmt=nil, cmd=nil)
126 tk_call('::blt::dnd', 'setdata', win, fmt, cmd)
128 list(tk_call('::blt::dnd', 'setdata', win))
131 def self.token(*args)
132 tk_call('::blt::dnd', 'token', *args)