PageRenderTime 25ms CodeModel.GetById 18ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 1indexing
 2	description: "Callback for GtkTreeModelForeachFunc"
 3	copyright: "[
 4					Copyright (C) 2007 Paolo Redaelli, GTK+ team
 5					
 6					This library is free software; you can redistribute it and/or
 7					modify it under the terms of the GNU Lesser General Public License
 8					as published by the Free Software Foundation; either version 2.1 of
 9					the License, or (at your option) any later version.
10					
11					This library is distributed in the hope that it will be useful, but
12					WITHOUT ANY WARRANTY; without even the implied warranty of
13					MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14					Lesser General Public License for more details.
15
16					You should have received a copy of the GNU Lesser General Public
17					License along with this library; if not, write to the Free Software
18					Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19					02110-1301 USA
20					]"
21	
22class GTK_TREE_MODEL_FOREACH_FUNCTION
23	-- GtkTreeModelForeachFunc ()
24	
25	-- gboolean (*GtkTreeModelForeachFunc) (GtkTreeModel *model,
26	-- GtkTreePath *path, GtkTreeIter *iter, gpointer data);
27	
28inherit WRAPPER_HANDLER -- It wraps a callback function
29	
30insert
31	ANY
32	GTK
33	
34creation make
35	
36feature
37	make (a_function: FUNCTION[TUPLE[GTK_TREE_MODEL, GTK_TREE_PATH, GTK_TREE_ITER], BOOLEAN]) is
38		require gtk_initialized: gtk.is_initialized
39		do
40			function := a_function
41		end
42	
43feature {} -- 
44	low_level_callback (model,path,iter,data: POINTER): INTEGER is
45			-- Low level callback will be called by GTK; it will call
46			-- `callback'.
47		external "C use <callbacks.h>"
48		alias "EiffelGtkTreeForeachFunc"
49		end 
50
51feature
52	callback (model_ptr, path_ptr, iter_ptr, data: POINTER): INTEGER is 
53		local 
54			a_model: GTK_TREE_MODEL; 
55			a_path: GTK_TREE_PATH; 
56			an_iter: GTK_TREE_ITER
57			factory: G_OBJECT_EXPANDED_FACTORY [GTK_TREE_MODEL]
58		do
59			debug
60				print ("Gtk tree select foreach function callback:")
61				print (" model=") print(model_ptr.to_string) 
62				print (" path=") print(path_ptr.to_string)
63				print (" path=") print(iter_ptr.to_string) 				
64				print (" data=") print (data.to_string)
65				print ("%N")
66			end
67			
68			a_model := factory.wrapper (model_ptr)
69			create a_path.from_external_pointer (path_ptr)
70			create an_iter.from_external_pointer (iter_ptr)
71			Result := (function.item ([a_model,a_path,an_iter]).to_integer)
72		end
73	
74	function: FUNCTION[TUPLE[GTK_TREE_MODEL, GTK_TREE_PATH, GTK_TREE_ITER], BOOLEAN]
75end