Boost logo

Boost :

Subject: Re: [boost] Thoughts for a GUI (Primitives) Library
From: Gwenio (urulokiurae_at_[hidden])
Date: 2010-09-25 15:04:57

I have been thinking about the design for event handlers, and have come up
with the prototype:

class control_event_handler {
 enum events {
  // contains ids for events that can be stored with the "set" function
 template<class Func> control_event_handler(Func f) {f(*this);} // A
function (object, pointer, or labanda) is passed to set the handlers.
 ~control_event_handler() {}
 template<class Func,events evt> void set(Func f); // Sets how to handle a
specific type of event
 // Functions calling handlers go here
 // How the the function data is stored goes here
A reference to an event handler object would be passed on the creation of
each window or control. The intent is something like the vtable used for
finding the function to call for virtual classes, only providing more
flexablity in regard to reusing a function is for multiple handlers.
Additional capabilities would be added for the release version such as
copy function(s) (something like those for locales would be good) to make
creating similar handlers.

I still have not determind how to store the data for event handlers,
but it will likely be a series of function containers from one of the Boost
libraries. I am not familiar enough with the function object libraries of
Boost to really know which would be the best to use. Anyone care to provide
an opinion about which would be best to use?

Boost list run by bdawes at, gregod at, cpdaniel at, john at