diff options
author | danglassey <danglassey> | 2002-08-14 09:57:17 +0000 |
---|---|---|
committer | danglassey <danglassey> | 2002-08-14 09:57:17 +0000 |
commit | c9458897ebbb739d8db83c80e06512d8a612f743 (patch) | |
tree | f8c5381045887e34388cc6b26cfccc254bf766dc /apps/windoze/tbdisp.cpp | |
download | sword-sf-cvs-c9458897ebbb739d8db83c80e06512d8a612f743.tar.gz |
*** empty log message ***
Diffstat (limited to 'apps/windoze/tbdisp.cpp')
-rw-r--r-- | apps/windoze/tbdisp.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/apps/windoze/tbdisp.cpp b/apps/windoze/tbdisp.cpp new file mode 100644 index 0000000..45de2bd --- /dev/null +++ b/apps/windoze/tbdisp.cpp @@ -0,0 +1,55 @@ +/****************************************************************************** + * tbdisp.cpp - code for class 'tbdisp'. tbdisp writes module output to a + * MSWindows TextBox (or any other control that takes a + * SetDialogItemText + */ + +#include <swmodule.h> +#include <tbdisp.h> +#include <windows.h> +#include <string.h> + + +/****************************************************************************** + * TBDisp Constructor - sets up an instance of TBDisp for use + * + * ENT: iwnd - window id on which control resides + * ictrlid - control id in which to display module text + */ + +TBDisp::TBDisp(HWND iwnd, int ictrlid) +{ + wnd = iwnd; + ctrlid = ictrlid; +} + + +/****************************************************************************** + * SWDisplay::Display - casts a module to a character pointer and displays it in + * an MSWindows control + * + * ENT: imodule - module to display + * + * RET: error status + */ + +char TBDisp::Display(SWModule &imodule) +{ + char *buf, *to; + const char *mtext; + + mtext = (const char *)imodule; + + buf = new char [ strlen(mtext) + 100 ]; + + for (to = buf; *mtext; mtext++) { + if (*mtext == '\n') + *to++ = '\r'; + *to++ = *mtext; + } + *to = 0; + + SetDlgItemText(wnd, ctrlid, buf); + delete [] buf; + return 0; +} |