/src/wrappers/gtk/library/motion_notify_event_callback.e
Specman e | 82 lines | 64 code | 15 blank | 3 comment | 3 complexity | 2e7f687749870e22f6ca16b9dcdb64bc MD5 | raw file
1indexing 2 description: "Generic callback for the motion-notify-event 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 MOTION_NOTIFY_EVENT_CALLBACK 26 27inherit CALLBACK redefine object end 28 29insert G_OBJECT_FACTORY [GTK_WIDGET] 30 31creation make 32 33feature 34 object: GTK_WIDGET 35 36feature 37 callback (motion_event_ptr: POINTER; instance: POINTER): INTEGER is 38 local 39 motion_event: GDK_EVENT_MOTION 40 do 41 debug 42 print ("Callback: instance=") print (instance.to_string) print ("%N") 43 end 44 -- The following is written with the implicit requirement 45 -- that the object is actually created by the Eiffel 46 object := wrapper(instance) 47 create motion_event.from_external_pointer (motion_event_ptr) 48 Result := function.item ([motion_event, object]).to_integer 49 -- GTK is about to release this event, detach it from Eiffel 50 motion_event.dispose 51 end 52 53 callback_pointer: POINTER is 54 do 55 Result := get_callback_pointer ($callback) 56 ensure 57 Result.is_not_null 58 end 59 60 connect (an_object: GTK_WIDGET; a_function: FUNCTION [ANY, TUPLE [GDK_EVENT_MOTION, GTK_WIDGET], BOOLEAN]) is 61 do 62 debug 63 print ("MOTION_NOTIFY_EVENT_CALLBACK.connect (an_object=") print (an_object.to_pointer.to_string) 64 print (" an_object.handle=") print (an_object.handle.to_string) 65 print (") Current=") print (to_pointer.to_string) 66 print (" Current.handle=") print (handle.to_string) 67 print ("%N") 68 end 69 70 handler_id := g_signal_connect_closure (an_object.handle, 71 signal_name.to_external, 72 handle, 73 0 -- i.e. call it before default handler 74 ) 75 function:=a_function 76 end 77 78 signal_name: STRING is "motion-notify-event" 79 80 function: FUNCTION [ANY, TUPLE [GDK_EVENT_MOTION, GTK_WIDGET], BOOLEAN] 81 82end