DtMrm.c 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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. /*
  24. * Common Desktop Environment
  25. *
  26. * (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
  27. * (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
  28. * (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
  29. * (c) Copyright 1993, 1994, 1995 Novell, Inc.
  30. * (c) Copyright 1995 Digital Equipment Corp.
  31. * (c) Copyright 1995 Fujitsu Limited
  32. * (c) Copyright 1995 Hitachi, Ltd.
  33. *
  34. *
  35. * RESTRICTED RIGHTS LEGEND
  36. *
  37. * Use, duplication, or disclosure by the U.S. Government is subject to
  38. * restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
  39. * Technical Data and Computer Software clause in DFARS 252.227-7013. Rights
  40. * for non-DOD U.S. Government Departments and Agencies are as set forth in
  41. * FAR 52.227-19(c)(1,2).
  42. *
  43. * Hewlett-Packard Company, 3000 Hanover Street, Palo Alto, CA 94304 U.S.A.
  44. * International Business Machines Corp., Route 100, Somers, NY 10589 U.S.A.
  45. * Sun Microsystems, Inc., 2550 Garcia Avenue, Mountain View, CA 94043 U.S.A.
  46. * Novell, Inc., 190 River Road, Summit, NJ 07901 U.S.A.
  47. * Digital Equipment Corp., 111 Powdermill Road, Maynard, MA 01754, U.S.A.
  48. * Fujitsu Limited, 1015, Kamikodanaka Nakahara-Ku, Kawasaki 211, Japan
  49. * Hitachi, Ltd., 6, Kanda Surugadai 4-Chome, Chiyoda-ku, Tokyo 101, Japan
  50. */
  51. /* *
  52. * (c) Copyright 1996 Hewlett-Packard Company *
  53. * (c) Copyright 1996 International Business Machines Corp. *
  54. * (c) Copyright 1996 Sun Microsystems, Inc. *
  55. * (c) Copyright 1996 Novell, Inc. *
  56. * (c) Copyright 1989, 1990, 1996 Digital Equipment Corporation. *
  57. * (c) Copyright 1996 FUJITSU LIMITED. *
  58. * (c) Copyright 1996 Hitachi. *
  59. */
  60. #ifdef REV_INFO
  61. #ifndef lint
  62. static char rcsid[] = "$TOG: DtMrm.c /main/4 1999/10/14 13:35:44 mgreess $"
  63. #endif
  64. #endif
  65. /*
  66. *++
  67. * FACILITY:
  68. *
  69. * UIL Resource Manager (URM):
  70. *
  71. * ABSTRACT:
  72. *
  73. * This contains only the top-level routine DtMrmIntialize. It can be
  74. * modified as needed to add or remove widgets being initialized for
  75. * URM facilities. This routine is normally accessible to
  76. * and used by an application at runtime to access URM facilities.
  77. *
  78. *--
  79. */
  80. /*
  81. *
  82. * INCLUDE FILES
  83. *
  84. */
  85. #include <X11/IntrinsicP.h>
  86. #include <Xm/Xm.h>
  87. #include <Mrm/MrmPublic.h>
  88. #include <Dt/Editor.h>
  89. #include <Dt/EditorP.h>
  90. #include <Dt/Help.h>
  91. #include <Dt/HelpP.h>
  92. #include <Dt/HelpDialog.h>
  93. #include <Dt/HelpDialogP.h>
  94. #include <Dt/HelpQuickD.h>
  95. #include <Dt/HelpQuickDP.h>
  96. #include <Dt/MenuButton.h>
  97. #include <Dt/MenuButtonP.h>
  98. #include <Dt/Mrm.h>
  99. #include <Dt/Print.h>
  100. #include <Dt/PrintSetupBP.h>
  101. #include <Dt/PrintSetupBP.h>
  102. #include <Dt/Term.h>
  103. /* work around conflict with <Xm/TextP.h> */
  104. #ifdef PreUnder
  105. #undef PreUnder
  106. #endif
  107. #include <Dt/TermP.h>
  108. /******** Conditionally defined macros for thread_safe DtTerm ******/
  109. #ifdef XTHREADS
  110. #define _MrmProcessLock() XtProcessLock()
  111. #define _MrmProcessUnlock() XtProcessUnlock()
  112. #else /* XTHREADS */
  113. #define _MrmProcessLock()
  114. #define _MrmProcessUnlock()
  115. #endif /* XTHREADS */
  116. /*
  117. *
  118. * TABLE OF CONTENTS
  119. *
  120. * DtMrmInitialize Initialize URM internals before use
  121. *
  122. */
  123. /*
  124. * The following flag is set to indicate successful URM initialization
  125. */
  126. static Boolean urm__initialize_complete = FALSE;
  127. void DtMrmInitialize (void)
  128. /*
  129. *++
  130. * PROCEDURE DESCRIPTION:
  131. *
  132. * DtMrmInitialize must be called in order to prepare an application to
  133. * use URM widget fetching facilities for CDE Dt widgets. It is
  134. * analogous to the MrmInitialize routine for Motif widgets.
  135. *
  136. * DtMrmInitialize initializes the internal data
  137. * structures (creating the mapping from class codes to the creation
  138. * routine for each builtin widget class) which URM needs in order to
  139. * successfully perform type conversion on arguments, and successfully
  140. * access widget creation facilities. DtMrmInitialize must be called before
  141. * any widgets are created, whether by URM's fetch mechanisms or directly
  142. * by the application. It may be called before or after XtInitialize, and
  143. * multiple calls after the first one are benign (no-ops).
  144. *
  145. * FORMAL PARAMETERS:
  146. *
  147. * IMPLICIT INPUTS:
  148. *
  149. * IMPLICIT OUTPUTS:
  150. *
  151. * FUNCTION VALUE:
  152. *
  153. * SIDE EFFECTS:
  154. *
  155. *--
  156. */
  157. {
  158. _MrmProcessLock();
  159. /*
  160. * Initialize only once
  161. */
  162. if (urm__initialize_complete)
  163. {
  164. _MrmProcessUnlock();
  165. return;
  166. }
  167. /*
  168. * Initialize the class descriptors for all the known widgets.
  169. */
  170. MrmRegisterClass(
  171. 0, NULL,
  172. "DtCreateEditor", DtCreateEditor,
  173. (WidgetClass) &dtEditorClassRec
  174. );
  175. MrmRegisterClass(
  176. 0, NULL,
  177. "DtCreateHelpDialog", DtCreateHelpDialog,
  178. (WidgetClass) &dtHelpDialogWidgetClassRec
  179. );
  180. MrmRegisterClass(
  181. 0, NULL,
  182. "DtCreateHelpQuickDialog", DtCreateHelpQuickDialog,
  183. (WidgetClass) &dtHelpQuickDialogWidgetClassRec
  184. );
  185. MrmRegisterClass(
  186. 0, NULL,
  187. "DtCreateMenuButton", DtCreateMenuButton,
  188. (WidgetClass) &dtMenuButtonClassRec
  189. );
  190. MrmRegisterClass(
  191. 0, NULL,
  192. "DtCreatePrintSetupBox", DtCreatePrintSetupBox,
  193. (WidgetClass) &dtPrintSetupBoxClassRec
  194. );
  195. MrmRegisterClass(
  196. 0, NULL,
  197. "DtCreatePrintSetupDialog", DtCreatePrintSetupDialog,
  198. (WidgetClass) &dtPrintSetupBoxClassRec
  199. );
  200. MrmRegisterClass(
  201. 0, NULL,
  202. "DtCreateTerm", DtCreateTerm,
  203. (WidgetClass) &dtTermClassRec
  204. );
  205. /*
  206. * Initialization complete
  207. */
  208. urm__initialize_complete = TRUE;
  209. _MrmProcessUnlock();
  210. return;
  211. }