home *** CD-ROM | disk | FTP | other *** search
- /***********************************************************
- Copyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
- Permission to use, copy, modify, and distribute these examples for any
- purpose and without fee is hereby granted, provided that the above
- copyright notice appear in all copies and that both that copyright
- notice and this permission notice appear in supporting documentation,
- and that the name of Digital not be used in advertising or publicity
- pertaining to distribution of the software without specific, written
- prior permission.
-
- DIGITAL AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT
- OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- OR PERFORMANCE OF THIS SOFTWARE.
-
- ******************************************************************/
-
- #include <X11/Intrinsic.h>
- #include <X11/StringDefs.h>
-
- #include "Graph.h"
- #include "BarDisplay.h"
-
- int main(argc, argv)
- unsigned int argc;
- char **argv;
- {
- Widget toplevel, graph, display;
- int bars;
- int barvalues[25];
- String labels[25];
- char buffer[25];
- Arg arg[25];
- unsigned int n;
- XtAppContext app;
-
- printf("How many bars? ");
- scanf("%d", &bars);
- for (n = 0; n < bars; n++) {
- barvalues[n] = 10*n;
- sprintf(buffer, "This is Label %d", n);
- labels[n] = XtNewString(buffer);
- }
-
- toplevel = XtAppInitialize(&app, "BarGraph",
- (XrmOptionDescList) NULL, 0, &argc, argv,
- (String *) NULL, (ArgList) NULL, 0);
-
- n = 0;
- XtSetArg(arg[n], XtNnumEntries, bars); n++;
- XtSetArg(arg[n], XtNlabels, labels); n++;
- XtSetArg(arg[n], XtNvalues, barvalues); n++;
- XtSetArg(arg[n], XtNmaxValue, 100); n++;
-
- graph = XtCreateManagedWidget("graph", graphWidgetClass, toplevel,
- arg, n);
-
- display = XtCreateManagedWidget("display", barDisplayObjectClass,
- graph, NULL, 0);
-
- XtRealizeWidget(toplevel);
- XtAppMainLoop(app);
- }
-