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
|
/* $Id: label_ex.c,v 1.8 2004/08/28 00:53:46 tom Exp $ */
#include <cdk.h>
#ifdef HAVE_XCURSES
char *XCursesProgramName = "label_ex";
#endif
int main(int argc, char **argv)
{
/* Declare variables. */
CDKSCREEN *cdkscreen;
CDKLABEL *demo;
WINDOW *cursesWin;
char *mesg[10];
CDK_PARAMS params;
CDKparseParams(argc, argv, ¶ms, CDK_MIN_PARAMS);
/* Set up CDK. */
cursesWin = initscr();
cdkscreen = initCDKScreen (cursesWin);
/* Start CDK Colors. */
initCDKColor();
/* Set the labels up. */
mesg[0] = "</29/B>This line should have a yellow foreground and a blue background.";
mesg[1] = "</5/B>This line should have a white foreground and a blue background.";
mesg[2] = "</26/B>This line should have a yellow foreground and a red background.";
mesg[3] = "<C>This line should be set to whatever the screen default is.";
/* Declare the labels. */
demo = newCDKLabel (cdkscreen,
CDKparamValue(¶ms, 'X', CENTER),
CDKparamValue(¶ms, 'Y', CENTER),
mesg, 4,
CDKparamValue(¶ms, 'N', TRUE),
CDKparamValue(¶ms, 'S', TRUE));
/* Is the label null? */
if (demo == 0)
{
/* Clean up the memory. */
destroyCDKScreen (cdkscreen);
/* End curses... */
endCDK();
/* Spit out a message. */
printf ("Oops. Can't seem to create the label. Is the window too small?\n");
exit (EXIT_FAILURE);
}
/* Draw the CDK screen. */
refreshCDKScreen (cdkscreen);
waitCDKLabel (demo, ' ');
/* Clean up. */
destroyCDKLabel (demo);
destroyCDKScreen (cdkscreen);
endCDK();
exit (EXIT_SUCCESS);
}
|