fdc6b4664f174977501c409371efb331c8b51894
[oweals/cde.git] / cde / programs / dtcreate / UxXt.h
1 /* @(#)95       1.3  com/config/UxXt.h, aic, aic324, 9322324a 6/1/93 16:14:00 */
2 /*
3  *  COMPONENT_NAME: AIC           AIXwindows Interface Composer
4  *
5  *  ORIGINS: 58
6  *
7  *
8  *                   Copyright IBM Corporation 1991, 1993
9  *
10  *                         All Rights Reserved
11  *
12  *   Permission to use, copy, modify, and distribute this software and its
13  *   documentation for any purpose and without fee is hereby granted,
14  *   provided that the above copyright notice appear in all copies and that
15  *   both that copyright notice and this permission notice appear in
16  *   supporting documentation, and that the name of IBM not be
17  *   used in advertising or publicity pertaining to distribution of the
18  *   software without specific, written prior permission.
19  *
20  *   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
21  *   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  *   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
23  *   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
24  *   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
25  *   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
26  *   OR PERFORMANCE OF THIS SOFTWARE.
27 */
28 /*---------------------------------------------------------------------
29  * $XConsortium: UxXt.h /main/4 1995/11/01 16:09:11 rswiston $
30  *---------------------------------------------------------------------
31  *
32  *
33  *             Copyright (c) 1991, Visual Edge Software Ltd.
34  *
35  * ALL  RIGHTS  RESERVED.  Permission  to  use,  copy,  modify,  and
36  * distribute  this  software  and its documentation for any purpose
37  * and  without  fee  is  hereby  granted,  provided  that the above
38  * copyright  notice  appear  in  all  copies  and  that  both  that
39  * copyright  notice and this permission notice appear in supporting
40  * documentation,  and that  the name of Visual Edge Software not be
41  * used  in advertising  or publicity  pertaining to distribution of
42  * the software without specific, written prior permission. The year
43  * included in the notice is the year of the creation of the work.
44  *-------------------------------------------------------------------*/
45
46 /*****************************************************************************/
47 /*                              UxXt.h                                       */
48 /*****************************************************************************/
49
50 #ifndef _UX_XT_H_INCLUDED
51 #define _UX_XT_H_INCLUDED
52
53 #include <Xm/Xm.h>
54
55 #ifdef UIL_CODE
56 #include <Mrm/MrmPublic.h>
57 #endif /* UIL_CODE */
58
59 #if 0
60 #ifdef __STDC__
61 typedef char *caddr_t;
62 #endif
63 #endif
64
65 /*-----------------------------------------------------
66  * UXORB_HEADER, if defined, is the include form for
67  * the header that defines the CORBA Environment type
68  * and exception type codes.
69  *
70  * You can specify a file with a compile option like
71  *      -DUXORB_HEADER='<SomeOrb.h>'
72  *-----------------------------------------------------*/
73 #ifdef UXORB_HEADER
74 #include UXORB_HEADER
75 #else
76         /*
77          * In the absence of an ORB implementation,
78          * these minimal definitions satisfy our method dispatch code.
79          */
80         typedef enum {
81                 NO_EXCEPTION,
82                 USER_EXCEPTION,
83                 SYSTEM_EXCEPTION
84         } exception_type;
85
86         typedef struct Environment {
87                 exception_type  _major;
88         } Environment;
89 #endif  /* UXORB_HEADER */
90
91 /*
92  * UxEnv is provided as a convenience for use in interface methods.
93  */
94 extern  Environment     UxEnv;
95
96
97 /* The following macros are used in converting string values to the form
98    required by the widgets */
99
100 #define RES_CONVERT( res_name, res_value) \
101         XtVaTypedArg, (res_name), XmRString, (res_value), strlen(res_value) + 1
102
103 #define UxPutStrRes( wgt, res_name, res_value ) \
104         XtVaSetValues( wgt, RES_CONVERT( res_name, res_value ), NULL )
105
106
107 #ifndef UX_INTERPRETER  /* Omit this section when interpreting the code */
108
109 /* The following macros are supplied for compatibility with swidget code */
110 #define swidget                 Widget
111 #define UxWidgetToSwidget(w)    (w)
112 #define UxGetWidget(sw)         (sw)
113 #define UxIsValidSwidget(sw)    ((sw) != NULL)
114 #define NO_PARENT               ((Widget) NULL)
115 #define UxThisWidget            (UxWidget)
116
117 /* Macros needed for the method support code */
118 #define UxMalloc(a)             (malloc(a))
119 #define UxRealloc(a,b)          (realloc((a), (b)))
120 #define UxCalloc(a,b)           (calloc((a), (b)))
121 #define UxStrEqual(a,b)         (!strcmp((a),(b)))
122 #define UxGetParent(a)          (XtParent((a)))
123
124 #define no_grab                 XtGrabNone
125 #define nonexclusive_grab       XtGrabNonexclusive
126 #define exclusive_grab          XtGrabExclusive
127
128
129 /* The following global variables are defined in the main() function */
130 extern  XtAppContext    UxAppContext;
131 extern  Widget          UxTopLevel;
132 extern  Display         *UxDisplay;
133 extern  int             UxScreen;
134
135
136 /* The following are error codes returned by the functions in UxXt.c */
137 #define UX_ERROR           -1
138 #define UX_NO_ERROR        0
139
140 #ifdef UIL_CODE
141 extern  void            UxMrmFetchError(MrmHierarchy, char *, Widget, Cardinal);
142 extern  MrmHierarchy    UxMrmOpenHierarchy( char *);
143 extern  void            UxMrmRegisterClass( char *, Widget (*)(Widget, String, Arg *, Cardinal));
144 #endif /* UIL_CODE */
145
146
147
148 /* The following are declarations of the functions in UxXt.c */
149
150
151 extern  int             UxPopupInterface( Widget wgt, XtGrabKind grab_flag );
152 extern  int             UxPopdownInterface( Widget wgt );
153 extern  int             UxDestroyInterface( Widget wgt);
154 extern  int             UxPutContext( Widget wgt, caddr_t context );
155 extern  caddr_t         UxGetContext( Widget wgt );
156 extern  void            UxFreeClientDataCB( Widget wgt, XtPointer client_data,
157                                                  XtPointer call_data );
158 extern  void            UxLoadResources( char *fname );
159 extern  XmFontList      UxConvertFontList( char *fontlist_str );
160 extern  Pixmap          UxConvertPixmap( char *file_name );
161 extern  Pixmap          UxConvert_bitmap( char *file_name );
162 extern  wchar_t *       UxConvertValueWcs( char *value_str );
163
164 extern  void            UxDestroyContextCB(Widget, XtPointer, XtPointer);
165 extern  void            UxDeleteContextCB( Widget, XtPointer, XtPointer);
166 extern  XtArgVal        UxRemoveValueFromArgList( Arg *args,
167                                                 Cardinal *ptr_num_args,
168                                                 String res_name );
169 extern  Widget          UxChildSite( Widget );
170 extern  Widget          UxRealWidget( Widget );
171
172 extern  Widget          GetTrueToplevel( Widget );
173
174
175 #ifdef __cplusplus
176 class _UxCInterface {
177
178 public:
179
180         virtual swidget childSite (Environment * pEnv) {
181                 if (pEnv)
182                         pEnv->_major = NO_EXCEPTION;
183                 return 0;
184         }
185         virtual swidget UxChildSite (swidget sw);
186
187 protected:
188         swidget UxThis;
189 };
190
191 #define CPLUS_ADAPT_CONTEXT(CLASS) \
192         static inline \
193                 CLASS* UxGetContext(CLASS*self) {return self;} \
194         static inline\
195                 void* UxGetContext(swidget any) {return ::UxGetContext(any);}
196
197 #endif /* _cplusplus */
198
199 #endif /* ! UX_INTERPRETER */
200
201 #endif /* ! _UX_XT_H_INCLUDED */
202