2
0

HelpUtilI.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  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: HelpUtilI.h /main/5 1995/10/26 12:26:30 rswiston $ */
  24. /*************************************<+>*************************************
  25. *****************************************************************************
  26. **
  27. ** File: HelpUtilI.h
  28. **
  29. ** Project: Rivers Project,
  30. **
  31. ** Description: Internal header file for our HelpUtil module.
  32. ** -----------
  33. **
  34. ** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992 Hewlett-Packard Company
  35. **
  36. ** (c) Copyright 1993, 1994 Hewlett-Packard Company
  37. ** (c) Copyright 1993, 1994 International Business Machines Corp.
  38. ** (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  39. ** (c) Copyright 1993, 1994 Novell, Inc.
  40. *******************************************************************
  41. *************************************<+>*************************************/
  42. #ifndef _HelpUtilI_h
  43. #define _HelpUtilI_h
  44. #include "HelpDialogP.h"
  45. /* default help4help volume */
  46. extern char _DtHelpDefaultHelp4HelpVolume[];
  47. extern char _DtHelpDefaultLocationId[];
  48. /*
  49. *****************************************************************************
  50. * Function: void _DtHelpErrorDialog(parent, message, helpLocationId)
  51. *
  52. * Parameters: widget Specifies the application's top level widget
  53. * message Specifies the desired error message to
  54. * display.
  55. *
  56. * Return Value: None
  57. *
  58. * Purpose: To display and error message in a motif error dialog.
  59. *
  60. *****************************************************************************
  61. */
  62. void _DtHelpErrorDialog(
  63. Widget parent,
  64. char * message);
  65. /*****************************************************************************
  66. * Function: _DtHelpFilterExecCmdStr
  67. *
  68. * Args:
  69. * helpWidget: help widget requesting to exec the command
  70. * pDisplayStuff: ptr to the DisplayWidget stuff of the help widget
  71. * commandStr: command string to execute
  72. * ret_cmdStr: the screened & possibly rewritten command is put here
  73. * ret_cmdWasAlias: was the command an alias?
  74. * ret_execPermitted: if executionPolicy permit exec & ret_cmdStr is valid
  75. * ret_queryNeeded: if executionPolicy requires a query before exec
  76. *
  77. * Description:
  78. * ret_cmdStr gets memory owned by the calling function; it should be
  79. * freed when no longer needed. The string will be the same as the
  80. * commandStr if commandStr was not an alias. If the commandStr
  81. * is an alias and if the alias is defined, the ret_cmdStr will be the
  82. * value of the alias. If the alias isn't defined, the ret_cmdStr will
  83. * be the default command if available, or the alias name otherwise.
  84. *
  85. * ret_cmdWasAlias will be True if the alias was defined or if the
  86. * alias was undefined AND no default command was given.
  87. * It will be False if no alias was used or if the alias was undefined
  88. * and a default command was present.
  89. *
  90. * Returns:
  91. * True: if execPermitted and a valid command string
  92. * False: if if execPermitted is False or invalid command string
  93. *
  94. * Comments:
  95. * This code is written such that we don't need nor want to know
  96. * whether it is a general or quick help widget.
  97. *
  98. * Warning:
  99. * command string must be writable; it is written, but left
  100. * unchanged when the function exits.
  101. *
  102. *****************************************************************************/
  103. Boolean _DtHelpFilterExecCmdStr(
  104. Widget helpWidget,
  105. unsigned char executionPolicy,
  106. const char * commandStr,
  107. char * * ret_cmdStr,
  108. Boolean * ret_cmdWasAlias,
  109. Boolean * ret_execPermitted,
  110. Boolean * ret_queryNeeded,
  111. char * hv_path);
  112. typedef Boolean (*_DtHelpCeWaitProc)(Widget w,void * clientData);
  113. /*********************************************************************
  114. * _DtHelpCeWaitAndProcessEvents
  115. *
  116. * Purpose:
  117. * _DtHelpCeWaitAndProcessEvents will process events and call
  118. * the waitProc until waitProc returns False. This function
  119. * is useful to put up modal dialogs that must be reponded to
  120. * in the midst of executing code that must remain on the call stack.
  121. *
  122. * Warning:
  123. * This function should only be used on modal dialogs.
  124. *
  125. *********************************************************************/
  126. void
  127. _DtHelpCeWaitAndProcessEvents (
  128. Widget w,
  129. _DtHelpCeWaitProc waitProc,
  130. void * clientData);
  131. /*****************************************************************************
  132. * Function: _DtHelpFilterExecCmd
  133. *
  134. * Args:
  135. * helpWidget: help widget requesting to exec the command
  136. * command: command string to execute
  137. * DtHELP_EXECUTE_???
  138. * execPolicy: current policy setting
  139. * ret_filteredCmdStr: filtered command string
  140. *****************************************************************************/
  141. int _DtHelpFilterExecCmd(
  142. Widget helpWidget,
  143. const char * commandStr,
  144. unsigned char executionPolicy,
  145. Boolean useQueryDialog,
  146. _DtHelpCommonHelpStuff * pHelpStuff,
  147. char * * ret_filteredCmdStr,
  148. char * hv_path);
  149. /*****************************************************************************
  150. * Function: _DtHelpExecFilteredCmd
  151. *
  152. * Args:
  153. * helpWidget: help widget requesting to exec the command
  154. * command: command string to execute
  155. * modal: is the execution modal (sync) or modeless (async)
  156. * helpLocationId: helpOnHelp file location for Help btn in error dialog
  157. * pDisplayStuff: ptr to the DisplayWidget stuff of the help widget
  158. * pHelpStuff: ptr to the CommonHelp stuff of the help widget
  159. *
  160. * Comments:
  161. * This code is written such that we don't need nor want to know
  162. * whether it is a general or quick help widget.
  163. *
  164. * Warning:
  165. * command string must be writable; it is written, but left
  166. * unchanged whent the function exits.
  167. *
  168. * Called by:
  169. *****************************************************************************/
  170. void _DtHelpExecFilteredCmd(
  171. Widget helpWidget,
  172. char * commandStr,
  173. char * helpLocationId,
  174. _DtHelpDisplayWidgetStuff * pDisplayStuff,
  175. _DtHelpCommonHelpStuff * pHelpStuff);
  176. /*****************************************************************************
  177. * Function: Boolean _DtHelpExpandHelpVolume(DtHelpDialogWidget nw);
  178. *
  179. *
  180. * Parameters: nw Specifies the current help dialog widget.
  181. *
  182. * Return Value: Boolean.
  183. *
  184. * Description: _DtHelpExpandHelpVolume looks for a $LANG variable in the
  185. * helpAccesFile string and if found, replaces it with the
  186. * current lang variable.
  187. *
  188. *****************************************************************************/
  189. Boolean _DtHelpExpandHelpVolume(
  190. Widget widget,
  191. _DtHelpDisplayWidgetStuff * display,
  192. _DtHelpCommonHelpStuff * help,
  193. _DtHelpPrintStuff * print);
  194. /*****************************************************************************
  195. * Function: char *_DtHelpParseIdString(char * specification);
  196. *
  197. *
  198. * Parameters: specification Specifies an author defined help topic.
  199. *
  200. * Return Value: Void.
  201. *
  202. * Description: This function copies the locationId portion of the
  203. * specification and retruns it to the calling routine.
  204. *
  205. *****************************************************************************/
  206. extern char *_DtHelpParseIdString(
  207. char *specification);
  208. /*****************************************************************************
  209. * Function: char *_DtHelpParseAccessFile(char * specification);
  210. *
  211. *
  212. * Parameters: specification Specifies an author defined help topic.
  213. *
  214. * Return Value: Void.
  215. *
  216. * Description: This function copies the helpAccessFile portion of the
  217. * specification and retruns it to the calling routine.
  218. *
  219. *****************************************************************************/
  220. extern char *_DtHelpParseAccessFile(
  221. char *specification);
  222. /*****************************************************************************
  223. * Function: void _DtHelpTopicListAddToHead(
  224. * char *locationId,
  225. * char *topicTitle,
  226. * int topicType,
  227. * int maxNodex,
  228. * char *accessPath,
  229. * DtTopicListStruct **pHead,
  230. * DtTopicListStruct **pTale,
  231. * int *totalNodes)
  232. *
  233. *
  234. * Parameters:
  235. *
  236. * Return Value: Void.
  237. *
  238. * Purpose: Adds an element to the top of the given topicList.
  239. *
  240. *****************************************************************************/
  241. extern void _DtHelpTopicListAddToHead(
  242. char *locationId,
  243. XmString topicTitle,
  244. int topicType,
  245. int maxNodes,
  246. char *accessPath,
  247. DtTopicListStruct **pHead,
  248. DtTopicListStruct **pTale,
  249. int *totalNodes,
  250. int scrollPosition);
  251. /*****************************************************************************
  252. * Function: void _DtTopicListDelUeteHead(
  253. * DtTopicListStruct *pHead,
  254. * DtTopicListStruct *pTale,
  255. * totalNodes)
  256. *
  257. *
  258. * Parameters:
  259. *
  260. * Return Value: Void.
  261. *
  262. * Purpose: Delets an element from the top of the given topicList.
  263. *
  264. *****************************************************************************/
  265. extern void _DtHelpTopicListDeleteHead(
  266. DtTopicListStruct **pHead,
  267. DtTopicListStruct **pTale,
  268. int *totalNodes);
  269. /*****************************************************************************
  270. * Function: void _DtHelpMapCB(
  271. *
  272. *
  273. *
  274. * Parameters:
  275. *
  276. * Return Value: Void.
  277. *
  278. * Purpose: Determins where a new child dialog should be mapped in
  279. * relation to its parent.
  280. *
  281. *****************************************************************************/
  282. extern XtCallbackProc _DtHelpMapCB(
  283. Widget w,
  284. XtPointer client_data,
  285. XtPointer call_data );
  286. /*****************************************************************************
  287. * Function: void _DtHelpMapCenteredCB(
  288. *
  289. *
  290. *
  291. * Parameters:
  292. *
  293. * Return Value: Void.
  294. *
  295. * Purpose: Determins where the center of our help dialog is and sets
  296. * where new child dialog should be mapped such that its centered.
  297. *
  298. *****************************************************************************/
  299. extern XtCallbackProc _DtHelpMapCenteredCB(
  300. Widget w,
  301. XtPointer client_data,
  302. XtPointer call_data);
  303. /*****************************************************************************
  304. * Function: Boolean _DtHelpResolvePathname(
  305. *
  306. *
  307. * Parameters:
  308. *
  309. * Return Value: Boolean.
  310. *
  311. *
  312. * Description: _DtHelpResolvePathname attempts to validate and expand a path
  313. * to a Cache Creek help access file.
  314. *
  315. *****************************************************************************/
  316. extern Boolean _DtHelpResolvePathname(
  317. Widget widget,
  318. char **fileName,
  319. _DtHelpVolumeHdl *volumeHandle,
  320. char *sysVolumeSearchPath,
  321. char *userVolumeSearchPath);
  322. /*****************************************************************************
  323. * Function: void _DtHelpDisplayDefinitionBox(
  324. * Widget parent,
  325. * Widget definitionBox,
  326. * char * path,
  327. * char * locationId);
  328. *
  329. * Parameters:
  330. *
  331. * Return Value:
  332. *
  333. * Purpose: This routine will create and post the definition box.
  334. * (e.g. the Quick Help Dialog widget)
  335. *
  336. ****************************************************************************/
  337. extern void _DtHelpDisplayDefinitionBox(
  338. Widget parent,
  339. Widget **definitionBox,
  340. char * path,
  341. char * locationId);
  342. /*****************************************************************************
  343. * Function: void _DtHelpDisplayFormatError()
  344. *
  345. * Parameters:
  346. *
  347. * Return Value:
  348. *
  349. * Purpose: This routine generate and display the proper errror
  350. * message to the display area as well as send the proper
  351. * error to XmWarning() function.
  352. *
  353. ****************************************************************************/
  354. void _DtHelpDisplayFormatError(
  355. XtPointer displayArea,
  356. Widget widget,
  357. char *userError,
  358. char *systemError);
  359. /*****************************************************************************
  360. * Function: void _DtHelpCommonHelpInit()
  361. *
  362. * Parameters:
  363. *
  364. * Return Value:
  365. *
  366. * Purpose: This routine inits common help stuff
  367. *
  368. ****************************************************************************/
  369. void _DtHelpCommonHelpInit(
  370. _DtHelpCommonHelpStuff * help);
  371. /*****************************************************************************
  372. * Function: void _DtHelpCommonHelpClean()
  373. *
  374. * Parameters:
  375. *
  376. * Return Value:
  377. *
  378. * Purpose: This routine cleans up common help stuff
  379. *
  380. ****************************************************************************/
  381. void _DtHelpCommonHelpClean(
  382. _DtHelpCommonHelpStuff * help,
  383. Boolean destroy);
  384. /*****************************************************************************
  385. * Function: void _DtHelpSetDlgButtonsWidth
  386. *
  387. * Parameters:
  388. *
  389. * Return Value:
  390. *
  391. * Purpose: This routine cleans up common help stuff
  392. *
  393. ****************************************************************************/
  394. void _DtHelpSetButtonPositions(
  395. Widget btnList[],
  396. int numBtns,
  397. Dimension minFormWidth,
  398. Dimension btnMargins,
  399. Dimension minBetweenBtnSpace);
  400. /*****************************************************************************
  401. * Function: _DtHelpXmFontListGetPropertyMax
  402. *
  403. * Parameters:
  404. * fontList: an XmFontList
  405. * atom: an XA_xxx value (see Vol 1, chpt 6.2.9)
  406. * ret_propertyValue: ptr to long value that will hold the max value
  407. *
  408. * Return Value:
  409. * True: got at least one value
  410. * False: unable to get any value
  411. *
  412. * Purpose:
  413. * This function returns the max value of XGetFontProperty calls
  414. * for each font in the XmFontList
  415. *
  416. ****************************************************************************/
  417. Boolean _DtHelpXmFontListGetPropertyMax(
  418. XmFontList fontList,
  419. Atom atom,
  420. unsigned long *ret_propertyValue);
  421. #endif /* _HelpUtilI_h */
  422. /* Do not add anything after this endif. */