Dnd.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: Dnd.h /main/3 1995/10/26 15:04:35 rswiston $ */
  24. /*
  25. * (c) Copyright 1993, 1994 Hewlett-Packard Company
  26. * (c) Copyright 1993, 1994 International Business Machines Corp.
  27. * (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  28. * (c) Copyright 1993, 1994 Novell, Inc.
  29. */
  30. #ifndef _Dt_Dnd_h
  31. #define _Dt_Dnd_h
  32. #include <Xm/DragIcon.h>
  33. #include <Xm/DragC.h>
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. /*
  38. * Constants
  39. */
  40. /* Dnd Callback Reasons */
  41. enum {
  42. DtCR_DND_CONVERT_DATA,
  43. DtCR_DND_CONVERT_DELETE,
  44. DtCR_DND_DRAG_FINISH,
  45. DtCR_DND_TRANSFER_DATA,
  46. DtCR_DND_DROP_ANIMATE,
  47. DtCR_DND_ROOT_TRANSFER
  48. };
  49. #define DtCR_DND_TRANSFER DtCR_DND_TRANSFER_DATA
  50. /*
  51. * Dnd Drag Start Resources
  52. * dropOnRootCallback is private and should not be used
  53. */
  54. #define DtNdropOnRootCallback "dropOnRootCallback"
  55. #define DtCDropOnRootCallback "DropOnRootCallback"
  56. #define DtNsourceIcon "sourceIcon"
  57. #define DtCSourceIcon "SourceIcon"
  58. #define DtNbufferIsText "bufferIsText"
  59. #define DtCBufferIsText "BufferIsText"
  60. /*
  61. *Dnd Drop Register Resources
  62. */
  63. #define DtNdropAnimateCallback "dropAnimateCallback"
  64. #define DtCDropAnimateCallback "DropAnimateCallback"
  65. #define DtNpreserveRegistration "preserveRegistration"
  66. #define DtCPreserveRegistration "PreserveRegistration"
  67. #define DtNregisterChildren "registerChildren"
  68. #define DtCRegisterChildren "RegisterChildren"
  69. #define DtNtextIsBuffer "textIsBuffer"
  70. #define DtCTextIsBuffer "TextIsBuffer"
  71. /*
  72. * Types
  73. */
  74. typedef enum {
  75. DtDND_SUCCESS,
  76. DtDND_FAILURE
  77. } DtDndStatus;
  78. typedef unsigned long DtDndProtocol;
  79. enum {
  80. DtDND_NOOP_TRANSFER = 0L,
  81. DtDND_TEXT_TRANSFER = (1L << 0),
  82. DtDND_FILENAME_TRANSFER = (1L << 1),
  83. DtDND_BUFFER_TRANSFER = (1L << 2)
  84. };
  85. typedef struct _DtDndBuffer {
  86. void * bp;
  87. int size;
  88. String name;
  89. } DtDndBuffer;
  90. typedef struct _DtDndContext {
  91. DtDndProtocol protocol;
  92. Cardinal numItems;
  93. union {
  94. XmString * strings;
  95. String * files;
  96. DtDndBuffer * buffers;
  97. } data;
  98. } DtDndContext;
  99. /*
  100. * Dnd Callback Structures
  101. */
  102. typedef struct _DtDndConvertCallbackStruct {
  103. int reason;
  104. XEvent * event;
  105. DtDndContext * dragData;
  106. DtDndStatus status;
  107. } DtDndConvertCallbackStruct, *DtDndConvertCallback;
  108. typedef struct _DtDndDragFinishCallbackStruct {
  109. int reason;
  110. XEvent * event;
  111. DtDndContext * dragData;
  112. Widget sourceIcon;
  113. } DtDndDragFinishCallbackStruct, *DtDndDragFinishCallback;
  114. typedef struct _DtDndTransferCallbackStruct {
  115. int reason;
  116. XEvent * event;
  117. Position x, y;
  118. unsigned char operation;
  119. DtDndContext * dropData;
  120. Widget dragContext;
  121. Boolean completeMove;
  122. DtDndStatus status;
  123. } DtDndTransferCallbackStruct, *DtDndTransferCallback;
  124. typedef DtDndTransferCallbackStruct DtDndDropCallbackStruct, *DtDndDropCallback;
  125. typedef struct _DtDndDropAnimateCallbackStruct {
  126. int reason;
  127. XEvent * event;
  128. Position x, y;
  129. unsigned char operation;
  130. DtDndContext * dropData;
  131. } DtDndDropAnimateCallbackStruct, *DtDndDropAnimateCallback;
  132. /*
  133. * Functions
  134. */
  135. extern Widget DtDndCreateSourceIcon(
  136. Widget widget,
  137. Pixmap source,
  138. Pixmap mask);
  139. extern Widget DtDndDragStart(
  140. Widget dragInitiator,
  141. XEvent* event,
  142. DtDndProtocol protocol,
  143. Cardinal numItems,
  144. unsigned char operations,
  145. XtCallbackList convertCallback,
  146. XtCallbackList dragFinishCallback,
  147. ArgList argList,
  148. Cardinal argCount);
  149. extern Widget DtDndVaDragStart(
  150. Widget dragInitiator,
  151. XEvent* event,
  152. DtDndProtocol protocol,
  153. Cardinal numItems,
  154. unsigned char operations,
  155. XtCallbackList convertCallback,
  156. XtCallbackList dragFinishCallback,
  157. ...);
  158. extern void DtDndDropRegister(
  159. Widget dropSite,
  160. DtDndProtocol protocols,
  161. unsigned char operations,
  162. XtCallbackList transferCallback,
  163. ArgList argList,
  164. Cardinal argCount);
  165. extern void DtDndVaDropRegister(
  166. Widget dropSite,
  167. DtDndProtocol protocols,
  168. unsigned char operations,
  169. XtCallbackList transferCallback,
  170. ...);
  171. extern void DtDndDropUnregister(
  172. Widget widget);
  173. #ifdef __cplusplus
  174. }
  175. #endif
  176. #endif /* _Dt_Dnd_h */