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 "Box.h"
- #include "Label.h"
- #include "Pushbutton.h"
-
- void Goodbye(widget, clientData, callData)
- Widget widget;
- caddr_t clientData, callData;
- {
- exit(0);
- }
-
- Widget pushbutton;
-
- void Sensitize(widget, clientData, callData)
- Widget widget;
- caddr_t clientData, callData;
- {
- static Boolean sensitive = TRUE;
-
- sensitive = !sensitive;
- XtSetSensitive(pushbutton, sensitive);
- }
-
- int main(argc, argv)
- unsigned int argc;
- char **argv;
- {
- Widget toplevel, label, sensitize, box;
- Arg arg[25];
- unsigned int n;
- XtAppContext app;
-
- toplevel = XtAppInitialize(&app, "Sensitive",
- (XrmOptionDescList) NULL, 0, &argc, argv,
- (String *) NULL, (ArgList) NULL, 0);
-
- box = XtCreateManagedWidget("box", boxWidgetClass, toplevel,
- (Arg *) NULL, 0);
-
- n = 0;
- XtSetArg(arg[n], XtNx, 10); n++;
- XtSetArg(arg[n], XtNy, 10); n++;
- XtSetArg(arg[n], XtNlabel, "Goodbye, world"); n++;
-
- label = XtCreateManagedWidget("label", labelWidgetClass, box,
- arg, n);
-
- n = 0;
- XtSetArg(arg[n], XtNx, 10); n++;
- XtSetArg(arg[n], XtNy, 40); n++;
- XtSetArg(arg[n], XtNlabel, "Toggle sensitivity"); n++;
-
- sensitize = XtCreateManagedWidget("sensitize", pushbuttonWidgetClass,
- box, arg, n);
-
- XtAddCallback(sensitize, XtNcallback, Sensitize, NULL);
-
- n = 0;
- XtSetArg(arg[n], XtNx, 10); n++;
- XtSetArg(arg[n], XtNy, 70); n++;
- XtSetArg(arg[n], XtNlabel, "Click and die"); n++;
-
- pushbutton = XtCreateManagedWidget("pushbutton", pushbuttonWidgetClass,
- box, arg, n);
-
- XtAddCallback(pushbutton, XtNcallback, Goodbye, NULL);
-
- XtRealizeWidget(toplevel);
- XtAppMainLoop(app);
- }
-