comp.lang.ada
 help / color / mirror / Atom feed
* Event mechanisms for GUI's
@ 2006-09-26 17:28 Lucretia
  2006-09-26 20:39 ` Jeffrey R. Carter
  2006-09-27  8:10 ` Dmitry A. Kazakov
  0 siblings, 2 replies; 26+ messages in thread
From: Lucretia @ 2006-09-26 17:28 UTC (permalink / raw)


Hi,

My wxAda project stalled due to a problem with C++. I'm starting on a
new project to see if I can do better than wxAda using native Ada and
binding only where necessary. It will do what wxWidgets does and
provide native controls for different platforms, i.e. GTK+-2.x for
Linux, Win32 API, etc. I'll be implementing it in Ada 2005 as well, as
long as the FSF GNAT doesn't cause too many problems.

I'm currently thinking of the event handling mechanism, I started to
think about using the listener/subject pattern, but then started to
wonder about the alternatives:

1) Event loops

This would be painful as there'd be a lot of case statements.

2) Signals & slots

This just seems to be a simplification of (5), where instead of using
an observer interface you just pass a function pointer and the signal
can contain many of these function pointers.

Can be implemented using generics to provide type safety.

3) Extension of tagged-types (like CLAW)

Not a bad idea, just override the subprograms you want to know about.

4) Ada.Real_Time interrupts

I don't know enough about this, so I won't even comment.

5) Listeners/Subjects

I'm not too sure how Java handles this with their Listener interfaces,
I can only think of having a listener/subject pair per event type and
then having something similar to the listener interfaces that Java has
by calling specific procedures in the interface'class from the
listener's update procedure.

So, there would possibly be 3 types: observer (abstract tagged),
subject (tagged), listener (interface). Then the control (e.g. a
window) would then have to implement an "Add_<whatever>_Listener" per
event type, which would add a <whatever>_Listener to a
<whatever>_Observer. Seems overly complex to me.

The one thing that Ada would have over the Java implementation is the
use of null subprograms in the interface, therefore an adapter type
would not be necessary as you would be able to implement only the
subprograms you are interested in.

Any comments would be welcome.

Thanks,
Luke.




^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2006-10-20  4:48 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-26 17:28 Event mechanisms for GUI's Lucretia
2006-09-26 20:39 ` Jeffrey R. Carter
2006-09-26 23:18   ` tmoran
2006-09-27  3:02     ` Jeffrey R. Carter
2006-09-27  4:26       ` tmoran
2006-09-27  5:39         ` Jeffrey R. Carter
2006-09-27  6:21       ` Lucretia
2006-09-27 21:29         ` Jeffrey R. Carter
2006-09-27 23:05           ` Randy Brukardt
2006-09-28  3:47             ` Jeffrey R. Carter
2006-09-28  4:15               ` tmoran
2006-09-29  3:16               ` Randy Brukardt
2006-10-14 19:25               ` Lucretia
2006-10-15  1:22                 ` Jeffrey R. Carter
2006-10-15  2:29                   ` Lucretia
2006-10-16  4:11                     ` Jeffrey R. Carter
2006-10-19 14:22                       ` Lucretia
2006-10-19 15:04                         ` Dmitry A. Kazakov
2006-10-19 20:18                         ` Jeffrey R. Carter
2006-10-19 21:51                           ` Lucretia
2006-10-19 22:01                             ` Lucretia
2006-10-20  4:48                             ` Jeffrey R. Carter
2006-10-15 13:53                   ` Ed Falis
2006-10-16  4:19                     ` Jeffrey R. Carter
2006-10-14 19:44             ` Lucretia
2006-09-27  8:10 ` Dmitry A. Kazakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox