1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
/*
* $Header: /cvsroot/xbae/Xbae/examples/tests/dm2.c,v 1.5 2005/05/15 18:16:06 dannybackx Exp $
*/
#include <stdio.h>
#include <stdlib.h>
#include <Xbae/Matrix.h>
#include <Xm/Text.h>
#include <XbaeConfig.h>
#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif
XtAppContext app;
Widget toplevel, mw = 0;
static String fallback[] = {
"Matrixwidget.height: 250",
"Matrixwidget.width: 250",
"Matrixwidget*mw.value: XBAE MATRIX MEMORY FEVER!!!",
"Matrixwidget*mw.columns: 4",
"Matrixwidget*mw.rows: 4",
"Matrixwidget*mw.cells: 1, 2, 3, 4\\n"
" 1, 2, 3, 4\\n"
" 1, 2, 3, 4\\n"
" 1, 2, 3, 4\\n"
" 1, 2, 3, 4",
NULL
};
unsigned long mark = 0;
unsigned int count = 10;
void
timeout(XtPointer cd, XtIntervalId* id)
{
if(mw) XtDestroyWidget(mw);
#ifdef WITH_DMALLOC
dmalloc_log_changed(mark, 1, 1, 1);
#endif
if (count-- == 0)
exit(0);
#ifdef WITH_DMALLOC
mark = dmalloc_mark();
#endif
mw = XtVaCreateManagedWidget("mw",
/* xmTextWidgetClass, toplevel, */
xbaeMatrixWidgetClass, toplevel,
NULL);
XtAppAddTimeOut( app, 100, timeout, NULL);
}
int
main(int argc, char *argv[])
{
#ifndef WITH_DMALLOC
fprintf(stderr, "This test only makes sense when compiled with dmalloc.\n");
exit(1);
#else
toplevel = XtVaAppInitialize(&app, "Matrixwidget",
NULL, 0,
&argc, argv,
#if 0
NULL,
#else
fallback,
#endif
NULL);
XtAppAddTimeOut( app, 100, timeout, NULL);
XtRealizeWidget(toplevel);
XtAppMainLoop(app);
/*NOTREACHED*/
return 0;
#endif
}
|