home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
n
/
newmarch.zip
/
FOUR.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-09-08
|
3KB
|
117 lines
/* Author: $Author: jan $
* File: $Source: /usr/usrs/jan/desktop/X_Book.boo/programs/RCS/four.c,v $
* Date: $Date: 1992/09/09 00:10:00 $
* Revision: $Revision: 1.1 $
*/
#include "copyright.h"
#include <stdio.h>
#include <Xm/PushB.h>
#include <Xm/RowColumn.h>
/*------------------------------------------------------
** Forward Declarations
*/
void main (); /* main logic for
application */
void CreateApplication (); /* create main window */
void QuitCB (); /* callback for
quit button */
/*------------------------------------------------------
** Global Variables
*/
#define MAX_ARGS 20
#define Class_name "FourButtons"
void
main (argc,argv)
int argc;
char **argv;
{
Widget app_shell;
/* Initialize toolkit, open the display
and create the toplevel widget. */
app_shell = XtInitialize(NULL, /* application name */
Class_name, /* class name */
NULL, /* options */
0, /* number of
options */
&argc, argv);
/* set up all the sub-widgets */
CreateApplication(app_shell);
XtRealizeWidget (app_shell);
/* Get and dispatch events. */
XtMainLoop ();
}
/*------------------------------------------------------
** CreateApplication - create main window
** This must be customized
** for each application.
*/
void CreateApplication (parent)
Widget parent; /* parent widget */
{
Widget row_column; /* RowColumn */
Widget button; /* PushButton */
Arg args[MAX_ARGS]; /* arg list */
int n; /* arg count */
/* Create RowColumn Window. */
n = 0;
row_column = XmCreateRowColumn (parent, "rowColumn", args, n);
XtManageChild (row_column);
n = 0;
button = XmCreatePushButton (row_column,
"Button 1", args, n);
XtManageChild (button);
XtAddCallback (button, XmNactivateCallback,
QuitCB, NULL);
n = 0;
button = XmCreatePushButton (row_column,
"Button 2", args, n);
XtManageChild (button);
XtAddCallback (button, XmNactivateCallback,
QuitCB, NULL);
n = 0;
button = XmCreatePushButton (row_column,
"Button 3", args, n);
XtManageChild (button);
XtAddCallback (button, XmNactivateCallback,
QuitCB, NULL);
n = 0;
button = XmCreatePushButton (row_column,
"Button 4", args, n);
XtManageChild (button);
XtAddCallback (button, XmNactivateCallback,
QuitCB, NULL);
}
/*------------------------------------------------------
** QuitCB - callback for quit button
*/
void QuitCB (w, client_data, call_data)
Widget w; /* widget id */
caddr_t client_data; /* data from application */
caddr_t call_data; /* data from widget call */
{
/* Terminate the application. */
printf("button was pressed\n");
exit (0);
}