PageRenderTime 24ms CodeModel.GetById 16ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

/src/wrappers/gtk/library/row_changed_callback.e

http://github.com/tybor/Liberty
Specman e | 86 lines | 68 code | 15 blank | 3 comment | 3 complexity | 67c8fb03e66516ecf0edb5f9b49030a2 MD5 | raw file
 1indexing
 2	description: "Generic callback for the row-changed signal"
 3	copyright: "[
 4					Copyright (C) 2006 Paolo redaelli, eiffel-libraries team,  GTK+ team and others
 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	license: "LGPL v2 or later"
22	date: "$Date:$"
23	revision "$Revision:$"
24
25class ROW_CHANGED_CALLBACK
26
27inherit
28	CALLBACK redefine object end
29
30insert
31	G_OBJECT_FACTORY [GTK_TREE_MODEL]
32
33creation make
34
35feature
36	object: GTK_TREE_MODEL
37
38feature
39
40	callback (path_ptr, iter_ptr, instance: POINTER) is
41		local
42			path: GTK_TREE_PATH
43			iter: GTK_TREE_ITER
44		do
45			debug
46				print ("Callback: instance=") print (instance.to_string) print ("%N")
47			end
48			-- The following is written with the implicit requirement 
49			-- that the object is actually created by the Eiffel 
50			object := wrapper(instance)
51			-- Note: path and iter are shared wrappers.
52			create path.copy_from_pointer (path_ptr)
53			create iter.copy_from_pointer (iter_ptr)
54			procedure.call ([object, path, iter])
55		end
56
57	callback_pointer: POINTER is
58		do
59			Result := get_callback_pointer ($callback)
60		ensure
61			Result.is_not_null
62		end
63
64	connect (an_object: GTK_TREE_MODEL;
65				a_procedure: PROCEDURE [ANY, TUPLE[GTK_TREE_MODEL,GTK_TREE_PATH,GTK_TREE_ITER]]) is
66		do
67			debug
68				print ("ROW_CHANGED_CALLBACK.connect (an_object=") print (an_object.to_pointer.to_string)
69				print (" an_object.handle=") print (an_object.handle.to_string)
70				print (") Current=") print (to_pointer.to_string)
71				print (" Current.handle=") print (handle.to_string)
72				print ("%N")
73			end
74			handler_id := g_signal_connect_closure (an_object.handle,
75																 signal_name.to_external,
76																 handle,
77																 0 -- i.e. call it before default handler
78																)
79			procedure := a_procedure
80		end
81
82	signal_name: STRING is "row-changed"
83
84	procedure: PROCEDURE [ANY, TUPLE[GTK_TREE_MODEL,GTK_TREE_PATH,GTK_TREE_ITER]]
85
86end