Boost logo

Boost :

Subject: Re: [boost] Thoughts for a GUI (Primitives) Library
From: Gwenio (urulokiurae_at_[hidden])
Date: 2010-09-02 17:17:40


Now for a start for discussion on event handling.

*Event Loop:*

There are two way that come to mind: let the application call a message
loop/get message function to retreive a message or have the sending of
messages handled internally like in Java.
I personally lean toward having a function that is called to process
messages, but would like to hear what advantages and disadvantages people
can come up with for each method.

*Event Handling:*

There are several way that event handling can be implemented. Ultimately it
involves data being provided to the back end to route messages to where they
need to go. As the target is OO code, date for event handling would need to
be given for each window context.

Quick List of (some) Methods:
- Callback Procedure
This is the simplist form, it has a pointer to a function pointer that is to
be called. This would be redundant, because the function would need to
determine the message type, which would have already been done by the back
end to convert the message to the correct form for the callback.
- Abstract Handler Class
This involves having a abstract base class for all event handlers to inherit
from. The derived classes then define how to handle each type of event. The
only problem with this arises when dealing with binaries compiled separately
from the main program as not all aspects of virtual function calls is
standardized. This would only be a problem in some cases, if ever.
- Use Boost Signals
It seems some people believe that Boost Signals would be a good way to
implement event handling, but I am not very familiar with this
particular library, so I cannot really comment on it.
I would like to hear the reason for and against going this route though.
- Descriptive Structure
The last way I know of would be to pass a descriptive object (or a pointer
to one) that provides the back end with the information needed to handle
events (pointers to related object and pointers of functions to call, ect).
This is fairly ambiguous, and would need a lot of work to design.

I await comment on these ideas, and for people to present their own ideas so
they can be discussed.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk