KWWidgets
|
00001 /* 00002 * tkDND.h -- 00003 * 00004 * Header files for the drag&drop tk extension. 00005 * 00006 * This software is copyrighted by: 00007 * George Petasis, 00008 * Software and Knowledge Engineering Laboratory, 00009 * Institute of Informatics and Telecommunications, 00010 * National Centre for Scientific Research "Demokritos", 00011 * Aghia Paraskevi, Athens, Greece. 00012 * e-mail: petasis@iit.demokritos.gr 00013 * and 00014 * Laurent Riesterer, Rennes, France. 00015 * e-mail: laurent.riesterer@free.fr 00016 * 00017 * The following terms apply to all files associated 00018 * with the software unless explicitly disclaimed in individual files. 00019 * 00020 * The authors hereby grant permission to use, copy, modify, distribute, 00021 * and license this software and its documentation for any purpose, provided 00022 * that existing copyright notices are retained in all copies and that this 00023 * notice is included verbatim in any distributions. No written agreement, 00024 * license, or royalty fee is required for any of the authorized uses. 00025 * Modifications to this software may be copyrighted by their authors 00026 * and need not follow the licensing terms described here, provided that 00027 * the new terms are clearly indicated on the first page of each file where 00028 * they apply. 00029 * 00030 * IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 00031 * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 00032 * ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 00033 * DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 00034 * POSSIBILITY OF SUCH DAMAGE. 00035 * 00036 * THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 00037 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 00038 * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 00039 * IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 00040 * NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 00041 * MODIFICATIONS. 00042 */ 00043 00044 #ifndef _TKDND 00045 #define _TKDND 00046 00047 #include "vtkTcl.h" 00048 #include "vtkTk.h" 00049 00050 #include <string.h> 00051 #include <tk.h> 00052 00053 /* 00054 * If we aren't in 8.4, don't use 8.4 constness 00055 */ 00056 #ifndef CONST84 00057 #define CONST84 00058 #endif 00059 00060 #if (TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)) 00061 # define HAVE_TCL84 00062 #endif 00063 #if (TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 5)) 00064 # define HAVE_TCL85 00065 #endif 00066 00067 /* 00068 * If "VERSION" is not defined, place a default value... 00069 */ 00070 #ifndef VERSION 00071 #ifdef PACKAGE_VERSION 00072 #define VERSION PACKAGE_VERSION 00073 #else 00074 #define VERSION "1.0" 00075 #endif 00076 #endif 00077 00078 #ifdef __WIN32__ 00079 # include <windows.h> 00080 # include <ole2.h> 00081 # include <tkPlatDecls.h> 00082 00083 # ifndef Tk_GetHWND 00084 EXTERN HWND Tk_GetHWND(Window win); 00085 # endif /* Tk_GetHWND */ 00086 #endif /* __WIN32__ */ 00087 00088 /* 00089 * These are passed to Tcl_PkgProvide... 00090 */ 00091 #define TKDND_PACKAGE "tkdnd" 00092 #define TKDND_VERSION VERSION 00093 00094 /* 00095 * Maximum length of the action descriptions list... 00096 */ 00097 #define TKDND_MAX_DESCRIPTIONS_LENGTH 1034 00098 #define TKDND_MAX_DESCRIPTIONS_LENGTH_STR "1024" 00099 00100 /* 00101 * These are used for selecting the most specific events. 00102 * (Laurent please add description :-) 00103 */ 00104 #define TKDND_SOURCE 0 00105 #define TKDND_GETDATA 1 00106 #define TKDND_GETCURSOR 2 00107 #define TKDND_TARGET 10 00108 #define TKDND_DRAGENTER 11 00109 #define TKDND_DRAGLEAVE 12 00110 #define TKDND_DRAG 13 00111 #define TKDND_DROP 14 00112 #define TKDND_ASK 15 00113 00114 /* TODO: remove 00115 #define TKDND_MODS 0x000000FF 00116 #define TKDND_BUTTONS 0x00001F00 00117 */ 00118 00119 /* 00120 * Debug Facilities... 00121 */ 00122 #ifdef DND_DEBUG 00123 #include <stdio.h> 00124 #ifdef __WIN32__ 00125 /* 00126 * Under Windows, we keep a log in a file. (Laurent, 09/07/2000) 00127 */ 00128 extern FILE *TkDND_Log; 00129 #define XDND_DEBUG(a) \ 00130 fprintf(TkDND_Log, "%s, %d: " a,__FILE__,__LINE__); fflush(TkDND_Log) 00131 #define XDND_DEBUG2(a,b) \ 00132 fprintf(TkDND_Log, "%s, %d: " a,__FILE__,__LINE__,b); fflush(TkDND_Log) 00133 #define XDND_DEBUG3(a,b,c) \ 00134 fprintf(TkDND_Log, "%s, %d: " a,__FILE__,__LINE__,b,c); fflush(TkDND_Log) 00135 #define XDND_DEBUG4(a,b,c,d) \ 00136 fprintf(TkDND_Log, "%s, %d: " a,__FILE__,__LINE__,b,c,d); fflush(TkDND_Log) 00137 #define XDND_DEBUG5(a,b,c,d,e) \ 00138 fprintf(TkDND_Log, "%s, %d: " a,__FILE__,__LINE__,b,c,d,e); fflush(TkDND_Log) 00139 #define XDND_DEBUG6(a,b,c,d,e,f) \ 00140 fprintf(TkDND_Log, "%s, %d: " a,__FILE__,__LINE__,b,c,d,e,f);fflush(TkDND_Log) 00141 #else /* __WIN32__ */ 00142 /* 00143 * Under Unix, we just write messages to stdout... 00144 */ 00145 #define XDND_DEBUG(a) \ 00146 printf("%s, %d: " a,__FILE__,__LINE__); fflush(stdout) 00147 #define XDND_DEBUG2(a,b) \ 00148 printf("%s, %d: " a,__FILE__,__LINE__,b); fflush(stdout) 00149 #define XDND_DEBUG3(a,b,c) \ 00150 printf("%s, %d: " a,__FILE__,__LINE__,b,c); fflush(stdout) 00151 #define XDND_DEBUG4(a,b,c,d) \ 00152 printf("%s, %d: " a,__FILE__,__LINE__,b,c,d); fflush(stdout) 00153 #define XDND_DEBUG5(a,b,c,d,e) \ 00154 printf("%s, %d: " a,__FILE__,__LINE__,b,c,d,e); fflush(stdout) 00155 #define XDND_DEBUG6(a,b,c,d,e,f) \ 00156 printf("%s, %d: " a,__FILE__,__LINE__,b,c,d,e,f); fflush(stdout) 00157 #endif /* __WIN32__ */ 00158 #else /* DND_DEBUG */ 00159 /* 00160 * Debug is not enabled. Just do nothing :-) 00161 */ 00162 #define XDND_DEBUG(a) 00163 #define XDND_DEBUG2(a,b) 00164 #define XDND_DEBUG3(a,b,c) 00165 #define XDND_DEBUG4(a,b,c,d) 00166 #define XDND_DEBUG5(a,b,c,d,e) 00167 #endif /* DND_DEBUG */ 00168 00169 typedef struct _DndType { 00170 int priority; /* For target types, check priorities */ 00171 #ifdef __WIN32__ 00172 CLIPFORMAT type; /* Clipboard format (Windows)*/ 00173 CLIPFORMAT matchedType; /* Clipboard format (Windows)*/ 00174 #else /* __WIN32__ */ 00175 Atom type; /* Clipboard format (Unix)*/ 00176 Atom matchedType; /* Clipboard format (Unix)*/ 00177 #endif /* __WIN32__ */ 00178 char *typeStr; /* Name of type */ 00179 unsigned long eventType; /* Type of event */ 00180 unsigned long eventMask; /* Modifiers of event */ 00181 char *script; /* Script to run */ 00182 struct _DndType *next; /* Next one in list */ 00183 short EnterEventSent; /* Have we send an <DragEnter> event? */ 00184 } DndType; 00185 00186 typedef struct _DndInfo { 00187 Tcl_Interp *interp; /* The associated interp */ 00188 Tk_Window topwin; /* The main Tk window */ 00189 Tk_Window tkwin; /* The associated Tk window */ 00190 DndType head; /* Head of the list of supported types */ 00191 #ifdef __WIN32__ 00192 LPDROPTARGET DropTarget; /* The OLE IDropTarget object */ 00193 #endif /* __WIN32__ */ 00194 DndType *cbData; 00195 Tcl_HashEntry *hashEntry; /* Hash table entry */ 00196 } DndInfo; 00197 00198 typedef struct _DndClass { 00199 Tk_Window MainWindow; /* The main window of our application */ 00200 Tcl_Interp *interp; /* A Tcl Interpreter */ 00201 Display *display; /* Display Pointer */ 00202 } DndClass; 00203 00204 #ifndef LONG 00205 #define LONG long 00206 #endif /* LONG */ 00207 00208 #ifdef MAC_TCL 00209 /* 00210 * Anybody ? 00211 */ 00212 #endif /* MAC_TCL */ 00213 00214 #endif /* _TKDND */