[gtkada] Signal handler
Dmitry A. Kazakov
mailbox at dmitry-kazakov.de
Wed Aug 3 12:15:57 CEST 2011
On Wed, 03 Aug 2011 11:28:07 +0200, you wrote:
> I encourage people who want to fix widgets in GtkAda to look into modifying
> directly the python scripts in contrib/ to do the automatic binding of the
> widgets. This is work in progress on our side, the goal is to make transition to
> more recent versions of gtk+ easier in the future.
If you are about to change GtkAda, why not to consider making handlers
type-safe? The existing schema only appears safe, it adds Ada types, but
does not ensure them matching the actual types of the signal or that signal
names are correct.
A type-/event-safe schema might be based on Ada 2005 interfaces. E.g.
package Gtk.Button is
...
-- Signal handlers:
-- Clicked event
type Clicked_Handler is limited interface;
procedure Connect
( Button : not null access Gtk_Button_Record;
Handler : in out Clicked_Handler'Class
);
procedure Connect
( Button : not null access Gtk_Button_Record;
Handler : in out Clicked_Handler'Class;
ID : out Handler_Id
);
procedure Handle
( Handler : in out Clicked_Handler;
Button : not null access Gtk_Button_Record'Class
) is abstract;
-- Released event
type Released_Handler is limited interface;
procedure Connect
( Button : not null access Gtk_Button_Record;
Handler : in out Released_Handler'Class;
ID : out Handler_Id
);
procedure Connect
( Button : not null access Gtk_Button_Record;
Handler : in out Released_Handler'Class
);
procedure Handle
( Handler : in out Released_Handler;
Button : not null access Gtk_Button_Record'Class
) is abstract;
... etc
This schema can be implemented on top of the existing one.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
More information about the gtkada
mailing list