/src/wrappers/gtk/library/drag_data_get_callback.e

http://github.com/tybor/Liberty · Specman e · 94 lines · 76 code · 18 blank · 0 comment · 4 complexity · d7209dcd374d5e67a9affa4ceff56aed MD5 · raw file

  1. indexing
  2. description: "Generic callback for the drag-data-get signal"
  3. copyright: "[
  4. Copyright (C) 2006 Paolo redaelli, eiffel-libraries team, GTK+ team and others
  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. license: "LGPL v2 or later"
  19. date: "$Date:$"
  20. revision "$Revision:$"
  21. class DRAG_DATA_GET_CALLBACK
  22. inherit CALLBACK redefine object end
  23. insert G_OBJECT_FACTORY [GTK_WIDGET]
  24. creation make
  25. feature
  26. object: GTK_WIDGET
  27. feature
  28. callback (drag_context_ptr, selection_data_ptr: POINTER; info, time: INTEGER; instance: POINTER) is
  29. require
  30. info >= 0
  31. time >= 0
  32. local
  33. drag_context_factory: G_OBJECT_EXPANDED_FACTORY [GDK_DRAG_CONTEXT]
  34. drag_context: GDK_DRAG_CONTEXT
  35. selection_data: GTK_SELECTION_DATA
  36. do
  37. debug
  38. print ("Callback: instance=") print (instance.to_string) print ("%N")
  39. end
  40. object := wrapper(instance)
  41. drag_context := drag_context_factory.existant_wrapper(drag_context_ptr)
  42. if drag_context=Void then
  43. create drag_context.from_external_pointer(drag_context_ptr)
  44. end
  45. create selection_data.from_external_pointer (selection_data_ptr)
  46. procedure.call ([drag_context, selection_data, info, time, object])
  47. ensure
  48. info >= 0
  49. time >= 0
  50. end
  51. callback_pointer: POINTER is
  52. do
  53. Result := get_callback_pointer ($callback)
  54. ensure
  55. Result.is_not_null
  56. end
  57. connect (an_object: GTK_WIDGET; a_procedure: PROCEDURE [ANY, TUPLE [GDK_DRAG_CONTEXT, GTK_SELECTION_DATA,
  58. INTEGER_32, INTEGER_32, GTK_WIDGET]]) is
  59. do
  60. debug
  61. print ("DRAG_DATA_GET_CALLBACK.connect (an_object=") print (an_object.to_pointer.to_string)
  62. print (" an_object.handle=") print (an_object.handle.to_string)
  63. print (") Current=") print (to_pointer.to_string)
  64. print (" Current.handle=") print (handle.to_string)
  65. print ("%N")
  66. end
  67. handler_id := g_signal_connect_closure (an_object.handle,
  68. signal_name.to_external,
  69. handle,
  70. 0 -- i.e. call it before default handler
  71. )
  72. procedure:=a_procedure
  73. end
  74. signal_name: STRING is "drag-data-get"
  75. procedure: PROCEDURE [ANY, TUPLE [GDK_DRAG_CONTEXT, GTK_SELECTION_DATA, INTEGER_32, INTEGER_32, GTK_WIDGET]]
  76. end