winhelp.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. /*
  2. * Help Viewer
  3. *
  4. * Copyright 1996 Ulrich Schmid
  5. * Copyright 2002 Sylvain Petreolle <spetreolle@yahoo.fr>
  6. * 2002 Eric Pouech
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with this library; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  21. */
  22. #define MAX_LANGUAGE_NUMBER 255
  23. #define MAX_STRING_LEN 255
  24. #define INTERNAL_BORDER_WIDTH 5
  25. #define POPUP_YDISTANCE 20
  26. #define SHADOW_DX 10
  27. #define SHADOW_DY 10
  28. #define BUTTON_CX 6
  29. #define BUTTON_CY 6
  30. #ifndef RC_INVOKED
  31. #include <stdarg.h>
  32. #include "hlpfile.h"
  33. #include "windef.h"
  34. #include "winbase.h"
  35. #include "macro.h"
  36. #include "winhelp_res.h"
  37. typedef struct tagHelpButton
  38. {
  39. HWND hWnd;
  40. LPCSTR lpszID;
  41. LPCSTR lpszName;
  42. LPCSTR lpszMacro;
  43. WPARAM wParam;
  44. RECT rect;
  45. struct tagHelpButton*next;
  46. } WINHELP_BUTTON;
  47. typedef struct
  48. {
  49. HLPFILE_PAGE* page;
  50. HLPFILE_WINDOWINFO* wininfo;
  51. ULONG relative;
  52. } WINHELP_WNDPAGE;
  53. typedef struct tagPageSet
  54. {
  55. /* FIXME: for now it's a fixed size */
  56. WINHELP_WNDPAGE set[40];
  57. unsigned index;
  58. } WINHELP_PAGESET;
  59. typedef struct tagWinHelp
  60. {
  61. unsigned ref_count;
  62. WINHELP_BUTTON* first_button;
  63. HLPFILE_PAGE* page;
  64. HWND hMainWnd;
  65. HWND hHistoryWnd;
  66. WNDPROC origRicheditWndProc;
  67. HFONT* fonts;
  68. UINT fonts_len;
  69. HCURSOR hHandCur;
  70. HBRUSH hBrush;
  71. HLPFILE_WINDOWINFO* info;
  72. WINHELP_PAGESET back;
  73. unsigned font_scale; /* 0 = small, 1 = normal, 2 = large */
  74. struct tagWinHelp* next;
  75. } WINHELP_WINDOW;
  76. #define DC_NOMSG 0x00000000
  77. #define DC_MINMAX 0x00000001
  78. #define DC_INITTERM 0x00000002
  79. #define DC_JUMP 0x00000004
  80. #define DC_ACTIVATE 0x00000008
  81. #define DC_CALLBACKS 0x00000010
  82. #define DW_NOTUSED 0
  83. #define DW_WHATMSG 1
  84. #define DW_MINMAX 2
  85. #define DW_SIZE 3
  86. #define DW_INIT 4
  87. #define DW_TERM 5
  88. #define DW_STARTJUMP 6
  89. #define DW_ENDJUMP 7
  90. #define DW_CHGFILE 8
  91. #define DW_ACTIVATE 9
  92. #define DW_CALLBACKS 10
  93. typedef LONG (CALLBACK *WINHELP_LDLLHandler)(WORD, LONG_PTR, LONG_PTR);
  94. typedef struct tagDll
  95. {
  96. HANDLE hLib;
  97. const char* name;
  98. WINHELP_LDLLHandler handler;
  99. DWORD class;
  100. struct tagDll* next;
  101. } WINHELP_DLL;
  102. typedef struct
  103. {
  104. UINT wVersion;
  105. HANDLE hInstance;
  106. BOOL isBook;
  107. WINHELP_WINDOW* active_win;
  108. WINHELP_WINDOW* active_popup;
  109. WINHELP_WINDOW* win_list;
  110. WNDPROC button_proc;
  111. WINHELP_DLL* dlls;
  112. WINHELP_PAGESET history;
  113. HFONT hButtonFont;
  114. } WINHELP_GLOBALS;
  115. extern const struct winhelp_callbacks
  116. {
  117. WORD (WINAPI *GetFSError)(void);
  118. HANDLE (WINAPI *HfsOpenSz)(LPSTR,BYTE);
  119. WORD (WINAPI *RcCloseHfs)(HANDLE);
  120. HANDLE (WINAPI *HfOpenHfs)(HANDLE,LPSTR,BYTE);
  121. HANDLE (WINAPI *RcCloseHf)(HANDLE);
  122. LONG (WINAPI *LcbReadHf)(HANDLE,BYTE*,LONG);
  123. LONG (WINAPI *LTellHf)(HANDLE);
  124. LONG (WINAPI *LSeekHf)(HANDLE,LONG,WORD);
  125. BOOL (WINAPI *FEofHf)(HANDLE);
  126. LONG (WINAPI *LcbSizeHf)(HANDLE);
  127. BOOL (WINAPI *FAccessHfs)(HANDLE,LPSTR,BYTE);
  128. WORD (WINAPI *RcLLInfoFromHf)(HANDLE,WORD,LPWORD,LPLONG,LPLONG);
  129. WORD (WINAPI *RcLLInfoFromHfs)(HANDLE,LPSTR,WORD,LPWORD,LPLONG,LPLONG);
  130. void (WINAPI *ErrorW)(int);
  131. void (WINAPI *ErrorSz)(LPSTR);
  132. ULONG_PTR (WINAPI *GetInfo)(WORD,HWND);
  133. LONG (WINAPI *API)(LPSTR,WORD,DWORD);
  134. } Callbacks;
  135. extern WINHELP_GLOBALS Globals;
  136. BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE*, int, BOOL);
  137. BOOL WINHELP_OpenHelpWindow(HLPFILE_PAGE* (*)(HLPFILE*, LONG, ULONG*),
  138. HLPFILE*, LONG, HLPFILE_WINDOWINFO*, int);
  139. BOOL WINHELP_GetOpenFileName(LPSTR, int);
  140. BOOL WINHELP_CreateIndexWindow(BOOL);
  141. void WINHELP_DeleteBackSet(WINHELP_WINDOW*);
  142. HLPFILE* WINHELP_LookupHelpFile(LPCSTR lpszFile);
  143. HLPFILE_WINDOWINFO* WINHELP_GetWindowInfo(HLPFILE* hlpfile, LPCSTR name);
  144. void WINHELP_LayoutMainWindow(WINHELP_WINDOW* win);
  145. WINHELP_WINDOW* WINHELP_GrabWindow(WINHELP_WINDOW*);
  146. BOOL WINHELP_ReleaseWindow(WINHELP_WINDOW*);
  147. extern const char MAIN_WIN_CLASS_NAME[];
  148. extern const char BUTTON_BOX_WIN_CLASS_NAME[];
  149. extern const char TEXT_WIN_CLASS_NAME[];
  150. extern const char SHADOW_WIN_CLASS_NAME[];
  151. extern const char HISTORY_WIN_CLASS_NAME[];
  152. extern const char STRING_BUTTON[];
  153. extern const char STRING_MENU_Xx[];
  154. extern const char STRING_DIALOG_TEST[];
  155. #endif
  156. /* Buttons */
  157. #define WH_FIRST_BUTTON 500