[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

Re: [XaraXtreme-dev] Kernel class for timers

Alex Bligh wrote:

--On 24 April 2006 20:07 +0100 Phil Martin <phil@xxxxxxxx> wrote:

What sort of thing have you got in mind? As you hint, it would be niice
to have a class-based solution rather than fiddling with messages or
non-oo callback functions.

What I had in mind was a timer object class (which one could derive
ones own from if one wanted), derived from MessageHandler
which would call a DoTimer virtual function either one-shot
or repeatedly. This could be overridden, but the default implementation
would broadcast a timer message, containing a pointer to the timer.

So simple users could use the base-class as is (keeping a pointer
to the timer to check whether it's their timer, or simply having
the timer as a member of the user's class), whereas more complex ones
which want to avoid adding to broadcast traffic could simply derive
and override.

I would probably use wxTimer as the basis for this (which effectively
calls on idles) as opposed to hanging off the idle system.


Sounds great.

Phil 8-)