/src/wrappers/gdk/library/gdk_drag_context.e

http://github.com/tybor/Liberty · Specman e · 165 lines · 97 code · 29 blank · 39 comment · 4 complexity · a3aabf81f27125d96ad5ce9d8a3cb8df MD5 · raw file

  1. indexing
  2. description: "GdkDragContext structure"
  3. copyright: "[
  4. Copyright (C) 2006 eiffel-libraries team, GTK+ team
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public License
  7. as published by the Free Software Foundation; either version 2.1 of
  8. the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  16. 02110-1301 USA
  17. ]"
  18. class GDK_DRAG_CONTEXT
  19. -- GdkDragContext
  20. -- typedef struct {
  21. -- GObject parent_instance;
  22. -- GdkDragProtocol protocol;
  23. -- gboolean is_source;
  24. -- GdkWindow *source_window;
  25. -- GdkWindow *dest_window;
  26. -- GList *targets;
  27. -- GdkDragAction actions;
  28. -- GdkDragAction suggested_action;
  29. -- GdkDragAction action;
  30. -- guint32 start_time;
  31. -- } GdkDragContext;
  32. --
  33. -- A GdkDragContext holds information about a drag in progress. It
  34. -- is used on both source and destination sides.
  35. inherit
  36. G_OBJECT
  37. insert
  38. GDK_DRAG_CONTEXT_EXTERNALS
  39. GDK_DRAG_ACTION
  40. creation from_external_pointer, secondary_wrapper_from
  41. feature -- size
  42. struct_size: INTEGER is
  43. external "C inline use <gtk/gtk.h>"
  44. alias "sizeof(GdkDragContext)"
  45. end
  46. feature -- Operations
  47. finish (success, delete: BOOLEAN; time: INTEGER) is
  48. -- Informs the drag source that the drop is finished, and
  49. -- that the data of the drag will no longer be required.
  50. -- `success': a flag indicating whether the drop was successful
  51. -- `delete': a flag indicating whether the source should delete the original data. (This should be TRUE for a move)
  52. -- `time': the timestamp from the "drag_data_drop" signal.
  53. require
  54. --time >= 0
  55. do
  56. gtk_drag_finish (handle, success.to_integer, delete.to_integer, time)
  57. end
  58. status (an_action: INTEGER; time: INTEGER) is
  59. -- Selects one of the actions offered by the drag source.
  60. -- This function is called by the drag destination in
  61. -- response to gdk_drag_motion() called by the drag source.
  62. -- `an_action': the selected action which will be taken when a drop happens, or 0 to indicate that a drop will not be accepted.
  63. -- `time': the timestamp for this operation.
  64. require
  65. --time >= 0
  66. is_valid_gdk_drag_action (an_action)
  67. do
  68. gdk_drag_status (handle, an_action, time)
  69. end
  70. feature -- Representation
  71. parent_instance: G_OBJECT is
  72. -- the parent instance
  73. local factory: G_OBJECT_EXPANDED_FACTORY[G_OBJECT]
  74. do
  75. Result := factory.wrapper(gdk_drag_context_parent_instance (handle))
  76. end
  77. protocol: INTEGER is -- GdkDragProtocol
  78. -- the DND protocol which governs this drag
  79. do
  80. end
  81. is_source: BOOLEAN is
  82. -- true if the context is used on the source side
  83. do
  84. Result := gdk_drag_context_is_source (handle).to_boolean
  85. end
  86. source_window: GDK_WINDOW is
  87. -- the source of this drag
  88. local window: POINTER; factory: G_OBJECT_EXPANDED_FACTORY[GDK_WINDOW]
  89. do
  90. window := gdk_drag_context_source_window (handle)
  91. Result := factory.existant_wrapper(window)
  92. if Result=Void then
  93. create Result.from_external_pointer (window)
  94. end
  95. end
  96. dest_window: GDK_WINDOW is
  97. -- the destination window of this drag
  98. local
  99. window: POINTER
  100. factory: G_OBJECT_EXPANDED_FACTORY[GDK_WINDOW]
  101. do
  102. window := gdk_drag_context_dest_window (handle)
  103. Result := factory.existant_wrapper (window)
  104. if Result=Void then
  105. create Result.from_external_pointer (window)
  106. end
  107. end
  108. -- targets: G_LIST
  109. -- a list of targets offered by the source
  110. actions: INTEGER is -- GdkDragAction
  111. -- a bitmask of actions proposed by the source when suggested_action is GDK_ACTION_ASK
  112. do
  113. Result := gdk_drag_context_actions (handle)
  114. ensure
  115. is_valid_gdk_drag_action (Result)
  116. end
  117. suggested_action: INTEGER is -- GdkDragAction
  118. -- the action suggested by the source
  119. do
  120. Result := gdk_drag_context_suggested_action (handle)
  121. ensure
  122. is_valid_gdk_drag_action (Result)
  123. end
  124. action: INTEGER is -- GdkDragAction
  125. -- the action chosen by the destination
  126. do
  127. Result := gdk_drag_context_action (handle)
  128. ensure
  129. is_valid_gdk_drag_action (Result)
  130. end
  131. start_time: INTEGER_64 is
  132. -- a timestamp recording the start time of this drag
  133. do
  134. Result := gdk_drag_context_start_time (handle)
  135. end
  136. end -- class GDK_DRAG_CONTEXT