UxXt.h 8.1 KB

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