2
* This an example of how to use the Command widget.
4
* User events handled through callback routines.
6
* November 14, 1989 - Chris D. Peterson
10
* $XConsortium: xcommand.c,v 1.12 91/01/22 19:44:25 gildea Exp $
12
* Copyright 1989 Massachusetts Institute of Technology
14
* Permission to use, copy, modify, distribute, and sell this software and its
15
* documentation for any purpose is hereby granted without fee, provided that
16
* the above copyright notice appear in all copies and that both that
17
* copyright notice and this permission notice appear in supporting
18
* documentation, and that the name of M.I.T. not be used in advertising or
19
* publicity pertaining to distribution of the software without specific,
20
* written prior permission. M.I.T. makes no representations about the
21
* suitability of this software for any purpose. It is provided "as is"
22
* without express or implied warranty.
24
* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
25
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
26
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
27
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
28
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
29
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
32
#include "../machine.h"
34
#include <X11/Intrinsic.h>
35
#include <X11/StringDefs.h> /* Get standard string definations. */
37
#include <X11/Xaw/Command.h>
38
#include <X11/Xaw/Cardinals.h>
40
#include "wf_resources.h"
44
String fallback_resources[] = {
45
"*Command.Label: Click the left mouse button here",
49
static XrmOptionDescRec options[] = {
50
{"-label", "*Command.label", XrmoptionSepArg, NULL}
57
* DeleteWindow(): Action proc to implement ICCCM delete_window.
62
DeleteWindow(w, event, params, num_params)
71
XtActionsRec actionProcs[] = {
72
"DeleteWindow", DeleteWindow,
75
Atom wm_delete_window;
84
l_toplevel = XtAppInitialize(&app_con, "Xcommand",
85
options, XtNumber(options),
86
&argc, argv, fallback_resources,
87
(ArgList) 0,(Cardinal) 0);
90
Syntax(app_con, argv[0]);
92
command = XtCreateManagedWidget("command", commandWidgetClass, l_toplevel,
96
* Add a callback routine to the Command widget that will print
97
* the message "button selected" to stdout.
100
* ICCCM delete_window.
102
XtAppAddActions(app_con, actionProcs, XtNumber(actionProcs));
103
XtAddCallback(command, XtNcallback, Select, NULL);
104
XtRealizeWidget(l_toplevel);
105
XtAppMainLoop(app_con);
109
/* Function Name: Select
110
* Description: This function prints a message to stdout.
111
* Arguments: w - ** UNUSED **
112
* call_data - ** UNUSED **
113
* client_data - ** UNUSED **
120
Select(w, client_data, call_data)
122
XtPointer call_data, client_data;
124
fprintf(stdout, "Button Selected.\n");
125
popup_file_panel(w,"File Menu");
129
/* Function Name: Syntax
130
* Description: Prints a the calling syntax for this function to stdout.
131
* Arguments: app_con - the application context.
132
* call - the name of the application.
133
* Returns: none - exits tho.
137
Syntax(app_con, call)
138
XtAppContext app_con;
141
XtDestroyApplicationContext(app_con);
142
fprintf( stderr, "Usage: %s [-label <label name>]\n", call);
150
fprintf(stderr,"%s",arg);