The C++ class application library (dclap) I'm putting together is
basically a skeleton application, for the common graphic user
interface systems. Jonathan Kans' Vibrant toolkit forms the basis
of this. I've put a C++ framework around it that I think
makes it easier to write apps to, and to write reusable
objects for.
For instance, my first reusable dialog is a send-mail dialog.
This object produces a self-contained window with
editable items and an OKAY & CANCEL button to complete a
message. If the user presses OKAY, any message is sent by
Internet Sendmail protocols. Any program using this DCLAP library
can throw up a send-mail dialog very easily with code like this:
void MyApp::SetUpMenus(void)
{
//... set up other menus...
// add item to send mail
iMenu->AddItem( kSendMail, "Send mail...");
}
void MyApp::IsMyMenu(DTaskMaster* action)
{
// ... process any other menu actions
// now process a SendMail request...
case kSendMail:
{
DWindow* win= new DSendMailDialog('SMal', this,
-10, -10, -20, -20, "Send mail");
win->Open();
return true;
}
}
In order to do something more complex with it, you can
subclass the DSendMailDialog, and, for instance, add
some check boxes, popup menus, and such to select options,
and have it send mail to, e.g, someone's biocompute e-mail
server with a gene sequence.
Here is an example subclass that changes the default To: address
to the address for a help desk:
class DBugMailDialog : public DSendMailDialog
{
public:
DBugMailDialog(long id, DTaskMaster* itsSuperior,
short width = -5, short height = -5, short left = -50, short top = -20, char* title = NULL):
DSendMailDialog(id, itsSuperior, width, height, left, top, title)
{}
virtual DView* InstallTo(DView* super) //override
{
DPrompt* pr;
pr= new DPrompt('Pgp1', super, "To:", 0, 0, Nlm_programFont);
super->NextSubviewToRight();
pr= new DPrompt('To ', super, "help at some.where.edu", 0, 0, Nlm_systemFont);
super->NextSubviewBelowLeft();
return pr;
}
};
I'll have a Gopher object one of these days. Apps that want to
include Internet Gopher access may include it in a similar way.
The main thrust of my contributions to this library will be
user-interface, the general scheme of a basic application skeleton,
modelled after MacApp and Think Class Library, and some Internet/TCP
objects (what I'm hung up on now...). If this library has
some broad appeal, perhaps others will contribute parts. I don't
know of any other free C++ application skeleton that currently works on
Mac & MSWindows & XWindows.
Most of my work on this is aimed at getting a usable cross platform
library to move my mac applications to. Jonathan Kans' work is
a great foundation for any cross-platform applications. I hope this
C++ app library will make writing such apps even easier, but it
will take some more work (== time I don't have enough of just now)
before it is ready. I hope to have the basic library available
this month, with plenty of bugs. If interested, keep an eye on this
newsgroup and poke around ftp.bio.indiana.edu:/util/dclap for details.
-- Don
--
-- d.gilbert--biocomputing--indiana u--bloomington--gilbertd at bio.indiana.edu