$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] Thoughts for a GUI (Primitives) Library
From: Edward Diener (eldiener_at_[hidden])
Date: 2010-09-25 20:28:50
On 9/25/2010 3:04 PM, Gwenio wrote:
> I have been thinking about the design for event handlers, and have come up
> with the prototype:
>
> class control_event_handler {
> public:
> 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
> private:
> // 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?
An event handler needs to be multi-cast, which means using
boost::signals internally. Anything less is the same old limitation
which inadequate GUI and component libraries always seem to settle upon
for some hideous reason.