4
char *XCursesProgramName="matrix_ex";
8
* This program demonstrates the Cdk matrix widget.
12
/* Declare local variables. */
13
CDKSCREEN *cdkscreen = 0;
14
CDKMATRIX *courseList = 0;
15
WINDOW *cursesWin = 0;
21
char *coltitle[10], *rowtitle[10], *mesg[100];
22
int colwidth[10], colvalue[10];
25
cursesWin = initscr();
26
cdkscreen = initCDKScreen (cursesWin);
28
/* Start CDK Colors. */
31
/* Create the horizontal and vertical matrix labels. */
32
coltitle[1] = "</B/5>Course"; colwidth[1] = 7 ; colvalue[1] = vUMIXED;
33
coltitle[2] = "</B/33>Lec 1"; colwidth[2] = 7 ; colvalue[2] = vUMIXED;
34
coltitle[3] = "</B/33>Lec 2"; colwidth[3] = 7 ; colvalue[3] = vUMIXED;
35
coltitle[4] = "</B/33>Lec 3"; colwidth[4] = 7 ; colvalue[4] = vUMIXED;
36
coltitle[5] = "</B/7>Flag"; colwidth[5] = 1 ; colvalue[5] = vUMIXED;
37
rowtitle[1] = "</B/6>Course 1"; rowtitle[2] = "<C></B/6>Course 2";
38
rowtitle[3] = "</B/6>Course 3"; rowtitle[4] = "<L></B/6>Course 4";
39
rowtitle[5] = "</B/6>Course 5"; rowtitle[6] = "<R></B/6>Course 6";
40
rowtitle[7] = "</B/6>Course 7"; rowtitle[8] = "<R></B/6>Course 8";
42
/* Create the title. */
43
title = "<C>This is the CDK\n<C>matrix widget.\n<C><#LT><#HL(30)><#RT>";
45
/* Create the matrix object. */
46
courseList = newCDKMatrix (cdkscreen,
48
rows, cols, vrows, vcols,
49
title, rowtitle, coltitle,
52
COL, TRUE, TRUE, TRUE);
54
/* Check to see if the matrix is null. */
58
destroyCDKScreen (cdkscreen);
61
/* Print out a little message. */
62
printf ("Oops. Can't seem to create the matrix widget. Is the window too small ?\n");
66
/* Activate the matrix. */
67
activateCDKMatrix (courseList, 0);
69
/* Check if the user hit escape or not. */
70
if (courseList->exitType == vESCAPE_HIT)
72
mesg[0] = "<C>You hit escape. No information passed back.";
74
mesg[2] = "<C>Press any key to continue.";
75
popupLabel (cdkscreen, mesg, 3);
77
else if (courseList->exitType == vNORMAL)
79
mesg[0] = "<C>You exited the matrix normally.";
80
mesg[1] = "<C>To get the contents of the matrix cell, you can";
81
mesg[2] = "<C>dereference the info array off of the matrix widget.";
83
mesg[4] = "<C>Press any key to continue.";
84
popupLabel (cdkscreen, mesg, 5);
88
destroyCDKMatrix (courseList);
89
destroyCDKScreen (cdkscreen);