Dnd.h

Go to the documentation of this file.
00001 /***********************************************************/
00002 /* Copyright 1996 Daniel Dardailler.  
00003 Permission to use, copy, modify, distribute, and sell this software
00004 for any purpose is hereby granted without fee, provided that the above
00005 copyright notice appear in all copies and that both that copyright
00006 notice and this permission notice appear in supporting documentation,
00007 and that the name of Daniel Dardailler not be used in advertising or
00008 publicity pertaining to distribution of the software without specific,
00009 written prior permission.  Daniel Dardailler makes no representations
00010 about the suitability of this software for any purpose.  It is
00011 provided "as is" without express or implied warranty.
00012 ************************************************************/
00013 
00014 #ifndef _DnD_h
00015 #define _DnD_h
00016 
00017 /* This is a Dnd Dynamic Motif-compliant Protocol messaging API */
00018 /* Only requires Xlib layer */
00019 
00020 #include <X11/Xlib.h>
00021 #include <X11/Xatom.h>
00022 
00023 #define DndVersion 1
00024 #define DndRevision 0
00025 #define DndIncludeVersion (DndVersion * 10 + DndRevision)
00026 
00027 /* The following values are used in the DndData structure */
00028 
00029 /* protocol style */
00030 #define DND_DRAG_NONE            0
00031 #define DND_DRAG_DROP_ONLY       1
00032 #define DND_DRAG_DYNAMIC         5
00033 
00034 /* message type */
00035 #define DND_TOP_LEVEL_ENTER   0
00036 #define DND_TOP_LEVEL_LEAVE   1
00037 #define DND_DRAG_MOTION       2
00038 #define DND_DROP_SITE_ENTER   3
00039 #define DND_DROP_SITE_LEAVE   4
00040 #define DND_DROP_START        5
00041 #define DND_OPERATION_CHANGED 8
00042 
00043 /* operation(s) */
00044 #define DND_NOOP  0L
00045 #define DND_MOVE   (1L << 0)
00046 #define DND_COPY  (1L << 1)
00047 #define DND_LINK  (1L << 2)
00048 
00049 /* status */
00050 #define DND_NO_DROP_SITE        1
00051 #define DND_INVALID_DROP_SITE   2
00052 #define DND_VALID_DROP_SITE  3
00053 
00054 /* completion */
00055 #define DND_DROP        0
00056 #define DND_DROP_HELP   1
00057 #define DND_DROP_CANCEL 2
00058 
00059 
00060 /* Client side structure used in the API */
00061 typedef struct {
00062     unsigned char       reason;  /* message type: DND_TOP_LEVEL_ENTER, etc */
00063     Time                time ;
00064     unsigned char       operation;
00065     unsigned char       operations;
00066     unsigned char       status;
00067     unsigned char       completion;
00068     short               x ;
00069     short               y ;
00070     Window              src_window ;
00071     Atom                property ;
00072 } DndData ;
00073 
00074 /* extern functions */
00075 /* These provides for basic formatting of ICCCM message going
00076    back and forth during the D&D gesture */
00077 
00078 extern void 
00079 DndWriteSourceProperty(Display * dpy,
00080            Window window, Atom dnd_selection,
00081            Atom * targets, unsigned short num_targets);
00082 
00083 extern void
00084 DndReadSourceProperty(Display * dpy,
00085           Window window, Atom dnd_selection,
00086           Atom ** targets, unsigned short * num_targets);
00087 
00088 extern void 
00089 DndWriteReceiverProperty(Display * dpy, Window window, 
00090        unsigned char protocol_style);
00091 
00092 extern void
00093 DndReadReceiverProperty(Display * dpy, Window window,
00094       unsigned char * protocol_style);
00095 
00096 extern void
00097 DndFillClientMessage(Display * dpy, Window window,
00098          XClientMessageEvent *cm,
00099          DndData * dnd_data,
00100          char receiver);
00101 
00102 extern Bool
00103 DndParseClientMessage(XClientMessageEvent *cm,
00104           DndData * dnd_data,
00105           char * receiver);
00106 
00107 #endif /* _Dnd_h */

Generated on Sat Dec 12 16:04:53 2009 for KWWidgets by  doxygen 1.6.1