c52cb3ec55aa2c548c92b9d3ccbd0bb530ec52f5
[cl-gtk2.git] / gtk / gtk.dnd.lisp
1 (in-package :gtk)
2
3 ;;
4 (define-g-boxed-opaque target-list "GtkTargetList"
5   :alloc (error "Use make-target-list to allocate GtkTargetList"))
6
7 (defcfun (gtk-target-list-new "gtk_target_list_new")
8     (g-boxed-foreign target-list :free-from-foreign nil)
9   (targets :pointer)
10   (n-targets :int))
11
12 (defun make-target-list (targets)
13   (with-foreign-boxed-array (n-targets targets-ptr target-entry targets)
14     (gtk-target-list-new targets-ptr n-targets)))
15
16 (defcfun (gtk-target-list-ref "gtk_target_list_ref")
17     (g-boxed-foreign target-list :free-from-foreign nil)
18   (target-list (g-boxed-foreign target-list)))
19
20 (defcfun (gtk-target-list-unref "gtk_target_list_unref") :void
21   (target-list (g-boxed-foreign target-list)))
22
23 (export (boxed-related-symbols 'target-list))
24
25 ;;
26
27 (defcfun (gtk-drag-dest-set "gtk_drag_dest_set") :void
28   (widget (g-object widget))
29   (flags dest-defaults)
30   (targets :pointer)
31   (n-targets :int)
32   (actions gdk-drag-action))
33
34 (defun drag-dest-set (widget flags targets actions)
35   (with-foreign-boxed-array (n-targets targets-ptr target-entry targets)
36     (gtk-drag-dest-set widget flags targets-ptr n-targets actions)))
37
38 (export 'drag-dest-set)
39
40 (defcfun (drag-dest-unset "gtk_drag_dest_unset") :void
41   (widget (g-object widget)))
42
43 (export 'drag-dest-unset)
44
45 (defcfun (drag-dest-add-text-targets "gtk_drag_dest_add_text_targets") :void
46   (widget (g-object widget)))
47
48 (export 'drag-dest-add-text-targets)
49
50 (defcfun (drag-dest-add-image-targets "gtk_drag_dest_add_image_targets") :void
51   (widget (g-object widget)))
52
53 (export 'drag-dest-add-image-targets)
54
55 (defcfun (drag-dest-add-uri-targets "gtk_drag_dest_add_uri_targets") :void
56   (widget (g-object widget)))
57
58 (export 'drag-dest-add-uri-targets)
59
60 (defcfun (drag-dest-set-track-motion "gtk_drag_dest_set_track_motion") :void
61   (widget (g-object widget))
62   (track-motion :boolean))
63
64 (export 'drag-dest-set-track-motion)
65
66 (defcfun (drag-dest-get-track-motion "gtk_drag_dest_get_track_motion") :boolean
67   (widget (g-object widget)))
68
69 (export 'drag-dest-get-track-motion)
70
71 (defcfun (drag-finish "gtk_drag_finish") :void
72   (context (g-object drag-context))
73   (success :boolean)
74   (del :boolean)
75   (time :uint32))
76
77 (export 'drag-finish)
78
79 (defcfun (drag-get-data "gtk_drag_get_data") :void
80   (widget (g-object widget))
81   (context (g-object drag-context))
82   (target gdk-atom-as-string)
83   (time :uint32))
84
85 (export 'drag-get-data)
86
87 (defcfun (drag-get-source-widget "gtk_drag_get_source_widget")
88     (g-object widget)
89   (context (g-object drag-context)))
90
91 (export 'drag-get-source-widget)
92
93 (defcfun (drag-highlight "gtk_drag_highlight") :void
94   (widget (g-object widget)))
95
96 (export 'drag-highlight)
97
98 (defcfun (drag-unhighlight "gtk_drag_unhighlight") :void
99   (widget (g-object widget)))
100
101 (export 'drag-unhighlight)
102
103 (defcfun (gtk-drag-begin "gtk_drag_begin") (g-object drag-context :free-from-foreign nil)
104   (widget (g-object widget))
105   (targets (g-boxed-foreign target-list))
106   (actions gdk-drag-action)
107   (button :int)
108   (event (g-object gdk:event)))
109
110 (defun drag-begin (widget targets actions button event)
111   (let* ((target-list (make-target-list targets))
112          (context (gtk-drag-begin widget target-list actions button event)))
113     (gtk-target-list-unref target-list)
114     context))
115
116 (export 'drag-begin)
117
118 (defcfun (drag-set-icon-widget "gtk_drag_set_icon_widget") :void
119   (context (g-object drag-context))
120   (widget (g-object widget))
121   (hot-x :int)
122   (hot-y :int))
123
124 (export 'drag-set-icon-widget)
125
126 (defcfun (drag-set-icon-pixbuf "gtk_drag_set_icon_pixbuf") :void
127   (context (g-object drag-context))
128   (pixbuf (g-object pixbuf))
129   (hot-x :int)
130   (hot-y :int))
131
132 (export 'drag-set-icon-pixbuf)
133
134 (defcfun (drag-set-icon-stock "gtk_drag_set_icon_stock") :void
135   (context (g-object drag-context))
136   (stock-id :string)
137   (hot-x :int)
138   (hot-y :int))
139
140 (export 'drag-set-icon-stock)
141
142 (defcfun (drag-set-icon-name "gtk_drag_set_icon_name") :void
143   (context (g-object drag-context))
144   (icon-name :string)
145   (hot-x :int)
146   (hot-y :int))
147
148 (export 'drag-set-icon-name)
149
150 (defcfun (drag-set-icon-default "gtk_drag_set_icon_default") :void
151   (context (g-object drag-context)))
152
153 (export 'drag-set-icon-default)
154
155 (defcfun (drag-check-threshold "gtk_drag_check_threshold") :boolean
156   (widget (g-object widget))
157   (start-x :int)
158   (start-y :int)
159   (current-x :int)
160   (current-y :int))
161
162 (export 'drag-check-threshold)
163
164 (defcfun (gtk-drag-source-set "gtk_drag_source_set") :void
165   (widget (g-object widget))
166   (start-button-mask modifier-type)
167   (targets :pointer)
168   (n-targets :int)
169   (actions gdk-drag-action))
170
171 (defun drag-source-set (widget button-mask targets actions)
172   (with-foreign-boxed-array (n-targets targets-ptr target-entry targets)
173     (gtk-drag-source-set widget button-mask targets-ptr n-targets actions)))
174
175 (export 'drag-source-set)
176
177 (defcfun (drag-source-set-icon-pixbuf "gtk_drag_source_set_icon_pixbuf") :void
178   (widget (g-object widget))
179   (pixbuf (g-object pixbuf)))
180
181 (export 'drag-source-set-icon-pixbuf)
182
183 (defcfun (drag-source-set-icon-stock "gtk_drag_source_set_icon_stock") :void
184   (widget (g-object widget))
185   (stock-id :string))
186
187 (export 'drag-source-set-icon-stock)
188
189 (defcfun (drag-source-set-icon-name "gtk_drag_source_set_icon_name") :void
190   (widget (g-object widget))
191   (icon-name :string))
192
193 (export 'drag-source-set-icon-name)
194
195 (defcfun (gtk-drag-source-unset "gtk_drag_source_unset") :void
196   (widget (g-object widget))
197   (target-list :pointer))
198
199 (defun drag-source-unset (widget targets)
200   (let ((target-list (make-target-list targets)))
201     (gtk-drag-source-unset widget target-list)
202     (gtk-target-list-unref target-list)
203     nil))
204
205 (export 'drag-source-unset)
206
207 (defcfun (drag-source-add-text-targets "gtk_drag_source_add_text_targets") :void
208   (widget (g-object widget)))
209
210 (export 'drag-source-add-text-targets)
211
212 (defcfun (drag-source-add-image-targets "gtk_drag_source_add_image_targets") :void
213   (widget (g-object widget)))
214
215 (export 'drag-source-add-image-targets)
216
217 (defcfun (drag-source-add-uri-targets "gtk_drag_source_add_uri_targets") :void
218   (widget (g-object widget)))
219
220 (export 'drag-source-add-uri-targets)