Encaps.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  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. /* $XConsortium: Encaps.h /main/4 1995/11/02 14:36:49 rswiston $ */
  24. /************************************<+>*************************************
  25. ****************************************************************************
  26. *
  27. * FILE: Encaps.h
  28. *
  29. * COMPONENT_NAME: Desktop File Manager
  30. *
  31. * DESCRIPTION: Public include file for the dialog encapsulation functions.
  32. *
  33. * (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
  34. * (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
  35. * (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
  36. * (c) Copyright 1993, 1994, 1995 Novell, Inc.
  37. *
  38. ****************************************************************************
  39. ************************************<+>*************************************/
  40. #ifndef _Encapsulate_h
  41. #define _Encapsulate_h
  42. /* Timer globals */
  43. extern int initialTimeoutLength;
  44. extern int activeTimeoutLength;
  45. extern int idleTimeoutLength;
  46. /* Dialog positioning offset value */
  47. extern int topPositionOffset;
  48. /*
  49. * Common dialog instance data.
  50. */
  51. typedef struct
  52. {
  53. Boolean displayed;
  54. Position x;
  55. Position y;
  56. Dimension width;
  57. Dimension height;
  58. } DialogInstanceData, * DialogInstanceDataPtr;
  59. /*
  60. * DialogData contains the dialog type specific data shared between
  61. * the dialog and the application.
  62. */
  63. typedef struct
  64. {
  65. int type;
  66. XtPointer data;
  67. } DialogData;
  68. /*
  69. * The following typedefs are the function definitions used by the
  70. * Dialog Class structure.
  71. */
  72. typedef void (*DialogCreateProc)(
  73. Display * display,
  74. Widget parent,
  75. Widget * shell,
  76. XtPointer * dialog
  77. );
  78. typedef void (*DialogInstallChangeProc)(
  79. XtPointer dialog,
  80. XtCallbackProc callback,
  81. XtPointer client_data
  82. );
  83. typedef void (*DialogInstallCloseProc)(
  84. XtPointer dialog,
  85. XtCallbackProc callback,
  86. XtPointer client_data
  87. );
  88. typedef void (*DialogDestroyProc)(
  89. XtPointer dialog
  90. );
  91. typedef XtPointer (*DialogGetValuesProc)(
  92. XtPointer dialog
  93. );
  94. typedef XtPointer (*DialogGetDefaultValuesProc)(
  95. void
  96. );
  97. typedef XtPointer (*DialogGetResourceValuesProc)(
  98. XrmDatabase data_base,
  99. char ** name_list
  100. );
  101. typedef void (*DialogSetValuesProc)(
  102. XtPointer dialog,
  103. XtPointer values
  104. );
  105. typedef void (*DialogWriteResourceValuesProc)(
  106. DialogData * values,
  107. int fd,
  108. char ** name_list
  109. );
  110. typedef void (*DialogFreeValuesProc)(
  111. XtPointer values
  112. );
  113. typedef void (*DialogSetFocusProc)(
  114. XtPointer dialog,
  115. XtPointer values
  116. );
  117. typedef void (*DialogMapWindowProc)(
  118. Widget parent,
  119. XtPointer dialog
  120. );
  121. /*
  122. * Resource write proc and structure used for dialog resources.
  123. */
  124. typedef void (*WriteResourceProc)();
  125. /* XtPointer resource_val; */
  126. typedef struct
  127. {
  128. String name;
  129. String type;
  130. int size;
  131. int offset;
  132. XtPointer default_value;
  133. WriteResourceProc write_resource;
  134. } DialogResource;
  135. /*
  136. * The Dialog Class structure.
  137. */
  138. typedef struct
  139. {
  140. DialogResource * resources;
  141. int resource_count;
  142. DialogCreateProc create;
  143. DialogInstallChangeProc install_change_callback;
  144. DialogInstallCloseProc install_close_callback;
  145. DialogDestroyProc destroy;
  146. DialogGetValuesProc get_values;
  147. DialogGetDefaultValuesProc get_default_values;
  148. DialogGetResourceValuesProc get_resource_values;
  149. DialogSetValuesProc set_values;
  150. DialogWriteResourceValuesProc write_resource_values;
  151. DialogFreeValuesProc free_values;
  152. DialogMapWindowProc map;
  153. DialogSetFocusProc set_focus;
  154. } DialogClass;
  155. /*
  156. * Procedure types used by the application for functions to be passed
  157. * to the encapsulation mechanism.
  158. */
  159. typedef void (*DialogChangedProc)(
  160. XtPointer change_data,
  161. DialogData * old_data,
  162. DialogData * new_data,
  163. XtPointer call_data
  164. );
  165. typedef void (*DialogClosedProc)(
  166. XtPointer close_data,
  167. DialogData * old_data,
  168. DialogData * new_data
  169. );
  170. /******** Public Function Declarations ********/
  171. extern void _DtInitializeEncapsulation(
  172. Display *display,
  173. char *name,
  174. char *class) ;
  175. extern int _DtInstallDialog(
  176. DialogClass *dialog_class,
  177. Boolean cache,
  178. Boolean destroyPopups) ;
  179. extern DialogData * _DtGetDialogData(
  180. DialogData *dialog_data) ;
  181. extern DialogData * _DtGetDefaultDialogData(
  182. int dialog_type) ;
  183. extern DialogData * _DtGetResourceDialogData(
  184. int dialog_type,
  185. XrmDatabase data_base,
  186. char **name_list) ;
  187. extern void _DtShowDialog(
  188. Widget parent,
  189. Widget map_parent,
  190. XtPointer top_rec,
  191. DialogData *dialog_data,
  192. DialogChangedProc change_proc,
  193. XtPointer change_data,
  194. DialogClosedProc close_proc,
  195. XtPointer close_data,
  196. char *workspaces,
  197. Boolean iconify_state,
  198. Boolean ignoreCache,
  199. char * title,
  200. XClassHint * classHints) ;
  201. extern void _DtHideDialog(
  202. DialogData *dialog_data,
  203. Boolean call_callbacks) ;
  204. extern Widget _DtGetDialogShell(
  205. DialogData *dialog_data) ;
  206. extern XtPointer _DtGetDialogInstance(
  207. DialogData *dialog_data) ;
  208. extern DialogData * _DtGetInstanceData(
  209. XtPointer instance) ;
  210. extern Boolean _DtIsDialogShowing(
  211. DialogData *dialog_data) ;
  212. extern void _DtWriteDialogData(
  213. DialogData *dialog_data,
  214. int fd,
  215. char **name_list) ;
  216. extern void _DtFreeDialogData(
  217. DialogData *dialog_data) ;
  218. extern void _DtDialogGetResources(
  219. XrmDatabase database,
  220. char **name_list,
  221. char *dialog_name,
  222. char *base,
  223. DialogResource *resources,
  224. int resource_count) ;
  225. extern void _DtDialogPutResources(
  226. int fd,
  227. char **name_list,
  228. char *dialog_name,
  229. char *base,
  230. DialogResource *resources,
  231. int resource_count) ;
  232. extern void _DtIntToString(
  233. int fd,
  234. int *value,
  235. char *out_buf) ;
  236. extern void _DtShortToString(
  237. int fd,
  238. short *value,
  239. char *out_buf) ;
  240. extern void _DtPositionToString(
  241. int fd,
  242. Position *value,
  243. char *out_buf) ;
  244. extern void _DtDimensionToString(
  245. int fd,
  246. Dimension *value,
  247. char *out_buf) ;
  248. extern void _DtBooleanToString(
  249. int fd,
  250. Boolean *value,
  251. char *out_buf) ;
  252. extern void _DtXmStringToString(
  253. int fd,
  254. XmString *value,
  255. char *out_buf) ;
  256. extern void _DtXmStringTableToString(
  257. int fd,
  258. XmStringTable *value,
  259. char *out_buf) ;
  260. extern void _DtStringToString(
  261. int fd,
  262. char **value,
  263. char *out_buf) ;
  264. extern void _DtmapCB(
  265. Widget w,
  266. XtPointer client_data,
  267. XtPointer call_data) ;
  268. extern void _DtEncapSetWorkSpaceHints(
  269. Widget shell,
  270. char *workspaces) ;
  271. extern void _DtBuildDialog(
  272. Widget parent,
  273. Widget map_parent,
  274. XtPointer top_rec,
  275. DialogData *dialog_data,
  276. DialogChangedProc change_proc,
  277. XtPointer change_data,
  278. DialogClosedProc close_proc,
  279. XtPointer close_data,
  280. char *workspaces,
  281. Boolean iconify_state,
  282. Boolean ignoreCache,
  283. char * title,
  284. XClassHint * classHints ) ;
  285. extern void _DtShowBuiltDialog(
  286. Widget parent,
  287. Widget map_parent,
  288. DialogData *dialog_data,
  289. char *workspaces,
  290. Boolean iconify_state,
  291. XClassHint * classHints ) ;
  292. extern void _DtChangeTo(
  293. XtPointer client_data,
  294. char *directory) ;
  295. extern void _DtFreeDialog(
  296. DialogData *dialog_data);
  297. /******** End Public Function Declarations ********/
  298. #endif /* _Encapsulate_h */
  299. /* DON'T ADD ANYTHING AFTER THIS #endif */