PageRenderTime 29ms CodeModel.GetById 24ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/wrappers/gtk/library/paste_clipboard_callback.e

http://github.com/tybor/Liberty
Specman e | 71 lines | 53 code | 16 blank | 2 comment | 3 complexity | 9d5a61432c8f43c8036130e8dfeabac0 MD5 | raw file
 1indexing
 2	description: "Callback for the paste-clipboard signal"
 3	copyright: "[
 4					Copyright (C) 2008 Anthony Lenton, Soluciones Inform??ticas Libres S.A.,
 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 PASTE_CLIPBOARD_CALLBACK
27
28inherit CALLBACK redefine object end
29
30insert G_OBJECT_FACTORY [GTK_TEXT_VIEW]
31
32creation make
33
34feature
35
36	object: GTK_TEXT_VIEW
37
38feature
39
40	callback (instance: POINTER) is
41		require
42			instance_not_null: instance.is_not_null
43		do
44			-- The following is written with the implicit requirement 
45			-- that the object is actually created by the Eiffel 
46			object := wrapper(instance)
47			procedure.call ([object])
48		end
49
50	callback_pointer: POINTER is
51		do
52			Result := get_callback_pointer ($callback)
53		ensure
54			Result.is_not_null
55		end
56
57	connect (an_object: like object; a_procedure: like procedure) is
58		require
59			an_object /= Void
60			a_procedure /= Void
61		do
62			handler_id := g_signal_connect_closure (an_object.handle, signal_name.to_external,
63																 handle, 1) -- i.e. call it after default handler
64			procedure := a_procedure
65		end
66
67	signal_name: STRING is "paste-clipboard"
68
69	procedure: PROCEDURE [ANY, TUPLE [like object]]
70
71end -- class PASTE_CLIPBOARD_CALLBACK