/src/wrappers/gtk/library/editing_started_callback.e

http://github.com/tybor/Liberty · Specman e · 84 lines · 65 code · 16 blank · 3 comment · 4 complexity · 4227b40cbcd2e7c00741e749c8789393 MD5 · raw file

  1. indexing
  2. description: "Generic callback for the editing-started signal"
  3. copyright: "[
  4. Copyright (C) 2006 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 EDITING_STARTED_CALLBACK
  22. inherit CALLBACK redefine object end
  23. insert G_OBJECT_FACTORY [GTK_CELL_RENDERER]
  24. creation make
  25. feature
  26. object: GTK_CELL_RENDERER
  27. feature
  28. callback (editable_ptr, path_ptr, instance: POINTER) is
  29. local
  30. cell_editable_factory: G_OBJECT_FACTORY[GTK_CELL_EDITABLE]
  31. an_editable: GTK_CELL_EDITABLE
  32. a_path: STRING
  33. do
  34. debug print ("Callback: instance=") print (instance.to_string) print ("%N") end
  35. -- The following is written with the implicit requirement
  36. -- that the button is actually created bu the Eiffel
  37. -- application.
  38. object := wrapper(instance)
  39. an_editable := cell_editable_factory.wrapper(editable_ptr)
  40. if path_ptr.is_not_null then create {CONST_STRING} a_path.from_external(path_ptr) end
  41. procedure.call ([an_editable, a_path, object])
  42. end
  43. callback_pointer: POINTER is
  44. do
  45. Result := get_callback_pointer ($callback)
  46. ensure
  47. Result.is_not_null
  48. end
  49. connect (an_object: GTK_CELL_RENDERER; a_procedure: PROCEDURE [ANY, TUPLE[GTK_CELL_EDITABLE,
  50. STRING, GTK_CELL_RENDERER]]) is
  51. do
  52. debug
  53. print ("EDITING_STARTED_CALLBACK.connect (an_object=") print (an_object.to_pointer.to_string)
  54. print (" an_object.handle=") print (an_object.handle.to_string)
  55. print (") Current=") print (to_pointer.to_string)
  56. print (" Current.handle=") print (handle.to_string)
  57. print ("%N")
  58. end
  59. handler_id := g_signal_connect_closure (an_object.handle,
  60. signal_name.to_external,
  61. handle,
  62. 0 -- i.e. call it before default handler
  63. )
  64. procedure:=a_procedure
  65. end
  66. signal_name: STRING is "editing-started"
  67. procedure: PROCEDURE [ANY, TUPLE[GTK_CELL_EDITABLE, STRING, GTK_CELL_RENDERER]]
  68. end