Proposed API:

new(PARENT, NAME, ELAPSE). Underneath it maps name to an ID, stores the parameters in a perl Win32::GUI::Timer object and adds a reference to the object to its window(parent) object. It then calls SetTimer, if ELAPSE is greater than 0.

INTERVAL(ELAPSE). Retrieves the parameters from the object, and calls SetTimer if ELAPSE > 0, or KillTimer if ELAPSE=0.

Kill(REMOVE). Retrieves the parameters from the object and calls KillTimer. Removes the reference from its window(parent) object if REMOVE evaluates true.

DESTROY(). Called when the reference count to the timer object goes to zero. Calls KillTimer.

So you can consider it like this:
new - calls SettTimer
Interval(n) - calls SetTimer
Interval(0) - calls KillTimer
Kill() - calls KillTimer, leaving the mapping between NAME and ID so that Interval(n) still has the parameters to call SetTimer again.
Kill(1) - calls KillTimer and removes the NAME to ID mapping.

I'm going to go ahead and re-work it and update the documentation and tests.

Updated implementation, documentation, and tests are now in CVS.

Regards,
Rob.
--
Robert May
Win32::GUI, a perl extension for native Win32 applications
http://perl-win32-gui.sourceforge.net/

Reply via email to