OSDN Git Service

change prefix to '/data/ruby'
[splhack/AndroidRuby.git] / lib / ruby-1.9.1-rc1 / ext / tk / lib / tkextlib / blt / unix_dnd.rb
1 #
2 #  tkextlib/blt/unix_dnd.rb
3 #
4 #    *** This is alpha version, because there is no document on BLT. ***
5 #
6 #                               by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
7 #
8
9 require 'tk'
10 require 'tkextlib/blt.rb'
11
12 module Tk::BLT
13   module DnD
14     extend TkCore
15
16     TkCommandNames = ['::blt::dnd'.freeze].freeze
17
18     ##############################
19
20     extend TkItemConfigMethod
21
22     class << self
23       def __item_cget_cmd(id)
24         ['::blt::dnd', *id]
25       end
26       private :__item_cget_cmd
27
28       def __item_config_cmd(id)
29         ['::blt::dnd', *id]
30       end
31       private :__item_config_cmd
32
33       private :itemcget, :itemcget_strict
34       private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
35
36       def cget(win, option)
37         itemcget(['cget', win], option)
38       end
39       def cget_strict(win, option)
40         itemcget_strict(['cget', win], option)
41       end
42       def configure(win, slot, value=None)
43         itemconfigure(['configure', win], slot, value)
44       end
45       def configinfo(win, slot=nil)
46         itemconfiginfo(['configure', win], slot)
47       end
48       def current_configinfo(win, slot=nil)
49         current_itemconfiginfo(['configure', win], slot)
50       end
51
52       def token_cget(win, option)
53         itemcget(['token', 'cget', win], option)
54       end
55       def token_cget_strict(win, option)
56         itemcget_strict(['token', 'cget', win], option)
57       end
58       def token_configure(win, slot, value=None)
59         itemconfigure(['token', 'configure', win], slot, value)
60       end
61       def token_configinfo(win, slot=nil)
62         itemconfiginfo(['token', 'configure', win], slot)
63       end
64       def current_token_configinfo(win, slot=nil)
65         current_itemconfiginfo(['token', 'configure', win], slot)
66       end
67
68       def token_windowconfigure(win, slot, value=None)
69         itemconfigure(['token', 'window', win], slot, value)
70       end
71       def token_windowconfiginfo(win, slot=nil)
72         itemconfiginfo(['token', 'window', win], slot)
73       end
74       def current_token_windowconfiginfo(win, slot=nil)
75         current_itemconfiginfo(['token', 'window', win], slot)
76       end
77     end
78
79     ##############################
80
81     def self.cancel(win)
82       tk_call('::blt::dnd', 'cancel', *wins)
83     end
84     def self.delete(*wins)
85       tk_call('::blt::dnd', 'delete', *wins)
86     end
87     def self.delete_source(*wins)
88       tk_call('::blt::dnd', 'delete', '-source', *wins)
89     end
90     def self.delete_target(*wins)
91       tk_call('::blt::dnd', 'delete', '-target', *wins)
92     end
93     def self.drag(win, x, y, token=None)
94       tk_call('::blt::dnd', 'drag', win, x, y, token)
95     end
96     def self.drop(win, x, y, token=None)
97       tk_call('::blt::dnd', 'drop', win, x, y, token)
98     end
99     def self.get_data(win, fmt=nil, cmd=nil)
100       if fmt
101         tk_call('::blt::dnd', 'getdata', win, fmt, cmd)
102       else
103         list(tk_call('::blt::dnd', 'getdata', win))
104       end
105     end
106     def self.names(pat=None)
107       list(tk_call('::blt::dnd', 'names', pat))
108     end
109     def self.source_names(pat=None)
110       list(tk_call('::blt::dnd', 'names', '-source', pat))
111     end
112     def self.target_names(pat=None)
113       list(tk_call('::blt::dnd', 'names', '-target', pat))
114     end
115     def self.pull(win, fmt)
116       tk_call('::blt::dnd', 'pull', win, fmt)
117     end
118     def self.register(win, keys={})
119       tk_call('::blt::dnd', 'register', win, keys)
120     end
121     def self.select(win, x, y, timestamp)
122       tk_call('::blt::dnd', 'select', win, x, y, timestamp)
123     end
124     def self.set_data(win, fmt=nil, cmd=nil)
125       if fmt
126         tk_call('::blt::dnd', 'setdata', win, fmt, cmd)
127       else
128         list(tk_call('::blt::dnd', 'setdata', win))
129       end
130     end
131     def self.token(*args)
132       tk_call('::blt::dnd', 'token', *args)
133     end
134   end
135 end