| 1 |
/* @(#)UxLib.h 17.1 (ESO-IPG) 01/25/02 17:26:00 */ |
| 2 |
/*--------------------------------------------------------------------- |
| 3 |
* $Date: 2003-06-04 14:49:18 $ $Revision: 1.1.1.1 $ |
| 4 |
*--------------------------------------------------------------------- |
| 5 |
* |
| 6 |
* |
| 7 |
* Copyright (c) 1989-1992, Visual Edge Software Ltd. |
| 8 |
* |
| 9 |
* ALL RIGHTS RESERVED. Permission to use, copy, modify, and |
| 10 |
* distribute this software and its documentation for any purpose |
| 11 |
* and without fee is hereby granted, provided that the above |
| 12 |
* copyright notice appear in all copies and that both that |
| 13 |
* copyright notice and this permission notice appear in supporting |
| 14 |
* documentation, and that the name of Visual Edge Software not be |
| 15 |
* used in advertising or publicity pertaining to distribution of |
| 16 |
* the software without specific, written prior permission. The year |
| 17 |
* included in the notice is the year of the creation of the work. |
| 18 |
*--------------------------------------------------------------------- |
| 19 |
* Runtime library definitions. |
| 20 |
* Used by UIM/X-generated Ux-format sources. |
| 21 |
*-------------------------------------------------------------------*/ |
| 22 |
|
| 23 |
#ifndef _UXLIB_INCLUDED |
| 24 |
#define _UXLIB_INCLUDED |
| 25 |
|
| 26 |
#include "uxproto.h" |
| 27 |
#include "valloc.h" |
| 28 |
#include "UxCorba.h" |
| 29 |
#include <X11/Intrinsic.h> |
| 30 |
#include <X11/StringDefs.h> |
| 31 |
#include <X11/Shell.h> |
| 32 |
#include <Xm/Xm.h> |
| 33 |
#include <Xm/Text.h> |
| 34 |
|
| 35 |
#ifdef __cplusplus |
| 36 |
extern "C" { |
| 37 |
#endif /* __cplusplus */ |
| 38 |
|
| 39 |
#define UxAlloc(s) UxMalloc(s) |
| 40 |
|
| 41 |
#ifdef DESIGN_TIME |
| 42 |
|
| 43 |
#include "UxDesign.h" |
| 44 |
|
| 45 |
#else /* ! design time */ |
| 46 |
|
| 47 |
/*------------------------------------------------ |
| 48 |
* The runtime library declarations. |
| 49 |
*------------------------------------------------*/ |
| 50 |
|
| 51 |
typedef struct ShadowWidget *swidget; |
| 52 |
typedef char **stringTable; |
| 53 |
|
| 54 |
#define NO_PARENT ((swidget) 0) |
| 55 |
#define NULL_SWIDGET ((swidget) 0) |
| 56 |
#define NULL_WIDGET ((Widget) 0) |
| 57 |
|
| 58 |
#ifndef ERROR |
| 59 |
#define ERROR -1 |
| 60 |
#endif |
| 61 |
#ifndef NO_ERROR |
| 62 |
#define NO_ERROR 0 |
| 63 |
#endif |
| 64 |
|
| 65 |
#ifndef _GRAB_INCLUDED |
| 66 |
#define _GRAB_INCLUDED |
| 67 |
typedef enum |
| 68 |
{ |
| 69 |
no_grab = XtGrabNone, |
| 70 |
nonexclusive_grab = XtGrabNonexclusive, |
| 71 |
exclusive_grab = XtGrabExclusive |
| 72 |
} grabtype; |
| 73 |
#endif /* _GRAB_INCLUDED */ |
| 74 |
|
| 75 |
/*------------------------------------------------------------------- |
| 76 |
* Resource Puts and Gets. |
| 77 |
*------------------------------------------------------------------*/ |
| 78 |
|
| 79 |
XtArgVal UxGetProp UXPROTO(( swidget, char * )); |
| 80 |
int UxPutProp UXPROTO(( swidget, char *, XtArgVal )); |
| 81 |
|
| 82 |
XtArgVal UxDDGetProp UXPROTO(( swidget, char * )); |
| 83 |
int UxDDPutProp UXPROTO(( swidget, char *, XtArgVal )); |
| 84 |
|
| 85 |
#include "UxPutsMF.h" |
| 86 |
#include "UxGetsMF.h" |
| 87 |
|
| 88 |
#define UxPutMsgDialogType(o,v) UxDDPutProp((o), "msgDialogType", ((XtArgVal)(v))) |
| 89 |
#define UxGetMsgDialogType(o) (char *)UxDDGetProp((o), "msgDialogType") |
| 90 |
|
| 91 |
#define UxPutText(m,v) UxPutProp((m), XmNvalue, ((XtArgVal) (v))) |
| 92 |
|
| 93 |
#define UxIsValidSwidget(sw) UxIsSwidget(sw) |
| 94 |
|
| 95 |
char *UxGetText UXPROTO(( swidget )); |
| 96 |
|
| 97 |
void UxPutAccelerators UXPROTO((swidget, char *)); |
| 98 |
void UxPutTranslations UXPROTO((swidget, char *)); |
| 99 |
|
| 100 |
char* UxGetAccelerators UXPROTO((swidget)); |
| 101 |
char* UxGetTranslations UXPROTO((swidget)); |
| 102 |
|
| 103 |
char* UxGetCreateManaged UXPROTO((swidget)); |
| 104 |
void UxPutCreateManaged UXPROTO((swidget, char*)); |
| 105 |
|
| 106 |
/*------------------------------------------------------------------- |
| 107 |
* Swidget creation. The UxCreate<ClassName> macros expand |
| 108 |
* into calls to one of these functions. |
| 109 |
*------------------------------------------------------------------*/ |
| 110 |
|
| 111 |
swidget UxCreateSwidget UXPROTO ((char*, WidgetClass, swidget)); |
| 112 |
swidget UxCreateDialogSwidget UXPROTO ((char*, WidgetClass, swidget)); |
| 113 |
swidget UxCreateComponent UXPROTO((char *, swidget)); |
| 114 |
void UxFreeSwidget UXPROTO((swidget)); |
| 115 |
|
| 116 |
|
| 117 |
/*------------------------------------------------------------------- |
| 118 |
* The UIM/X runtime convenience library. |
| 119 |
*------------------------------------------------------------------*/ |
| 120 |
|
| 121 |
void UxAddCallback UXPROTO(( swidget, char *, |
| 122 |
XtCallbackProc, XtPointer)); |
| 123 |
void UxAddTabGroup UXPROTO(( swidget )); |
| 124 |
void UxCenterVisibly UXPROTO(( swidget, swidget )); |
| 125 |
void UxCenterWidgetVisibly UXPROTO(( Widget, Widget )); |
| 126 |
Widget UxCreateWidget UXPROTO(( swidget )); |
| 127 |
|
| 128 |
void UxDelayUpdate UXPROTO(( swidget )); |
| 129 |
int UxDestroyInterface UXPROTO(( swidget )); |
| 130 |
void UxDestroySwidget UXPROTO(( swidget )); |
| 131 |
|
| 132 |
swidget UxFindSwidget UXPROTO(( char * )); |
| 133 |
void UxFreeClientDataCB UXPROTO ((Widget, XtPointer, XtPointer)); |
| 134 |
|
| 135 |
WidgetClass UxGetClass UXPROTO((swidget)); |
| 136 |
void* UxGetContext UXPROTO((swidget)); |
| 137 |
char* UxGetName UXPROTO((swidget)); |
| 138 |
swidget UxGetParent UXPROTO((swidget)); |
| 139 |
Widget UxGetWidget UXPROTO((swidget)); |
| 140 |
void UxPutWidget UXPROTO((swidget, Widget)); |
| 141 |
|
| 142 |
Widget UxInitialize UXPROTO(( char *, int *, char ** )); |
| 143 |
void UxAppInitialize UXPROTO(( char *, int *, char ** )); |
| 144 |
void UxPreInitialize UXPROTO(( void )); |
| 145 |
int UxIsSwidget UXPROTO(( swidget )); |
| 146 |
|
| 147 |
int UxUsingSb UXPROTO(( void )); |
| 148 |
void UxStartUnderSoftbench UXPROTO(( Cardinal *, String* )); |
| 149 |
|
| 150 |
void UxMainLoop UXPROTO(( void )); |
| 151 |
void UxManage UXPROTO(( swidget )); |
| 152 |
void UxMap UXPROTO(( swidget )); |
| 153 |
void UxNotify UXPROTO(( void )); |
| 154 |
Widget UxOptionInitialize UXPROTO(( char *, int *, char **, |
| 155 |
XrmOptionDescRec *, Cardinal )); |
| 156 |
|
| 157 |
swidget UxNameToSwidget UXPROTO(( swidget, char * )); |
| 158 |
|
| 159 |
int UxPopupInterface UXPROTO(( swidget, grabtype )); |
| 160 |
int UxPopdownInterface UXPROTO(( swidget )); |
| 161 |
void UxPostMenu UXPROTO(( Widget, XEvent *, String *, Cardinal *)); |
| 162 |
int UxRealizeInterface UXPROTO(( swidget )); |
| 163 |
Widget UxRealWidget UXPROTO(( swidget )); |
| 164 |
void UxRemoveTabGroup UXPROTO(( swidget )); |
| 165 |
Widget UxShellWidget UXPROTO(( swidget )); |
| 166 |
|
| 167 |
void UxTextAppend UXPROTO((Widget, char*)); |
| 168 |
|
| 169 |
void UxUnmanage UXPROTO(( swidget )); |
| 170 |
void UxUnmap UXPROTO(( swidget )); |
| 171 |
void UxUpdate UXPROTO(( swidget )); |
| 172 |
|
| 173 |
void UxWaitForNotify UXPROTO(( void )); |
| 174 |
swidget UxWidgetToSwidget UXPROTO(( Widget )); |
| 175 |
|
| 176 |
/*------------------------------------------------------------------- |
| 177 |
* The runtime versions of the following are the toolkit functions. |
| 178 |
* Use the Ux- form so that your code works in UIM/X at test time. |
| 179 |
*-------------------------------------------------------------------*/ |
| 180 |
|
| 181 |
#define UxAddActions(a,b) XtAppAddActions(UxAppContext, a,b) |
| 182 |
#define UxNextEvent(e) XtAppNextEvent(UxAppContext, e) |
| 183 |
#define UxDispatchEvent(e) XtDispatchEvent(e) |
| 184 |
|
| 185 |
/*------------------------------------------------------------------- |
| 186 |
* The following are used in Ux-form generated code. |
| 187 |
* You will rarely if ever need to call them directly. |
| 188 |
*-------------------------------------------------------------------*/ |
| 189 |
|
| 190 |
WidgetClass UxGetDefaultShell UXPROTO((swidget)); |
| 191 |
void UxPutDefaultShell UXPROTO((swidget, char *)); |
| 192 |
|
| 193 |
int UxIsShellClass UXPROTO(( WidgetClass )); |
| 194 |
void UxMainWindowSetAreas UXPROTO((swidget, |
| 195 |
swidget, swidget, swidget, |
| 196 |
swidget, swidget )); |
| 197 |
void UxPutContext UXPROTO((swidget, void*)); |
| 198 |
void UxRegisterPopupMenuHandler UXPROTO(( swidget, swidget )); |
| 199 |
void UxScrolledWindowSetAreas UXPROTO((swidget, |
| 200 |
swidget, swidget, swidget)); |
| 201 |
void UxSetDefaultShell UXPROTO(( char * )); |
| 202 |
|
| 203 |
int UxGetIfClassCode UXPROTO((swidget)); |
| 204 |
void UxPutClassCode UXPROTO((swidget, int)); |
| 205 |
|
| 206 |
void UxLoadResources UXPROTO((char *)); |
| 207 |
|
| 208 |
char *UxInitCat UXPROTO((void)); |
| 209 |
|
| 210 |
void UxDestroyContextCB UXPROTO((Widget, XtPointer, XtPointer)); |
| 211 |
swidget UxChildSite UXPROTO((swidget)); |
| 212 |
|
| 213 |
/*------------------------------------------------------------------- |
| 214 |
* Global state of Motif and your X session. |
| 215 |
*-------------------------------------------------------------------*/ |
| 216 |
|
| 217 |
extern Widget UxTopLevel; |
| 218 |
extern XtAppContext UxAppContext; |
| 219 |
extern XEvent *UxCurrentEvent; |
| 220 |
extern Display *UxDisplay; |
| 221 |
extern int UxScreen; |
| 222 |
extern Window UxRootWindow; |
| 223 |
extern GC UxDrawGC; |
| 224 |
|
| 225 |
/*----------------------------------------------------- |
| 226 |
* For backwards compatibility of user-rtime.c |
| 227 |
*-----------------------------------------------------*/ |
| 228 |
|
| 229 |
#define UxrDDInstall(nm, ut, xt) UxDDInstall( nm, ut, xt) |
| 230 |
|
| 231 |
#endif /* not DESIGN_TIME */ |
| 232 |
|
| 233 |
#ifdef __cplusplus |
| 234 |
|
| 235 |
/*----------------------------------------------------- |
| 236 |
* Base Class of all generated interfaces |
| 237 |
*-----------------------------------------------------*/ |
| 238 |
class _UxCInterface { |
| 239 |
|
| 240 |
public: |
| 241 |
virtual swidget childSite (Environment * pEnv); |
| 242 |
virtual swidget UxChildSite (swidget sw); |
| 243 |
|
| 244 |
protected: |
| 245 |
swidget UxThis; |
| 246 |
}; |
| 247 |
|
| 248 |
/*----------------------------------------------------- |
| 249 |
* Macros |
| 250 |
*-----------------------------------------------------*/ |
| 251 |
#define CPLUS_ADAPT_CONTEXT(CLASS) \ |
| 252 |
static inline \ |
| 253 |
CLASS* UxGetContext(CLASS*self) {return self;} \ |
| 254 |
static inline\ |
| 255 |
void* UxGetContext(swidget any) {return ::UxGetContext(any);} |
| 256 |
|
| 257 |
/*----------------------------------------------------- |
| 258 |
* Function Declarations |
| 259 |
*-----------------------------------------------------*/ |
| 260 |
swidget UxChildSite (swidget); |
| 261 |
|
| 262 |
#endif /* _cplusplus */ |
| 263 |
|
| 264 |
#ifdef __cplusplus |
| 265 |
} /* Close scope of 'extern "C"' declaration which encloses file. */ |
| 266 |
#endif /* __cplusplus */ |
| 267 |
|
| 268 |
#endif /* _UXLIB_INCLUDED */ |