/src/wrappers/gtk/library/gtk_tree_model_foreach_function.e

http://github.com/tybor/Liberty · Specman e · 75 lines · 57 code · 13 blank · 5 comment · 3 complexity · 9e74058a5a4b15c6d860dc058976edfb MD5 · raw file

  1. indexing
  2. description: "Callback for GtkTreeModelForeachFunc"
  3. copyright: "[
  4. Copyright (C) 2007 Paolo Redaelli, 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 GTK_TREE_MODEL_FOREACH_FUNCTION
  19. -- GtkTreeModelForeachFunc ()
  20. -- gboolean (*GtkTreeModelForeachFunc) (GtkTreeModel *model,
  21. -- GtkTreePath *path, GtkTreeIter *iter, gpointer data);
  22. inherit WRAPPER_HANDLER -- It wraps a callback function
  23. insert
  24. ANY
  25. GTK
  26. creation make
  27. feature
  28. make (a_function: FUNCTION[TUPLE[GTK_TREE_MODEL, GTK_TREE_PATH, GTK_TREE_ITER], BOOLEAN]) is
  29. require gtk_initialized: gtk.is_initialized
  30. do
  31. function := a_function
  32. end
  33. feature {} --
  34. low_level_callback (model,path,iter,data: POINTER): INTEGER is
  35. -- Low level callback will be called by GTK; it will call
  36. -- `callback'.
  37. external "C use <callbacks.h>"
  38. alias "EiffelGtkTreeForeachFunc"
  39. end
  40. feature
  41. callback (model_ptr, path_ptr, iter_ptr, data: POINTER): INTEGER is
  42. local
  43. a_model: GTK_TREE_MODEL;
  44. a_path: GTK_TREE_PATH;
  45. an_iter: GTK_TREE_ITER
  46. factory: G_OBJECT_EXPANDED_FACTORY [GTK_TREE_MODEL]
  47. do
  48. debug
  49. print ("Gtk tree select foreach function callback:")
  50. print (" model=") print(model_ptr.to_string)
  51. print (" path=") print(path_ptr.to_string)
  52. print (" path=") print(iter_ptr.to_string)
  53. print (" data=") print (data.to_string)
  54. print ("%N")
  55. end
  56. a_model := factory.wrapper (model_ptr)
  57. create a_path.from_external_pointer (path_ptr)
  58. create an_iter.from_external_pointer (iter_ptr)
  59. Result := (function.item ([a_model,a_path,an_iter]).to_integer)
  60. end
  61. function: FUNCTION[TUPLE[GTK_TREE_MODEL, GTK_TREE_PATH, GTK_TREE_ITER], BOOLEAN]
  62. end