Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dtinfo / dtinfo / src / external-api / oliascmd.c
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: oliascmd.c /main/3 1996/06/11 16:48:04 cde-hal $ */
24 /*
25  * $id: oliascmd.c,v 1.2 1992/10/07 16:38:43 brennan Exp $
26  *
27  * Copyright (c) 1992 HaL Computer Systems, Inc.  All rights reserved.
28  * UNPUBLISHED -- rights reserved under the Copyright Laws of the United
29  * States.  Use of a copyright notice is precautionary only and does not
30  * imply publication or disclosure.
31  * 
32  * This software contains confidential information and trade secrets of HaL
33  * Computer Systems, Inc.  Use, disclosure, or reproduction is prohibited
34  * without the prior express written permission of HaL Computer Systems, Inc.
35  * 
36  *                         RESTRICTED RIGHTS LEGEND
37  * Use, duplication, or disclosure by the Government is subject to
38  * restrictions as set forth in subparagraph (c)(l)(ii) of the Rights in
39  * Technical Data and Computer Software clause at DFARS 252.227-7013.
40  *                        HaL Computer Systems, Inc.
41  *                  1315 Dell Avenue, Campbell, CA  95008
42  * 
43  */
44
45 #include <stdlib.h>
46 #include "olias.h"
47 #include <Xm/Xm.h>
48 #include <Xm/PushB.h>
49 #include <Xm/Label.h>
50 #include <Xm/Form.h>
51 #include <Xm/Separator.h>
52 #include <Xm/TextF.h>
53 #include <X11/Xmu/Editres.h>
54
55 Widget toplevel, ibase, loc;
56
57 /* **************************************************************
58  * activate
59  * ************************************************************** */
60
61 static void
62 activate (Widget w, XtPointer client_data, XtPointer call_data)
63 {
64   static OliasDisplayEvent event;
65
66   event.type = OLIAS_DISPLAY_EVENT;
67   XtVaGetValues (ibase, XmNvalue, &event.infobase, NULL);
68   XtVaGetValues (loc,   XmNvalue, &event.locator,  NULL);
69
70 /*  printf ("Infobase = <%s>, locator = <%s>\n", event.infobase, event.locator);
71 */
72 /*  puts ("** Calling API **"); */
73   olias_send_event (toplevel, (OliasEvent *) &event);
74 /*  puts ("** Returned from API **"); */
75 }
76
77
78 /* **************************************************************
79  * main
80  * ************************************************************** */
81
82 int
83 main (int argc, char *argv[])
84 {
85   XtAppContext app_context;
86   Widget form, lform, fform;
87   Widget sep, panel, send, quit;
88   Dimension width, height;
89
90   toplevel =
91    XtVaAppInitialize (&app_context, "OliasCmd", NULL, 0, &argc, argv, NULL, 0);
92
93   XtAddEventHandler(toplevel, (EventMask) 0, TRUE,
94                     (XtEventHandler) _XEditResCheckMessages, NULL);
95
96 #define WIDGET  XtVaCreateWidget
97 #define WIDGETM XtVaCreateManagedWidget
98
99   form  = WIDGET  ("form",      xmFormWidgetClass,       toplevel, NULL);
100   panel = WIDGET  ("panel",     xmFormWidgetClass,       form,     NULL);
101   send  = WIDGETM ("send",      xmPushButtonWidgetClass, panel,    NULL);
102   quit  = WIDGETM ("quit",      xmPushButtonWidgetClass, panel,    NULL);
103   sep   = WIDGETM ("separator", xmSeparatorWidgetClass,  form,     NULL);
104   lform = WIDGET  ("lform",     xmFormWidgetClass,       form,     NULL);
105           WIDGETM ("infobase",  xmLabelWidgetClass,      lform,    NULL);
106           WIDGETM ("locator",   xmLabelWidgetClass,      lform,    NULL);
107   fform = WIDGET  ("fform",     xmFormWidgetClass,       form,     NULL);
108   ibase = WIDGETM ("ib_field",  xmTextFieldWidgetClass,  fform,    NULL);
109   loc   = WIDGETM ("loc_field", xmTextFieldWidgetClass,  fform,    NULL);
110   
111   XtAddCallback (send, XmNactivateCallback, activate, toplevel);
112   XtAddCallback (quit, XmNactivateCallback, (XtCallbackProc) exit, toplevel);
113
114   XtVaSetValues (form, XmNdefaultButton, send, NULL);
115
116   XtManageChild (panel);
117   XtManageChild (lform);
118   XtManageChild (fform);
119   XtVaSetValues (form, XmNshadowThickness, 0, NULL);
120   XtManageChild (form);
121
122   XtRealizeWidget (toplevel);
123
124   XtVaGetValues (toplevel, XmNwidth, &width, XmNheight, &height, NULL);
125   XtVaSetValues (toplevel, XmNminWidth, (int) width,
126                  XmNminHeight, (int) height,
127                  XmNmaxHeight, (int) height,
128                  NULL);
129   
130   XtAppMainLoop (app_context);
131
132   exit (0);
133 }