pmhelp.pas 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2002 by Yuri Prokushev ([email protected]).
  5. OS/2 Presentation Manager Information Presentation Facility,
  6. Help Manager declarations.
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. {Warning: This code is alfa. Future versions
  14. of this unit might not be compatible.}
  15. unit pmhelp;
  16. interface
  17. {$MODE OBJFPC}
  18. uses
  19. os2def;
  20. resourcestring
  21. msg_failedtodisplay='Failed to display help panel.';
  22. msg_failedtoload='Failed to load help manager.';
  23. //************************************************************************/
  24. //* HelpSubTable entry structure */
  25. //************************************************************************/
  26. type
  27. HelpSubTable=Word;
  28. PHelpSubTable=^HelpSubTable;
  29. //************************************************************************/
  30. //* HelpTable entry structure */
  31. //* */
  32. //* Pack the structure HELPTABLE so that it is identical in the 32-Bit */
  33. //* and 16-Bit world. We have to do this because the HelpTable can */
  34. //* reside either in memory or in the application's resources. */
  35. //************************************************************************/
  36. type
  37. {$PACKRECORDS 2}
  38. PHelpTable=^HelpTable;
  39. HelpTable=record
  40. idAppWindow: Word;
  41. phstHelpSubTable: PHelpSubTable;
  42. idExtPanel: Word;
  43. End;
  44. //************************************************************************/
  45. //* IPF Initialization Structure used on the */
  46. //* WinCreateHelpInstance() call. */
  47. //************************************************************************/
  48. type
  49. PHelpInit=^HelpInit;
  50. HelpInit=record
  51. cb: cardinal;
  52. ulReturnCode: cardinal;
  53. pszTutorialName: PChar;
  54. phtHelpTable: PHelpTable;
  55. hmodHelpTableModule: cardinal;
  56. hmodAccelActionBarModule: cardinal;
  57. idAccelTable: cardinal;
  58. idActionBar: cardinal;
  59. pszHelpWindowTitle: PChar;
  60. fShowPanelId: cardinal;
  61. pszHelpLibraryName: PChar;
  62. End;
  63. //************************************************************************/
  64. //* Search parent chain indicator for HM_SET_ACTIVE_WINDOW message. */
  65. //************************************************************************/
  66. const
  67. HWnd_Parent = 0;
  68. //************************************************************************/
  69. //* Constants used to define whether user wants to display panel using */
  70. //* panel number or panel name. */
  71. //************************************************************************/
  72. const
  73. HM_ResourceID = 0;
  74. HM_PanelName = 1;
  75. HMPanelType_Number =0;
  76. HMPanelType_Name =1;
  77. //************************************************************************/
  78. //* Constants used to define how the panel IDs are displayed on */
  79. //* help panels. */
  80. //************************************************************************/
  81. const
  82. CMIC_Hide_Panel_ID =$0000;
  83. CMIC_Show_Panel_ID =$0001;
  84. CMIC_Toggle_Panel_ID =$0002;
  85. //************************************************************************/
  86. //* IPF message base. */
  87. //************************************************************************/
  88. const
  89. HM_Msg_Base =$0220;
  90. //************************************************************************/
  91. //* Messages applications can send to the IPF. */
  92. //************************************************************************/
  93. const
  94. HM_Dismiss_Window =HM_Msg_Base+$0001;
  95. HM_Display_Help =HM_Msg_Base+$0002;
  96. HM_Ext_Help =HM_Msg_Base+$0003;
  97. HM_General_Help =HM_Ext_Help;
  98. HM_Set_Active_Window =HM_Msg_Base+$0004;
  99. HM_Load_Help_Table =HM_Msg_Base+$0005;
  100. HM_Create_Help_Table =HM_Msg_Base+$0006;
  101. HM_Set_Help_Window_Title =HM_Msg_Base+$0007;
  102. HM_Set_Show_Panel_ID =HM_Msg_Base+$0008;
  103. HM_Replace_Help_For_Help =HM_Msg_Base+$0009;
  104. HM_Replace_Using_Help =HM_Replace_Help_For_Help;
  105. HM_Help_Index =HM_Msg_Base+$000a;
  106. HM_Help_Contents =HM_Msg_Base+$000b;
  107. HM_Keys_Help =HM_Msg_Base+$000c;
  108. HM_Set_Help_Library_Name =HM_Msg_Base+$000d;
  109. HM_Set_OBJCOM_Window =HM_Msg_Base+$0018;
  110. HM_Upadte_OBJCOM_Window_Chain =HM_Msg_Base+$0019;
  111. HM_Query_DDF_Data =HM_Msg_Base+$001a;
  112. HM_Invalidate_DDF_Data =HM_Msg_Base+$001b;
  113. HM_Query =HM_Msg_Base+$001c;
  114. HM_Set_CoverPage_Size =HM_Msg_Base+$001d;
  115. //************************************************************************/
  116. //* Constants used to query the info from IPF in HM_QUERY message */
  117. //************************************************************************/
  118. //* Hi word in lParam 1 */
  119. const
  120. HMQW_COVERPAGE =$0001;
  121. HMQW_INDEX =$0002;
  122. HMQW_TOC =$0003;
  123. HMQW_SEARCH =$0004;
  124. HMQW_VIEWPAGES =$0005;
  125. HMQW_LIBRARY =$0006;
  126. HMQW_VIEWPORT =$0007;
  127. HMQW_OBJCOM_WINDOW =$0008;
  128. HMQW_INSTANCE =$0009;
  129. HMQW_ACTIVEVIEWPORT =$000a;
  130. CONTROL_SELECTED =$000b;
  131. HMQW_GROUP_VIEWPORT =$00f1;
  132. HMQW_RES_VIEWPORT =$00f2;
  133. USERDATA =$00f3;
  134. //* Lo word in lParam1 of HMQW_VIEWPORT */
  135. HMQVP_NUMBER =$0001;
  136. HMQVP_NAME =$0002;
  137. HMQVP_GROUP =$0003;
  138. //************************************************************************/
  139. //* Predefined Control IDs */
  140. //************************************************************************/
  141. const
  142. CTRL_PREVIOUS_ID =$0001;
  143. CTRL_SEARCH_ID =$0002;
  144. CTRL_PRINT_ID =$0003;
  145. CTRL_INDEX_ID =$0004;
  146. CTRL_CONTENTS_ID =$0005;
  147. CTRL_BACK_ID =$0006;
  148. CTRL_FORWARD_ID =$0007;
  149. CTRL_TUTORIAL_ID =$00FF;
  150. CTRL_USER_ID_BASE =257;
  151. //************************************************************************/
  152. //* Messages the IPF sends to the applications active window */
  153. //* as defined by the IPF. */
  154. //************************************************************************/
  155. const
  156. HM_ERROR =HM_Msg_Base+$000e;
  157. HM_HELPSUBITEM_NOT_FOUND =HM_Msg_Base+$000f;
  158. HM_QUERY_KEYS_HELP =HM_Msg_Base+$0010;
  159. HM_TUTORIAL =HM_Msg_Base+$0011;
  160. HM_EXT_HELP_UNDEFINED =HM_Msg_Base+$0012;
  161. HM_GENERAL_HELP_UNDEFINED =HM_EXT_HELP_UNDEFINED;
  162. HM_ACTIONBAR_COMMAND =HM_Msg_Base+$0013;
  163. HM_INFORM =HM_Msg_Base+$0014;
  164. HM_NOTIFY =HM_Msg_Base+$0022;
  165. HM_SET_USERDATA =HM_Msg_Base+$0023;
  166. HM_CONTROL =HM_Msg_Base+$0024;
  167. //**********************************************************************/
  168. //* notify information for HM_NOTIFY */
  169. //**********************************************************************/
  170. const
  171. OPEN_COVERPAGE =$0001;
  172. OPEN_PAGE =$0002;
  173. SWAP_PAGE =$0003;
  174. OPEN_TOC =$0004;
  175. OPEN_INDEX =$0005;
  176. OPEN_HISTORY =$0006;
  177. OPEN_SEARCH_HIT_LIST =$0007;
  178. OPEN_LIBRARY =$0008;
  179. HELP_REQUESTED =$0009;
  180. //**********************************************************************/
  181. //* HMERR_NO_FRAME_WND_IN_CHAIN - There is no frame window in the */
  182. //* window chain from which to find or set the associated help */
  183. //* instance. */
  184. //**********************************************************************/
  185. const
  186. HMERR_NO_FRAME_WND_IN_CHAIN =$00001001;
  187. //*********************************************************************/
  188. //* HMERR_INVALID_ASSOC_APP_WND - The application window handle */
  189. //* specified on the WinAssociateHelpInstance() call is not a valid */
  190. //* window handle. */
  191. //*********************************************************************/
  192. const
  193. HMERR_INVALID_ASSOC_APP_WND =$00001002;
  194. //**********************************************************************/
  195. //* HMERR_INVALID_ASSOC_HELP_INST - The help instance handle specified */
  196. //* on the WinAssociateHelpInstance() call is not a valid */
  197. //* window handle. */
  198. //**********************************************************************/
  199. const
  200. HMERR_INVALID_ASSOC_HELP_INST =$00001003;
  201. //**********************************************************************/
  202. //* HMERR_INVALID_DESTROY_HELP_INST - The window handle specified */
  203. //* as the help instance to destroy is not of the help instance class. */
  204. //**********************************************************************/
  205. const
  206. HMERR_INVALID_DESTROY_HELP_INST =$00001004;
  207. //**********************************************************************/
  208. //* HMERR_NO_HELP_INST_IN_CHAIN - The parent or owner chain of the */
  209. //* application window specified does not have a help instance */
  210. //* associated with it. */
  211. //**********************************************************************/
  212. const
  213. HMERR_NO_HELP_INST_IN_CHAIN =$00001005;
  214. //**********************************************************************/
  215. //* HMERR_INVALID_HELP_INSTANCE_HDL - The handle specified to be a */
  216. //* help instance does not have the class name of a IPF */
  217. //* help instance. */
  218. //**********************************************************************/
  219. const
  220. HMERR_INVALID_HELP_INSTANCE_HDL =$00001006;
  221. //*********************************************************************/
  222. //* HMERR_INVALID_QUERY_APP_WND - The application window specified on */
  223. //* a WinQueryHelpInstance() call is not a valid window handle. */
  224. //*********************************************************************/
  225. const
  226. HMERR_INVALID_QUERY_APP_WND =$00001007;
  227. //*********************************************************************/
  228. //* HMERR_HELP_INST_CALLED_INVALID - The handle of the help instance */
  229. //* specified on an API call to the IPF does not have the */
  230. //* class name of an IPF help instance. */
  231. //*********************************************************************/
  232. const
  233. HMERR_HELP_INST_CALLED_INVALID =$00001008;
  234. HMERR_HELPTABLE_UNDEFINE =$00001009;
  235. HMERR_HELP_INSTANCE_UNDEFINE =$0000100a;
  236. HMERR_HELPITEM_NOT_FOUND =$0000100b;
  237. HMERR_INVALID_HELPSUBITEM_SIZE =$0000100c;
  238. HMERR_HELPSUBITEM_NOT_FOUND =$0000100d;
  239. //*********************************************************************/
  240. //* HMERR_INDEX_NOT_FOUND - No index in library file. */
  241. //*********************************************************************/
  242. const
  243. HMERR_INDEX_NOT_FOUND =$00002001;
  244. //**********************************************************************/
  245. //* HMERR_CONTENT_NOT_FOUND - Library file does not have any contents. */
  246. //**********************************************************************/
  247. const
  248. HMERR_CONTENT_NOT_FOUND =$00002002;
  249. //*********************************************************************/
  250. //* HMERR_OPEN_LIB_FILE - Cannot open library file */
  251. //*********************************************************************/
  252. const
  253. HMERR_OPEN_LIB_FILE =$00002003;
  254. //*********************************************************************/
  255. //* HMERR_READ_LIB_FILE - Cannot read library file */
  256. //*********************************************************************/
  257. const
  258. HMERR_READ_LIB_FILE =$00002004;
  259. //*********************************************************************/
  260. //* HMERR_CLOSE_LIB_FILE - Cannot close library file */
  261. //*********************************************************************/
  262. const
  263. HMERR_CLOSE_LIB_FILE =$00002005;
  264. //*********************************************************************/
  265. //* HMERR_INVALID_LIB_FILE - Improper library file provided */
  266. //*********************************************************************/
  267. const
  268. HMERR_INVALID_LIB_FILE =$00002006;
  269. //************************************************************************/
  270. //* HMERR_NO_MEMORY - Unable to allocate the requested amount of memory. */
  271. //************************************************************************/
  272. const
  273. HMERR_NO_MEMORY =$00002007;
  274. //*********************************************************************/
  275. //* HMERR_ALLOCATE_SEGMENT - Unable */
  276. //* to allocate a segment of memory for memory allocation requested */
  277. //* from the IPF. */
  278. //*********************************************************************/
  279. const
  280. HMERR_ALLOCATE_SEGMENT =$00002008;
  281. //*********************************************************************/
  282. //* HMERR_FREE_MEMORY - Unable to free allocated memory */
  283. //*********************************************************************/
  284. const
  285. HMERR_FREE_MEMORY =$00002009;
  286. //*********************************************************************/
  287. //* HMERR_PANEL_NOT_FOUND - Unable */
  288. //* to find a help panel requested to help manager */
  289. //*********************************************************************/
  290. const
  291. HMERR_PANEL_NOT_FOUND =$00002010;
  292. //*********************************************************************/
  293. //* HMERR_DATABASE_NOT_OPEN - Unable to read the unopened database */
  294. //*********************************************************************/
  295. const
  296. HMERR_DATABASE_NOT_OPEN =$00002011;
  297. //*********************************************************************/
  298. //* HMERR_DDL_ERROR - Unable to load resource dll */
  299. //*********************************************************************/
  300. const
  301. HMERR_LOAD_DLL =$00002013;
  302. //********************************************************************/
  303. //* AC Viewport stucture definitions */
  304. //********************************************************************/
  305. type
  306. PACVP=^ACVP;
  307. ACVP=record
  308. cb: cardinal;
  309. hAB: HAB;
  310. hmq: HMQ;
  311. ObjectID: cardinal; // object identifier
  312. hWndParent: HWND; // IPF viewport client handle
  313. hWndOwner: HWND; // IPF viewport client handle
  314. hWndACVP: HWND; // applications frame window hwnd
  315. end;
  316. //*******************************************************************/
  317. //* Define Handle to DDF */
  318. //*******************************************************************/
  319. Type
  320. HDDF=pointer;
  321. // DdfHyperText Flags
  322. const
  323. REFERENCE_BY_ID =0;
  324. REFERENCE_BY_RES =1;
  325. // DdfBeginList formatting flags
  326. HMBT_NONE =1;
  327. HMBT_ALL =2;
  328. HMBT_FIT =3;
  329. HMLS_SINGLELINE =1;
  330. HMLS_DOUBLELINE =2;
  331. // DdfBitmap alignment flags
  332. ART_RUNIN =$10;
  333. ART_LEFT =$01;
  334. ART_RIGHT =$02;
  335. ART_CENTER =$04;
  336. // DdfSetColor Color Flag
  337. CLR_UNCHANGED =-6;
  338. //*******************************************************************/
  339. // error codes returned by DDF API functions */
  340. //*******************************************************************/
  341. const
  342. HMERR_DDF_MEMORY =$3001;
  343. HMERR_DDF_ALIGN_TYPE =$3002;
  344. HMERR_DDF_BACKCOLOR =$3003;
  345. HMERR_DDF_FORECOLOR =$3004;
  346. HMERR_DDF_FONTSTYLE =$3005;
  347. HMERR_DDF_REFTYPE =$3006;
  348. HMERR_DDF_LIST_UNCLOSED =$3007;
  349. HMERR_DDF_LIST_UNINITIALIZED =$3008;
  350. HMERR_DDF_LIST_BREAKTYPE =$3009;
  351. HMERR_DDF_LIST_SPACING =$300A;
  352. HMERR_DDF_HINSTANCE =$300B;
  353. HMERR_DDF_EXCEED_MAX_LENGTH =$300C;
  354. HMERR_DDF_EXCEED_MAX_INC =$300D;
  355. HMERR_DDF_INVALID_DDF =$300E;
  356. HMERR_DDF_FORMAT_TYPE =$300F;
  357. HMERR_DDF_INVALID_PARM =$3010;
  358. HMERR_DDF_INVALID_FONT =$3011;
  359. HMERR_DDF_SEVERE =$3012;
  360. //************************************************************************/
  361. //* Window Help API declarations. */
  362. //************************************************************************/
  363. function WinDestroyHelpInstance(hwndHelpInstance: HWND): Longbool; cdecl;
  364. function WinCreateHelpInstance(ahab: HAB; var phinitHMInitStructure: HELPINIT): HWND; cdecl;
  365. function WinAssociateHelpInstance(hwndHelpInstance, hwndApp: HWND): Longbool; cdecl;
  366. function WinQueryHelpInstance(hwndApp: HWND): HWND; cdecl;
  367. function WinLoadHelpTable(hwndHelpInstance: HWND; idHelpTable: cardinal; Module: cardinal): Longbool; cdecl;
  368. function WinCreateHelpTable(hwndHelpInstance: HWND; var phtHelpTable: HELPTABLE): Longbool; cdecl;
  369. function DdfInitialize(hwndHelpInstance: HWND; cbBuffer, ulIncrement: cardinal): HDDF; cdecl;
  370. function DdfPara(ahddf: HDDF):Longbool; cdecl;
  371. function DdfSetFormat(ahddf: HDDF; fFormatType: cardinal): Longbool; cdecl;
  372. function DdfSetTextAlign(ahddf: HDDF; fAlign: cardinal): Longbool; cdecl;
  373. function DdfSetColor(ahddf: HDDF; fBackColor, fForColor: Longint): Longbool; cdecl;
  374. function DdfInform(ahddf: HDDF; var pszText: PChar; resInformNumber: cardinal): Longbool; cdecl;
  375. function DdfSetFontStyle(ahddf: HDDF; fFontStyle: cardinal): Longbool; cdecl;
  376. function DdfHyperText(ahddf: HDDF; var pszText, pszReference: PChar; fReferenceType: cardinal): Longbool; cdecl;
  377. function DdfBeginList(ahddf: HDDF; ulWidthDT, fBreakType, fSpacing: cardinal): Longbool; cdecl;
  378. function DdfListItem(ahddf: HDDF; var pszTerm, pszDescription: PChar): Longbool; cdecl;
  379. function DdfEndList(ahddf: HDDF): Longbool; cdecl;
  380. function DdfMetafile(ahddf: HDDF; ahmf: cardinal; var prclRect: RECTL): Longbool; cdecl;
  381. function DdfText(ahddf: HDDF; var pszText: PChar): Longbool; cdecl;
  382. function DdfSetFont(ahddf: HDDF; var pszFaceName: PChar; ulWidth, ulHeight: cardinal): Longbool; cdecl;
  383. function DdfBitmap(ahddf: HDDF; hbm: HBITMAP; fAlign: cardinal): Longbool; cdecl;
  384. implementation
  385. const
  386. HELPMGRDLL='HELPMGR';
  387. function WinDestroyHelpInstance(hwndHelpInstance: HWND): Longbool; cdecl;
  388. external HELPMGRDLL index 52;
  389. function WinCreateHelpInstance(ahab: HAB; var phinitHMInitStructure: HELPINIT): HWND; cdecl;
  390. external HELPMGRDLL index 51;
  391. function WinAssociateHelpInstance(hwndHelpInstance, hwndApp: HWND): Longbool; cdecl;
  392. external HELPMGRDLL index 54;
  393. function WinQueryHelpInstance(hwndApp: HWND): HWND; cdecl;
  394. external HELPMGRDLL index 53;
  395. function WinLoadHelpTable(hwndHelpInstance: HWND; idHelpTable: cardinal; Module: cardinal): Longbool; cdecl;
  396. external HELPMGRDLL index 55;
  397. function WinCreateHelpTable(hwndHelpInstance: HWND; var phtHelpTable: HELPTABLE): Longbool; cdecl;
  398. external HELPMGRDLL index 56;
  399. function DdfInitialize(hwndHelpInstance: HWND; cbBuffer, ulIncrement: cardinal): HDDF; cdecl;
  400. external HELPMGRDLL index 74;
  401. function DdfPara (ahddf: HDDF): Longbool; cdecl;
  402. external HELPMGRDLL index 75;
  403. function DdfSetFormat(ahddf: HDDF; fFormatType: cardinal): Longbool; cdecl;
  404. external HELPMGRDLL index 76;
  405. function DdfSetTextAlign (ahddf: HDDF; fAlign: cardinal): Longbool; cdecl;
  406. external HELPMGRDLL index 77;
  407. function DdfSetColor(ahddf: HDDF; fBackColor, fForColor: Longint): Longbool; cdecl;
  408. external HELPMGRDLL index 78;
  409. function DdfInform(ahddf: HDDF; var pszText: PChar; resInformNumber: cardinal): Longbool; cdecl;
  410. external HELPMGRDLL index 79;
  411. function DdfSetFontStyle(ahddf: HDDF; fFontStyle: cardinal): Longbool; cdecl;
  412. external HELPMGRDLL index 80;
  413. function DdfHyperText(ahddf: HDDF; var pszText, pszReference: PChar; fReferenceType: cardinal): Longbool; cdecl;
  414. external HELPMGRDLL index 81;
  415. function DdfBeginList(ahddf: HDDF; ulWidthDT, fBreakType, fSpacing: cardinal): Longbool; cdecl;
  416. external HELPMGRDLL index 82;
  417. function DdfListItem(ahddf: HDDF; var pszTerm, pszDescription: PChar): Longbool; cdecl;
  418. external HELPMGRDLL index 83;
  419. function DdfEndList(ahddf: HDDF): Longbool; cdecl;
  420. external HELPMGRDLL index 84;
  421. function DdfMetafile(ahddf: HDDF; ahmf: cardinal; var prclRect: RECTL): Longbool; cdecl;
  422. external HELPMGRDLL index 86;
  423. function DdfText(ahddf: HDDF; var pszText: PChar): Longbool; cdecl;
  424. external HELPMGRDLL index 85;
  425. function DdfSetFont(ahddf: HDDF; var pszFaceName: PChar; ulWidth, ulHeight: cardinal): Longbool; cdecl;
  426. external HELPMGRDLL index 87;
  427. function DdfBitmap(ahddf: HDDF; hbm: HBITMAP; fAlign: cardinal): Longbool; cdecl;
  428. external HELPMGRDLL index 88;
  429. end.
  430. {
  431. $Log$
  432. Revision 1.4 2002-10-17 18:54:24 hajny
  433. + added missing CVS log
  434. }