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

/src/wrappers/gtk/library/realize_callback.e

http://github.com/tybor/Liberty
Specman e | 70 lines | 53 code | 15 blank | 2 comment | 3 complexity | c6a0a042f1f68fc2b88c9a4a65a07dcd MD5 | raw file
 1indexing
 2	description: "Generic callback for the realize signal"
 3	copyright: "[
 4					Copyright (C) 2006 Soluciones Informaticas Libres S.A. (except),
 5					eiffel-libraries team,  GTK+ team and others
 6					
 7					This library is free software; you can redistribute it and/or
 8					modify it under the terms of the GNU Lesser General Public License
 9					as published by the Free Software Foundation; either version 2.1 of
10					the License, or (at your option) any later version.
11					
12					This library is distributed in the hope that it will be useful, but
13					WITHOUT ANY WARRANTY; without even the implied warranty of
14					MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15					Lesser General Public License for more details.
16
17					You should have received a copy of the GNU Lesser General Public
18					License along with this library; if not, write to the Free Software
19					Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20					02110-1301 USA
21				]"
22	license: "LGPL v2 or later"
23	date: "$Date:$"
24	revision "$Revision:$"
25
26class REALIZE_CALLBACK
27
28inherit
29	CALLBACK
30		redefine object end
31
32insert
33	G_OBJECT_FACTORY [GTK_WIDGET]
34
35creation make
36
37feature
38
39	object: GTK_WIDGET
40
41	callback (instance: POINTER) is
42		do
43			-- The following is written with the implicit requirement 
44			-- that the object is actually created by the Eiffel 
45			object := wrapper(instance)
46			procedure.call([object])
47		end
48
49	callback_pointer: POINTER is
50		do
51			Result := get_callback_pointer ($callback)
52		ensure
53			Result.is_not_null
54		end
55
56	connect (an_object: GTK_WIDGET; a_procedure: PROCEDURE [ANY, TUPLE[GTK_WIDGET]]) is
57		do
58			handler_id := g_signal_connect_closure (an_object.handle,
59																 signal_name.to_external,
60																 handle,
61																 1 -- i.e. call it after default handler
62																)
63			procedure := a_procedure
64		end
65
66	procedure: PROCEDURE [ANY, TUPLE[GTK_WIDGET]]
67
68	signal_name: STRING is "realize"
69
70end -- class REALIZE_CALLBACK