Extending JLib

A brief note on how to add things to JLib, if you're that way inclined.

Things which aren't window classes: just write the code, write a header file. If you want to handle exceptions, use the REALLY_THROW_EXCEPTIONS constant to decide whether to do try/catch or use the thread's exception pointer to check. And don't forget to call jlib_catch(). If you define your own exception type (deriving from JException) then you may need to add an entry to the JExn::type enumeration, which lives in <JExcept.hpp>.

Window classes can be added to JLib in one of two ways. You should look at existing source code to get the hang of this. The first way is to write the control in JLib, subclassing JControl or whatever, and using handlers. The JViewer class was written like this. The second way is to write a normal C-style window procedure for the control, add a call to WinRegisterClass() in an appropriate place (see below), and knock up a C++ interface to the window. JSplitWindow was written like this.

<sys\JIntern.hpp> defines the interfaces for bits of JLib to create & destroy windows. This mechanism ensures that window creation & what-have-you is done in the main thread, irrespective of which thread the object's constructor was run in. If you want to create windows, you'll need to use JInternal::window::create(). See virtually any control class for examples. Note you'll need to have unzipped the source archive to get the sys\ include files.


John Fairhurst 11th June 1998