HelpCB.c 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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: HelpCB.c /main/5 1996/03/25 00:51:28 pascale $ */
  24. /*
  25. ****************************************************************************
  26. **
  27. ** File: HelpCB.c
  28. **
  29. ** Project: DT 3.0
  30. **
  31. ** Description: Contains the callbacks for Help
  32. **
  33. **
  34. ****************************************************************************/
  35. /*
  36. * (c) Copyright 1996 Digital Equipment Corporation.
  37. * (c) Copyright 1990, 1996 Hewlett-Packard Company.
  38. * (c) Copyright 1996 International Business Machines Corp.
  39. * (c) Copyright 1996 Sun Microsystems, Inc.
  40. * (c) Copyright 1996 Novell, Inc.
  41. * (c) Copyright 1996 FUJITSU LIMITED.
  42. * (c) Copyright 1996 Hitachi.
  43. */
  44. #include <Dt/HelpDialog.h>
  45. #include "Main.h"
  46. #include "Help.h"
  47. void
  48. HelpRequestCB(
  49. Widget w,
  50. caddr_t client_data,
  51. caddr_t call_data )
  52. {
  53. char *helpVolume, *locationId;
  54. intptr_t topic;
  55. topic = (intptr_t) client_data;
  56. helpVolume = HELP_VOLUME;
  57. switch (topic)
  58. {
  59. case HELP_MAIN_WINDOW:
  60. locationId = HELP_MAIN_WINDOW_STR;
  61. break;
  62. case HELP_MENUBAR:
  63. locationId = HELP_MENUBAR_STR;
  64. break;
  65. case HELP_FILE_BUTTON:
  66. locationId = HELP_FILE_BUTTON_STR;
  67. break;
  68. case HELP_HELP_BUTTON:
  69. locationId = HELP_HELP_BUTTON_STR;
  70. break;
  71. case HELP_FILE_MENU:
  72. locationId = HELP_FILE_MENU_STR;
  73. break;
  74. case HELP_HELP_MENU:
  75. locationId = HELP_HELP_MENU_STR;
  76. break;
  77. case HELP_EXIT:
  78. locationId = HELP_EXIT_STR;
  79. break;
  80. case HELP_INTRODUCTION:
  81. locationId = HELP_INTRODUCTION_STR;
  82. break;
  83. case HELP_TASKS:
  84. locationId = HELP_TASKS_STR;
  85. break;
  86. case HELP_REFERENCE:
  87. locationId = HELP_REFERENCE_STR;
  88. break;
  89. case HELP_ITEM:
  90. locationId = HELP_ITEM_STR;
  91. break;
  92. case HELP_USING:
  93. locationId = HELP_USING_STR;
  94. helpVolume = HELP_USING_HELP_VOLUME;
  95. break;
  96. case HELP_VERSION:
  97. locationId = HELP_VERSION_STR;
  98. break;
  99. case HELP_COLOR_BUTTON:
  100. locationId = HELP_COLOR_BUTTON_STR;
  101. break;
  102. case HELP_FONT_BUTTON:
  103. locationId = HELP_FONT_BUTTON_STR;
  104. break;
  105. case HELP_BACKDROP_BUTTON:
  106. locationId = HELP_BACKDROP_BUTTON_STR;
  107. break;
  108. case HELP_KEYBOARD_BUTTON:
  109. locationId = HELP_KEYBOARD_BUTTON_STR;
  110. break;
  111. case HELP_MOUSE_BUTTON:
  112. locationId = HELP_MOUSE_BUTTON_STR;
  113. break;
  114. case HELP_AUDIO_BUTTON:
  115. locationId = HELP_AUDIO_BUTTON_STR;
  116. break;
  117. case HELP_SCREEN_BUTTON:
  118. locationId = HELP_SCREEN_BUTTON_STR;
  119. break;
  120. case HELP_DTWM_BUTTON:
  121. locationId = HELP_DTWM_BUTTON_STR;
  122. break;
  123. case HELP_STARTUP_BUTTON:
  124. locationId = HELP_STARTUP_BUTTON_STR;
  125. break;
  126. case HELP_I18N_BUTTON:
  127. locationId = HELP_I18N_BUTTON_STR;
  128. break;
  129. case HELP_COLOR_DIALOG:
  130. locationId = HELP_COLOR_DIALOG_STR;
  131. break;
  132. case HELP_ADD_PALETTE_DIALOG:
  133. locationId = HELP_ADD_PALETTE_DIALOG_STR;
  134. break;
  135. case HELP_ADD_PALETTE_WARNING_DIALOG:
  136. locationId = HELP_ADD_PALETTE_WARNING_DIALOG_STR;
  137. break;
  138. case HELP_DELETE_PALETTE_DIALOG:
  139. locationId = HELP_DELETE_PALETTE_DIALOG_STR;
  140. break;
  141. case HELP_DELETE_PALETTE_WARNING_DIALOG:
  142. locationId = HELP_DELETE_PALETTE_WARNING_DIALOG_STR;
  143. break;
  144. case HELP_MODIFY_PALETTE_DIALOG:
  145. locationId = HELP_MODIFY_PALETTE_DIALOG_STR;
  146. break;
  147. case HELP_COLOR_USE_DIALOG:
  148. locationId = HELP_COLOR_USE_DIALOG_STR;
  149. break;
  150. case HELP_FONT_DIALOG:
  151. locationId = HELP_FONT_DIALOG_STR;
  152. break;
  153. case HELP_BACKDROP_DIALOG:
  154. locationId = HELP_BACKDROP_DIALOG_STR;
  155. break;
  156. case HELP_KEYBOARD_DIALOG:
  157. locationId = HELP_KEYBOARD_DIALOG_STR;
  158. break;
  159. case HELP_MOUSE_DIALOG:
  160. locationId = HELP_MOUSE_DIALOG_STR;
  161. break;
  162. case HELP_AUDIO_DIALOG:
  163. locationId = HELP_AUDIO_DIALOG_STR;
  164. break;
  165. case HELP_SCREEN_DIALOG:
  166. locationId = HELP_SCREEN_DIALOG_STR;
  167. break;
  168. case HELP_DTWM_DIALOG:
  169. locationId = HELP_DTWM_DIALOG_STR;
  170. break;
  171. case HELP_STARTUP_DIALOG:
  172. locationId = HELP_STARTUP_DIALOG_STR;
  173. break;
  174. case HELP_I18N_DIALOG:
  175. locationId = HELP_I18N_DIALOG_STR;
  176. break;
  177. }
  178. Help(helpVolume, locationId);
  179. }
  180. void
  181. QuickHelpRequestCB(
  182. Widget w,
  183. caddr_t client_data,
  184. caddr_t call_data )
  185. {
  186. }
  187. void
  188. HelpModeCB(
  189. Widget w,
  190. caddr_t client_data,
  191. caddr_t call_data )
  192. {
  193. Widget widget;
  194. switch(DtHelpReturnSelectedWidgetId(style.shell, (Cursor)NULL, &widget))
  195. {
  196. /*
  197. * There are additional cases (e.g. user aborts request) but I
  198. * don't feel they warrant an error dialog.
  199. */
  200. case DtHELP_SELECT_VALID:
  201. while (!XtIsShell(widget))
  202. {
  203. if (XtHasCallbacks(widget, XmNhelpCallback) == XtCallbackHasSome)
  204. {
  205. XtCallCallbacks(widget, XmNhelpCallback, (XtPointer)NULL);
  206. return;
  207. }
  208. widget = XtParent(widget);
  209. }
  210. break;
  211. case DtHELP_SELECT_INVALID:
  212. ErrDialog((char *)GETMESSAGE(2, 8, "You must select an item\nwithin the Style Manager."), style.shell);
  213. break;
  214. }
  215. }
  216. void
  217. HelpHyperlinkCB(
  218. Widget w,
  219. caddr_t client_data,
  220. caddr_t call_data )
  221. {
  222. DtHelpDialogCallbackStruct *pHyper =
  223. (DtHelpDialogCallbackStruct *) call_data;
  224. switch(pHyper->hyperType)
  225. {
  226. case DtHELP_LINK_JUMP_NEW:
  227. DisplayHelp(pHyper->helpVolume, pHyper->locationId);
  228. break;
  229. default:
  230. ;
  231. /* application defined link code goes here */
  232. }
  233. }
  234. void
  235. HelpCloseCB(
  236. Widget w,
  237. caddr_t client_data,
  238. caddr_t call_data )
  239. {
  240. HelpStruct *pHelpCache = (HelpStruct *)client_data;
  241. HelpStruct *pHelp;
  242. /*
  243. * empty for loop just marches pHelp to the right place
  244. */
  245. for(pHelp = pHelpCache;
  246. pHelp != (HelpStruct *)NULL && pHelp->dialog != w;
  247. pHelp = pHelp->pNext);
  248. if(pHelp != (HelpStruct *)NULL)
  249. {
  250. /* this should always happen */
  251. pHelp->inUse = False;
  252. }
  253. XtUnmapWidget(XtParent(w));
  254. }