KWWidgets
Dnd.h
Go to the documentation of this file.
1 /***********************************************************/
2 /* Copyright 1996 Daniel Dardailler.
3 Permission to use, copy, modify, distribute, and sell this software
4 for any purpose is hereby granted without fee, provided that the above
5 copyright notice appear in all copies and that both that copyright
6 notice and this permission notice appear in supporting documentation,
7 and that the name of Daniel Dardailler not be used in advertising or
8 publicity pertaining to distribution of the software without specific,
9 written prior permission. Daniel Dardailler makes no representations
10 about the suitability of this software for any purpose. It is
11 provided "as is" without express or implied warranty.
12 ************************************************************/
13 
14 #ifndef _DnD_h
15 #define _DnD_h
16 
17 /* This is a Dnd Dynamic Motif-compliant Protocol messaging API */
18 /* Only requires Xlib layer */
19 
20 #include <X11/Xlib.h>
21 #include <X11/Xatom.h>
22 
23 #define DndVersion 1
24 #define DndRevision 0
25 #define DndIncludeVersion (DndVersion * 10 + DndRevision)
26 
27 /* The following values are used in the DndData structure */
28 
29 /* protocol style */
30 #define DND_DRAG_NONE 0
31 #define DND_DRAG_DROP_ONLY 1
32 #define DND_DRAG_DYNAMIC 5
33 
34 /* message type */
35 #define DND_TOP_LEVEL_ENTER 0
36 #define DND_TOP_LEVEL_LEAVE 1
37 #define DND_DRAG_MOTION 2
38 #define DND_DROP_SITE_ENTER 3
39 #define DND_DROP_SITE_LEAVE 4
40 #define DND_DROP_START 5
41 #define DND_OPERATION_CHANGED 8
42 
43 /* operation(s) */
44 #define DND_NOOP 0L
45 #define DND_MOVE (1L << 0)
46 #define DND_COPY (1L << 1)
47 #define DND_LINK (1L << 2)
48 
49 /* status */
50 #define DND_NO_DROP_SITE 1
51 #define DND_INVALID_DROP_SITE 2
52 #define DND_VALID_DROP_SITE 3
53 
54 /* completion */
55 #define DND_DROP 0
56 #define DND_DROP_HELP 1
57 #define DND_DROP_CANCEL 2
58 
59 
60 /* Client side structure used in the API */
61 typedef struct {
62  unsigned char reason; /* message type: DND_TOP_LEVEL_ENTER, etc */
63  Time time ;
64  unsigned char operation;
65  unsigned char operations;
66  unsigned char status;
67  unsigned char completion;
68  short x ;
69  short y ;
70  Window src_window ;
71  Atom property ;
72 } DndData ;
73 
74 /* extern functions */
75 /* These provides for basic formatting of ICCCM message going
76  back and forth during the D&D gesture */
77 
78 extern void
79 DndWriteSourceProperty(Display * dpy,
80  Window window, Atom dnd_selection,
81  Atom * targets, unsigned short num_targets);
82 
83 extern void
84 DndReadSourceProperty(Display * dpy,
85  Window window, Atom dnd_selection,
86  Atom ** targets, unsigned short * num_targets);
87 
88 extern void
89 DndWriteReceiverProperty(Display * dpy, Window window,
90  unsigned char protocol_style);
91 
92 extern void
93 DndReadReceiverProperty(Display * dpy, Window window,
94  unsigned char * protocol_style);
95 
96 extern void
97 DndFillClientMessage(Display * dpy, Window window,
98  XClientMessageEvent *cm,
99  DndData * dnd_data,
100  char receiver);
101 
102 extern Bool
103 DndParseClientMessage(XClientMessageEvent *cm,
104  DndData * dnd_data,
105  char * receiver);
106 
107 #endif /* _Dnd_h */