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 23 #pragma once 24 25 #define MAX_LANGUAGE_NUMBER 255 26 #define MAX_STRING_LEN 255 27 28 #define INTERNAL_BORDER_WIDTH 5 29 #define POPUP_YDISTANCE 20 30 #define SHADOW_DX 10 31 #define SHADOW_DY 10 32 #define BUTTON_CX 6 33 #define BUTTON_CY 6 34 35 #ifndef RC_INVOKED 36 37 #include <stdarg.h> 38 39 #include "hlpfile.h" 40 #include "windef.h" 41 #include "winbase.h" 42 #include "macro.h" 43 #include "winhelp_res.h" 44 45 typedef struct tagHelpButton 46 { 47 HWND hWnd; 48 49 LPCSTR lpszID; 50 LPCSTR lpszName; 51 LPCSTR lpszMacro; 52 53 WPARAM wParam; 54 55 RECT rect; 56 57 struct tagHelpButton*next; 58 } WINHELP_BUTTON; 59 60 typedef struct 61 { 62 HLPFILE_PAGE* page; 63 HLPFILE_WINDOWINFO* wininfo; 64 ULONG relative; 65 } WINHELP_WNDPAGE; 66 67 typedef struct tagPageSet 68 { 69 /* FIXME: for now it's a fixed size */ 70 WINHELP_WNDPAGE set[40]; 71 unsigned index; 72 } WINHELP_PAGESET; 73 74 typedef struct tagWinHelp 75 { 76 unsigned ref_count; 77 WINHELP_BUTTON* first_button; 78 HLPFILE_PAGE* page; 79 80 HWND hMainWnd; 81 HWND hHistoryWnd; 82 83 WNDPROC origRicheditWndProc; 84 85 HFONT* fonts; 86 UINT fonts_len; 87 88 HCURSOR hHandCur; 89 90 HBRUSH hBrush; 91 92 HLPFILE_WINDOWINFO* info; 93 94 WINHELP_PAGESET back; 95 unsigned font_scale; /* 0 = small, 1 = normal, 2 = large */ 96 97 struct tagWinHelp* next; 98 } WINHELP_WINDOW; 99 100 #define DC_NOMSG 0x00000000 101 #define DC_MINMAX 0x00000001 102 #define DC_INITTERM 0x00000002 103 #define DC_JUMP 0x00000004 104 #define DC_ACTIVATE 0x00000008 105 #define DC_CALLBACKS 0x00000010 106 107 #define DW_NOTUSED 0 108 #define DW_WHATMSG 1 109 #define DW_MINMAX 2 110 #define DW_SIZE 3 111 #define DW_INIT 4 112 #define DW_TERM 5 113 #define DW_STARTJUMP 6 114 #define DW_ENDJUMP 7 115 #define DW_CHGFILE 8 116 #define DW_ACTIVATE 9 117 #define DW_CALLBACKS 10 118 119 typedef LONG (CALLBACK *WINHELP_LDLLHandler)(WORD, LONG_PTR, LONG_PTR); 120 121 typedef struct tagDll 122 { 123 HANDLE hLib; 124 const char* name; 125 WINHELP_LDLLHandler handler; 126 DWORD class; 127 struct tagDll* next; 128 } WINHELP_DLL; 129 130 typedef struct 131 { 132 UINT wVersion; 133 HANDLE hInstance; 134 BOOL isBook; 135 WINHELP_WINDOW* active_win; 136 WINHELP_WINDOW* active_popup; 137 WINHELP_WINDOW* win_list; 138 WNDPROC button_proc; 139 WINHELP_DLL* dlls; 140 WINHELP_PAGESET history; 141 HFONT hButtonFont; 142 } WINHELP_GLOBALS; 143 144 extern const struct winhelp_callbacks 145 { 146 WORD (WINAPI *GetFSError)(void); 147 HANDLE (WINAPI *HfsOpenSz)(LPSTR,BYTE); 148 WORD (WINAPI *RcCloseHfs)(HANDLE); 149 HANDLE (WINAPI *HfOpenHfs)(HANDLE,LPSTR,BYTE); 150 HANDLE (WINAPI *RcCloseHf)(HANDLE); 151 LONG (WINAPI *LcbReadHf)(HANDLE,BYTE*,LONG); 152 LONG (WINAPI *LTellHf)(HANDLE); 153 LONG (WINAPI *LSeekHf)(HANDLE,LONG,WORD); 154 BOOL (WINAPI *FEofHf)(HANDLE); 155 LONG (WINAPI *LcbSizeHf)(HANDLE); 156 BOOL (WINAPI *FAccessHfs)(HANDLE,LPSTR,BYTE); 157 WORD (WINAPI *RcLLInfoFromHf)(HANDLE,WORD,LPWORD,LPLONG,LPLONG); 158 WORD (WINAPI *RcLLInfoFromHfs)(HANDLE,LPSTR,WORD,LPWORD,LPLONG,LPLONG); 159 void (WINAPI *ErrorW)(int); 160 void (WINAPI *ErrorSz)(LPSTR); 161 ULONG_PTR (WINAPI *GetInfo)(WORD,HWND); 162 LONG (WINAPI *API)(LPSTR,WORD,DWORD); 163 } Callbacks; 164 165 extern WINHELP_GLOBALS Globals; 166 167 BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE*, int, BOOL); 168 BOOL WINHELP_OpenHelpWindow(HLPFILE_PAGE* (*)(HLPFILE*, LONG, ULONG*), 169 HLPFILE*, LONG, HLPFILE_WINDOWINFO*, int); 170 BOOL WINHELP_GetOpenFileName(LPSTR, int); 171 BOOL WINHELP_CreateIndexWindow(BOOL); 172 void WINHELP_DeleteBackSet(WINHELP_WINDOW*); 173 HLPFILE* WINHELP_LookupHelpFile(LPCSTR lpszFile); 174 HLPFILE_WINDOWINFO* WINHELP_GetWindowInfo(HLPFILE* hlpfile, LPCSTR name); 175 void WINHELP_LayoutMainWindow(WINHELP_WINDOW* win); 176 WINHELP_WINDOW* WINHELP_GrabWindow(WINHELP_WINDOW*); 177 BOOL WINHELP_ReleaseWindow(WINHELP_WINDOW*); 178 179 extern const char MAIN_WIN_CLASS_NAME[]; 180 extern const char BUTTON_BOX_WIN_CLASS_NAME[]; 181 extern const char TEXT_WIN_CLASS_NAME[]; 182 extern const char SHADOW_WIN_CLASS_NAME[]; 183 extern const char HISTORY_WIN_CLASS_NAME[]; 184 extern const char STRING_BUTTON[]; 185 extern const char STRING_MENU_Xx[]; 186 extern const char STRING_DIALOG_TEST[]; 187 #endif 188 189 /* Buttons */ 190 #define WH_FIRST_BUTTON 500 191