home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
m
/
master12.zip
/
mastering
/
seldlog.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-08-25
|
4KB
|
122 lines
/* include files */
#include <stdio.h>
#include <Xm/PushB.h>
#include <Xm/BulletinB.h>
#include <Xm/SelectioB.h>
#include <Xm/PushB.h>
/* Functions defined in this program */
void main();
void activateCB(); /* Callback for the pushbutton */
/* Global variables */
Widget toplevel; /* Shell widget */
/*-------------------------------------------------------------
** main - Main logic for seldlog
*/
void main (argc,argv)
unsigned int argc;
char **argv;
{
Widget bboard; /* Bulletin board widget */
Widget button; /* Pushbutton widget */
Arg args[10]; /* arg list */
register int n; /* arg count */
XtAppContext app_context; /* application context */
XmString btn_text; /* button label pointer for compound string */
/* Initialize the toolkit, create application context, open display,
and create a toplevel shell */
toplevel = XtAppInitialize (&app_context, "Seldlog", NULL, 0, &argc,
argv, NULL, args, 0);
/* Create a bulletin board widget in which to place the pushbutton */
n = 0;
bboard = XmCreateBulletinBoard (toplevel, "bboard", args, n);
/* Manage the bulletin board widget */
XtManageChild (bboard);
/* Create a compound string for the button text */
btn_text = XmStringCreateLtoR("Create Selection Dialog", XmFONTLIST_DEFAULT_TAG);
/* Set up an arglist for the pushbutton */
n = 0;
XtSetArg (args[n], XmNlabelString, btn_text); n++;
/* Create the push button */
button = XtCreateManagedWidget ("button", xmPushButtonWidgetClass, bboard,
args, n);
/* Free the compound string memory */
XmStringFree (btn_text);
/* Add a callback */
XtAddCallback (button, XmNactivateCallback, activateCB, NULL);
/* Realize widgets */
XtRealizeWidget (toplevel);
/* Process events */
XtAppMainLoop (app_context);
}
/*-------------------------------------------------------------
** activateCB - callback for button
*/
void activateCB (w, client_data, call_data)
Widget w; /* widget id */
XtPointer client_data; /* data from application */
XtPointer call_data; /* data from widget class */
{
Arg args[10]; /* arg list */
register int n; /* arg count */
Widget sdlog; /* selection dialog */
Widget xtra_button1; /* extra button */
Widget xtra_button2; /* extra button */
static char *char_list_items[7] = {
"XmDialogShell",
"XmBulletinBoard",
"XmCommand",
"XmFileSelectionBox",
"XmForm",
"XmMessageBox",
"XmSelectionBox"};
XmString cstring_list_items[7];
/* Create the array of compound strings from the character array. */
for (n = 0; n < 7; n++)
cstring_list_items[n] = (XmString) XmStringCreateLtoR(char_list_items[n],
XmFONTLIST_DEFAULT_TAG);
/* Create the file selection box */
n = 0;
XtSetArg(args[n], XmNlistItems, cstring_list_items); n++;
XtSetArg(args[n], XmNlistItemCount, 7); n++;
sdlog = XmCreateSelectionDialog (toplevel, "sdlog", args, n);
/* Manage the selectionbox widget */
XtManageChild (sdlog);
/* Add the extra pushbuttons. We need two: the first is
the work area widget (which we'll leave unmanaged), and the
second is the "real" pushbutton.
n = 0;
xtra_button1 = XmCreatePushButton(sdlog, "xtra", args, n);
n = 0;
xtra_button2 = XmCreatePushButton(sdlog, "xtra", args, n); */
/* Manage only the second pushbutton; it appears next to OK
XtManageChild(xtra_button2); */
}